diff options
author | Graydon, Tracy <tracy.graydon@intel.com> | 2012-11-28 18:07:32 -0800 |
---|---|---|
committer | Graydon, Tracy <tracy.graydon@intel.com> | 2012-11-28 18:07:32 -0800 |
commit | f9151a123d7943fb7e944a38b1aa835c03b0188e (patch) | |
tree | e7dfd84705f5db614d08449cb3e70c4dad74ff97 | |
download | audiofile-f9151a123d7943fb7e944a38b1aa835c03b0188e.tar.gz audiofile-f9151a123d7943fb7e944a38b1aa835c03b0188e.tar.bz2 audiofile-f9151a123d7943fb7e944a38b1aa835c03b0188e.zip |
Initial commit of audiofilesubmit/1.0/20121129.024832submit/1.0/20121129.024342
217 files changed, 63774 insertions, 0 deletions
diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS new file mode 100644 index 0000000..2158352 --- /dev/null +++ b/ACKNOWLEDGEMENTS @@ -0,0 +1,24 @@ +Thanks to all who've contributed patches for the Audio File Library, +especially Michael Krause, Jean-Francois Panisset, Simon Kagedal, Eric +Mitchell, Bruce Forsberg, Julien Boulnois, Axel Roebel, Mark Murnane, +Chris Wolf, Davy Durham, and Fabrizio Gennari. + +Thanks to Douglas Scott of SGI for helping me understand the tricky +parts of the Audio File Library API. Thanks to Chris Pirazzi, Scott +Porter, and SGI for creating the Audio File Library in the first +place. + +Thanks to Axel Roebel for answering all my questions regarding the +IRCAM file format. + +Thanks to Chris Wolf for porting the library to Windows. + +Thanks also to all who have reported bugs. + +Thanks to Linus and the Linux community for keeping it real. + +Thanks to Apple for the Audio Interchange File Format. + +Thanks to Apple and SGI for handling audio really well. + +No thanks to Microsoft. @@ -0,0 +1,5 @@ +Audio File Library Authors + +Michael Pruett <michael@68k.org> + +Chris Pirazzi, Scott Porter, and Doug Scott @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/COPYING.GPL b/COPYING.GPL new file mode 100644 index 0000000..60549be --- /dev/null +++ b/COPYING.GPL @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..58c0bb1 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,952 @@ +2004-03-05 Michael Pruett <michael@68k.org> + + * libaudiofile/Makefile.am, libaudiofile/audiofile.exports: + Export only public entry points. + + * Released version 0.2.6 of the Audio File Library. + +2004-02-19 Michael Pruett <michael@68k.org> + + * libaudiofile/audiofile.h: Update comments to reflect the fact + that AVR and IFF/8SVX file formats are now implemented. + +2004-02-18 Michael Pruett <michael@68k.org> + + * test/Makefile.am, test/writeavr.c. test/writeiff.c, + test/writenist.c: Add regression tests for AVR, IFF/8SVX, and + NIST SPHERE file formats. + +2004-02-14 Michael Pruett <michael@68k.org> + + * configure.in, examples/Makefile.am, examples/osxplay.c: Add + example program for Mac OS X demonstrating audio file playback + using the Audio File Library and Core Audio. + +2004-02-09 Michael Pruett <michael@68k.org> + + Fabrizio Gennari has contributed several Windows-related fixes: + + * libaudiofile/openclose.c, win32/config.h: Open files with + binary translation mode under MinGW and Cygwin. + * win32/sfinfo.dsp: Link against non-debug version of libaudiofile + when building non-debug version of sfinfo. + * win32/*: Sychronize MSVC project files with latest source code. + +2004-01-27 Michael Pruett <michael@68k.org> + + * libaudiofile/afinternal.h, libaudiofile/openclose.c: Store + file name in AFfilehandle structure. + + * libaudiofile/Makefile.am, libaudiofile/avr.c, + libaudiofile/avr.h, libaudiofile/avrwrite.c, + libaudiofile/units.c: Add support for reading and writing AVR + files. + +2004-01-22 Michael Pruett <michael@68k.org> + + * libaudiofile/util.[ch]: Add functions for reading and writing + 16-bit and 32-bit integers with specified byte order. + + * libaudiofile/Makefile.am, libaudiofile/iff.c, + libaudiofile/iff.h, libaudiofile/iffwrite.c, + libaudiofile/units.c: Add support for reading and writing + IFF/8SVX files. + +2004-01-15 Michael Pruett <michael@68k.org> + + * libaudiofile/Makefile.am, libaudiofile/nist.c, + libaudiofile/nist.h, libaudiofile/nistwrite.c: Add support for + reading and writing NIST SPHERE files. + + * libaudiofile/audiofile.h: Add constants for new file + formats. + + * libaudiofile/units.c, libaudiofile/units.h: Define units for + new file formats. + +2004-01-12 Michael Pruett <michael@68k.org> + + * libaudiofile/Makefile.am, libaudiofile/util.[ch], + libaudiofile/debug.[ch]: Move debugging routines into a + separate file. + + * libaudiofile/modules.c: Include "debug.h" for debugging + routines. + +2004-01-06 Michael Pruett <michael@68k.org> + + * libaudiofile/afinternal.h, libaudiofile/aiff.h, + libaudiofile/aiffwrite.c: Eliminate duplicate definition of + AIFC_VERSION_1 constant. + +2003-12-21 Michael Pruett <michael@68k.org> + + * Released version 0.2.5 of the Audio File Library. + +2003-12-20 Michael Pruett <michael@68k.org> + + * test/seek.c: Delete temporary file before exiting. + +2003-12-17 Michael Pruett <michael@68k.org> + + * libaudiofile/aiff.c: When reading an AIFF-C file with an + unknown compression type, return an error. + + * libaudiofile/aiff.c: Skip zero-length miscellaneous chunks. + + * libaudiofile/aiff.c: Add support for reading AIFF-C files with + little-endian audio data. + +2003-12-17 Michael Pruett <michael@68k.org> + + Fix two bugs related to processing 24-bit audio data. + + * libaudiofile/data.c: Fix calculation of bytes per virtual frame + in the case of 24-bit audio data. Previously, requesting more + than _AF_ATOMIC_NVFRAMES from afReadFrames when reading a 24-bit + audio file would result in corrupted audio data since the audio + data pointer would be incremented using a sample size of 3 bytes + rather than 4 bytes. + + * libaudiofile/openclose.c: Set virtual sample width by default to + the same value as file sample width. Previously for 24-bit audio + data, the virtual sample width would be incorrectly set to 32. + + * test/twentyfour2.c: Add new test which checks reading and + writing a large amount of 24-bit audio data. This program + serves as a regression test for a bug in the Audio File Library + in which requesting more than 1024 frames (_AF_ATOMIC_NVFRAMES) + from afReadFrames when reading a 24-bit audio file would result + in corrupted audio data. + +2003-12-08 Michael Pruett <michael@68k.org> + + * examples/*, test/*: Add examples subdirectory. Separate + example programs from regression test programs. Remove obsolete + test programs. + +2003-12-03 Michael Pruett <michael@68k.org> + + * sfcommands/sfconvert.c: Fix argument parsing in sfconvert. + * sfcommands/printinfo.c: Fix format strings to handle different + sizes of off_t when printing track byte count, data offset, + and frame count. + +2003-10-01 Michael Pruett <michael@68k.org> + + * sfcommands/printinfo.c: Change printfileinfo to display duration + with millisecond accuracy. + +2003-09-29 Michael Pruett <michael@68k.org> + + * test/seek.c: Include <string.h> for memcmp. Thanks to Christian + Weisgerber for catching this omission. + +2003-09-25 Michael Pruett <michael@68k.org> + + * Released version 0.2.4 of the Audio File Library. + +2003-09-24 Michael Pruett <michael@68k.org> + + * libaudiofile/afinternal.h: Remove unused structure definitions. + * libaudiofile/audiofile.h: Correct return type of afTellFrame + to be AFframecount rather than AFfileoffset. + +2003-09-23 Michael Pruett <michael@68k.org> + + * libaudiofile/modules/ima.c: Include <config.h>. + +2003-09-16 Michael Pruett <michael@68k.org> + + * libaudiofile/audiofile.h: Define LIBAUDIOFILE_MICRO_VERSION. + +2003-09-15 Michael Pruett <michael@68k.org> + + * test/Makefile.am, test/seek.c: Add test case for seeking within + an audio file. + +2003-09-11 Michael Pruett <michael@68k.org> + + * test/*.c: Update tests to use exit(EXIT_FAILURE) upon abnormal + termination. + +2003-09-11 Michael Pruett <michael@68k.org> + + * libaudiofile/wave.c, libaudiofile/wavewrite.c: Add support + for miscellaneous data in WAVE files. Thanks to Davy Durham + for this patch. + + * test/{misc.sh,miscread.c,miscwrite.c}: Update miscellaneous + data tests to support WAVE as well as AIFF. + +2003-09-11 Michael Pruett <michael@68k.org> + + * libaudiofile/*.c: Replace use of off_t with AFfileoffset and + AFframecount, as appropriate. + * configure.in: Add AC_SYS_LARGEFILE in order to support large + files. + +2003-09-09 Michael Pruett <michael@68k.org> + + * libaudiofile/*.c: Include <config.h> as necessary. + +2003-09-08 Michael Pruett <michael@68k.org> + + * test/*.c: Update test programs to include <config.h> as necessary. + +2003-09-04 Michael Pruett <michael@68k.org> + + * configure.in, libaudiofile/{aiff.c,aiff.h,aiffwrite.c}, + libaudiofile/{ircam.c,ircamwrite.c}, libaudiofile/modules.h, + libaudiofile/{next.c,nextwrite.c}, libaudiofile/nist.c, + libaudiofile/{wave.c,wavewrite.c}, libaudiofile/modules/adpcm.h, + test/{pipe.c,sixteen-to-eight.c,twentyfour.c}: Check for + <inttypes.h> and include it if available. + + Thanks to Daniel Bergstrom for proposing this change. + +2003-08-21 Michael Pruett <mpruett@sgi.com> + + * configure.in, Makefile.am, win32/Makefile.am: Include win32 + directory in distribution. + +2003-07-02 Michael Pruett <mpruett@sgi.com> + + * test/testchannelmatrix.c, test/Makefile.am: Add regression + test for channel matrix functionality. + +2003-07-01 Michael Pruett <mpruett@sgi.com> + + Applying a patch from Masahiro Sakai to enable building as a + DLL under Cygwin. + + * configure.in: Add AC_LIBTOOL_WIN32_DLL and call + AM_PROG_LIBTOOL after AC_PROG_CC. + * libaudiofile/Makefile.am: Add -no-undefined to + libaudiofile_la_LDFLAGS. + +2003-06-10 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/format.c: Fix error in channel matrix + initialization. Thanks to Jasmin Frenette for reporting this + problem. + +2002-09-11 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/raw.c: Account for data offset when calculating + frame count on raw audio data files. + + Thanks to Davy Durham for reporting this problem. + + * test/writeraw.c, test/Makefile.am: Add a regression test for + raw audio data files. + +2002-05-17 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/wave.c: Add support for reading names of markers + in WAVE files. Locations of WAVE markers are now assumed to be + in units of frames as is the case with Sound Forge. + * libaudiofile/wavewrite.c, libaudiofile/wave.h: Add support + for writing markers in WAVE files. + + Thanks to Davy Durham for the above patches. + + * libaudiofile/marker.[ch]: Change static function findMarkByID + to non-static _af_mark_find_by_id for use by WAVE file marker + code. + + * test/testmarkers.c: Add a regression test for markers. + * test/printmarkers.c: Add a utility for printing marker + information. + * test/Makefile.am: Add testmarkers and printmarkers. + +2002-05-16 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/wave.c: Compute the frame count of uncompressed + WAVE files using double-precision floating-point arithmetic. + +2002-05-16 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/openclose.c: Implement afOpenVirtualFile. + +2002-03-24 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/marker.c: afInitMarkerComment was corrupting the + marker's name because it would free and allocate the marker's + name but write to its comment. Thanks to Daniel Kobras and + Davy Durham for noticing and fixing this problem. + +2002-02-20 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/*: Eliminate unnecessary global symbols. Thanks + to Daniel Kobras for fixing this problem. + +2002-02-04 Michael Pruett <mpruett@sgi.com> + + * audiofile.spec.in: Add /usr/lib/libaudiofile.la and + /usr/lib/pkgconfig/audiofile.pc to the RPM spec file. + +2001-10-25 Michael Pruett <mpruett@sgi.com> + + * test/irixread.c: Improve error handling. Use proper + conversion specifications in printf statements. + + * Makefile.am, configure.in, audiofile.pc.in: Add pkgconfig file. + + * Released version 0.2.3 of the Audio File Library. + +2001-10-10 Michael Pruett <mpruett@sgi.com> + + * test/error.c: Expanded the error test to include several more + library functions. + + * libaudiofile/format.c: Improve error checking and add comments. + +2001-09-20 Michael Pruett <mpruett@sgi.com> + + * test/irixread.c, test/irixtestloop.c, test/linuxtest.c: + Always use virtual audio format in calculations regarding audio + data in memory. + +2001-09-18 Michael Pruett <mpruett@sgi.com> + + * configure.in: Bump version to 0.2.3 in anticipation of the + upcoming release. + +2001-09-08 Michael Pruett <mpruett@sgi.com> + + * test/sgi.c: Replace fixed-point shift with a call to the more + elegant alDoubleToFixed. + +2001-08-29 Michael Pruett <mpruett@sgi.com> + + * test/pipe.{c,sh}: Added simple test of Audio File Library + operation on non-seekable file handles. + +2001-08-28 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/openclose.c: Applied Chris Wolf's patch invoking + the macro SETBINARYMODE on all file pointers before handing + them off to the AF VFS. This macro does nothing on non-Windows + systems. + +2001-08-27 Michael Pruett <mpruett@sgi.com> + + * win32/*: Added Chris Wolf's Windows port of the Audio File Library. + +2001-08-24 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/error.c: Include <config.h>. + + * libaudiofile/modules.c: Replacing null macro arguments with + the token NULLMODULEPARAM so that the module macros will work + with bad preprocessors. + +2001-08-23 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/openclose.c: Include <unistd.h> only if the + system has this header file. + + * libaudiofile/modules/rebuffer.c: Don't define min and max if + they've been defined already. + +2001-08-23 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/modules/Makefile.am, libaudiofile/units.[ch]: + Added IMA and MS ADPCM compression modules. + + * libaudiofile/modules/msadpcm.[ch]: Checked in MS ADPCM + compression module. + + * libaudiofile/modules/{ima,adpcm}.[ch]: Checked in IMA + compression module and Stichting Mathematisch Centrum's IMA + reference codec. + + * libaudiofile/afinternal.h: Declared new internal tokens for + compression parameters in PV lists. + + * libaudiofile/audiofile.h: Declared constants for DV and MS + ADPCM compression formats. + + * libaudiofile/wave.[ch]: Handle IMA and MS ADPCM compression + in WAVE files. + + * libaudiofile/openclose.c: If a track has compression + parameters, deallocate them before closing the file. + + * sfcommands/printinfo.c: Added support for compressed audio + data to sound commands. + +2001-08-07 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/query.c: Added support for + AF_QUERYTYPE_COMPRESSION. + +2001-08-04 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/util.c, libaudiofile/util.h: Add utility + routines _af_pv_getlong, _af_pv_getdouble, and _af_pv_getptr. + +2001-07-19 Michael Pruett <mpruett@sgi.com> + + * Released version 0.2.2 of the Audio File Library. + +2001-07-19 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/format.c: Add afSetChannelMatrix and + afGetVirtualChannels. + + * libaudiofile/openclose.c: Add afIdentifyFD, afIdentifyNamedFD, + afOpenFD, and afOpenNamedFD. + +2001-07-18 Michael Pruett <mpruett@sgi.com> + + * sfcommands/sfconvert.c: Use a fixed-size buffer for reading + and writing audio data, thus reducing memory usage when + converting large sound files. Add float, integer, and channels + keywords to sfconvert. + + * docs/sfconvert: Updated documentation to reflect new + keywords. + + * libaudiofile/setup.c: Change the default file format for + big-endian systems from AIFF to AIFF-C. + + * libaudiofile/{data.c,audiofile.h}: Change the type of the + buffer parameter of afWriteFrames from void * to const void *. + +2001-07-12 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/{aiffwrite.c,wavewrite.c}: Since + _af_format_frame_size takes compression into account, compute + the extent of compressed and uncompressed audio data using + _af_format_frame_size. + + * libaudiofile/wave.c: Add support for double-precision + floating-point WAVE files. + +2001-07-10 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/util.[ch]: Make _af_format_sample_size and + _af_format_frame_size consider compression. + +2001-07-09 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/aiffwrite.c: Make AIFF code handle compressed + data formats more cleanly. + + * libaudiofile/{wave.h,wave.c,wavewrite.c}: Make WAVE code + handle compressed data formats more cleanly. + + * test/query2.c: Print default value of instrument parameters + if instrument parameters are supported. + + * test/{writeulaw.c,writealaw.c}: Update writeulaw and + writealaw to test G.711 compression in AIFF-C and WAVE files in + addition to NeXT .snd. + +2001-07-08 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/{aiff.c,aiffwrite.c}: Add support for + floating-point AIFF-C files. + + * test/testfloat.c: Add a test for reading and writing + floating-point audio files. + + * libaudiofile/af_vfs.[ch]: Change the virtual file read and + write operations to use size_t and ssize_t as read(2) and + write(2) do. + +2001-07-07 Michael Pruett <mpruett@sgi.com> + + * configure.in, test/Makefile.am: Link against libaudio.so only + for programs which use it. + +2001-07-04 Michael Pruett <mpruett@sgi.com> + + * test/floatto24.c: Added program to test virtual sample format + conversion from float to 24-bit signed integer. + +2001-06-28 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/pcm.c: Added afInitPCMMapping(), + afGetPCMMapping(), and afGetVirtualPCMMapping(). + +2001-06-28 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/{wave.c,wavewrite.c}: Improved support for + floating-point WAVE files. + + * libaudiofile/wave.c: Made error messages more informative for + currently unsupported data formats such as ADPCM and MPEG + audio. + + * libaudiofile/wave.h: Declared additional WAVE format tag + constants. + +2001-06-28 Mark Murnane <mark.murnane@sun.com> + + * libaudiofile/{openclose.c,track.c}: Included string.h to + ensure proper declaration of memset(). + + * libaudiofile/util.c: Ditto for memset(), strlen() and strcpy(). + + * libaudiofile/modules/g711.c: Ditto for strerror(). + + * sfcommands/sfconvert.c: Ditto for strcmp(). + +2001-06-19 Michael Pruett <mpruett@sgi.com> + + * test/power.c: Adding a new example program which calculates + the power and peak amplitudes of an audio file. This program + is based on Chris Vaill's normalize. + +2001-06-06 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/modules.c: Fix conversion between 24-bit and + 32-bit data formats on little-endian systems. Thanks to Axel + Roebel for pointing out this problem. + + * libaudiofile/aiffwrite.c: Don't write a MARK chunk unless + markers are present. Don't confuse the big-endian marker id + used for writing to the file with its native-endian value used + in calls to afGetMark*. + + * test/twentyfour.c: Add a new program to test the conversion + between 24-bit signed integer data in a file and 32-bit signed + integer data in memory. + +2001-06-05 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/af_vfs.c: Prevent division by zero in af_fread + and af_fwrite when size is zero. + + * libaudiofile/aiff.c: Check that the number of markers in a + MARK chunk is positive before allocating markers. + + Thanks to Axel Roebel for pointing out both of these problems. + +2001-05-19 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/nist.[ch]: Checked in support for recognizing + NIST SPHERE files. + +2001-05-16 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/query.c: Backing out last change. The file + format and instrument parameter selectors once again return + arrays of type 'int' rather than arrays of type 'long'. + + Although the AUpv structure uses only long integers, the Audio + File Library's API uses 'int' and not 'long' when describing + file formats and instrument parameters. Furthermore all + existing applications expect the affected query calls to return + arrays of int. + + * test/query2.c: Expect arrays of int rather than arrays of + long when querying on file formats and instrument parameters. + +2001-05-09 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/aiffwrite.c: Fix a memory leak in WriteMARK, and + make WriteMARK use the afGetMark* calls rather than accessing + track->markers directly. + + * libaudiofile/util.[ch]: Add _af_print_pvlist for debugging. + +2001-05-04 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/ircam.[ch]: Make a first pass at supporting the + IRCAM file format. + +2001-04-25 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/query.c: Although the documentation states that + certain selectors return an array of integers, the AUpv structure + uses only long integers. I'm resolving the ambiguity in the + documentation by making such selectors return an array of long + integers. + + This change has no impact on platforms where sizeof (int) == + sizeof (long), but it makes the query system consistent on + platforms where the above is not the case. + +2001-04-23 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/wavewrite.c: Fixed a bug seen on 64-bit systems + in which WAVE files would be created with zero-length RIFF and + data chunks. (Thanks to Wayne Price for bringing this bug to + my attention.) + +2001-04-19 Michael Pruett <mpruett@sgi.com> + + * sfcommands/sfconvert.c: Make sfconvert use the sample rate of + the input file. + +2001-04-09 Michael Pruett <mpruett@sgi.com> + + * Include <string.h> in source files which use string functions. + (Thanks to Michael Madore for pointing out this omission.) + * Fix calculation of file position for G.711 compression. + (Thanks to Bruce Forsberg for pointing out this bug.) + * configure.in: Check for int{8,16,32}_t and define them + appropriately if they are missing. + +2001-02-20 Michael Pruett <mpruett@sgi.com> + + * Released version 0.2.1. + * Removed -release flag on library build. + * libaudiofile/*: Added some lint-style comments to clean up + some warnings pointed out by Jean-Francois Panisset. + +2000-12-15 Michael Pruett <mpruett@sgi.com> + + * Released version 0.2. + +2000-11-01 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/*: Finished integrating the modules code. + +2000-10-26 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/raw.[ch]: Added support for raw file reading and + writing. + +2000-10-24 Michael Pruett <mpruett@sgi.com> + + * libaudiofile/*: Cleaned up the Audio File Library and improved + error handling. + +2000-10-09 Michael Pruett <michael@68k.org> + + * libaudiofile/wave*.[ch]: WAVE format chunks can occur in any + order. Processing of WAVE chunks now acts accordingly. + (Thanks to Michael Krause for pointing out shortcomings in the + previous implementation.) + * libaudiofile/*.[ch]: The VFS layer doesn't handle SEEK_END + as a valid mode for fseek; we must use af_flength instead. + * Removed query from the test suite as it did not handle + values of AU_NULL_PVLIST returned from afQuery. (It even + crashes under IRIX.) + +2000-10-04 Michael Pruett <michael@68k.org> + + * libaudiofile/*.c: Added better error handling. + * libaudiofile/*.c: Added the file format unit structure, + updated querying accordingly. All queries except compression + types are implemented. + * Added query and query2 to the test suite. + +2000-09-13 Michael Pruett <michael@68k.org> + + * libaudiofile/*.c: Added support for G.711 a-law, thanks to + Bruce Forsberg. + +1999-11-20 Michael Pruett <michael@68k.org> + + * libaudiofile/*.c: Cleaning up, added afOpenFD. + +1999-08-21 Kjartan Maraas <kmaraas@online.no> + + * */*c: Even more warning fixes - initialize vars, add 'int' as return + type of a function, and include headers. + +1999-08-20 Elliot Lee <sopwith@redhat.com> + * */*.c: More warning fixes - remove unused variables, add 'int' as return type + of main(), and include some more header files. + +1999-08-18 Anders Carlsson <anders.carlsson@tordata.se> + + * Fixed compiler warnings. + +1999-08-16 Elliot Lee <sopwith@redhat.com> + * libaudiofile/af_vfs.[ch]: Virtualize file access. + * libaudiofile/*.[ch]: Use the new virtualized file access routines. + +1999-05-09 Michael Pruett <michael@68k.org> + + * bread.c, ulaw.c: If more sample frames are requested than + remain in the file, limit the number of sample frames that can + be returned. This bug was brought to my attention by Scott + Heavner. + * test/sgi.[ch]: These files contain SGI Audio Library routines + used in SGI-specific test programs. + * test/irixread.c, test/irixtest.c, test/irixtestloop.c: These + programs now use the routines contained in sgi.[ch] and are more + robust. + +1999-05-23 Raja R Harinath <harinath@cs.umn.edu> + + * test/miscread.c: Include <config.h>. + * test/miscwrite.c: Likewise. + * test/writeaiff.c: Likewise. + * test/writenext.c: Likewise. + * test/writeulaw.c: Likewise. + * test/writewave.c: Likewise. + +1999-05-09 Michael Pruett <michael@68k.org> + + * Merge in Audio File Library version 0.1.7. + + * aiff.c: Fixed an obscure bug in AIFF parsing in the + instrument chunk parsing code. Made AIFF parsing slightly + cleaner by replacing multiple-character constant comparisons + with memcmp and strings. + + * compression.[ch]: Added support for compressed audio. + + * au.c, auwrite.c, ulaw.c, g711.[ch]: Incorporated support for + G.711 mu-law encoding. Currently this encoding is only available + for NeXT/Sun .snd/.au format files. + + * audiofile.c: Virtual byte order is now set properly. + + * aiff.c, audiofile.c, auwrite.c, bread.c, bwrite.c, + compression.c, instrument.c, loop.c, marker.c, misc.c, + query.c, ulaw.c: Added more error checking. + + * docs/*: Documentation has been improved. + + * test/*: Several simple test programs have been added as a + test suite. + + * sfcommands/*: Fix hard-coded virtual byte order since it's + now set by the library. + + * configure.in: Fixed platform-specific tests and detect byte + order at configuration time. + +1999-04-11 James Henstridge <james@daa.com.au> + + * audiofile.spec.in: added %{prefix}/share/aclocal/* to files + list for the devel package. + +1999-02-24 Martin Baulig <martin@home-of-linux.org> + + * configure.in (BUILD_STATIC_LIBS): New automake conditional. + + * sfcommands/Makefile.am, test/Makefile.am: Only link statically + if we build static libraries. + +1999-02-22 Raja R Harinath <harinath@cs.umn.edu> + + * libaudiofile/audiofile.h (extern "C"): Remove duplicated + __cplusplus guards. + +1999-02-22 Michael Fulbright <drmike@redhat.com> + * Fixed spec file to be autogenerated + +1999-02-22 Michael Pruett <michael@68k.org> + Elliot Lee <sopwith@redhat.com> + + * */*: Merge in audiofile 0.1.6. + +1999-01-20 Jeff Garzik <jgarzik@pobox.com> + + * libaudiofile/wave.c: + Fix newly-uncovered bug caught by Mike Bond <mike.bond@template.com>. + +1999-01-17 Jeff Garzik <jgarzik@pobox.com> + + * aiff.c, wave.c: + Replaced some [int == '1234'] comparisons with memcmp. + + * aiff.h: + Replaced large enum value with 'const unsigned long' instead, to + silence ANSI C compiler warning. + + * ulaw.c: + Converted function declarations from K&R to ANSI C, silencing a + (big surprise) ANSI C compiler warning. + + * libaudiofile/Makefile.am: + Remove non-existent instrument.h, loop.h, marker.h + + * sfcommands/Makefile.am: + Add README to EXTRA_DIST. + + * libaudiofile/aiff.c, libaudiofile/aiffwrite.c, + libaudiofile/audiofile.c, libaudiofile/auwrite.c, + libaudiofile/bread.c, libaudiofile/bwrite.c, + libaudiofile/byteorder.c, libaudiofile/byteorder.h, + libaudiofile/extended.c, libaudiofile/extended.h, + libaudiofile/instrument.c, libaudiofile/loop.c, + libaudiofile/marker.c, libaudiofile/misc.c, + libaudiofile/swapblock.c, libaudiofile/swapblock.h, + libaudiofile/ulaw.c, libaudiofile/ulaw.h: + More namespace cleanups. Made a few functions static, several + more renamed to add "_af_" prefix. + + * libaudiofile/instrument.h, libaudiofile/loop.h, + libaudiofile/marker.h: + Removed because they only contained prototypes of static funcs, + and were included only by their implementation modules. + +1999-01-16 Jeff Garzik <jgarzik@pobox.com> + + * test/transparency.c: + Change to unsigned short to avoid Sun CC warning. + + * libaudiofile/swapblock.c: + Changed const long to a #define, Sun CC choked on the const. + The definition of u_int16_t may be interfering with array + definitions like this one, b/c u_int16_t is a macro instead of a + typedef on Solaris platforms. + + * acconfig.h: + Protected against multiple inclusion, using @TOP@ and @BOTTOM@. + + * libaudiofile/afinternal.h: + Include config.h for u_int8_t and friends. + + * libaudiofile/audiofile.h, libaudiofile/aupvlist.h: + Mark as extern 'c' if C++ compile. + + * libaudiofile/aiff.c, libaudiofile/aiffwrite.c, + libaudiofile/au.c, libaudiofile/audiofile.c, + libaudiofile/auwrite.c, libaudiofile/bread.c, + libaudiofile/bwrite.c, libaudiofile/byteorder.c, + libaudiofile/swapblock.c, libaudiofile/util.c, + libaudiofile/wave.c, libaudiofile/wavewrite.c, + test/miscread.c, test/miscwrite.c: + s/#if HAVE_CONFIG_H/#ifdef HAVE_CONFIG_H/ + +1999-01-16 Jeff Garzik <jgarzik@pobox.com> + + * libaudiofile/afinternal.h, libaudiofile/aiff.c, + libaudiofile/aiffwrite.c, libaudiofile/au.c, + libaudiofile/audiofile.c, libaudiofile/auwrite.c, + libaudiofile/bread.c, libaudiofile/bwrite.c, + libaudiofile/error.c, libaudiofile/error.h, + libaudiofile/instrument.c, libaudiofile/loop.c, + libaudiofile/marker.c, libaudiofile/misc.c, + libaudiofile/util.c, libaudiofile/util.h, + libaudiofile/wave.c, libaudiofile/wavewrite.c: + Major namespace cleanups: + Made several functions static as warranted. + Renamed a some exported private functions to _af_funcname + to prevent collision. + +1999-01-16 Jeff Garzik <jgarzik@pobox.com> + + * autogen.sh configure.in acconfig.h: + Added AM_CONFIG_HEADER and requisite support for it. + + * libaudiofile/aiff.c libaudiofile/aiffwrite.c libaudiofile/au.c + libaudiofile/audiofile.c libaudiofile/auwrite.c + libaudiofile/bread.c libaudiofile/bwrite.c + libaudiofile/byteorder.c libaudiofile/swapblock.c + libaudiofile/util.c libaudiofile/wave.c + libaudiofile/wavewrite.c test/miscread.c test/miscwrite.c: + Conditionally include config.h. + +1999-01-16 Raja R Harinath <harinath@cs.umn.edu> + + * libaudiofile/error.c (afSetErrorHandler): Provide a better + implementation which agrees with the semantics of the variable + names, and usual "set_error_handler" type of functions. (Modifies + a "fix" in commit: "1999-01-16 Jeff Garzik <jgarzik@pobox.com>"). + +1999-01-16 Jeff Garzik <jgarzik@pobox.com> + + * libaudiofile/aes.c, libaudiofile/aiff.c, libaudiofile/aiffwrite.c, + libaudiofile/au.c, libaudiofile/audiofile.c, libaudiofile/aupv.c, + libaudiofile/auwrite.c, libaudiofile/bread.c, libaudiofile/bwrite.c, + libaudiofile/error.c, libaudiofile/loop.c, libaudiofile/misc.c, + libaudiofile/swapblock.c, libaudiofile/util.c, libaudiofile/wave.c, + libaudiofile/wavewrite.c, sfcommands/printinfo.c, + sfcommands/sfconvert.c, sfcommands/sfinfo.c: + Corrected missing-default-case, unused-var, no-return-value, + implicit-declaration, other gcc warnings. Fixing those warnings + also fixed many bugs. + + * test/adddcoffset.c, test/copy.c, test/linuxtest.c, test/miscread.c, + test/miscwrite.c, test/results.c, test/transparency.c: + Changed main() declaration to standard one, fixed warnings. + +1999-01-01 Jeff Garzik <jgarzik@pobox.com> + + * libaudiofile/audiofile.h: + Corrected comma-in-final-element warnings. + +1998-12-10 Jeff Garzik <jgarzik@pobox.com> + + * tests/miscwrite.c: + include string.h to silence warning about strlen + +Tue Dec 8 21:38:08 PST 1998 Manish Singh <yosh@gimp.org> + + * auto* fixes for make dist + +1998-12-07 Jeff Garzik <jgarzik@pobox.com> + + * LICENSE: + Removed. Automake automatically adds the file COPYING to the + distribution, so this file is redundant. + +1998-12-01 Yo Ric Dude <ricdude@ix.netcom.com> + + * libaudiofile/Makefile.am, au.c, audiofile.c, audiofile.h, + bread.c, teach libaudiofile how to handle u-law encoded .au + files. NOTE: only added routines for reading files. + + * libaudiofile/ulaw.c, libaudiofile/ulaw.h: u-law algorithms from + http://www.itl.atr.co.jp/comp.speech/Section2/Q2.7.html. + +1998-10-21 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> + * added an audiofile-config and an audiofile.m4 + +1998-10-17 Raja R Harinath <harinath@cs.umn.edu> + + * configure.in (u_int_{8,16,32}_t): Define these to some "natural" + C types if the typedefs are missing. + + * libaudiofile/Makefile.am (include_HEADERS): + Remove spurious empty line. + +Wed Oct 7 02:13:34 PDT 1998 Manish Singh <yosh@gimp.org> + + * auto* stuff fixes + +Wed Oct 7 02:08:30 CDT 1998 Frank Belew <frb@umr.edu> + + * added support for automake, and libtool + +1998-07-16 Michael Pruett <michael@68k.org> + + * Changes for the Audio File Library version 0.1.4. + + AES data functions are now implemented. They're only effective + whenusing the AIFF/AIFF-C formats. + + Miscellaneous data functions are now implemented for the + AIFF/AIFF-C file formats. + + The Audio File Library now uses GNU autoconf. + + The Audio File Library now builds shared libraries. + + Some rudimentary documentation is now included. + +1998-06-22 Michael Pruett <michael@68k.org> + + * Changes for the Audio File Library version 0.1.3 + + The Linux-specific test programs should work on all Linux + platforms which support audio. (I believe this includes just + Linux/i386, Linux/PowerPC, and Linux/Alpha. I may be wrong.) + + The function afReadFrames now returns the proper value. + + The afGetInstParams, afSetInstParams, afGetInstParamLong, and + afSetInstParamLong calls are now implemented to the same extent + that SGI's versions are. + + Instrument, marker, and loop data functions are now fully + implemented. I'll eventually get around to the miscellaneous data + functions. + + The AUpvlist functions have been implemented and tested. The + afQuery calls are on my list of things to implement. + + A few minor bugs have been fixed. @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..c46e5c1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to produce Makefile.in + +bin_SCRIPTS = \ + audiofile-config + +SRC_SUBDIRS = libaudiofile sfcommands test examples +SUBDIRS = $(SRC_SUBDIRS) docs win32 + +EXTRA_DIST= \ + ACKNOWLEDGEMENTS \ + NOTES \ + README \ + TODO \ + COPYING.GPL \ + configure configure.in\ + audiofile.m4 \ + audiofile.spec.in \ + audiofile.pc.in + +m4datadir = $(datadir)/aclocal +m4data_DATA = audiofile.m4 + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = audiofile.pc + +dist-hook: audiofile.spec + cp audiofile.spec $(distdir) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..59f5048 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,520 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +bin_SCRIPTS = \ + audiofile-config + + +SRC_SUBDIRS = libaudiofile sfcommands test examples +SUBDIRS = $(SRC_SUBDIRS) docs win32 + +EXTRA_DIST = \ + ACKNOWLEDGEMENTS \ + NOTES \ + README \ + TODO \ + COPYING.GPL \ + configure configure.in\ + audiofile.m4 \ + audiofile.spec.in \ + audiofile.pc.in + + +m4datadir = $(datadir)/aclocal +m4data_DATA = audiofile.m4 + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = audiofile.pc +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = audiofile.spec audiofile.pc audiofile-config +SCRIPTS = $(bin_SCRIPTS) + +DIST_SOURCES = +DATA = $(m4data_DATA) $(pkgconfig_DATA) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ + Makefile.am Makefile.in NEWS TODO aclocal.m4 \ + audiofile-config.in audiofile.pc.in audiofile.spec.in \ + config.guess config.h.in config.sub configure configure.in \ + depcomp install-sh ltmain.sh missing mkinstalldirs +DIST_SUBDIRS = $(SUBDIRS) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$@ $(SHELL) ./config.status + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h stamp-hT + @echo timestamp > stamp-hT 2> /dev/null + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @mv stamp-hT stamp-h +$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/./stamp-h.in; \ + $(MAKE) $(srcdir)/./stamp-h.in; \ + else :; fi +$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT + @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null + cd $(top_srcdir) && $(AUTOHEADER) + @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in + +distclean-hdr: + -rm -f config.h +audiofile.spec: $(top_builddir)/config.status audiofile.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +audiofile.pc: $(top_builddir)/config.status audiofile.pc.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +audiofile-config: $(top_builddir)/config.status audiofile-config.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + if test -f $$p; then \ + echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f; \ + elif test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done +uninstall-info-am: +install-m4dataDATA: $(m4data_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(m4datadir) + @list='$(m4data_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(m4datadir)/$$f"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(m4datadir)/$$f; \ + done + +uninstall-m4dataDATA: + @$(NORMAL_UNINSTALL) + @list='$(m4data_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(m4datadir)/$$f"; \ + rm -f $(DESTDIR)$(m4datadir)/$$f; \ + done +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pkgconfigdir)/$$f"; \ + rm -f $(DESTDIR)$(pkgconfigdir)/$$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): + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +# Avoid unsightly `./'. +distdir = $(PACKAGE)-$(VERSION) + +GZIP_ENV = --best + +distdir: $(DISTFILES) + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/. + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="${top_distdir}" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(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 + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || (echo "Error: files left after uninstall" 1>&2; \ + exit 1) ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && $(MAKE) $(AM_MAKEFLAGS) distclean \ + && rm -f $(distdir).tar.gz \ + && (test `find . -type f -print | wc -l` -eq 0 \ + || (echo "Error: files left after distclean" 1>&2; \ + exit 1) ) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(m4datadir) $(DESTDIR)$(pkgconfigdir) + +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)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) +distclean: distclean-recursive + -rm -f config.status config.cache config.log +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-m4dataDATA install-pkgconfigDATA + +install-exec-am: install-binSCRIPTS + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ + uninstall-m4dataDATA uninstall-pkgconfigDATA + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive dist dist-all \ + distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-binSCRIPTS install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-m4dataDATA install-man \ + install-pkgconfigDATA install-recursive install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-binSCRIPTS uninstall-info-am \ + uninstall-info-recursive uninstall-m4dataDATA \ + uninstall-pkgconfigDATA uninstall-recursive + + +dist-hook: audiofile.spec + cp audiofile.spec $(distdir) +# 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: @@ -0,0 +1,5 @@ +News for Audio File Library version 0.2.6 + +Added support for AVR, IFF/8SVX, and NIST SPHERE file formats. + +Added example program demonstrating audio file playback on Mac OS X. @@ -0,0 +1,41 @@ +Audio File Library 0.2.6 +Development Notes +Michael Pruett <michael@68k.org> + +---- + +Large file support is now available on many systems by running configure +with the flag --enable-largefile. By default support for large files +is turned off. This option is unnecessary on systems where off_t is +always 64 bits (e.g. IRIX, FreeBSD, NetBSD, OpenBSD, Mac OS X). + +The Audio File Library supports CCITT G.711 mu-law and A-law as well +as IMA and MS ADPCM. Many compressed data formats are not supported. +This is currently the most important issue to address. + +Error handling is at the present quite robust, but more work can always +be done in this area. + +SGI's Audio File Library on IRIX implements the following formats which +this version of the library does not: + + MPEG1 audio bitstream + Sound Designer II + SampleVision + VOC + SoundFont2 + +I plan to implement some of these as time permits. Sound Designer +II is out of the question because of its dependency upon Macintosh +resource forks. Handling these files on Unix systems is simply not +worth the effort. + +---- + +This version of the Audio File Library has been tested under the +following operating environments: + + mips-sgi-irix6.5 / IRIX 6.5 (MIPSpro cc 7.4m) + powerpc-apple-darwin7.2.0 / Mac OS X 10.3.2 (gcc 3.3) + i686-pc-linux-gnu / Debian GNU/Linux 3.0 (gcc 2.95.4) + sparc-sun-solaris2.9 / Solaris 9 (gcc 3.0.4) @@ -0,0 +1,49 @@ +Audio File Library +Version 0.2.6 +Friday, 5 March 2004 + +Copyright (C) 1998-2000, 2003-2004, Michael Pruett +Copyright (C) 2000-2001, Silicon Graphics, Inc. + +michael@68k.org +http://www.68k.org/~michael/audiofile/ + +---- + +The Audio File Library provides a uniform programming interface to +standard digital audio file formats. + +This library allows the processing of audio data to and from audio +files of many common formats (currently AIFF, AIFF-C, WAVE, NeXT/Sun +.snd/.au, IRCAM, AVR, Amiga IFF/8SVX, and NIST SPHERE). The library +also supports compression (currently G.711 mu-law and A-law and IMA and +MS ADPCM) as well as PCM formats of all flavors (signed and unsigned +integer, single- and double-precision floating point). + +One premise of the Audio File Library is that the data presented to +an application need not be in the same format as the data contained in +the file. Another, however, is that the capabilities of the file format +are exposed to the application programmer should the programmer wish to +take advantage of them. + +The Audio File Library itself is available under the GNU Library General +Public License, and the programs in this package are available under +the GNU General Public License. The two licenses are included in the +files COPYING and COPYING.GPL, respectively. + +---- + +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; if not, write to the +Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307 USA. @@ -0,0 +1,34 @@ +Audio File Library +To Do List + +Michael Pruett <michael@68k.org> + +Short-term +---------- + +Handle more compressed data formats, most importantly Ogg Vorbis and FLAC. +GSM 06.10 would also be nice. + +Handle sample rate conversion. + +More comprehensive tests should be developed to stress-test the +library. Tests are needed most for the following sets of functions: + * af{Get,Set}VirtualChannels/afSetChannelMatrix + * afGetSampleFormat/af{Get,Set}VirtualSampleFormat + * af{Get,Set}Loop{IDs,Mode,Count,Start,End,StartFrame,EndFrame,Track} + +Support for auxiliary data in IRCAM files (maximum amplitude, comments, +etc.) should be added. + +Long-term +--------- + +It would be nice to support some more file formats. + +Add locale support for error messages. + +Documentation should probably be in the SGML DocBook format. + +Whenever a compression format is requested, the library should scan +through /usr/lib/audiofile/*.so to see if any DSOs support the requested +format. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..5727bd4 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,4055 @@ +# aclocal.m4 generated automatically by aclocal 1.5 + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Do all the work for Automake. 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. + +# serial 5 + +# 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... + + +# We require 2.13 because we rely on SHELL being computed by configure. +AC_PREREQ([2.13]) + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. +# The purpose of this macro is to provide the user with a means to +# check macros which are provided without letting her know how the +# information is coded. +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) +# ---------------------------------------------- +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) +fi + +# Define the identity of the package. +PACKAGE=$1 +AC_SUBST(PACKAGE)dnl +VERSION=$2 +AC_SUBST(VERSION)dnl +ifelse([$3],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +ifdef([m4_pattern_allow], + [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl + +# Autoconf 2.50 always computes EXEEXT. However we need to be +# compatible with 2.13, for now. So we always define EXEEXT, but we +# don't compute it. +AC_SUBST(EXEEXT) +# Similar for OBJEXT -- only we only use OBJEXT if the user actually +# requests that it be used. This is a bit dumb. +: ${OBJEXT=o} +AC_SUBST(OBJEXT) + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl +AC_REQUIRE([AM_SET_DEPDIR])dnl +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 +]) + +# +# Check to make sure that the build environment is sane. +# + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + + +# serial 2 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + am_backtick='`' + AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# 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], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# 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 +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + + + +# 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" or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" +AC_SUBST([$1DEPMODE]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST(DEPDIR) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +pushdef([subst], defn([AC_SUBST])) +subst(AMDEPBACKSLASH) +popdef([subst]) +]) + +# Generate code to set up dependency tracking. +# This macro should only be invoked once -- use via AC_REQUIRE. +# Usage: +# AM_OUTPUT_DEPENDENCY_COMMANDS + +# +# 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_OUTPUT_COMMANDS([ +test x"$AMDEP_TRUE" != x"" || +for mf in $CONFIG_FILES; do + case "$mf" in + Makefile) dirpart=.;; + */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; + *) continue;; + esac + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`echo "$file" | sed -e 's|/[^/]*$||'` + $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +], [AMDEP_TRUE="$AMDEP_TRUE" +ac_aux_dir="$ac_aux_dir"])]) + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +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 | fgrep -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 +]) + +# serial 3 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +# +# FIXME: Once using 2.50, use this: +# m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], + [errprint(__file__:__line__: [$0: invalid condition: $1 +])dnl +m4exit(1)])dnl +ifelse([$1], [FALSE], + [errprint(__file__:__line__: [$0: invalid condition: $1 +])dnl +m4exit(1)])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +# serial 3 + +# 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. We must strip everything past the first ":", +# and everything past the last "/". + +AC_PREREQ([2.12]) + +AC_DEFUN([AM_CONFIG_HEADER], +[ifdef([AC_FOREACH],dnl + [dnl init our file count if it isn't already + m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) + dnl prepare to store our destination file list for use in config.status + AC_FOREACH([_AM_File], [$1], + [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) + m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) + dnl and add it to the list of files AC keeps track of, along + dnl with our hook + AC_CONFIG_HEADERS(_AM_File, +dnl COMMANDS, [, INIT-CMDS] +[# update the timestamp +echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" +][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS + m4_popdef([_AM_Dest])])],dnl +[AC_CONFIG_HEADER([$1]) + AC_OUTPUT_COMMANDS( + ifelse(patsubst([$1], [[^ ]], []), + [], + [test -z "$CONFIG_HEADERS" || echo timestamp >dnl + patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl +[am_indx=1 +for am_file in $1; do + case " \$CONFIG_HEADERS " in + *" \$am_file "*) + am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` + if test -n "\$am_dir"; then + am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` + for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do + am_tmpdir=\$am_tmpdir\$am_subdir/ + if test ! -d \$am_tmpdir; then + mkdir \$am_tmpdir + fi + done + fi + echo timestamp > "\$am_dir"stamp-h\$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` +done]) +])]) # AM_CONFIG_HEADER + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(m4_regexp([$1], [^/.*]), -1, + [.], + m4_patsubst([$1], [^\(/\).*], [\1])), + m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +]) # _AM_DIRNAME + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-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. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # <tim.van.holder@pandora.be>, C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <<EOF 1>&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +AC_MSG_RESULT([$hardcode_action]) + +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + need_lib_prefix=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ + +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | [[A-Za-z]]:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +# AC_PROG_LD_GNU - +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + diff --git a/audiofile-config.in b/audiofile-config.in new file mode 100644 index 0000000..c2df275 --- /dev/null +++ b/audiofile-config.in @@ -0,0 +1,58 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage="\ +Usage: audiofile-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @AUDIOFILE_VERSION@ + ;; + --cflags) + if test @includedir@ != /usr/include ; then + includes=-I@includedir@ + fi + echo $includes + ;; + --libs) + libdirs=-L@libdir@ + echo $libdirs -laudiofile -lm + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/audiofile.m4 b/audiofile.m4 new file mode 100644 index 0000000..62bc417 --- /dev/null +++ b/audiofile.m4 @@ -0,0 +1,179 @@ +# Configure paths for the Audio File Library +# Bertrand Guiheneuf 98-10-21 +# stolen from esd.m4 in esound : +# Manish Singh 98-9-30 +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS. +dnl +AC_DEFUN(AM_PATH_AUDIOFILE, +[dnl +dnl Get compiler flags and libraries from the audiofile-config script. +dnl +AC_ARG_WITH(audiofile-prefix,[ --with-audiofile-prefix=PFX Prefix where Audio File Library is installed (optional)], + audiofile_prefix="$withval", audiofile_prefix="") +AC_ARG_WITH(audiofile-exec-prefix,[ --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)], + audiofile_exec_prefix="$withval", audiofile_exec_prefix="") +AC_ARG_ENABLE(audiofiletest, [ --disable-audiofiletest Do not try to compile and run a test Audio File Library program], , enable_audiofiletest=yes) + + if test x$audiofile_exec_prefix != x ; then + audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix" + if test x${AUDIOFILE_CONFIG+set} != xset ; then + AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config + fi + fi + if test x$audiofile_prefix != x ; then + audiofile_args="$audiofile_args --prefix=$audiofile_prefix" + if test x${AUDIOFILE_CONFIG+set} != xset ; then + AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config + fi + fi + + AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no) + min_audiofile_version=ifelse([$1], ,0.2.5,$1) + AC_MSG_CHECKING(for Audio File Library - version >= $min_audiofile_version) + no_audiofile="" + if test "$AUDIOFILE_CONFIG" = "no" ; then + no_audiofile=yes + else + AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs` + AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags` + audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_audiofiletest" = "xyes" ; then + AC_LANG_SAVE + AC_LANG_C + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" + LIBS="$LIBS $AUDIOFILE_LIBS" +dnl +dnl Now check if the installed Audio File Library is sufficiently new. +dnl (Also checks the sanity of the results of audiofile-config to some extent.) +dnl + rm -f conf.audiofiletest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <audiofile.h> + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.audiofiletest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_audiofile_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_audiofile_version"); + exit(1); + } + + if (($audiofile_major_version > major) || + (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) || + (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version); + printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n"); + printf("*** to point to the correct copy of audiofile-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + AC_LANG_RESTORE + fi + fi + if test "x$no_audiofile" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$AUDIOFILE_CONFIG" = "no" ; then + cat <<END +*** The audiofile-config script installed by the Audio File Library could +*** not be found. If the Audio File Library was installed in PREFIX, make +*** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG +*** environment variable to the full path to audiofile-config. +END + else + if test -f conf.audiofiletest ; then + : + else + echo "*** Could not run Audio File Library test program; checking why..." + AC_LANG_SAVE + AC_LANG_C + CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" + LIBS="$LIBS $AUDIOFILE_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <audiofile.h> +], [ return 0; ], + [ cat <<END +*** The test program compiled, but did not run. This usually means that +*** the run-time linker is not finding Audio File Library or finding the +*** wrong version of Audio File Library. +*** +*** If it is not finding Audio File Library, you'll need to set your +*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point +*** to the installed location. Also, make sure you have run ldconfig if +*** that is required on your system. +*** +*** If you have an old version installed, it is best to remove it, although +*** you may also be able to get things to work by modifying +*** LD_LIBRARY_PATH. +END + ], + [ echo "*** The test program failed to compile or link. See the file config.log" + echo "*** for the exact error that occured. This usually means the Audio File" + echo "*** Library was incorrectly installed or that you have moved the Audio" + echo "*** File Library since it was installed. In the latter case, you may want" + echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + AC_LANG_RESTORE + fi + fi + AUDIOFILE_CFLAGS="" + AUDIOFILE_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(AUDIOFILE_CFLAGS) + AC_SUBST(AUDIOFILE_LIBS) + rm -f conf.audiofiletest +]) diff --git a/audiofile.pc.in b/audiofile.pc.in new file mode 100644 index 0000000..763d72e --- /dev/null +++ b/audiofile.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: audiofile +Description: audiofile +Requires: +Version: @VERSION@ +Libs: -L${libdir} -laudiofile -lm +Cflags: -I${includedir} diff --git a/audiofile.spec b/audiofile.spec new file mode 100644 index 0000000..2f219ff --- /dev/null +++ b/audiofile.spec @@ -0,0 +1,69 @@ +%define ver 0.2.6 +%define RELEASE 1 +%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} +%define prefix /usr + +Summary: A library to handle various audio file formats. +Name: audiofile +Version: %ver +Release: %rel +Copyright: LGPL +Group: Libraries/Sound +Source: ftp://ftp.gnome.org/pub/GNOME/sources/audiofile/audiofile-%{PACKAGE_VERSION}.tar.gz +URL: http://www.68k.org/~michael/audiofile/ +BuildRoot:/var/tmp/audiofile-%{PACKAGE_VERSION}-root +Docdir: %{prefix}/doc +Obsoletes: libaudiofile + +%description +The Audio File Library provides an elegant API for accessing a variety +of audio file formats, such as AIFF/AIFF-C, WAVE, and NeXT/Sun +.snd/.au, in a manner independent of file and data formats. + +%package devel +Summary: Library, headers, etc. to develop with the Audio File Library. +Group: Libraries + +%description devel +Library, header files, etc. for developing applications with the Audio +File Library. + +%prep +%setup + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix +make $MAKE_FLAGS + +%install + +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT + +# +# makefile is broken, sets exec_prefix explicitely. +# +make exec_prefix=$RPM_BUILD_ROOT/%{prefix} prefix=$RPM_BUILD_ROOT/%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog + +* Fri Nov 20 1998 Michael Fulbright <drmike@redhat.com> +- First try at a spec file + +%files +%defattr(-, root, root) +%doc COPYING TODO README ChangeLog docs +%{prefix}/bin/* +%{prefix}/lib/lib*.so.* + +%files devel +%defattr(-, root, root) +%{prefix}/lib/lib*.so +%{prefix}/lib/*.a +%{prefix}/lib/*.la +%{prefix}/lib/pkgconfig/*.pc +%{prefix}/include/* +%{prefix}/share/aclocal/* diff --git a/audiofile.spec.in b/audiofile.spec.in new file mode 100644 index 0000000..fbeefec --- /dev/null +++ b/audiofile.spec.in @@ -0,0 +1,69 @@ +%define ver @VERSION@ +%define RELEASE 1 +%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} +%define prefix /usr + +Summary: A library to handle various audio file formats. +Name: audiofile +Version: %ver +Release: %rel +Copyright: LGPL +Group: Libraries/Sound +Source: ftp://ftp.gnome.org/pub/GNOME/sources/audiofile/audiofile-%{PACKAGE_VERSION}.tar.gz +URL: http://www.68k.org/~michael/audiofile/ +BuildRoot:/var/tmp/audiofile-%{PACKAGE_VERSION}-root +Docdir: %{prefix}/doc +Obsoletes: libaudiofile + +%description +The Audio File Library provides an elegant API for accessing a variety +of audio file formats, such as AIFF/AIFF-C, WAVE, and NeXT/Sun +.snd/.au, in a manner independent of file and data formats. + +%package devel +Summary: Library, headers, etc. to develop with the Audio File Library. +Group: Libraries + +%description devel +Library, header files, etc. for developing applications with the Audio +File Library. + +%prep +%setup + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix +make $MAKE_FLAGS + +%install + +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT + +# +# makefile is broken, sets exec_prefix explicitely. +# +make exec_prefix=$RPM_BUILD_ROOT/%{prefix} prefix=$RPM_BUILD_ROOT/%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog + +* Fri Nov 20 1998 Michael Fulbright <drmike@redhat.com> +- First try at a spec file + +%files +%defattr(-, root, root) +%doc COPYING TODO README ChangeLog docs +%{prefix}/bin/* +%{prefix}/lib/lib*.so.* + +%files devel +%defattr(-, root, root) +%{prefix}/lib/lib*.so +%{prefix}/lib/*.a +%{prefix}/lib/*.la +%{prefix}/lib/pkgconfig/*.pc +%{prefix}/include/* +%{prefix}/share/aclocal/* diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..ed2e03b --- /dev/null +++ b/config.guess @@ -0,0 +1,1321 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-20' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. 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 <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 c99 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # 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. + cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* 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 $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + 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 $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + 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 $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#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 <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# 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 $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> 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: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..1fefe5a --- /dev/null +++ b/config.h.in @@ -0,0 +1,110 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* 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 + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `short' if <sys/types.h> does not define. */ +#undef int16_t + +/* Define to `int' if <sys/types.h> does not define. */ +#undef int32_t + +/* Define to `signed char' if <sys/types.h> does not define. */ +#undef int8_t + +/* Define to `long' if <sys/types.h> does not define. */ +#undef off_t + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define to `unsigned short' if <sys/types.h> does not define. */ +#undef u_int16_t + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef u_int32_t + +/* Define to `unsigned char' if <sys/types.h> does not define. */ +#undef u_int8_t diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..f365797 --- /dev/null +++ b/config.sub @@ -0,0 +1,1443 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to <config-patches@gnu.org>. 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 <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 | mipsisa64 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..e3a66bf --- /dev/null +++ b/configure @@ -0,0 +1,11411 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-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. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF + +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="libaudiofile/aiff.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + +PACKAGE=audiofile +AUDIOFILE_MAJOR_VERSION=0 +AUDIOFILE_MINOR_VERSION=2 +AUDIOFILE_MICRO_VERSION=6 +AUDIOFILE_VERSION=${AUDIOFILE_MAJOR_VERSION}.${AUDIOFILE_MINOR_VERSION}.${AUDIOFILE_MICRO_VERSION} + +AUDIOFILE_VERSION_INFO=2:6:2 + + + + + + + +VERSION=$AUDIOFILE_VERSION + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`CDPATH=:; 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= + am_backtick='`' + { echo "$as_me:$LINENO: WARNING: ${am_backtick}missing' script is too old or missing" >&5 +echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="${MAKE}"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + +# test to see if srcdir already configured +if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# Define the identity of the package. +PACKAGE=$PACKAGE +VERSION=$VERSION + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. + +# Autoconf 2.50 always computes EXEEXT. However we need to be +# compatible with 2.13, for now. So we always define EXEEXT, but we +# don't compute it. + +# Similar for OBJEXT -- only we only use OBJEXT if the user actually +# requests that it be used. This is a bit dumb. +: ${OBJEXT=o} + + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + + ac_config_headers="$ac_config_headers config.h" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_config_commands="$ac_config_commands default-1" + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include='#' +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote='"' + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="${MAKE}"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi; +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi; +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi; +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + + + + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4202 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + 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 + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 + + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:4738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # <tim.van.holder@pandora.be>, C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <<EOF 1>&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + need_lib_prefix=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +f = shl_load; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +f = dlopen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 6536 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 6634 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ + +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + +echo "$as_me:$LINENO: checking for ldexp in -lm" >&5 +echo $ECHO_N "checking for ldexp in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_ldexp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldexp (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +ldexp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_ldexp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_m_ldexp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_ldexp" >&5 +echo "${ECHO_T}$ac_cv_lib_m_ldexp" >&6 +if test $ac_cv_lib_m_ldexp = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + + +echo "$as_me:$LINENO: checking for alOpenPort in -laudio" >&5 +echo $ECHO_N "checking for alOpenPort in -laudio... $ECHO_C" >&6 +if test "${ac_cv_lib_audio_alOpenPort+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-laudio $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char alOpenPort (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +alOpenPort (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_audio_alOpenPort=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_audio_alOpenPort=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_audio_alOpenPort" >&5 +echo "${ECHO_T}$ac_cv_lib_audio_alOpenPort" >&6 +if test $ac_cv_lib_audio_alOpenPort = yes; then + AUDIO_LIB=-laudio +fi + + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + +for ac_header in fcntl.h unistd.h inttypes.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianess by grep'ing values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if fgrep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if fgrep 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 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianess +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianess +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +if test "x$enable_largefile" = "x"; then + enable_largefile=no +fi +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + +fi; +if test "$enable_largefile" != no; then + + echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_CC=' -n32'; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_file_offset_bits=64; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 +if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + +fi +rm -f conftest* + echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_large_files=1; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6 +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + +fi +rm -f conftest* +fi + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define off_t long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 + +echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_off_t" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_off_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77" >&5 +echo "$as_me: error: cannot compute sizeof (off_t), 77" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +long longval () { return (long) (sizeof (off_t)); } +unsigned long ulongval () { return (long) (sizeof (off_t)); } +#include <stdio.h> +#include <stdlib.h> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (off_t))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (off_t)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (off_t)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_off_t=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77" >&5 +echo "$as_me: error: cannot compute sizeof (off_t), 77" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_off_t=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 + +echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_size_t" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (size_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_size_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77" >&5 +echo "$as_me: error: cannot compute sizeof (size_t), 77" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +long longval () { return (long) (sizeof (size_t)); } +unsigned long ulongval () { return (long) (sizeof (size_t)); } +#include <stdio.h> +#include <stdlib.h> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (size_t))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (size_t)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (size_t)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_size_t=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t), 77" >&5 +echo "$as_me: error: cannot compute sizeof (size_t), 77" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_size_t=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_long=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo= ac_hi= +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77" >&5 +echo "$as_me: error: cannot compute sizeof (long), 77" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include <stdio.h> +#include <stdlib.h> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77" >&5 +echo "$as_me: error: cannot compute sizeof (long), 77" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + +echo "$as_me:$LINENO: checking for u_int8_t" >&5 +echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((u_int8_t *) 0) + return 0; +if (sizeof (u_int8_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_u_int8_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6 +if test $ac_cv_type_u_int8_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int8_t unsigned char +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int16_t" >&5 +echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int16_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((u_int16_t *) 0) + return 0; +if (sizeof (u_int16_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_u_int16_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6 +if test $ac_cv_type_u_int16_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int16_t unsigned short +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((u_int32_t *) 0) + return 0; +if (sizeof (u_int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_u_int32_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 +if test $ac_cv_type_u_int32_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int32_t unsigned int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for int8_t" >&5 +echo $ECHO_N "checking for int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_int8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((int8_t *) 0) + return 0; +if (sizeof (int8_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_int8_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_int8_t" >&6 +if test $ac_cv_type_int8_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define int8_t signed char +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for int16_t" >&5 +echo $ECHO_N "checking for int16_t... $ECHO_C" >&6 +if test "${ac_cv_type_int16_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((int16_t *) 0) + return 0; +if (sizeof (int16_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_int16_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_int16_t" >&6 +if test $ac_cv_type_int16_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((int32_t *) 0) + return 0; +if (sizeof (int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_int32_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6 +if test $ac_cv_type_int32_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sgtty.h> +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <termio.h> +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_memcmp_working=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" + + +for ac_func in strdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +platform=none +echo "$as_me:$LINENO: checking for platform specific tests to compile" >&5 +echo $ECHO_N "checking for platform specific tests to compile... $ECHO_C" >&6 +case "$host_os" in + linux*) + TEST_BIN="linuxtest" + platform=linux + ;; + irix5* | irix6*) + TEST_BIN="irixread irixtestloop" + platform=irix + ;; + darwin*) + if test -e /System/Library/Frameworks/CoreAudio.framework; then + TEST_BIN="osxplay" + platform="Mac OS X" + fi + ;; +esac +echo "$as_me:$LINENO: result: $platform" >&5 +echo "${ECHO_T}$platform" >&6 + + +ac_config_files="$ac_config_files audiofile.spec audiofile.pc sfcommands/Makefile test/Makefile examples/Makefile libaudiofile/Makefile libaudiofile/modules/Makefile docs/Makefile win32/Makefile Makefile audiofile-config" +ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.53, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" +ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "audiofile.spec" ) CONFIG_FILES="$CONFIG_FILES audiofile.spec" ;; + "audiofile.pc" ) CONFIG_FILES="$CONFIG_FILES audiofile.pc" ;; + "sfcommands/Makefile" ) CONFIG_FILES="$CONFIG_FILES sfcommands/Makefile" ;; + "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "libaudiofile/Makefile" ) CONFIG_FILES="$CONFIG_FILES libaudiofile/Makefile" ;; + "libaudiofile/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES libaudiofile/modules/Makefile" ;; + "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "win32/Makefile" ) CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "audiofile-config" ) CONFIG_FILES="$CONFIG_FILES audiofile-config" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@AUDIOFILE_MAJOR_VERSION@,$AUDIOFILE_MAJOR_VERSION,;t t +s,@AUDIOFILE_MINOR_VERSION@,$AUDIOFILE_MINOR_VERSION,;t t +s,@AUDIOFILE_MICRO_VERSION@,$AUDIOFILE_MICRO_VERSION,;t t +s,@AUDIOFILE_VERSION@,$AUDIOFILE_VERSION,;t t +s,@AUDIOFILE_VERSION_INFO@,$AUDIOFILE_VERSION_INFO,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@CPP@,$CPP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@AUDIO_LIB@,$AUDIO_LIB,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@TEST_BIN@,$TEST_BIN,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi + # Run the commands associated with the file. + case $ac_file in + config.h ) # update the timestamp +echo timestamp >"./stamp-h1" + ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default-1 ) +test x"$AMDEP_TRUE" != x"" || +for mf in $CONFIG_FILES; do + case "$mf" in + Makefile) dirpart=.;; + */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; + *) continue;; + esac + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`echo "$file" | sed -e 's|/[^/]*$||'` + $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + default ) case "$CONFIG_FILES" in *audiofile-config*) chmod +x audiofile-config;; esac ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..d523173 --- /dev/null +++ b/configure.in @@ -0,0 +1,105 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(libaudiofile/aiff.c) + +PACKAGE=audiofile +AUDIOFILE_MAJOR_VERSION=0 +AUDIOFILE_MINOR_VERSION=2 +AUDIOFILE_MICRO_VERSION=6 +AUDIOFILE_VERSION=${AUDIOFILE_MAJOR_VERSION}.${AUDIOFILE_MINOR_VERSION}.${AUDIOFILE_MICRO_VERSION} + +dnl set version info for libaudiofile.so to package rev - $MAJOR + $MINOR : $MICRO : $MINOR +AUDIOFILE_VERSION_INFO=2:6:2 + +AC_SUBST(AUDIOFILE_MAJOR_VERSION) +AC_SUBST(AUDIOFILE_MINOR_VERSION) +AC_SUBST(AUDIOFILE_MICRO_VERSION) +AC_SUBST(AUDIOFILE_VERSION) +AC_SUBST(AUDIOFILE_VERSION_INFO) + +VERSION=$AUDIOFILE_VERSION + +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +AM_CONFIG_HEADER(config.h) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL + +dnl Checks for libraries. +dnl Check for the ldexp function in the math library. +AC_CHECK_LIB(m, ldexp) + +dnl Check for the SGI Audio Library function alOpenPort. +AC_CHECK_LIB(audio, alOpenPort, AUDIO_LIB=-laudio) +AC_SUBST(AUDIO_LIB) + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h unistd.h inttypes.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_BIGENDIAN + +dnl Disable large file support by default. +if test "x$enable_largefile" = "x"; then + enable_largefile=no +fi +AC_SYS_LARGEFILE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T + +AC_CHECK_SIZEOF(off_t) +AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(long) + +dnl Workaround the lack of these types. +AC_CHECK_TYPE(u_int8_t, unsigned char) +AC_CHECK_TYPE(u_int16_t, unsigned short) +AC_CHECK_TYPE(u_int32_t, unsigned int) +AC_CHECK_TYPE(int8_t, signed char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) + +dnl Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MEMCMP +AC_CHECK_FUNCS(strdup) + +dnl Set up platform specific stuff +platform=none +AC_MSG_CHECKING([for platform specific tests to compile]) +case "$host_os" in + linux*) + TEST_BIN="linuxtest" + platform=linux + ;; + irix5* | irix6*) + TEST_BIN="irixread irixtestloop" + platform=irix + ;; + darwin*) + if test -e /System/Library/Frameworks/CoreAudio.framework; then + TEST_BIN="osxplay" + platform="Mac OS X" + fi + ;; +esac +AC_MSG_RESULT($platform) +AC_SUBST(TEST_BIN) + +AC_OUTPUT([ + audiofile.spec + audiofile.pc + sfcommands/Makefile + test/Makefile + examples/Makefile + libaudiofile/Makefile + libaudiofile/modules/Makefile + docs/Makefile + win32/Makefile + Makefile + audiofile-config], [case "$CONFIG_FILES" in *audiofile-config*) chmod +x audiofile-config;; esac]) @@ -0,0 +1,411 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 AIX 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. + + tmpdepfile1="$object.d" + tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` + if test "$libtool" = yes; then + "$@" -Wc,-MD + else + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + test -z "$dashmflag" && dashmflag=-M + ( IFS=" " + case " $* " in + *" --mode=compile "*) # this is libtool, let us make it quiet + for arg + do # cycle over the arguments + case "$arg" in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + 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) + # 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;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tail +3 "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + 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 diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..3bb2e48 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,16 @@ +EXTRA_DIST = \ + afCloseFile \ + afGetFrameSize \ + afGetTrackBytes \ + afIntro \ + afNewFileSetup \ + afOpenFile \ + afQuery \ + afReadFrames \ + afReadMisc \ + afSeekFrame \ + afSetErrorHandler \ + afSetVirtualByteOrder \ + afWriteFrames \ + sfconvert \ + sfinfo diff --git a/docs/Makefile.in b/docs/Makefile.in new file mode 100644 index 0000000..50e3143 --- /dev/null +++ b/docs/Makefile.in @@ -0,0 +1,232 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +EXTRA_DIST = \ + afCloseFile \ + afGetFrameSize \ + afGetTrackBytes \ + afIntro \ + afNewFileSetup \ + afOpenFile \ + afQuery \ + afReadFrames \ + afReadMisc \ + afSeekFrame \ + afSetErrorHandler \ + afSetVirtualByteOrder \ + afWriteFrames \ + sfconvert \ + sfinfo + +subdir = docs +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu docs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: +tags: TAGS +TAGS: + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || 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 + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/docs/afCloseFile b/docs/afCloseFile new file mode 100644 index 0000000..c1f67ba --- /dev/null +++ b/docs/afCloseFile @@ -0,0 +1,17 @@ +afCloseFile closes an open audio file, updating the file if it was +opened for writing. + +SYNOPSIS +#include <audiofile.h> + +int afCloseFile (AFfilehandle file); + +RETURN VALUE +afCloseFile returns 0 if the file was closed properly and -1 if an +error occurred while closing the file. + +ERRORS +afCloseFile can generate these possible errors: +AF_BAD_FILEHANDLE +AF_BAD_LSEEK +AF_BAD_WRITE diff --git a/docs/afGetFrameSize b/docs/afGetFrameSize new file mode 100644 index 0000000..781d04c --- /dev/null +++ b/docs/afGetFrameSize @@ -0,0 +1,34 @@ +afGetFrameSize returns the frame size in bytes for a specified audio +track. + +SYNOPSIS +#include <audiofile.h> + +float afGetFrameSize (AFfilehandle file, int track, int expand3to4); + +PARAMETERS +file is a valid AFfilehandle. + +track is an integer which refers to a specific audio track in the +file. At present no supported audio file format allows for more than +one audio track within a file, so track should always be +AF_DEFAULT_TRACK. + +If expand3to4 is a non-zero value, then 3-byte frames will be treated +as taking up 4 bytes in memory. This is useful for calculating how +much memory will be needed to store audio data suitable for playback +since 24-bit audio data is typically aligned on 32-bit boundaries. (At +least that's how it's done on SGI systems; I know of no other computer +system that has support for 24-bit audio.) + +DESCRIPTION +afGetFrameSize returns the number of bytes in a frame in the given +track of the specified file. + +A sample frame consists of one or more samples. For a monaural track, +a sample frame will always contain one sample. For a stereophonic +track, a sample frame will always contain two samples, one for the left +channel and one for the right channel. + +The parameter expand3to4 is ignored unless the specified audio track +contains 24-bit sampled audio data. diff --git a/docs/afGetTrackBytes b/docs/afGetTrackBytes new file mode 100644 index 0000000..3109dba --- /dev/null +++ b/docs/afGetTrackBytes @@ -0,0 +1,55 @@ +NAME + +afGetFrameCount, afGetTrackBytes, afGetDataOffset - get the total sample +frame count, length of audio track in bytes, offset of the audio track for a +specified audio track in a specified AFfilehandle structure + + +SYNOPSIS + +#include <audiofile.h> + +AFframecount afGetFrameCount (AFfilehandle file, int track); + +AFfileoffset afGetTrackBytes (AFfilehandle file, int track); + +AFfileoffset afGetDataOffset (AFfilehandle file, int track); + + +PARAMETERS + +file is an AFfilehandle that has been created by a previous call to +afOpenFile. + +track is an integer which specifies an audio track within file. All +supported file formats contain exactly one audio track per file, so the +constant AF_DEFAULT_TRACK should always be used. + + +DESCRIPTION + +afGetFrameCount returns the total number of sample frames contained +within the specified track of the specified file. + +Each sample frame of audio consists of a fixed number of samples (equal to +the number of audio channels in the file, equal to the value returned by +afGetChannels for the particular track and file). For monaural data, a +sample frame consists of one audio sample. For stereophonic data, a sample +frame consists of a stereo pair. + +afGetTrackBytes returns the total number of bytes of raw audio data +(i.e., prior to decompression) in track. This is useful for determining +raw file seek points, etc. + +afGetDataOffset returns the offset in bytes of the start of the audio +data contained within the specified track of the specified file. + + +RETURN VALUE + +afGetFrameCount returns the total number of sample frames in track. +afGetTrackBytes() returns the total number of bytes of audio data in +track. afGetDataOffset() returns the offset in bytes to the beginning +of the audio data in track. + +If an error occurs, -1 is returned by all of these routines. diff --git a/docs/afIntro b/docs/afIntro new file mode 100644 index 0000000..1a07204 --- /dev/null +++ b/docs/afIntro @@ -0,0 +1,92 @@ +The purpose of the Audio File Library is to provide transparency to +the programmer of file formats and data formats. + +BASICS + +Audio files contain a sequence of amplitudes sampled at a particular +rate, called the sampling frequency. The method by which sounds can +be acquired or generated in this manner is referred to as pulse-code +modulation (PCM). The representation of these amplitudes varies from +one file format to another. Common representations for these data are +two's complement integers, unsigned integers, and floating-point +numbers. + +For uncompressed audio, a track within an audio file consists of a +sequence of frames, each of which contains a number of samples equal to +the number of channels in the track. For example, in a stereo track, +every frame contains two samples. + +To read from a file containing audio data, the following sequence of +function calls are typically used: + +afOpenFile +afReadFrames +afCloseFile + +To write to a file, a similar sequence of commands is typically +employed: + +afNewFileSetup +afOpenFile +afWriteFrames +afCloseFile + +Data format transparency is achieved in the Audio File Library by +providing the data in a virtual format. The virtual format consists of +a virtual byte order and a virtual sample format. Virtual byte order +is by default set to the host byte order and does not depend on the +native byte order of the file format being used. Virtual sample format +is by default in an uncompressed format. + +The current Audio File Library does not support the concept of a virtual +sampling rate, but this may be supported in the future. + +At the present, the Audio File Library supports only CCITT G.711 +mu-law/A-law compression. + +PROGRAMMING PARADIGM + +An audio file is manipulated through the AFfilehandle opaque data +type. Calls to the library are made with this file handle as an +argument. When opening a file for writing, another opaque data +structure called AFfilsetup is used. This structure is then passed to +calls which set various file parameters which are set at the time the +file is created, such as its file type and data format; such +properties cannot be modified for an existing file. + +FUNCTIONS + +Calls available through the library include the following: + +afNewFileSetup - create a file setup structure +afFreeFileSetup - free a file setup structure +afOpenFile - create a file handle structure given a file name and + optionally a file setup +afCloseFile - close an open audio file +afSyncFile - update an audio file which has been opened for writing +afSetVirtual{ByteOrder,Channels,PCMMapping,SampleFormat} - set virtual + format for audio data within a specified track +afInit{ByteOrder,Channels,Rate,SampleFormat} - set parameters of an + AFfilesetup structure which will be used to open an audio file for + writing + +afQuery - query regarding the capabilities of the Audio File Library +afQueryLong +afQueryPointer +afQueryDouble + +afSetLoop* - set loop parameters +afGetLoop* - get loop parameters + +afSetMark* - set mark parameters +afGetMark* - get mark parameters + +afSetInst* - set instrument parameters +afGetInst* - get instrument parameters + +afGetAESChannelData - get AES channel data for a given audio file +afSetAESChannelData - set AES channel data for a given audio file +afInitAESChannelData - specify that storage space is to be allocated + for AES channel status data in a given audio file +afInitAESChannelDataTo - specify whether storage space is to be allocated + for AES channel status data in a given audio file diff --git a/docs/afNewFileSetup b/docs/afNewFileSetup new file mode 100644 index 0000000..1985755 --- /dev/null +++ b/docs/afNewFileSetup @@ -0,0 +1,25 @@ +afNewFileSetup creates and initializes a new AFfilesetup structure. + +SYNOPSIS + +#include <audiofile.h> + +AFfilesetup afNewFileSetup(void); + +RETURN VALUE + +afNewFileSetup returns, upon success, a valid AFfilesetup structure. + +Upon failure, afNewFileSetup returns a null AFfilesetup +(AF_NULL_FILESETUP). This case should only occur when no memory is +available. + +DESCRIPTION + +The opaque AFfilesetup structure returned by afNewFileSetup can be +used to specify parameters for a file to be opened for writing by +afOpenFile. + +SEE ALSO + +afOpenFile diff --git a/docs/afOpenFile b/docs/afOpenFile new file mode 100644 index 0000000..f8d2a47 --- /dev/null +++ b/docs/afOpenFile @@ -0,0 +1,42 @@ +afOpenFile opens a specified audio file and creates a file handle +structure which is used for subsequent calls to the Audio File +Library. + +SYNOPSIS +#include <audiofile.h> + +AFfilehandle afOpenFile(const char *path, const char *mode, + const AFfilesetup seutp); + +PARAMETERS +path is the path to the file to be opened. + +mode specifies a mode for opening the file (typically "r" or "w"). + +setup is ignored unless the mode specifies writing. + +RETURN VALUE +afOpenFile returns, upon success, a valid AFfilehandle which can be +used in subsequent calls to the Audio File Library for reading or +writing. + +Upon failure, afOpenFile returns a null file handle +(AF_NULL_FILEHANDLE). + +afCloseFile is used to close the file when it is no longer needed. + +ERRORS +afOpenFile can produce the following errors: +AF_BAD_OPEN (open failed) +AF_BAD_READ (read failed) +AF_BAD_WRITE (write failed) +AF_BAD_LSEEK (lseek failed) +AF_BAD_MALLOC (memory allocation failed) +AF_BAD_FILEFMT (unrecognized file format) + +SEE ALSO +afCloseFile +afNewFileSetup +afInitFileFormat +afReadFrames +afWriteFrames diff --git a/docs/afQuery b/docs/afQuery new file mode 100644 index 0000000..0129261 --- /dev/null +++ b/docs/afQuery @@ -0,0 +1,57 @@ +afQuery queries the capabilities of the Audio File Library. + +SYNOPSIS +#include <audiofile.h> + +AUpvlist afQuery (int querytype, int arg1, int arg2, int arg3, int arg4); +long afQueryLong (int querytype, int arg1, int arg2, int arg3, int arg4); +double afQueryDouble (int querytype, int arg1, int arg2, int arg3, int arg4); +void *afQueryPointer (int querytype, int arg1, int arg2, int arg3, int arg4); + +PARAMETERS +querytype can be one of the following: +AF_QUERYTYPE_FILEFMT +AF_QUERYTYPE_INST +AF_QUERYTYPE_INSTPARAM +AF_QUERYTYPE_COMPRESSION +AF_QUERYTYPE_COMPRESSIONPARAM +AF_QUERYTYPE_MISC +AF_QUERYTYPE_MARK +AF_QUERYTYPE_LOOP + +For AF_QUERYTYPE_FILEFMT, the following selectors are valid values for arg1: + +AF_QUERY_LABEL - Request a short label string for the format (e.g., "aiff"). + +AF_QUERY_NAME - Request a short name for the format (e.g., "MS RIFF WAVE"). + +AF_QUERY_DESC - Request a descriptive name for the format (e.g., "Audio +Interchange File Format"). + +AF_QUERY_IMPLEMENTED - Request a boolean value indicating whether the +format is implemented for reading and writing in the Audio File Library. + +AF_QUERY_ID_COUNT - Request the total number of formats implemented. + +AF_QUERY_IDS - Request an integer array of the id token values of all +implemented file formats. + +AF_QUERY_COMPRESSION_TYPES - Used with the selector AF_QUERY_VALUE_COUNT +in arg2, this will return a long integer containing the number of +compression schemes available for use within the format specified in arg3. +Used with selector AF_QUERY_VALUES, it returns a pointer to an integer +array containing the compression id values of the compression schemes +supported by the format specified in arg3. + +AF_QUERY_SAMPLE_FORMATS - Used with the selector AF_QUERY_DEFAULT in arg2, +this will return the default sample format for the file format specified in +arg3. + +AF_QUERY_SAMPLE_SIZES - Used with selector AF_QUERY_DEFAULT in arg2, this +will return the default sample width for the file format specified in arg3. + + +ERRORS +afQuery can produce the following errors: +* AF_BAD_QUERYTYPE - The query type is unsupported. +* AF_BAD_QUERY - The arguments to the query are bad. diff --git a/docs/afReadFrames b/docs/afReadFrames new file mode 100644 index 0000000..5119840 --- /dev/null +++ b/docs/afReadFrames @@ -0,0 +1,46 @@ +afReadFrames reads sample frames from a given audio track in an audio file. + +SYNOPSIS + +#include <audiofile.h> + +int afReadFrames (const AFfilehandle file, int track, void *samples, + const int count) + +PARAMETERS + +file is the AFfilehandle structure for the audio file from which audio +sample data will be read. + +track is the track number within the audio file referred to by file. +track should be set to the default value of AF_DEFAULT_TRACK at the +present time. + +samples is a pointer to a buffer capable of storing count frames read +from the file referred to by file. + +count is the number of sample frames to be read from the track +specified by track within the file specified by file. + +RETURN VALUE + +afReadFrames returns the number of frames successfully read from file into the +array referred to by samples. + +ERRORS + +Possible errors include +(old school) +AF_BAD_READ +AF_BAD_FILEHANDLE +AF_BAD_LSEEK +AF_BAD_TRACKID (the track parameter differs from AF_DEFAULT_TRACK) +AF_BAD_AIFF_SSND + +(new school--unsupported) +AF_ERR_BAD_READ +AF_ERR_BAD_LSEEK + +SEE ALSO + +afWriteFrames diff --git a/docs/afReadMisc b/docs/afReadMisc new file mode 100644 index 0000000..b7fcdf7 --- /dev/null +++ b/docs/afReadMisc @@ -0,0 +1,33 @@ +afReadMisc, afWriteMisc, afSeekMisc + +SYNOPSIS + +#include <audiofile.h> + +int afReadMisc (const AFfilehandle file, int miscid, void *buffer, int nbytes); + +int afWriteMisc (const AFfilehandle file, int miscid, void *buffer, int nbytes); + +int afSeekMisc (const AFfilehandle file, int chunkid, int offbytes); + +RETURN VALUE + +afReadMisc returns the number of bytes read from the specified +miscellaneous chunk into the buffer referred to by buffer. + +afWriteMisc returns the number of bytes written to the specified +miscellaneous chunk from the buffer referred to by buffer. + +afSeekMisc returns the new location of the logical file pointer as +measured as an offset in bytes from the beginning of the miscellaneous +chunk's data area. + +ERROR VALUES +afReadMisc, afWriteMisc, and afSeekMisc can return the following error +codes: +AF_BAD_READ +AF_BAD_WRITE +AF_BAD_MISCSEEK +AF_BAD_MISCID +AF_BAD_TRACKID +AF_BAD_FILEHANDLE diff --git a/docs/afSeekFrame b/docs/afSeekFrame new file mode 100644 index 0000000..eb7315f --- /dev/null +++ b/docs/afSeekFrame @@ -0,0 +1,39 @@ +afSeekFrame moves the logical file pointer for a specified audio track +to a desired sample frame location. + +afTellFrame retrieves current value of a file read or write pointer. + +SYNOPSIS + +#include <audiofile.h> + +AFframecount afSeekFrame (const AFfilehandle file, int track, + AFframecount frameoffset); + +AFframecount afTellFrame (const AFfilehandle file, int track); + +PARAMETERS + +file is an AFfilehandle structure which has been created by +afOpenFile. + +track is an integer which refers to an audio track within a file. The +constant AF_DEFAULT_TRACK should always be used for this parameter +since no currently supported file formats support more than one track +per file. + +frameoffset is an offset measured in sample frames. This value must be +greater than or equal to zero and strictly less than the number of +sample frames contained within the specified audio track. If +frameoffset is -1, afSeekFrame() will return the current frame. + +RETURN VALUE + +On successful completion, the value returned from afSeekFrame and +afTellFrame is the current file pointer location as measured in sample +frames from the start of the audio track. + +ERROR VALUES + +The following errors could be generated by afSeekFrame or afTellFrame: +AF_BAD_LSEEK diff --git a/docs/afSetErrorHandler b/docs/afSetErrorHandler new file mode 100644 index 0000000..0ff5eb5 --- /dev/null +++ b/docs/afSetErrorHandler @@ -0,0 +1,28 @@ +afSetErrorHandler allows an alternate error handling routine to be +specified. + +SYNOPSIS + + #include <audiofile.h> + + AFerrfunc afSetErrorHandler (AFerrfunc errorFunction); + +PARAMETERS + +errorFunction is a pointer to an error handling function which has the +following prototype: + void error (long, char *, ...); + +RETURN VALUE + +The value returned from afSetErrorHandler is a pointer to the previous +error handling function. + +DESCRIPTION + +The afSetErrorHandler() library function allows the user to override +the default error handling function. + +The arguments are a long indicating an error code and a string (which +may have printf-style formatting) followed by a variable argument list +which contains any arguments for the format string. diff --git a/docs/afSetVirtualByteOrder b/docs/afSetVirtualByteOrder new file mode 100644 index 0000000..e756c1b --- /dev/null +++ b/docs/afSetVirtualByteOrder @@ -0,0 +1,62 @@ +The functions afSetVirtualSampleFormat, afSetVirtualByteOrder, +afSetVirtualChannels, afSetVirtualPCMMapping set the virtual data +format for a particular track of an audio file. + +SYNOPSIS + +#include <audiofile.h> + +int afSetVirtualSampleFormat (AFfilehandle file, int track, + int sampleFormat, int sampleWidth); + +int afSetVirtualByteOrder (AFfilehandle file, int track, + int byteOrder); + +int afSetVirtualChannels (AFfilehandle file, int track, int channels); + +int afSetVirtualRate (AFfilehandle file, int track, double rate); + +int afSetVirtualPCMMapping (AFfilehandle file, int track, + double slope, double intercept, double minclip, double maxclip); + +PARAMETERS + +* file is an AFfilehandle which refers to an open audio file and is + usually created by afOpenFile. + +* track is an integer which identifies a particular track in an open + audio file. The only valid track is AF_DEFAULT_TRACK for all + currently supported file formats. + +* sampleFormat is an integer which denotes a virtual sample format. + Valid values are AF_SAMPFMT_TWOSCOMP, AF_SAMPFMT_UNSIGNED, + AF_SAMPFMT_FLOAT, and AF_SAMPFMT_DOUBLE. Note that this + implementation of the Audio File Library only supports the two's + complement sample format at present. + +* sampleWidth is a positive integer which specifies the number of bits in a + virtual sample. + +* channels is a positive integer which specifies the number of + interleaved audio channels in the given audio track. + +* byteOrder is an integer which specifies the virtual byte order of + samples in the given audio track. byteOrder can be either + AF_BYTEORDER_BIGENDIAN or AF_BYTEORDER_LITTLEENDIAN. + +* slope and intercept are double-precision floating point values which + indicate the audio data sample slope and zero-crossing value, + respectively, for the given sample format. + +* minclip and maxclip are double-precision floating point values + which indicates the minimum or maximum sample values to be returned. + Any values less than minclip will be set to minclip, and any values + greater than maxclip will be set to maxclip. + +RETURN VALUE + +These functions return 0 for success and -1 for failure. + +BUGS + +At present, afSetVirtualRate is not implemented. diff --git a/docs/afWriteFrames b/docs/afWriteFrames new file mode 100644 index 0000000..e5501b6 --- /dev/null +++ b/docs/afWriteFrames @@ -0,0 +1,29 @@ +afWriteFrames writes the sample frames pointed to by samples to the +audio file represented by file. + +SYNOPSIS + +#include <audiofile.h> + +int afWriteFrames(AFfilehandle file, int track, void *samples, + AFframecount frameCount); + +PARAMETERS + +file is a valid file handle. + +track is always use AF_DEFAULT_TRACK for now. + +samples is a pointer to the array of sample frames to be written to the file. +frameCount is the number of frames from samples to be written. + +ERRORS + +afWriteFrames can return these possible errors: +AF_BAD_WRITE +AF_BAD_LSEEK +AF_BAD_TRACKID + +SEE ALSO + +afReadFrames diff --git a/docs/sfconvert b/docs/sfconvert new file mode 100644 index 0000000..6a6b3be --- /dev/null +++ b/docs/sfconvert @@ -0,0 +1,27 @@ +NAME + +sfconvert + +SYNOPSIS + +sfconvert infile outfile [ options ... ] [ output keywords ... ] + +DESCRIPTION + +The following keywords specify the format of the output sound file: + + byteorder e endian (e is big or little) + channels n n-channel file (typically 1 or 2) + format f file format f (see below) + integer n s n-bit integer file, where s is: + 2scomp: 2's complement signed data + unsigned: unsigned data + float m floating point file, maxamp m (usually 1.0) + +Currently supported file formats are the following: + + aiff Audio Interchange File Format + aifc AIFF-C File Format + next NeXT/Sun Format + wave MS RIFF WAVE Format + bics Berkeley/IRCAM/CARL Sound File Format diff --git a/docs/sfinfo b/docs/sfinfo new file mode 100644 index 0000000..13a9359 --- /dev/null +++ b/docs/sfinfo @@ -0,0 +1,9 @@ +sfinfo [options] file1 file2... + +options can be any combination of -reporterror and -short. + +sfinfo prints information regarding the file in question. + +-short prints one-line information. + +-reporterror prints errors if files are not valid audio files. diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..00634ad --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,23 @@ +INCLUDES = -I$(top_srcdir)/libaudiofile + +noinst_PROGRAMS = \ + adddcoffset \ + power \ + @TEST_BIN@ + +EXTRA_PROGRAMS = irixread irixtestloop linuxtest osxplay + +irixread_SOURCES = irixread.c sgi.c sgi.h +irixread_LDADD = $(top_builddir)/libaudiofile/libaudiofile.la @AUDIO_LIB@ + +irixtestloop_SOURCES = irixtestloop.c sgi.c sgi.h +irixtestloop_LDADD = $(top_builddir)/libaudiofile/libaudiofile.la @AUDIO_LIB@ + +linuxtest_SOURCES = linuxtest.c + +osxplay_SOURCES = osxplay.c +osxplay_LDFLAGS = -framework AudioUnit -framework CoreServices + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..a34583d --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,385 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +INCLUDES = -I$(top_srcdir)/libaudiofile + +noinst_PROGRAMS = \ + adddcoffset \ + power \ + @TEST_BIN@ + + +EXTRA_PROGRAMS = irixread irixtestloop linuxtest osxplay + +irixread_SOURCES = irixread.c sgi.c sgi.h +irixread_LDADD = $(top_builddir)/libaudiofile/libaudiofile.la @AUDIO_LIB@ + +irixtestloop_SOURCES = irixtestloop.c sgi.c sgi.h +irixtestloop_LDADD = $(top_builddir)/libaudiofile/libaudiofile.la @AUDIO_LIB@ + +linuxtest_SOURCES = linuxtest.c + +osxplay_SOURCES = osxplay.c +osxplay_LDFLAGS = -framework AudioUnit -framework CoreServices + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +subdir = examples +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = irixread$(EXEEXT) irixtestloop$(EXEEXT) \ + linuxtest$(EXEEXT) osxplay$(EXEEXT) +noinst_PROGRAMS = adddcoffset$(EXEEXT) power$(EXEEXT) @TEST_BIN@ +PROGRAMS = $(noinst_PROGRAMS) + +adddcoffset_SOURCES = adddcoffset.c +adddcoffset_OBJECTS = adddcoffset.$(OBJEXT) +adddcoffset_LDADD = $(LDADD) +adddcoffset_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +adddcoffset_LDFLAGS = +am_irixread_OBJECTS = irixread.$(OBJEXT) sgi.$(OBJEXT) +irixread_OBJECTS = $(am_irixread_OBJECTS) +irixread_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +irixread_LDFLAGS = +am_irixtestloop_OBJECTS = irixtestloop.$(OBJEXT) sgi.$(OBJEXT) +irixtestloop_OBJECTS = $(am_irixtestloop_OBJECTS) +irixtestloop_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +irixtestloop_LDFLAGS = +am_linuxtest_OBJECTS = linuxtest.$(OBJEXT) +linuxtest_OBJECTS = $(am_linuxtest_OBJECTS) +linuxtest_LDADD = $(LDADD) +linuxtest_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +linuxtest_LDFLAGS = +am_osxplay_OBJECTS = osxplay.$(OBJEXT) +osxplay_OBJECTS = $(am_osxplay_OBJECTS) +osxplay_LDADD = $(LDADD) +osxplay_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +power_SOURCES = power.c +power_OBJECTS = power.$(OBJEXT) +power_LDADD = $(LDADD) +power_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +power_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/adddcoffset.Po $(DEPDIR)/irixread.Po \ +@AMDEP_TRUE@ $(DEPDIR)/irixtestloop.Po $(DEPDIR)/linuxtest.Po \ +@AMDEP_TRUE@ $(DEPDIR)/osxplay.Po $(DEPDIR)/power.Po \ +@AMDEP_TRUE@ $(DEPDIR)/sgi.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = adddcoffset.c $(irixread_SOURCES) $(irixtestloop_SOURCES) \ + $(linuxtest_SOURCES) $(osxplay_SOURCES) power.c +DIST_COMMON = Makefile.am Makefile.in +SOURCES = adddcoffset.c $(irixread_SOURCES) $(irixtestloop_SOURCES) $(linuxtest_SOURCES) $(osxplay_SOURCES) power.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +adddcoffset$(EXEEXT): $(adddcoffset_OBJECTS) $(adddcoffset_DEPENDENCIES) + @rm -f adddcoffset$(EXEEXT) + $(LINK) $(adddcoffset_LDFLAGS) $(adddcoffset_OBJECTS) $(adddcoffset_LDADD) $(LIBS) +irixread$(EXEEXT): $(irixread_OBJECTS) $(irixread_DEPENDENCIES) + @rm -f irixread$(EXEEXT) + $(LINK) $(irixread_LDFLAGS) $(irixread_OBJECTS) $(irixread_LDADD) $(LIBS) +irixtestloop$(EXEEXT): $(irixtestloop_OBJECTS) $(irixtestloop_DEPENDENCIES) + @rm -f irixtestloop$(EXEEXT) + $(LINK) $(irixtestloop_LDFLAGS) $(irixtestloop_OBJECTS) $(irixtestloop_LDADD) $(LIBS) +linuxtest$(EXEEXT): $(linuxtest_OBJECTS) $(linuxtest_DEPENDENCIES) + @rm -f linuxtest$(EXEEXT) + $(LINK) $(linuxtest_LDFLAGS) $(linuxtest_OBJECTS) $(linuxtest_LDADD) $(LIBS) +osxplay$(EXEEXT): $(osxplay_OBJECTS) $(osxplay_DEPENDENCIES) + @rm -f osxplay$(EXEEXT) + $(LINK) $(osxplay_LDFLAGS) $(osxplay_OBJECTS) $(osxplay_LDADD) $(LIBS) +power$(EXEEXT): $(power_OBJECTS) $(power_DEPENDENCIES) + @rm -f power$(EXEEXT) + $(LINK) $(power_LDFLAGS) $(power_OBJECTS) $(power_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/adddcoffset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/irixread.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/irixtestloop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/linuxtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/osxplay.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/power.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sgi.Po@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + +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)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/adddcoffset.c b/examples/adddcoffset.c new file mode 100644 index 0000000..cadc6cb --- /dev/null +++ b/examples/adddcoffset.c @@ -0,0 +1,99 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + adddcoffset.c + + This program adds a user-specified DC offset term to a sound file. + It's not very useful. +*/ + +#include <stdio.h> +#include <stdlib.h> + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include "audiofile.h" +#endif + +void adddcoffset (float offset, char *infilename, char *outfilename); +void usageerror (void); + +int main (int ac, char **av) +{ + float offset; + + if (ac != 4) + usageerror(); + + offset = atof(av[1]); + adddcoffset(offset, av[2], av[3]); + return 0; +} + +void adddcoffset (float offset, char *infilename, char *outfilename) +{ + AFfilehandle infile = afOpenFile(infilename, "r", NULL); + int channelCount, frameCount; + short *buffer; + int i; + + AFfilesetup outfilesetup = afNewFileSetup(); + AFfilehandle outfile; + + frameCount = afGetFrameCount(infile, AF_DEFAULT_TRACK); + channelCount = afGetChannels(infile, AF_DEFAULT_TRACK); + + afInitFileFormat(outfilesetup, AF_FILE_AIFF); + afInitByteOrder(outfilesetup, AF_DEFAULT_TRACK, AF_BYTEORDER_BIGENDIAN); + afInitChannels(outfilesetup, AF_DEFAULT_TRACK, channelCount); + afInitRate(outfilesetup, AF_DEFAULT_TRACK, 44100.0); + afInitSampleFormat(outfilesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + outfile = afOpenFile(outfilename, "w", outfilesetup); + + if (infile == NULL) + { + printf("unable to open input file '%s'.\n", infilename); + return; + } + + printf("afGetFrameCount: %d\n", (int)afGetFrameCount(infile, AF_DEFAULT_TRACK)); + printf("afGetChannels: %d\n", afGetChannels(infile, AF_DEFAULT_TRACK)); + + buffer = (short *) malloc(frameCount * channelCount * sizeof (short)); + afReadFrames(infile, AF_DEFAULT_TRACK, (void *) buffer, frameCount); + + for (i=0; i<frameCount; i++) + { + buffer[i] += offset; + } + + afWriteFrames(outfile, AF_DEFAULT_TRACK, (void *) buffer, frameCount); + afCloseFile(outfile); +} + +void usageerror (void) +{ + fprintf(stderr, "usage: adddcoffset offset infile outfile\n"); + exit(EXIT_FAILURE); +} diff --git a/examples/irixread.c b/examples/irixread.c new file mode 100644 index 0000000..567949c --- /dev/null +++ b/examples/irixread.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + irixread.c + + This program reads and plays a given audio file using Irix's + default audio output device. This file will not work on any + operating system other than Irix. + + The only difference between this program and irixtest is that this + program does not load the entire audio track into memory at once. + Only a small number of frames are read into a buffer and then + written to the audio port. While there are more frames to be + read, this process is repeated. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <dmedia/audio.h> +#include <dmedia/audiofile.h> + +#include "sgi.h" + +const int BUFFERED_FRAME_COUNT = 65536; + +void usage (void) +{ + fprintf(stderr, "usage: irixread filename\n"); + exit(EXIT_FAILURE); +} + +main (int argc, char **argv) +{ + AFfilehandle file; + AFframecount count, frameCount; + int channelCount, sampleFormat, sampleWidth; + float frameSize; + void *buffer; + double sampleRate; + + ALport outport; + ALconfig outportconfig; + + if (argc < 2) + usage(); + + file = afOpenFile(argv[1], "r", NULL); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "Could not open file %s.\n", argv[1]); + exit(EXIT_FAILURE); + } + + frameCount = afGetFrameCount(file, AF_DEFAULT_TRACK); + frameSize = afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1); + channelCount = afGetVirtualChannels(file, AF_DEFAULT_TRACK); + sampleRate = afGetRate(file, AF_DEFAULT_TRACK); + afGetVirtualSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, + &sampleWidth); + + if (sampleFormat == AF_SAMPFMT_UNSIGNED) + { + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, + AF_SAMPFMT_TWOSCOMP, sampleWidth); + } + + printf("frame count: %lld\n", frameCount); + printf("frame size: %d bytes\n", (int) frameSize); + printf("channel count: %d\n", channelCount); + printf("sample rate: %.2f Hz\n", sampleRate); + buffer = malloc(BUFFERED_FRAME_COUNT * frameSize); + + outportconfig = alNewConfig(); + setwidth(outportconfig, sampleWidth); + setsampleformat(outportconfig, sampleFormat); + alSetChannels(outportconfig, channelCount); + + count = afReadFrames(file, AF_DEFAULT_TRACK, buffer, BUFFERED_FRAME_COUNT); + + outport = alOpenPort("irixread", "w", outportconfig); + setrate(outport, sampleRate); + + do + { + printf("count = %lld\n", count); + alWriteFrames(outport, buffer, count); + + count = afReadFrames(file, AF_DEFAULT_TRACK, buffer, + BUFFERED_FRAME_COUNT); + } while (count > 0); + + waitport(outport); + + alClosePort(outport); + alFreeConfig(outportconfig); + + afCloseFile(file); +} diff --git a/examples/irixtestloop.c b/examples/irixtestloop.c new file mode 100644 index 0000000..514a4f5 --- /dev/null +++ b/examples/irixtestloop.c @@ -0,0 +1,150 @@ +/* + Audio File Library + + Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + irixtestloop.c + + This file reads the loop points from a file (presumably AIFF) and + loops that part of the file several times. Audio output is routed + to IRIX's default audio output device. This program will not + compile on any platform other than IRIX. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <dmedia/audio.h> +#include <dmedia/audiofile.h> + +#include "sgi.h" + +const int REPEAT_COUNT = 3; + +void usage (void) +{ + printf("usage: irixtestloop file\n"); + printf("where file is of a format which contains a loop (e.g. AIFF)\n"); + exit(EXIT_FAILURE); +} + +main (int argc, char **argv) +{ + AFfilehandle file; + void *buffer; + + AFframecount frameCount; + int sampleFormat, sampleWidth, channelCount; + float frameSize; + double sampleRate; + + int *loopids, *markids; + int i, loopCount, markCount; + int startmarkid, endmarkid; + AFframecount startloop, endloop; + + ALport outport; + ALconfig outportconfig; + + if (argc < 2) + usage(); + + file = afOpenFile(argv[1], "r", NULL); + frameCount = afGetFrameCount(file, AF_DEFAULT_TRACK); + frameSize = afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1); + channelCount = afGetVirtualChannels(file, AF_DEFAULT_TRACK); + afGetVirtualSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + sampleRate = afGetRate(file, AF_DEFAULT_TRACK); + + /* + If the file's sample format is unsigned integer data, + change the virtual sample format to two's complement + since the SGI Audio Library won't accept unsigned + data. + */ + if (sampleFormat == AF_SAMPFMT_UNSIGNED) + { + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, + AF_SAMPFMT_TWOSCOMP, sampleWidth); + } + + printf("frame count: %lld\n", frameCount); + printf("frame size: %d bytes\n", frameSize); + printf("channel count: %d\n", channelCount); + printf("sample rate: %.2f Hz\n", sampleRate); + + buffer = malloc(frameCount * frameSize); + afReadFrames(file, AF_DEFAULT_TRACK, buffer, frameCount); + + loopCount = afGetLoopIDs(file, AF_DEFAULT_INST, NULL); + loopids = malloc(sizeof (int) * loopCount); + afGetLoopIDs(file, AF_DEFAULT_INST, loopids); + + markCount = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); + markids = malloc(sizeof (int) * markCount); + afGetMarkIDs(file, AF_DEFAULT_TRACK, markids); + + printf("loop ids:"); + for (i=0; i<loopCount; i++) + printf(" %d", loopids[i]); + printf("\n"); + + printf("mark ids:"); + for (i=0; i<markCount; i++) + printf(" %d", markids[i]); + printf("\n"); + + startmarkid = afGetLoopStart(file, AF_DEFAULT_INST, 1); + endmarkid = afGetLoopEnd(file, AF_DEFAULT_INST, 1); + startloop = afGetMarkPosition(file, AF_DEFAULT_TRACK, startmarkid); + endloop = afGetMarkPosition(file, AF_DEFAULT_TRACK, endmarkid); + + afCloseFile(file); + + outportconfig = alNewConfig(); + setwidth(outportconfig, sampleWidth); + setsampleformat(outportconfig, sampleFormat); + alSetChannels(outportconfig, channelCount); + + outport = alOpenPort("irixtestloop", "w", outportconfig); + setrate(outport, sampleRate); + + alWriteFrames(outport, buffer, startloop); + for (i=0; i<REPEAT_COUNT; i++) + { + printf("iteration %d: start %lld, end %lld, length %lld\n", + i, endloop, startloop, endloop - startloop); + alWriteFrames(outport, + (char *) buffer + (int) (startloop * frameSize), + endloop - startloop); + } + + waitport(outport); + + alClosePort(outport); + alFreeConfig(outportconfig); + + free(buffer); +} diff --git a/examples/linuxtest.c b/examples/linuxtest.c new file mode 100644 index 0000000..710083d --- /dev/null +++ b/examples/linuxtest.c @@ -0,0 +1,170 @@ +/* + Audio File Library + + Copyright (c) 1998-1999, Michael Pruett <michael@68k.org> + Copyright (c) 2001, Silicon Graphics, 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 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. +*/ + +/* + linuxtest.c + + This file plays a 16-bit, 44.1 kHz monophonic or stereophonic + audio file through a PC sound card on a Linux system. This file + will not compile under any operating system that does not support + the Open Sound System API. +*/ + +#include <stdio.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/soundcard.h> + +#include <audiofile.h> + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* + If it's not defined already, define the native audio hardware + byte order. +*/ + +#ifndef AFMT_S16_NE +#ifdef WORDS_BIGENDIAN /* defined in config.h */ +#define AFMT_S16_NE AFMT_S16_BE +#else +#define AFMT_S16_NE AFMT_S16_LE +#endif /* WORDS_BIGENDIAN */ +#endif /* AFMT_S16_NE */ + +void setupdsp (int audiofd, int channelCount); +void usage (void); + +/* BUFFER_FRAMES represents the size of the buffer in frames. */ +#define BUFFER_FRAMES 4096 + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFframecount frameCount, framesRead; + int sampleFormat, sampleWidth, channelCount; + float frameSize; + void *buffer; + int audiofd; + + if (argc != 2) + usage(); + + file = afOpenFile(argv[1], "r", NULL); + frameCount = afGetFrameCount(file, AF_DEFAULT_TRACK); + printf("frame count: %d\n", (int) frameCount); + + channelCount = afGetVirtualChannels(file, AF_DEFAULT_TRACK); + afGetVirtualSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, + &sampleWidth); + + frameSize = afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1); + + printf("sample format: %d, sample width: %d, channels: %d\n", + sampleFormat, sampleWidth, channelCount); + + if ((sampleFormat != AF_SAMPFMT_TWOSCOMP) && + (sampleFormat != AF_SAMPFMT_UNSIGNED)) + { + fprintf(stderr, "The audio file must contain integer data in two's complement or unsigned format.\n"); + exit(EXIT_FAILURE); + } + + if ((sampleWidth != 16) || (channelCount > 2)) + { + fprintf(stderr, "The audio file must be of a 16-bit monophonic or stereophonic format.\n"); + exit(EXIT_FAILURE); + } + + buffer = malloc(BUFFER_FRAMES * frameSize); + + audiofd = open("/dev/dsp", O_WRONLY); + if (audiofd < 0) + { + perror("open"); + exit(EXIT_FAILURE); + } + + setupdsp(audiofd, channelCount); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, + BUFFER_FRAMES); + + while (framesRead > 0) + { + printf("read %ld frames\n", framesRead); + write(audiofd, buffer, framesRead * frameSize); + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, + BUFFER_FRAMES); + } + + close(audiofd); + free(buffer); + + return 0; +} + +void setupdsp (int audiofd, int channelCount) +{ + int format, frequency, channels; + + format = AFMT_S16_NE; + if (ioctl(audiofd, SNDCTL_DSP_SETFMT, &format) == -1) + { + perror("set format"); + exit(EXIT_FAILURE); + } + + if (format != AFMT_S16_NE) + { + fprintf(stderr, "format not correct.\n"); + exit(EXIT_FAILURE); + } + + channels = channelCount; + if (ioctl(audiofd, SNDCTL_DSP_CHANNELS, &channels) == -1) + { + perror("set channels"); + exit(EXIT_FAILURE); + } + + frequency = 44100; + if (ioctl(audiofd, SNDCTL_DSP_SPEED, &frequency) == -1) + { + perror("set frequency"); + exit(EXIT_FAILURE); + } +} + +void usage (void) +{ + fprintf(stderr, "usage: linuxtest file\n"); + fprintf(stderr, + "where file refers to a 16-bit monophonic or stereophonic 44.1 kHz audio file\n"); + exit(EXIT_FAILURE); +} diff --git a/examples/osxplay.c b/examples/osxplay.c new file mode 100644 index 0000000..0708c68 --- /dev/null +++ b/examples/osxplay.c @@ -0,0 +1,257 @@ +/* + Audio File Library + + Copyright (c) 2003, Michael Pruett. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + osxplay.c + + This program demonstrates audio file playback using the Audio + File Library and Core Audio. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <audiofile.h> + +#include <CoreServices/CoreServices.h> +#include <AudioUnit/AudioUnit.h> +#include <CoreAudio/CoreAudio.h> + +#define BUFFER_FRAME_COUNT 1024 + +int isPlaying = 1; +void *buffer = NULL; + +void getASBDForFile (AFfilehandle file, int track, + AudioStreamBasicDescription *asbd) +{ + int sampleFormat, sampleWidth, channelCount; + double rate; + + afGetVirtualSampleFormat(file, track, &sampleFormat, &sampleWidth); + channelCount = afGetChannels(file, track); + rate = afGetRate(file, track); + + asbd->mSampleRate = rate; + asbd->mFormatID = kAudioFormatLinearPCM; + switch (sampleFormat) + { + case AF_SAMPFMT_TWOSCOMP: + asbd->mFormatFlags = kAudioFormatFlagIsSignedInteger; + asbd->mBitsPerChannel = sampleWidth; + break; + case AF_SAMPFMT_UNSIGNED: + asbd->mFormatFlags = 0; + asbd->mBitsPerChannel = sampleWidth; + break; + case AF_SAMPFMT_FLOAT: + asbd->mFormatFlags = kAudioFormatFlagIsFloat; + asbd->mBitsPerChannel = 32; + break; + case AF_SAMPFMT_DOUBLE: + asbd->mFormatFlags = kAudioFormatFlagIsFloat; + asbd->mBitsPerChannel = 64; + break; + } + + asbd->mChannelsPerFrame = channelCount; + asbd->mFramesPerPacket = 1; + asbd->mBytesPerFrame = ceilf(afGetVirtualFrameSize(file, track, 1)); + asbd->mBytesPerPacket = asbd->mBytesPerFrame; + + if (afGetVirtualByteOrder(file, track) == AF_BYTEORDER_BIGENDIAN) + asbd->mFormatFlags |= kAudioFormatFlagIsBigEndian; +} + +OSStatus openOutput (AudioUnit *outputUnit) +{ + OSStatus status = noErr; + ComponentDescription description; + Component component; + + description.componentType = kAudioUnitType_Output; + description.componentSubType = kAudioUnitSubType_DefaultOutput; + description.componentManufacturer = kAudioUnitManufacturer_Apple; + description.componentFlags = 0; + description.componentFlagsMask = 0; + + component = FindNextComponent(NULL, &description); + if (component == NULL) + { + fprintf(stderr, "Could not find audio output device.\n"); + exit(EXIT_FAILURE); + } + + status = OpenAComponent(component, outputUnit); + if (status != noErr) + { + fprintf(stderr, "Could not open audio output device.\n"); + exit(EXIT_FAILURE); + } + + status = AudioUnitInitialize(*outputUnit); + if (status != noErr) + { + fprintf(stderr, "Could not initialize audio output device.\n"); + exit(EXIT_FAILURE); + } + + return status; +} + +OSStatus fileRenderProc (void *inRefCon, + AudioUnitRenderActionFlags *inActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + UInt32 inNumFrames, + AudioBufferList *ioData) +{ + AFfilehandle file = (AFfilehandle) inRefCon; + AFframecount framesToRead, framesRead; + + framesToRead = inNumFrames; + if (framesToRead > BUFFER_FRAME_COUNT) + framesToRead = BUFFER_FRAME_COUNT; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, + buffer, framesToRead); + if (framesRead > 0) + { + ioData->mBuffers[0].mData = buffer; + ioData->mBuffers[0].mDataByteSize = framesRead * + afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1); + } + else + isPlaying = 0; + + return noErr; +} + +OSStatus setupOutput (AudioUnit *outputUnit, AFfilehandle file) +{ + OSStatus status = noErr; + UInt32 size; + Boolean outWritable; + + AudioStreamBasicDescription fileASBD, inputASBD, outputASBD; + AURenderCallbackStruct renderCallback; + + /* Set virtual sample format to single-precision floating-point. */ + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32); + + /* Get ASBD for virtual sample format. */ + getASBDForFile(file, AF_DEFAULT_TRACK, &fileASBD); + + status = AudioUnitGetPropertyInfo(*outputUnit, + kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, + 0, &size, &outWritable); + + status = AudioUnitGetProperty(*outputUnit, + kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, + 0, &outputASBD, &size); + + if (outWritable) + { + outputASBD = fileASBD; + + status = AudioUnitSetProperty(*outputUnit, + kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, + 0, &outputASBD, size); + } + + inputASBD = fileASBD; + + status = AudioUnitSetProperty(*outputUnit, + kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, + 0, &inputASBD, size); + if (status != noErr) + { + fprintf(stderr, "Could not set input stream format.\n"); + exit(EXIT_FAILURE); + } + + /* + Set the render callback to a procedure which will + read from the file. + */ + renderCallback.inputProc = fileRenderProc; + renderCallback.inputProcRefCon = file; + + status = AudioUnitSetProperty(*outputUnit, + kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, + &renderCallback, sizeof (AURenderCallbackStruct)); + if (status != noErr) + { + fprintf(stderr, "Could not set render callback.\n"); + exit(EXIT_FAILURE); + } + + return status; +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AudioUnit outputUnit; + + if (argc < 2) + { + fprintf(stderr, "usage: %s filename\n", argv[0]); + exit(EXIT_FAILURE); + } + + file = afOpenFile(argv[1], "r", AF_NULL_FILESETUP); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "Could not open file '%s' for reading.\n", argv[1]); + exit(EXIT_FAILURE); + } + + openOutput(&outputUnit); + setupOutput(&outputUnit, file); + AudioOutputUnitStart(outputUnit); + + buffer = malloc(BUFFER_FRAME_COUNT * + afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1)); + + while (isPlaying) + usleep(250000); + + AudioOutputUnitStop(outputUnit); + AudioUnitUninitialize(outputUnit); + CloseComponent(outputUnit); + + free(buffer); + + afCloseFile(file); +} diff --git a/examples/power.c b/examples/power.c new file mode 100644 index 0000000..01bfe5d --- /dev/null +++ b/examples/power.c @@ -0,0 +1,220 @@ +/* + This program is derived from Chris Vaill's normalize program + and has been modified to use the Audio File Library for file + reading and audio data conversion. + + Copyright (C) 2001, Silicon Graphics, Inc. + Copyright (C) 1999-2001, Chris Vaill + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + power.c + + Calculate the power and peak amplitudes of an audio file. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <audiofile.h> + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +struct smooth +{ + double *buf; + int length, start, n; +}; + +static double get_smoothed_data (struct smooth *s) +{ + int i; + double smoothed; + + smoothed = 0; + for (i = 0; i < s->n; i++) + smoothed += s->buf[i]; + smoothed = smoothed / s->n; + + return smoothed; +} + +void print_power (char *filename); + +int main (int argc, char **argv) +{ + int i; + + if (argc < 2) + { + fprintf(stderr, "usage: %s filename [more filenames...]\n", + argv[0]); + exit(EXIT_FAILURE); + } + + for (i=1; i<argc; i++) + print_power(argv[i]); + + return 0; +} + +void print_power (char *filename) +{ + AFfilehandle file; + double *sums, *frames; + int channelCount, windowSize, frameCount; + int i, c; + struct smooth *powsmooth; + int winStart, winEnd; + int lastWindow = FALSE; + double pow, maxpow; + + double level, peak, minSample = 1, maxSample = -1; + + file = afOpenFile(filename, "r", NULL); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "Could not open file %s.\n", filename); + return; + } + + channelCount = afGetChannels(file, AF_DEFAULT_TRACK); + windowSize = afGetRate(file, AF_DEFAULT_TRACK) / 100; + frameCount = afGetFrameCount(file, AF_DEFAULT_TRACK); + + sums = calloc(channelCount, sizeof (double)); + for (c=0; c<channelCount; c++) + sums[c] = 0; + + frames = calloc(channelCount * windowSize, sizeof (double)); + + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_DOUBLE, + sizeof (double)); + + powsmooth = calloc(channelCount, sizeof (struct smooth)); + for (c=0; c<channelCount; c++) + { + /* Use a 100-element (1 second) window. */ + powsmooth[c].length = 100; + powsmooth[c].buf = calloc(powsmooth[c].length, sizeof (double)); + powsmooth[c].start = 0; + powsmooth[c].n = 0; + } + + winStart = 0; + winEnd = 0; + lastWindow = FALSE; + maxpow = 0; + + do + { + winEnd = winStart + windowSize; + + if (winEnd >= frameCount) + { + winEnd = frameCount; + lastWindow = TRUE; + } + + afReadFrames(file, AF_DEFAULT_TRACK, frames, windowSize); + + for (c=0; c<channelCount; c++) + { + sums[c] = 0; + + for (i=0; i < winEnd - winStart; i++) + { + double sample; + + sample = frames[i*channelCount + c]; + sums[c] += sample*sample; + + if (sample > maxSample) + maxSample = sample; + if (sample < minSample) + minSample = sample; + } + } + + /* Compute power for each channel. */ + for (c=0; c<channelCount; c++) + { + double pow; + int end; + + pow = sums[c] / (winEnd - winStart); + + end = (powsmooth[c].start + powsmooth[c].n) % + powsmooth[c].length; + powsmooth[c].buf[end] = pow; + + if (powsmooth[c].n == powsmooth[c].length) + { + powsmooth[c].start = (powsmooth[c].start + 1) % powsmooth[c].length; + pow = get_smoothed_data(&powsmooth[c]); + if (pow > maxpow) + maxpow = pow; + } + else + { + powsmooth[c].n++; + } + } + + winStart += windowSize; + } while (!lastWindow); + + for (c = 0; c < channelCount; c++) + { + pow = get_smoothed_data(&powsmooth[c]); + if (pow > maxpow) + maxpow = pow; + } + + free(sums); + free(frames); + for (c=0; c<channelCount; c++) + free(powsmooth[c].buf); + free(powsmooth); + + level = sqrt(maxpow); + + afCloseFile(file); + + printf("file: %s\n", filename); + + printf("level (dB): %f\n", 20 * log10(level)); + printf("peak-: %f\n", minSample); + printf("peak+: %f\n", maxSample); + + peak = abs(minSample); + if (peak < abs(maxSample)) + peak = abs(maxSample); + + printf("peak (dB): %f\n", 20 * log10(peak)); +} diff --git a/examples/sgi.c b/examples/sgi.c new file mode 100644 index 0000000..12346d2 --- /dev/null +++ b/examples/sgi.c @@ -0,0 +1,109 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + sgi.c + + These routines are used in SGI-specific test programs. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <unistd.h> + +#include <audiofile.h> + +#include <dmedia/audio.h> + +/* + Set the sample width of an audio configuration. +*/ +void setwidth (ALconfig config, int sampleWidth) +{ + if (sampleWidth <= 8) + { + printf("setting width to 8\n"); + alSetWidth(config, AL_SAMPLE_8); + } + else if (sampleWidth <= 16) + { + printf("setting width to 16\n"); + alSetWidth(config, AL_SAMPLE_16); + } + else if (sampleWidth <= 24) + { + printf("setting width to 24\n"); + alSetWidth(config, AL_SAMPLE_24); + } +} + +/* + Set the sample format of an audio configuration. +*/ +void setsampleformat (ALconfig config, int audioFileSampleFormat) +{ + if (audioFileSampleFormat == AF_SAMPFMT_TWOSCOMP) + { + printf("setting sample format to 2's complement\n"); + alSetSampFmt(config, AL_SAMPFMT_TWOSCOMP); + } + else if (audioFileSampleFormat == AF_SAMPFMT_FLOAT) + { + printf("setting sample format to float\n"); + alSetSampFmt(config, AL_SAMPFMT_FLOAT); + } + else if (audioFileSampleFormat == AF_SAMPFMT_DOUBLE) + { + printf("setting sample format to double\n"); + alSetSampFmt(config, AL_SAMPFMT_DOUBLE); + } +} + +/* + Set the sample rate of an audio port. +*/ +void setrate (ALport port, double rate) +{ + int rv; + ALpv params; + + rv = alGetResource(port); + + params.param = AL_RATE; + params.value.ll = alDoubleToFixed(rate); + + if (alSetParams(rv, ¶ms, 1) < 0) + { + printf("alSetParams failed: %s\n", alGetErrorString(oserror())); + } +} + +/* + Wait until the audio port has no more samples to play. +*/ +void waitport (ALport port) +{ + while (alGetFilled(port) > 0) + sginap(1); +} diff --git a/examples/sgi.h b/examples/sgi.h new file mode 100644 index 0000000..ebb6e5b --- /dev/null +++ b/examples/sgi.h @@ -0,0 +1,53 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + sgi.h + + These routines are used in SGI-specific test programs. +*/ + +#ifndef SGI_H +#define SGI_H + +#include <dmedia/audio.h> + +/* + Set the sample width of an audio configuration. +*/ +void setwidth (ALconfig config, int width); + +/* + Set the sample format of an audio configuration. +*/ +void setsampleformat (ALconfig config, int width); + +/* + Set the sample rate of an audio port. +*/ +void setrate (ALport port, double rate); + +/* + Wait until the audio port has no more samples to play. +*/ +void waitport (ALport port); + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libaudiofile/Makefile.am b/libaudiofile/Makefile.am new file mode 100644 index 0000000..dc20efb --- /dev/null +++ b/libaudiofile/Makefile.am @@ -0,0 +1,41 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = modules + +lib_LTLIBRARIES = libaudiofile.la + +EXTRA_DIST = audiofile.exports + +libaudiofile_la_SOURCES = \ + openclose.c setup.c format.c data.c pcm.c \ + error.c byteorder.c af_vfs.c \ + util.c debug.c aupv.c units.c compression.c \ + aes.c instrument.c loop.c marker.c misc.c track.c query.c \ + raw.c raw.h \ + aiff.c aiffwrite.c extended.c aiff.h \ + next.c nextwrite.c next.h \ + wave.c wavewrite.c wave.h \ + ircam.c ircamwrite.c ircam.h \ + avr.c avrwrite.c avr.h \ + iff.c iffwrite.c iff.h \ + nist.c nistwrite.c nist.h \ + g711.c g711.h \ + afinternal.h aupvinternal.h aupvlist.h byteorder.h \ + compression.h error.h extended.h instrument.h marker.h \ + pcm.h setup.h track.h units.h \ + print.h util.h debug.h \ + modules.c modules.h + +libaudiofile_la_LIBADD = modules/libmodules.la + +libaudiofile_la_LDFLAGS = -version-info 0:2:0 -no-undefined \ + -export-symbols audiofile.exports + +include_HEADERS = audiofile.h aupvlist.h af_vfs.h + +# GNU gcc +# AM_CFLAGS = -Wall -g +# SGI MIPSpro cc +# AM_CFLAGS = -fullwarn -g +# No debugging. +AM_CFLAGS = -DNDEBUG diff --git a/libaudiofile/Makefile.in b/libaudiofile/Makefile.in new file mode 100644 index 0000000..8faf2db --- /dev/null +++ b/libaudiofile/Makefile.in @@ -0,0 +1,536 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +SUBDIRS = modules + +lib_LTLIBRARIES = libaudiofile.la + +EXTRA_DIST = audiofile.exports + +libaudiofile_la_SOURCES = \ + openclose.c setup.c format.c data.c pcm.c \ + error.c byteorder.c af_vfs.c \ + util.c debug.c aupv.c units.c compression.c \ + aes.c instrument.c loop.c marker.c misc.c track.c query.c \ + raw.c raw.h \ + aiff.c aiffwrite.c extended.c aiff.h \ + next.c nextwrite.c next.h \ + wave.c wavewrite.c wave.h \ + ircam.c ircamwrite.c ircam.h \ + avr.c avrwrite.c avr.h \ + iff.c iffwrite.c iff.h \ + nist.c nistwrite.c nist.h \ + g711.c g711.h \ + afinternal.h aupvinternal.h aupvlist.h byteorder.h \ + compression.h error.h extended.h instrument.h marker.h \ + pcm.h setup.h track.h units.h \ + print.h util.h debug.h \ + modules.c modules.h + + +libaudiofile_la_LIBADD = modules/libmodules.la + +libaudiofile_la_LDFLAGS = -version-info 0:2:0 -no-undefined \ + -export-symbols audiofile.exports + + +include_HEADERS = audiofile.h aupvlist.h af_vfs.h + +# GNU gcc +# AM_CFLAGS = -Wall -g +# SGI MIPSpro cc +# AM_CFLAGS = -fullwarn -g +# No debugging. +AM_CFLAGS = -DNDEBUG +subdir = libaudiofile +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +libaudiofile_la_DEPENDENCIES = modules/libmodules.la +am_libaudiofile_la_OBJECTS = openclose.lo setup.lo format.lo data.lo \ + pcm.lo error.lo byteorder.lo af_vfs.lo util.lo debug.lo aupv.lo \ + units.lo compression.lo aes.lo instrument.lo loop.lo marker.lo \ + misc.lo track.lo query.lo raw.lo aiff.lo aiffwrite.lo \ + extended.lo next.lo nextwrite.lo wave.lo wavewrite.lo ircam.lo \ + ircamwrite.lo avr.lo avrwrite.lo iff.lo iffwrite.lo nist.lo \ + nistwrite.lo g711.lo modules.lo +libaudiofile_la_OBJECTS = $(am_libaudiofile_la_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/aes.Plo $(DEPDIR)/af_vfs.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/aiff.Plo $(DEPDIR)/aiffwrite.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/aupv.Plo $(DEPDIR)/avr.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/avrwrite.Plo $(DEPDIR)/byteorder.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/compression.Plo $(DEPDIR)/data.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/debug.Plo $(DEPDIR)/error.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/extended.Plo $(DEPDIR)/format.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/g711.Plo $(DEPDIR)/iff.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/iffwrite.Plo $(DEPDIR)/instrument.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/ircam.Plo $(DEPDIR)/ircamwrite.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/loop.Plo $(DEPDIR)/marker.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/misc.Plo $(DEPDIR)/modules.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/next.Plo $(DEPDIR)/nextwrite.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/nist.Plo $(DEPDIR)/nistwrite.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/openclose.Plo $(DEPDIR)/pcm.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/query.Plo $(DEPDIR)/raw.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/setup.Plo $(DEPDIR)/track.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/units.Plo $(DEPDIR)/util.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/wave.Plo $(DEPDIR)/wavewrite.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = $(libaudiofile_la_SOURCES) +HEADERS = $(include_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +SOURCES = $(libaudiofile_la_SOURCES) + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libaudiofile/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) +libaudiofile.la: $(libaudiofile_la_OBJECTS) $(libaudiofile_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libaudiofile_la_LDFLAGS) $(libaudiofile_la_OBJECTS) $(libaudiofile_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/aes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/af_vfs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/aiff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/aiffwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/aupv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/avr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/avrwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/byteorder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/compression.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/data.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/extended.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/format.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/g711.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/iff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/iffwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/instrument.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ircam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ircamwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/loop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/marker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/misc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/modules.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/next.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/nextwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/nist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/nistwrite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/openclose.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/query.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/raw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/setup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/track.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/units.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/wave.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/wavewrite.Plo@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ + $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ + rm -f $(DESTDIR)$(includedir)/$$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): + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) + +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)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-recursive distclean distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-recursive \ + distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-includeHEADERS install-info \ + install-info-am install-info-recursive install-libLTLIBRARIES \ + install-man install-recursive install-strip installcheck \ + installcheck-am installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + tags tags-recursive uninstall uninstall-am \ + uninstall-includeHEADERS uninstall-info-am \ + uninstall-info-recursive uninstall-libLTLIBRARIES \ + uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libaudiofile/aes.c b/libaudiofile/aes.c new file mode 100644 index 0000000..c6b09a8 --- /dev/null +++ b/libaudiofile/aes.c @@ -0,0 +1,108 @@ +/* + Audio File Library + Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aes.c + + This file contains routines for dealing with AES recording data. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> +#include <assert.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" + +void afInitAESChannelData (AFfilesetup setup, int trackid) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + track->aesDataSet = AF_TRUE; +} + +void afInitAESChannelDataTo (AFfilesetup setup, int trackid, int willBeData) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + track->aesDataSet = willBeData; +} + +/* + What is with these return values? +*/ +int afGetAESChannelData (AFfilehandle file, int trackid, unsigned char buf[24]) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (track->hasAESData == AF_FALSE) + { + if (buf) + memset(buf, 0, 24); + return 0; + } + + if (buf) + memcpy(buf, track->aesData, 24); + + return 1; +} + +void afSetAESChannelData (AFfilehandle file, int trackid, unsigned char buf[24]) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (!_af_filehandle_can_write(file)) + return; + + if (track->hasAESData) + { + memcpy(track->aesData, buf, 24); + } + else + { + _af_error(AF_BAD_NOAESDATA, + "unable to store AES channel status data for track %d", + trackid); + } +} diff --git a/libaudiofile/af_vfs.c b/libaudiofile/af_vfs.c new file mode 100644 index 0000000..2c32d8f --- /dev/null +++ b/libaudiofile/af_vfs.c @@ -0,0 +1,190 @@ +/* + Audio File Library + Copyright (C) 1999, Elliot Lee <sopwith@redhat.com> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + af_vfs.c + + Virtual file operations for the Audio File Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "afinternal.h" +#include "af_vfs.h" + +#include <stdlib.h> + +AFvirtualfile * +af_virtual_file_new(void) +{ + return (AFvirtualfile *) calloc(sizeof (AFvirtualfile), 1); +} + +void +af_virtual_file_destroy(AFvirtualfile *vfile) +{ + vfile->destroy(vfile); + + free(vfile); +} + +size_t af_fread (void *data, size_t size, size_t nmemb, AFvirtualfile *vfile) +{ + if (size == 0 || nmemb == 0) + return 0; + + if (vfile->read) { + int retval; + + retval = (* vfile->read) (vfile, data, size * nmemb); + + return retval/size; + } else + return 0; +} + +size_t af_fwrite (const void *data, size_t size, size_t nmemb, + AFvirtualfile *vfile) +{ + if (size == 0 || nmemb == 0) + return 0; + + if (vfile->write) { + int retval; + + retval = (* vfile->write) (vfile, data, size * nmemb); + + return retval/size; + } else + return 0; +} + +int +af_fclose(AFvirtualfile *vfile) +{ + af_virtual_file_destroy(vfile); + + return 0; +} + +long +af_flength(AFvirtualfile *vfile) +{ + if(vfile->length) + return (* vfile->length)(vfile); + else + return 0; +} + +int +af_fseek(AFvirtualfile *vfile, long offset, int whence) +{ + if(whence == SEEK_CUR) + (* vfile->seek) (vfile, offset, 1); + else if(whence == SEEK_SET) + (* vfile->seek) (vfile, offset, 0); + else + return -1; + + return 0; +} + +long +af_ftell(AFvirtualfile *vfile) +{ + if(vfile->tell) + return (* vfile->tell)(vfile); + else + return 0; +} + +static ssize_t af_file_read (AFvirtualfile *vfile, void *data, size_t nbytes); +static long af_file_length (AFvirtualfile *vfile); +static ssize_t af_file_write (AFvirtualfile *vfile, const void *data, + size_t nbytes); +static void af_file_destroy(AFvirtualfile *vfile); +static long af_file_seek(AFvirtualfile *vfile, long offset, int is_relative); +static long af_file_tell(AFvirtualfile *vfile); + +AFvirtualfile * +af_virtual_file_new_for_file(FILE *fh) +{ + AFvirtualfile *vf; + + if(!fh) + return NULL; + + vf = af_virtual_file_new(); + vf->closure = fh; + vf->read = af_file_read; + vf->write = af_file_write; + vf->length = af_file_length; + vf->destroy = af_file_destroy; + vf->seek = af_file_seek; + vf->tell = af_file_tell; + + return vf; +} + +static ssize_t af_file_read(AFvirtualfile *vfile, void *data, size_t nbytes) +{ + return fread(data, 1, nbytes, vfile->closure); +} + +static long +af_file_length(AFvirtualfile *vfile) +{ + long curpos, retval; + + curpos = ftell(vfile->closure); + fseek(vfile->closure, 0, SEEK_END); + retval = ftell(vfile->closure); + fseek(vfile->closure, curpos, SEEK_SET); + + return retval; +} + +static ssize_t af_file_write (AFvirtualfile *vfile, const void *data, + size_t nbytes) +{ + return fwrite(data, 1, nbytes, vfile->closure); +} + +static void +af_file_destroy(AFvirtualfile *vfile) +{ + fclose(vfile->closure); vfile->closure = NULL; +} + +static long +af_file_seek(AFvirtualfile *vfile, long offset, int is_relative) +{ + fseek(vfile->closure, offset, is_relative?SEEK_CUR:SEEK_SET); + + return ftell(vfile->closure); +} + +static long +af_file_tell(AFvirtualfile *vfile) +{ + return ftell(vfile->closure); +} diff --git a/libaudiofile/af_vfs.h b/libaudiofile/af_vfs.h new file mode 100644 index 0000000..93985dc --- /dev/null +++ b/libaudiofile/af_vfs.h @@ -0,0 +1,55 @@ +/* + Audio File Library + Copyright (C) 1999, Elliot Lee <sopwith@redhat.com> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + af_vfs.h + + Virtual file operations for the Audio File Library. +*/ + +#ifndef AUDIOFILE_VFS_H +#define AUDIOFILE_VFS_H 1 + +#include <stdio.h> + +struct _AFvirtualfile +{ + ssize_t (*read) (AFvirtualfile *vfile, void *data, size_t nbytes); + long (*length) (AFvirtualfile *vfile); + ssize_t (*write) (AFvirtualfile *vfile, const void *data, size_t nbytes); + void (*destroy)(AFvirtualfile *vfile); + long (*seek) (AFvirtualfile *vfile, long offset, int is_relative); + long (*tell) (AFvirtualfile *vfile); + + void *closure; +}; + +AFvirtualfile *af_virtual_file_new (void); +AFvirtualfile *af_virtual_file_new_for_file (FILE *fh); +void af_virtual_file_destroy (AFvirtualfile *vfile); + +size_t af_fread (void *data, size_t size, size_t nmemb, AFvirtualfile *vfile); +size_t af_fwrite (const void *data, size_t size, size_t nmemb, AFvirtualfile *vfile); +int af_fclose (AFvirtualfile *vfile); +long af_flength (AFvirtualfile *vfile); +int af_fseek (AFvirtualfile *vfile, long offset, int whence); +long af_ftell (AFvirtualfile *vfile); + +#endif diff --git a/libaudiofile/afinternal.h b/libaudiofile/afinternal.h new file mode 100644 index 0000000..6e964b1 --- /dev/null +++ b/libaudiofile/afinternal.h @@ -0,0 +1,355 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + afinternal.h + + This file defines the internal structures for the Audio File Library. +*/ + +#ifndef AFINTERNAL_H +#define AFINTERNAL_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdio.h> +#include "audiofile.h" +#include "af_vfs.h" +#include "error.h" + +typedef int bool; +#define AF_TRUE (1) +#define AF_FALSE (0) + +typedef int status; +#define AF_SUCCEED (0) +#define AF_FAIL (-1) + +typedef union AFPVu +{ + long l; + double d; + void *v; +} AFPVu; + +typedef struct _SuppMiscInfo +{ + int type; /* AF_MISC_... */ + int count; /* 0 = unlimited */ +} _SuppMiscInfo; + +typedef struct _InstParamInfo +{ + int id; + int type; + char *name; + AFPVu defaultValue; +} _InstParamInfo; + +typedef struct _MarkerSetup +{ + int id; + char *name, *comment; +} _MarkerSetup; + +typedef struct _Marker +{ + short id; + unsigned long position; + char *name, *comment; +} _Marker; + +typedef struct _Loop +{ + int id; + int mode; /* AF_LOOP_MODE_... */ + int count; /* how many times the loop is played */ + int beginMarker, endMarker; + int trackid; +} _Loop; + +typedef struct _PCMInfo +{ + double slope, intercept, minClip, maxClip; +} _PCMInfo; + +typedef struct _AudioFormat +{ + double sampleRate; /* sampling rate in Hz */ + int sampleFormat; /* AF_SAMPFMT_... */ + int sampleWidth; /* sample width in bits */ + int byteOrder; /* AF_BYTEORDER_... */ + + _PCMInfo pcm; /* parameters of PCM data */ + + int channelCount; /* number of channels */ + + int compressionType; /* AF_COMPRESSION_... */ + void *compressionParams; /* NULL if no compression */ +} _AudioFormat; + +/* modules */ +struct _AFmoduleinst; +struct _AFchunk; + +typedef void (*_AFfnpmod) (struct _AFmoduleinst *i); +typedef void (*_AFfnpsimplemod) (struct _AFchunk *inc, + struct _AFchunk *outc, void *modspec); + +typedef struct _AFmodule +{ + char *name; + _AFfnpmod describe; + _AFfnpmod max_pull; + _AFfnpmod max_push; + _AFfnpmod run_pull; + _AFfnpmod reset1; + _AFfnpmod reset2; + _AFfnpmod run_push; + _AFfnpmod sync1; + _AFfnpmod sync2; + _AFfnpsimplemod run; + _AFfnpmod free; +} _AFmodule; + +typedef struct _AFchunk +{ + void *buf; /* chunk data */ + AFframecount nframes; /* # of frames in chunk */ + _AudioFormat f; /* format of data in chunk */ +} _AFchunk; + +typedef struct _AFmoduleinst +{ + _AFchunk *inc, *outc; + void *modspec; + union + { + struct { struct _AFmoduleinst *source; } pull; + struct { struct _AFmoduleinst *sink; } push; + } u; + _AFmodule *mod; + bool free_on_close; /* AF_TRUE=don't free module until close */ + bool valid; /* internal use only */ +#ifdef AF_DEBUG /* these are set in _AFsetupmodules */ + int margin; /* margin for printing of CHNK messages */ + bool dump; /* whether to dump chunks */ +#endif +} _AFmoduleinst; + +/* information private to module routines */ +typedef struct _AFmodulestate +{ + bool modulesdirty; + int nmodules; + + /* See comment at very end of arrangemodules(). */ + bool mustuseatomicnvframes; + + /* previous rates before user changed them */ + double old_f_rate, old_v_rate; + + _AFchunk *chunk; + _AFmoduleinst *module; + + /* array of pointers to buffers, one for each module */ + void **buffer; + + /* These modules have extended lifetimes. */ + + /* file read / write */ + _AFmoduleinst filemodinst; + + /* file module's rebuffer */ + _AFmoduleinst filemod_rebufferinst; + + /* rate conversion */ + _AFmoduleinst rateconvertinst; + + /* old rates */ + double rateconvert_inrate, rateconvert_outrate; + + /* rate conversion's rebuffer */ + _AFmoduleinst rateconvert_rebufferinst; +} _AFmodulestate; + +typedef struct _Track +{ + int id; /* usually AF_DEFAULT_TRACKID */ + + _AudioFormat f, v; /* file and virtual audio formats */ + + double *channelMatrix; + + int markerCount; + _Marker *markers; + + bool hasAESData; /* Is AES nonaudio data present? */ + unsigned char aesData[24]; /* AES nonaudio data */ + + AFframecount totalfframes; /* frameCount */ + AFframecount nextfframe; /* currentFrame */ + AFframecount frames2ignore; + AFfileoffset fpos_first_frame; /* dataStart */ + AFfileoffset fpos_next_frame; + AFfileoffset fpos_after_data; + AFframecount totalvframes; + AFframecount nextvframe; + AFfileoffset data_size; /* trackBytes */ + + _AFmodulestate ms; + + double taper, dynamic_range; + bool ratecvt_filter_params_set; + + bool filemodhappy; +} _Track; + +typedef struct _TrackSetup +{ + int id; + + _AudioFormat f; + + bool rateSet, sampleFormatSet, sampleWidthSet, byteOrderSet, + channelCountSet, compressionSet, aesDataSet, markersSet, + dataOffsetSet, frameCountSet; + + int markerCount; + _MarkerSetup *markers; + + AFfileoffset dataOffset; + AFframecount frameCount; +} _TrackSetup; + +typedef struct _LoopSetup +{ + int id; +} _LoopSetup; + +typedef struct _InstrumentSetup +{ + int id; + + int loopCount; + _LoopSetup *loops; + bool loopSet; +} _InstrumentSetup; + +typedef struct _Instrument +{ + int id; + + int loopCount; + _Loop *loops; + + AFPVu *values; +} _Instrument; + +typedef struct _Miscellaneous +{ + int id; + int type; + int size; + + void *buffer; + + AFfileoffset position; /* offset within the miscellaneous chunk */ +} _Miscellaneous; + +typedef struct _MiscellaneousSetup +{ + int id; + int type; + int size; +} _MiscellaneousSetup; + +typedef struct _AFfilesetup +{ + int valid; + + int fileFormat; + + bool trackSet, instrumentSet, miscellaneousSet; + + int trackCount; + _TrackSetup *tracks; + + int instrumentCount; + _InstrumentSetup *instruments; + + int miscellaneousCount; + _MiscellaneousSetup *miscellaneous; +} _AFfilesetup; + +typedef struct _AFfilehandle +{ + int valid; /* _AF_VALID_FILEHANDLE */ + int access; /* _AF_READ_ACCESS or _AF_WRITE_ACCESS */ + + bool seekok; + + AFvirtualfile *fh; + + char *fileName; + + int fileFormat; + + int trackCount; + _Track *tracks; + + int instrumentCount; + _Instrument *instruments; + + int miscellaneousCount; + _Miscellaneous *miscellaneous; + + void *formatSpecific; /* format-specific data */ +} _AFfilehandle; + +enum +{ + _AF_VALID_FILEHANDLE = 38212, + _AF_VALID_FILESETUP = 38213 +}; + +enum +{ + _AF_READ_ACCESS = 1, + _AF_WRITE_ACCESS = 2 +}; + +/* The following are tokens for compression parameters in PV lists. */ +enum +{ + _AF_SAMPLES_PER_BLOCK = 700, /* type: long */ + _AF_BLOCK_SIZE = 701, /* type: long */ + _AF_MS_ADPCM_NUM_COEFFICIENTS = 800, /* type: long */ + _AF_MS_ADPCM_COEFFICIENTS = 801 /* type: array of int16_t[2] */ +}; + +/* NeXT/Sun sampling rate */ +#define _AF_SRATE_CODEC (8012.8210513) + +#endif diff --git a/libaudiofile/aiff.c b/libaudiofile/aiff.c new file mode 100644 index 0000000..9ad4041 --- /dev/null +++ b/libaudiofile/aiff.c @@ -0,0 +1,795 @@ +/* + Audio File Library + Copyright (C) 1998-2000, 2003, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aiff.c + + This file contains routines for parsing AIFF and AIFF-C sound + files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "extended.h" +#include "audiofile.h" +#include "util.h" +#include "afinternal.h" +#include "byteorder.h" +#include "aiff.h" +#include "setup.h" +#include "track.h" +#include "marker.h" + +static status ParseFVER (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseAESD (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseMiscellaneous (AFfilehandle file, AFvirtualfile *fh, + u_int32_t type, size_t size); +static status ParseINST (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseMARK (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseCOMM (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseSSND (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); + +_InstParamInfo _af_aiff_inst_params[_AF_AIFF_NUM_INSTPARAMS] = +{ + { AF_INST_MIDI_BASENOTE, AU_PVTYPE_LONG, "MIDI base note", {60} }, + { AF_INST_NUMCENTS_DETUNE, AU_PVTYPE_LONG, "Detune in cents", {0} }, + { AF_INST_MIDI_LOVELOCITY, AU_PVTYPE_LONG, "Low velocity", {1} }, + { AF_INST_MIDI_HIVELOCITY, AU_PVTYPE_LONG, "High velocity", {127} }, + { AF_INST_MIDI_LONOTE, AU_PVTYPE_LONG, "Low note", {0} }, + { AF_INST_MIDI_HINOTE, AU_PVTYPE_LONG, "High note", {127} }, + { AF_INST_NUMDBS_GAIN, AU_PVTYPE_LONG, "Gain in dB", {0} }, + { AF_INST_SUSLOOPID, AU_PVTYPE_LONG, "Sustain loop id", {0} }, + { AF_INST_RELLOOPID, AU_PVTYPE_LONG, "Release loop id", {0} } +}; + +int _af_aiffc_compression_types[_AF_AIFF_NUM_COMPTYPES] = +{ + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +}; + +_AFfilesetup _af_aiff_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_AIFF, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 1, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +/* + FVER chunks are only present in AIFF-C files. +*/ +static status ParseFVER (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, size_t size) +{ + u_int32_t timestamp; + + assert(!memcmp(&type, "FVER", 4)); + + af_fread(×tamp, sizeof (u_int32_t), 1, fh); + timestamp = BENDIAN_TO_HOST_INT32(timestamp); + /* timestamp holds the number of seconds since January 1, 1904. */ + + return AF_SUCCEED; +} + +/* + Parse AES recording data. +*/ +static status ParseAESD (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, size_t size) +{ + _Track *track; + unsigned char aesChannelStatusData[24]; + + assert(!memcmp(&type, "AESD", 4)); + assert(size == 24); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + track->hasAESData = AF_TRUE; + + /* + Try to read 24 bytes of AES nonaudio data from the file. + Fail if the file disappoints. + */ + if (af_fread(aesChannelStatusData, 1, 24, fh) != 24) + return AF_FAIL; + + memcpy(track->aesData, aesChannelStatusData, 24); + + return AF_SUCCEED; +} + +/* + Parse miscellaneous data chunks such as name, author, copyright, + and annotation chunks. +*/ +static status ParseMiscellaneous (AFfilehandle file, AFvirtualfile *fh, + u_int32_t type, size_t size) +{ + int misctype = AF_MISC_UNRECOGNIZED; + + assert(!memcmp(&type, "NAME", 4) || !memcmp(&type, "AUTH", 4) || + !memcmp(&type, "(c) ", 4) || !memcmp(&type, "ANNO", 4) || + !memcmp(&type, "APPL", 4) || !memcmp(&type, "MIDI", 4)); + + /* Skip zero-length miscellaneous chunks. */ + if (size == 0) + return AF_FAIL; + + file->miscellaneousCount++; + file->miscellaneous = _af_realloc(file->miscellaneous, + file->miscellaneousCount * sizeof (_Miscellaneous)); + + if (!memcmp(&type, "NAME", 4)) + misctype = AF_MISC_NAME; + else if (!memcmp(&type, "AUTH", 4)) + misctype = AF_MISC_AUTH; + else if (!memcmp(&type, "(c) ", 4)) + misctype = AF_MISC_COPY; + else if (!memcmp(&type, "ANNO", 4)) + misctype = AF_MISC_ANNO; + else if (!memcmp(&type, "APPL", 4)) + misctype = AF_MISC_APPL; + else if (!memcmp(&type, "MIDI", 4)) + misctype = AF_MISC_MIDI; + + file->miscellaneous[file->miscellaneousCount - 1].id = file->miscellaneousCount; + file->miscellaneous[file->miscellaneousCount - 1].type = misctype; + file->miscellaneous[file->miscellaneousCount - 1].size = size; + file->miscellaneous[file->miscellaneousCount - 1].position = 0; + file->miscellaneous[file->miscellaneousCount - 1].buffer = _af_malloc(size); + af_fread(file->miscellaneous[file->miscellaneousCount - 1].buffer, + size, 1, file->fh); + + return AF_SUCCEED; +} + +/* + Parse instrument chunks, which contain information about using + sound data as a sampled instrument. +*/ +static status ParseINST (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Instrument *instrument; + u_int8_t baseNote; + int8_t detune; + u_int8_t lowNote, highNote, lowVelocity, highVelocity; + int16_t gain; + + u_int16_t sustainLoopPlayMode, sustainLoopBegin, sustainLoopEnd; + u_int16_t releaseLoopPlayMode, releaseLoopBegin, releaseLoopEnd; + + assert(!memcmp(&type, "INST", 4)); + + instrument = _af_calloc(1, sizeof (_Instrument)); + instrument->id = AF_DEFAULT_INST; + instrument->values = _af_calloc(_AF_AIFF_NUM_INSTPARAMS, sizeof (AFPVu)); + instrument->loopCount = 2; + instrument->loops = _af_calloc(2, sizeof (_Loop)); + + file->instrumentCount = 1; + file->instruments = instrument; + + af_fread(&baseNote, 1, 1, fh); + af_fread(&detune, 1, 1, fh); + af_fread(&lowNote, 1, 1, fh); + af_fread(&highNote, 1, 1, fh); + af_fread(&lowVelocity, 1, 1, fh); + af_fread(&highVelocity, 1, 1, fh); + af_fread(&gain, 2, 1, fh); + gain = BENDIAN_TO_HOST_INT16(gain); + +#ifdef DEBUG + printf("baseNote/detune/lowNote/highNote/lowVelocity/highVelocity/gain:" + " %d %d %d %d %d %d %d\n", + baseNote, detune, lowNote, highNote, lowVelocity, highVelocity, + gain); +#endif + + instrument->values[0].l = baseNote; + instrument->values[1].l = detune; + instrument->values[2].l = lowVelocity; + instrument->values[3].l = highVelocity; + instrument->values[4].l = lowNote; + instrument->values[5].l = highNote; + instrument->values[6].l = gain; + + instrument->values[7].l = 1; /* sustain loop id */ + instrument->values[8].l = 2; /* release loop id */ + + af_fread(&sustainLoopPlayMode, sizeof (u_int16_t), 1, fh); + sustainLoopPlayMode = BENDIAN_TO_HOST_INT16(sustainLoopPlayMode); + af_fread(&sustainLoopBegin, sizeof (u_int16_t), 1, fh); + sustainLoopBegin = BENDIAN_TO_HOST_INT16(sustainLoopBegin); + af_fread(&sustainLoopEnd, sizeof (u_int16_t), 1, fh); + sustainLoopEnd = BENDIAN_TO_HOST_INT16(sustainLoopEnd); + + af_fread(&releaseLoopPlayMode, sizeof (u_int16_t), 1, fh); + releaseLoopPlayMode = BENDIAN_TO_HOST_INT16(releaseLoopPlayMode); + af_fread(&releaseLoopBegin, sizeof (u_int16_t), 1, fh); + releaseLoopBegin = BENDIAN_TO_HOST_INT16(releaseLoopBegin); + af_fread(&releaseLoopEnd, sizeof (u_int16_t), 1, fh); + releaseLoopEnd = BENDIAN_TO_HOST_INT16(releaseLoopEnd); + +#ifdef DEBUG + printf("sustain loop: mode %d, begin %d, end %d\n", + sustainLoopPlayMode, sustainLoopBegin, sustainLoopEnd); + + printf("release loop: mode %d, begin %d, end %d\n", + releaseLoopPlayMode, releaseLoopBegin, releaseLoopEnd); +#endif + + instrument->loops[0].id = 1; + instrument->loops[0].mode = sustainLoopPlayMode; + instrument->loops[0].beginMarker = sustainLoopBegin; + instrument->loops[0].endMarker = sustainLoopEnd; + + instrument->loops[1].id = 2; + instrument->loops[1].mode = releaseLoopPlayMode; + instrument->loops[1].beginMarker = releaseLoopBegin; + instrument->loops[1].endMarker = releaseLoopEnd; + + return AF_SUCCEED; +} + +/* + Parse marker chunks, which contain the positions and names of loop markers. +*/ +static status ParseMARK (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Track *track; + int i; + u_int16_t numMarkers; + + assert(!memcmp(&type, "MARK", 4)); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fread(&numMarkers, sizeof (u_int16_t), 1, fh); + numMarkers = BENDIAN_TO_HOST_INT16(numMarkers); + + track->markerCount = numMarkers; + if (numMarkers) + track->markers = _af_marker_new(numMarkers); + + for (i=0; i<numMarkers; i++) + { + u_int16_t markerID = 0; + u_int32_t markerPosition = 0; + u_int8_t sizeByte = 0; + char *markerName = NULL; + + af_fread(&markerID, sizeof (u_int16_t), 1, fh); + markerID = BENDIAN_TO_HOST_INT16(markerID); + af_fread(&markerPosition, sizeof (u_int32_t), 1, fh); + markerPosition = BENDIAN_TO_HOST_INT32(markerPosition); + af_fread(&sizeByte, sizeof (unsigned char), 1, fh); + markerName = _af_malloc(sizeByte + 1); + af_fread(markerName, sizeof (unsigned char), sizeByte, fh); + + markerName[sizeByte] = '\0'; + +#ifdef DEBUG + printf("marker id: %d, position: %d, name: %s\n", + markerID, markerPosition, markerName); + + printf("size byte: %d\n", sizeByte); +#endif + + /* + If sizeByte is even, then 1+sizeByte (the length + of the string) is odd. Skip an extra byte to + make it even. + */ + + if ((sizeByte % 2) == 0) + af_fseek(fh, 1, SEEK_CUR); + + track->markers[i].id = markerID; + track->markers[i].position = markerPosition; + track->markers[i].name = markerName; + track->markers[i].comment = _af_strdup(""); + } + + return AF_SUCCEED; +} + +/* + Parse common data chunks, which contain information regarding the + sampling rate, the number of sample frames, and the number of + sound channels. +*/ +static status ParseCOMM (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Track *track; + u_int16_t numChannels; + u_int32_t numSampleFrames; + u_int16_t sampleSize; + unsigned char sampleRate[10]; + + assert(!memcmp(&type, "COMM", 4)); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fread(&numChannels, sizeof (u_int16_t), 1, fh); + track->f.channelCount = BENDIAN_TO_HOST_INT16(numChannels); + + af_fread(&numSampleFrames, sizeof (u_int32_t), 1, fh); + track->totalfframes = BENDIAN_TO_HOST_INT32(numSampleFrames); + + af_fread(&sampleSize, sizeof (u_int16_t), 1, fh); + track->f.sampleWidth = BENDIAN_TO_HOST_INT16(sampleSize); + + af_fread(sampleRate, 10, 1, fh); + track->f.sampleRate = _af_convert_from_ieee_extended(sampleRate); + + track->f.compressionType = AF_COMPRESSION_NONE; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + if (file->fileFormat == AF_FILE_AIFFC) + { + u_int8_t compressionID[4]; + /* Pascal strings are at most 255 bytes long. */ + unsigned char compressionName[256]; + unsigned char compressionNameLength; + + af_fread(compressionID, 4, 1, fh); + + /* Read the Pascal-style string containing the name. */ + af_fread(&compressionNameLength, 1, 1, fh); + af_fread(compressionName, compressionNameLength, 1, fh); + compressionName[compressionNameLength] = '\0'; + + if (!memcmp(compressionID, "NONE", 4)) + track->f.compressionType = AF_COMPRESSION_NONE; + else if (!memcmp(compressionID, "ACE2", 4) || + !memcmp(compressionID, "ACE8", 4) || + !memcmp(compressionID, "MAC3", 4) || + !memcmp(compressionID, "MAC6", 4)) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "AIFF-C format does not support Apple's proprietary %s compression format", compressionName); + return AF_FAIL; + } + else if (!memcmp(compressionID, "ulaw", 4) || + !memcmp(compressionID, "ULAW", 4)) + { + track->f.compressionType = AF_COMPRESSION_G711_ULAW; + } + else if (!memcmp(compressionID, "alaw", 4) || + !memcmp(compressionID, "ALAW", 4)) + { + track->f.compressionType = AF_COMPRESSION_G711_ALAW; + } + else if (!memcmp(compressionID, "fl32", 4) || + !memcmp(compressionID, "FL32", 4)) + { + track->f.sampleFormat = AF_SAMPFMT_FLOAT; + track->f.sampleWidth = 32; + track->f.compressionType = AF_COMPRESSION_NONE; + } + else if (!memcmp(compressionID, "fl64", 4) || + !memcmp(compressionID, "FL64", 4)) + { + track->f.sampleFormat = AF_SAMPFMT_DOUBLE; + track->f.sampleWidth = 64; + track->f.compressionType = AF_COMPRESSION_NONE; + } + else if (!memcmp(compressionID, "sowt", 4)) + { + track->f.compressionType = AF_COMPRESSION_NONE; + track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; + } + else + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "AIFF-C compression type '%c%c%c%c' not currently supported", + compressionID[0], + compressionID[1], + compressionID[2], + compressionID[3]); + return AF_FAIL; + } + } + + _af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth); + + return AF_SUCCEED; +} + +/* + Parse the stored sound chunk, which usually contains little more + than the sound data. +*/ +static status ParseSSND (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Track *track; + u_int32_t offset, blockSize; + + assert(!memcmp(&type, "SSND", 4)); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fread(&offset, sizeof (u_int32_t), 1, fh); + offset = BENDIAN_TO_HOST_INT32(offset); + af_fread(&blockSize, sizeof (u_int32_t), 1, fh); + blockSize = BENDIAN_TO_HOST_INT32(blockSize); + + /* + This seems like a reasonable way to calculate the number of + bytes in an SSND chunk. + */ + track->data_size = size - 8 - offset; + +#ifdef DEBUG + printf("offset: %d\n", offset); + printf("block size: %d\n", blockSize); +#endif + + track->fpos_first_frame = af_ftell(fh) + offset; + +#ifdef DEBUG + printf("data start: %d\n", track->fpos_first_frame); +#endif + + /* Sound data follows. */ + + return AF_SUCCEED; +} + +status _af_aiff_read_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t type, size, formtype; + size_t index = 0; + bool hasCOMM, hasFVER, hasSSND, hasMARK, hasINST; + bool hasAESD, hasNAME, hasAUTH, hasCOPY; + _Track *track; + + hasCOMM = AF_FALSE; + hasFVER = AF_FALSE; + hasSSND = AF_FALSE; + hasMARK = AF_FALSE; + hasINST = AF_FALSE; + hasAESD = AF_FALSE; + hasNAME = AF_FALSE; + hasAUTH = AF_FALSE; + hasCOPY = AF_FALSE; + + assert(file != NULL); + assert(file->fh != NULL); + + af_fseek(file->fh, 0, SEEK_SET); + + af_fread(&type, 4, 1, file->fh); + af_fread(&size, 4, 1, file->fh); + size = BENDIAN_TO_HOST_INT32(size); + af_fread(&formtype, 4, 1, file->fh); + + if (memcmp(&type, "FORM", 4) != 0 || + (memcmp(&formtype, "AIFF", 4) && memcmp(&formtype, "AIFC", 4))) + return AF_FAIL; + +#ifdef DEBUG + printf("size: %d\n", size); +#endif + + file->instrumentCount = 0; + file->instruments = NULL; + file->miscellaneousCount = 0; + file->miscellaneous = NULL; + + /* AIFF files have only one track. */ + track = _af_track_new(); + file->trackCount = 1; + file->tracks = track; + + /* Include the offset of the form type. */ + index += 4; + + while (index < size) + { + u_int32_t chunkid = 0, chunksize = 0; + status result = AF_SUCCEED; + +#ifdef DEBUG + printf("index: %d\n", index); +#endif + af_fread(&chunkid, 4, 1, file->fh); + af_fread(&chunksize, 4, 1, file->fh); + chunksize = BENDIAN_TO_HOST_INT32(chunksize); + +#ifdef DEBUG + _af_printid(chunkid); + printf(" size: %d\n", chunksize); +#endif + + if (!memcmp("COMM", &chunkid, 4)) + { + hasCOMM = AF_TRUE; + result = ParseCOMM(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("FVER", &chunkid, 4)) + { + hasFVER = AF_TRUE; + ParseFVER(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("INST", &chunkid, 4)) + { + hasINST = AF_TRUE; + ParseINST(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("MARK", &chunkid, 4)) + { + hasMARK = AF_TRUE; + ParseMARK(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("AESD", &chunkid, 4)) + { + hasAESD = AF_TRUE; + ParseAESD(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("NAME", &chunkid, 4) || + !memcmp("AUTH", &chunkid, 4) || + !memcmp("(c) ", &chunkid, 4) || + !memcmp("ANNO", &chunkid, 4) || + !memcmp("APPL", &chunkid, 4) || + !memcmp("MIDI", &chunkid, 4)) + { + ParseMiscellaneous(file, file->fh, chunkid, chunksize); + } + /* + The sound data chunk is required if there are more than + zero sample frames. + */ + else if (!memcmp("SSND", &chunkid, 4)) + { + if (hasSSND) + { + _af_error(AF_BAD_AIFF_SSND, "AIFF file has more than one SSND chunk"); + return AF_FAIL; + } + hasSSND = AF_TRUE; + result = ParseSSND(file, file->fh, chunkid, chunksize); + } + + if (result == AF_FAIL) + return AF_FAIL; + + index += chunksize + 8; + + /* all chunks must be aligned on an even number of bytes */ + if ((index % 2) != 0) + index++; + + af_fseek(file->fh, index + 8, SEEK_SET); + } + + if (!hasCOMM) + { + _af_error(AF_BAD_AIFF_COMM, "bad AIFF COMM chunk"); + } + + /* The file has been successfully parsed. */ + return AF_SUCCEED; +} + +bool _af_aiff_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[8]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 1, 8, fh) != 8 || memcmp(buffer, "FORM", 4) != 0) + return AF_FALSE; + if (af_fread(buffer, 1, 4, fh) != 4 || memcmp(buffer, "AIFF", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +bool _af_aifc_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[8]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 1, 8, fh) != 8 || memcmp(buffer, "FORM", 4) != 0) + return AF_FALSE; + if (af_fread(buffer, 1, 4, fh) != 4 || memcmp(buffer, "AIFC", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +AFfilesetup _af_aiff_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + bool isAIFF = setup->fileFormat == AF_FILE_AIFF; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "AIFF/AIFF-C file must have 1 track"); + return AF_NULL_FILESETUP; + } + + track = &setup->tracks[0]; + + if (track->sampleFormatSet) + { + if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + _af_error(AF_BAD_FILEFMT, "AIFF/AIFF-C format does not support unsigned data"); + return AF_NULL_FILESETUP; + } + else if (isAIFF && track->f.sampleFormat != AF_SAMPFMT_TWOSCOMP) + { + _af_error(AF_BAD_FILEFMT, "AIFF format supports only two's complement integer data"); + return AF_NULL_FILESETUP; + } + } + else + _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, + track->f.sampleWidth); + + /* Check sample width if writing two's complement. Otherwise ignore. */ + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP && + (track->f.sampleWidth < 1 || track->f.sampleWidth > 32)) + { + _af_error(AF_BAD_WIDTH, + "invalid sample width %d for AIFF/AIFF-C file " + "(must be 1-32)", track->f.sampleWidth); + return AF_NULL_FILESETUP; + } + + if (isAIFF && track->f.compressionType != AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_FILESETUP, + "AIFF does not support compression; use AIFF-C"); + return AF_NULL_FILESETUP; + } + + /* XXXmpruett handle compression here */ + + if (track->byteOrderSet && + track->f.byteOrder != AF_BYTEORDER_BIGENDIAN && + track->f.sampleWidth > 8) + { + _af_error(AF_BAD_BYTEORDER, + "AIFF/AIFF-C format supports only big-endian data"); + } + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + if (setup->instrumentSet) + { + if (setup->instrumentCount != 0 && setup->instrumentCount != 1) + { + _af_error(AF_BAD_NUMINSTS, "AIFF/AIFF-C file must have 0 or 1 instrument chunk"); + return AF_NULL_FILESETUP; + } + if (setup->instruments != 0 && + setup->instruments[0].loopCount != 2) + { + _af_error(AF_BAD_NUMLOOPS, "AIFF/AIFF-C file with instrument must also have 2 loops"); + return AF_NULL_FILESETUP; + } + } + + if (setup->miscellaneousSet) + { + int i; + for (i=0; i<setup->miscellaneousCount; i++) + { + switch (setup->miscellaneous[i].type) + { + case AF_MISC_COPY: + case AF_MISC_AUTH: + case AF_MISC_NAME: + case AF_MISC_ANNO: + case AF_MISC_APPL: + case AF_MISC_MIDI: + break; + + default: + _af_error(AF_BAD_MISCTYPE, "invalid miscellaneous type %d for AIFF/AIFF-C file", setup->miscellaneous[i].type); + return AF_NULL_FILESETUP; + } + } + } + + return _af_filesetup_copy(setup, &_af_aiff_default_filesetup, AF_TRUE); +} + +bool _af_aiff_instparam_valid (AFfilehandle filehandle, AUpvlist list, int i) +{ + int param, type, lval; + + AUpvgetparam(list, i, ¶m); + AUpvgetvaltype(list, i, &type); + if (type != AU_PVTYPE_LONG) + return AF_FALSE; + + AUpvgetval(list, i, &lval); + + switch (param) + { + case AF_INST_MIDI_BASENOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_NUMCENTS_DETUNE: + return ((lval >= -50) && (lval <= 50)); + + case AF_INST_MIDI_LOVELOCITY: + return ((lval >= 1) && (lval <= 127)); + + case AF_INST_MIDI_HIVELOCITY: + return ((lval >= 1) && (lval <= 127)); + + case AF_INST_MIDI_LONOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_MIDI_HINOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_NUMDBS_GAIN: + case AF_INST_SUSLOOPID: + case AF_INST_RELLOOPID: + return AF_TRUE; + + default: + return AF_FALSE; + break; + } + + return AF_TRUE; +} + +int _af_aifc_get_version (AFfilehandle file) +{ + return AIFC_VERSION_1; +} diff --git a/libaudiofile/aiff.h b/libaudiofile/aiff.h new file mode 100644 index 0000000..4f1ce18 --- /dev/null +++ b/libaudiofile/aiff.h @@ -0,0 +1,101 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aiff.h + + This file contains structures and constants related to the AIFF + and AIFF-C formats. +*/ + +#ifndef AIFF_H +#define AIFF_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#define _AF_AIFF_NUM_INSTPARAMS 9 +#define _AF_AIFF_NUM_COMPTYPES 2 + +#define AIFC_VERSION_1 0xa2805140 + +struct _COMM +{ + short numChannels; + long numSampleFrames; + short sampleSize; + unsigned char sampleRate[10]; +}; + +struct _MARK +{ + short numMarkers; + struct _Marker *markers; +}; + +struct _INST +{ + u_int8_t baseNote; + int8_t detune; + u_int8_t lowNote, highNote; + u_int8_t lowVelocity, highVelocity; + int16_t gain; + + int16_t sustainLoopPlayMode; + int16_t sustainLoopBegin; + int16_t sustainLoopEnd; + + int16_t releaseLoopPlayMode; + int16_t releaseLoopBegin; + int16_t releaseLoopEnd; +}; + +bool _af_aiff_recognize (AFvirtualfile *fh); +bool _af_aifc_recognize (AFvirtualfile *fh); + +status _af_aiff_read_init (AFfilesetup, AFfilehandle); +status _af_aiff_write_init (AFfilesetup, AFfilehandle); +bool _af_aiff_instparam_valid (AFfilehandle, AUpvlist, int); + +AFfilesetup _af_aiff_complete_setup (AFfilesetup); + +status _af_aiff_update (AFfilehandle); + +int _af_aifc_get_version (AFfilehandle); + +#define _AF_AIFFC_NUM_COMPTYPES 2 + +typedef struct _AIFFInfo +{ + AFfileoffset miscellaneousPosition; + AFfileoffset FVER_offset; + AFfileoffset COMM_offset; + AFfileoffset MARK_offset; + AFfileoffset INST_offset; + AFfileoffset AESD_offset; + AFfileoffset SSND_offset; +} _AIFFInfo; + +#endif diff --git a/libaudiofile/aiffwrite.c b/libaudiofile/aiffwrite.c new file mode 100644 index 0000000..a8b5b9c --- /dev/null +++ b/libaudiofile/aiffwrite.c @@ -0,0 +1,581 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aiffwrite.c + + This file contains routines for writing AIFF and AIFF-C format + sound files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> + +#include "extended.h" +#include "afinternal.h" +#include "audiofile.h" +#include "aiff.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" + +status _af_aiff_update (AFfilehandle file); + +static status WriteCOMM (AFfilehandle file); +static status WriteSSND (AFfilehandle file); +static status WriteMARK (AFfilehandle file); +static status WriteINST (AFfilehandle file); +static status WriteFVER (AFfilehandle file); +static status WriteAESD (AFfilehandle file); +static status WriteMiscellaneous (AFfilehandle file); + +static _AIFFInfo *aiffinfo_new (void) +{ + _AIFFInfo *aiff = _af_malloc(sizeof (_AIFFInfo)); + + aiff->miscellaneousPosition = 0; + aiff->FVER_offset = 0; + aiff->COMM_offset = 0; + aiff->MARK_offset = 0; + aiff->INST_offset = 0; + aiff->AESD_offset = 0; + aiff->SSND_offset = 0; + + return aiff; +} + +status _af_aiff_write_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t fileSize = HOST_TO_BENDIAN_INT32(0); + + assert(file); + assert(file->fileFormat == AF_FILE_AIFF || + file->fileFormat == AF_FILE_AIFFC); + + if (_af_filesetup_make_handle(setup, file) == AF_FAIL) + return AF_FAIL; + + file->formatSpecific = aiffinfo_new(); + + af_fwrite("FORM", 4, 1, file->fh); + af_fwrite(&fileSize, 4, 1, file->fh); + + if (file->fileFormat == AF_FILE_AIFF) + af_fwrite("AIFF", 4, 1, file->fh); + else if (file->fileFormat == AF_FILE_AIFFC) + af_fwrite("AIFC", 4, 1, file->fh); + + if (file->fileFormat == AF_FILE_AIFFC) + WriteFVER(file); + + WriteCOMM(file); + WriteMARK(file); + WriteINST(file); + WriteAESD(file); + WriteMiscellaneous(file); + WriteSSND(file); + + return AF_SUCCEED; +} + +status _af_aiff_update (AFfilehandle file) +{ + _Track *track; + u_int32_t length; + + assert(file); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + +#ifdef DEBUG + printf("_af_aiff_update called.\n"); +#endif + + /* Get the length of the file. */ + length = af_flength(file->fh); + length -= 8; + length = HOST_TO_BENDIAN_INT32(length); + + /* Set the length of the FORM chunk. */ + af_fseek(file->fh, 4, SEEK_SET); + af_fwrite(&length, 4, 1, file->fh); + + if (file->fileFormat == AF_FILE_AIFFC) + WriteFVER(file); + + WriteCOMM(file); + WriteMARK(file); + WriteINST(file); + WriteAESD(file); + WriteMiscellaneous(file); + WriteSSND(file); + + return AF_SUCCEED; +} + +static status WriteCOMM (const AFfilehandle file) +{ + _Track *track; + u_int32_t chunkSize; + _AIFFInfo *aiff; + bool isAIFFC; + + u_int16_t sb; + u_int32_t lb; + unsigned char eb[10]; + + u_int8_t compressionTag[4]; + /* Pascal strings can occupy only 255 bytes (+ a size byte). */ + char compressionName[256]; + + isAIFFC = file->fileFormat == AF_FILE_AIFFC; + + aiff = file->formatSpecific; + + /* + If COMM_offset hasn't been set yet, set it to the + current offset. + */ + if (aiff->COMM_offset == 0) + aiff->COMM_offset = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->COMM_offset, SEEK_SET); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + if (isAIFFC) + { + if (track->f.compressionType == AF_COMPRESSION_NONE) + { + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP) + { + memcpy(compressionTag, "NONE", 4); + strcpy(compressionName, "not compressed"); + } + else if (track->f.sampleFormat == AF_SAMPFMT_FLOAT) + { + memcpy(compressionTag, "fl32", 4); + strcpy(compressionName, "32-bit Floating Point"); + } + else if (track->f.sampleFormat == AF_SAMPFMT_DOUBLE) + { + memcpy(compressionTag, "fl64", 4); + strcpy(compressionName, "64-bit Floating Point"); + } + /* + We disallow unsigned sample data for + AIFF files in _af_aiff_complete_setup, + so the next condition should never be + satisfied. + */ + else if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + _af_error(AF_BAD_SAMPFMT, + "AIFF/AIFF-C format does not support unsigned data"); + assert(0); + return AF_FAIL; + } + } + else if (track->f.compressionType == AF_COMPRESSION_G711_ULAW) + { + memcpy(compressionTag, "ulaw", 4); + strcpy(compressionName, "CCITT G.711 u-law"); + } + else if (track->f.compressionType == AF_COMPRESSION_G711_ALAW) + { + memcpy(compressionTag, "alaw", 4); + strcpy(compressionName, "CCITT G.711 A-law"); + } + } + + af_fwrite("COMM", 4, 1, file->fh); + + /* + For AIFF-C files, the length of the COMM chunk is 22 + plus the length of the compression name plus the size + byte. If the length of the data is an odd number of + bytes, add a zero pad byte at the end, but don't + include the pad byte in the chunk's size. + */ + if (isAIFFC) + chunkSize = 22 + strlen(compressionName) + 1; + else + chunkSize = 18; + chunkSize = HOST_TO_BENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, 4, 1, file->fh); + + /* number of channels, 2 bytes */ + sb = HOST_TO_BENDIAN_INT16(track->f.channelCount); + af_fwrite(&sb, 2, 1, file->fh); + + /* number of sample frames, 4 bytes */ + lb = HOST_TO_BENDIAN_INT32(track->totalfframes); + af_fwrite(&lb, 4, 1, file->fh); + + /* sample size, 2 bytes */ + sb = HOST_TO_BENDIAN_INT16(track->f.sampleWidth); + af_fwrite(&sb, 2, 1, file->fh); + + /* sample rate, 10 bytes */ + _af_convert_to_ieee_extended(track->f.sampleRate, eb); + af_fwrite(eb, 10, 1, file->fh); + + if (file->fileFormat == AF_FILE_AIFFC) + { + u_int8_t sizeByte, zero = 0; + + af_fwrite(compressionTag, 4, 1, file->fh); + + sizeByte = strlen(compressionName); + + af_fwrite(&sizeByte, 1, 1, file->fh); + af_fwrite(compressionName, sizeByte, 1, file->fh); + + /* + If sizeByte is even, then 1+sizeByte + (the length of the string) is odd. Add an + extra byte to make the chunk's extent even + (even though the chunk's size may be odd). + */ + if ((sizeByte % 2) == 0) + af_fwrite(&zero, 1, 1, file->fh); + } + + return AF_SUCCEED; +} + +/* + The AESD chunk contains information pertinent to audio recording + devices. +*/ +static status WriteAESD (const AFfilehandle file) +{ + _Track *track; + u_int32_t size = 24; + _AIFFInfo *aiff; + + assert(file); + + aiff = file->formatSpecific; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + if (track->hasAESData == AF_FALSE) + return AF_SUCCEED; + + if (aiff->AESD_offset == 0) + aiff->AESD_offset = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->AESD_offset, SEEK_SET); + + if (af_fwrite("AESD", 4, 1, file->fh) < 1) + return AF_FAIL; + + size = HOST_TO_BENDIAN_INT32(size); + + if (af_fwrite(&size, 4, 1, file->fh) < 1) + return AF_FAIL; + + if (af_fwrite(track->aesData, 24, 1, file->fh) < 1) + return AF_FAIL; + + return AF_SUCCEED; +} + +static status WriteSSND (AFfilehandle file) +{ + _Track *track; + u_int32_t chunkSize, zero = 0; + _AIFFInfo *aiff; + + assert(file); + assert(file->fh); + + aiff = file->formatSpecific; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + if (aiff->SSND_offset == 0) + aiff->SSND_offset = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->SSND_offset, SEEK_SET); + + chunkSize = _af_format_frame_size(&track->f, AF_FALSE) * + track->totalfframes + 8; + + af_fwrite("SSND", 4, 1, file->fh); + chunkSize = HOST_TO_BENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, 4, 1, file->fh); + + /* data offset */ + af_fwrite(&zero, 4, 1, file->fh); + /* block size */ + af_fwrite(&zero, 4, 1, file->fh); + + if (track->fpos_first_frame == 0) + track->fpos_first_frame = af_ftell(file->fh); + + return AF_SUCCEED; +} + +static status WriteINST (AFfilehandle file) +{ + u_int32_t length; + struct _INST instrumentdata; + + length = 20; + length = HOST_TO_BENDIAN_INT32(length); + + instrumentdata.sustainLoopPlayMode = + HOST_TO_BENDIAN_INT16(afGetLoopMode(file, AF_DEFAULT_INST, 1)); + instrumentdata.sustainLoopBegin = + HOST_TO_BENDIAN_INT16(afGetLoopStart(file, AF_DEFAULT_INST, 1)); + instrumentdata.sustainLoopEnd = + HOST_TO_BENDIAN_INT16(afGetLoopEnd(file, AF_DEFAULT_INST, 1)); + + instrumentdata.releaseLoopPlayMode = + HOST_TO_BENDIAN_INT16(afGetLoopMode(file, AF_DEFAULT_INST, 2)); + instrumentdata.releaseLoopBegin = + HOST_TO_BENDIAN_INT16(afGetLoopStart(file, AF_DEFAULT_INST, 2)); + instrumentdata.releaseLoopEnd = + HOST_TO_BENDIAN_INT16(afGetLoopEnd(file, AF_DEFAULT_INST, 2)); + + af_fwrite("INST", 4, 1, file->fh); + af_fwrite(&length, 4, 1, file->fh); + + instrumentdata.baseNote = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_BASENOTE); + af_fwrite(&instrumentdata.baseNote, 1, 1, file->fh); + instrumentdata.detune = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMCENTS_DETUNE); + af_fwrite(&instrumentdata.detune, 1, 1, file->fh); + instrumentdata.lowNote = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LONOTE); + af_fwrite(&instrumentdata.lowNote, 1, 1, file->fh); + instrumentdata.highNote = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HINOTE); + af_fwrite(&instrumentdata.highNote, 1, 1, file->fh); + instrumentdata.lowVelocity = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LOVELOCITY); + af_fwrite(&instrumentdata.lowVelocity, 1, 1, file->fh); + instrumentdata.highVelocity = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HIVELOCITY); + af_fwrite(&instrumentdata.highVelocity, 1, 1, file->fh); + + instrumentdata.gain = + afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMDBS_GAIN); + instrumentdata.gain = HOST_TO_BENDIAN_INT16(instrumentdata.gain); + af_fwrite(&instrumentdata.gain, 2, 1, file->fh); + + af_fwrite(&instrumentdata.sustainLoopPlayMode, 2, 1, file->fh); + af_fwrite(&instrumentdata.sustainLoopBegin, 2, 1, file->fh); + af_fwrite(&instrumentdata.sustainLoopEnd, 2, 1, file->fh); + + af_fwrite(&instrumentdata.releaseLoopPlayMode, 2, 1, file->fh); + af_fwrite(&instrumentdata.releaseLoopBegin, 2, 1, file->fh); + af_fwrite(&instrumentdata.releaseLoopEnd, 2, 1, file->fh); + + return AF_SUCCEED; +} + +static status WriteMARK (AFfilehandle file) +{ + AFfileoffset chunkStartPosition, chunkEndPosition; + u_int32_t length = 0; + u_int16_t numMarkers, sb; + int i, *markids; + _AIFFInfo *aiff; + + assert(file); + + numMarkers = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); + if (numMarkers == 0) + return AF_SUCCEED; + + aiff = file->formatSpecific; + + if (aiff->MARK_offset == 0) + aiff->MARK_offset = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->MARK_offset, SEEK_SET); + + af_fwrite("MARK", 4, 1, file->fh); + af_fwrite(&length, 4, 1, file->fh); + + chunkStartPosition = af_ftell(file->fh); + + markids = _af_calloc(numMarkers, sizeof (int)); + assert(markids); + afGetMarkIDs(file, AF_DEFAULT_TRACK, markids); + + sb = HOST_TO_BENDIAN_INT16(numMarkers); + af_fwrite(&sb, 2, 1, file->fh); + + for (i=0; i<numMarkers; i++) + { + u_int8_t namelength, zero = 0; + u_int16_t id; + u_int32_t position; + char *name; + + id = markids[i]; + position = afGetMarkPosition(file, AF_DEFAULT_TRACK, markids[i]); + + id = HOST_TO_BENDIAN_INT16(id); + position = HOST_TO_BENDIAN_INT32(position); + + af_fwrite(&id, 2, 1, file->fh); + af_fwrite(&position, 4, 1, file->fh); + + name = afGetMarkName(file, AF_DEFAULT_TRACK, markids[i]); + assert(name); + namelength = strlen(name); + + /* Write the name as a Pascal-style string. */ + af_fwrite(&namelength, 1, 1, file->fh); + af_fwrite(name, 1, namelength, file->fh); + + /* + We need a pad byte if the length of the + Pascal-style string (including the size byte) + is odd, i.e. if namelength + 1 % 2 == 1. + */ + if ((namelength % 2) == 0) + af_fwrite(&zero, 1, 1, file->fh); + } + + free(markids); + + chunkEndPosition = af_ftell(file->fh); + length = chunkEndPosition - chunkStartPosition; + +#ifdef DEBUG + printf(" end: %d\n", chunkEndPosition); + printf(" length: %d\n", length); +#endif + + af_fseek(file->fh, chunkStartPosition - 4, SEEK_SET); + + length = HOST_TO_BENDIAN_INT32(length); + af_fwrite(&length, 4, 1, file->fh); + af_fseek(file->fh, chunkEndPosition, SEEK_SET); + + return AF_SUCCEED; +} + +/* + The FVER chunk, if present, is always the first chunk in the file. +*/ +static status WriteFVER (AFfilehandle file) +{ + u_int32_t chunkSize, timeStamp; + _AIFFInfo *aiff; + + assert(file->fileFormat == AF_FILE_AIFFC); + + aiff = file->formatSpecific; + + if (aiff->FVER_offset == 0) + aiff->FVER_offset = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->FVER_offset, SEEK_SET); + + af_fwrite("FVER", 4, 1, file->fh); + + chunkSize = 4; + chunkSize = HOST_TO_BENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, 4, 1, file->fh); + + timeStamp = AIFC_VERSION_1; + timeStamp = HOST_TO_BENDIAN_INT32(timeStamp); + af_fwrite(&timeStamp, 4, 1, file->fh); + + return AF_SUCCEED; +} + +/* + WriteMiscellaneous writes all the miscellaneous data chunks in a + file handle structure to an AIFF or AIFF-C file. +*/ +static status WriteMiscellaneous (AFfilehandle file) +{ + _AIFFInfo *aiff; + int i; + + aiff = (_AIFFInfo *) file->formatSpecific; + + if (aiff->miscellaneousPosition == 0) + aiff->miscellaneousPosition = af_ftell(file->fh); + else + af_fseek(file->fh, aiff->miscellaneousPosition, SEEK_SET); + + for (i=0; i<file->miscellaneousCount; i++) + { + _Miscellaneous *misc = &file->miscellaneous[i]; + u_int32_t chunkType, chunkSize; + u_int8_t padByte = 0; + +#ifdef DEBUG + printf("WriteMiscellaneous: %d, type %d\n", i, misc->type); +#endif + + switch (misc->type) + { + case AF_MISC_NAME: + memcpy(&chunkType, "NAME", 4); break; + case AF_MISC_AUTH: + memcpy(&chunkType, "AUTH", 4); break; + case AF_MISC_COPY: + memcpy(&chunkType, "(c) ", 4); break; + case AF_MISC_ANNO: + memcpy(&chunkType, "ANNO", 4); break; + case AF_MISC_MIDI: + memcpy(&chunkType, "MIDI", 4); break; + case AF_MISC_APPL: + memcpy(&chunkType, "APPL", 4); break; + } + + chunkSize = HOST_TO_BENDIAN_INT32(misc->size); + + af_fwrite(&chunkType, 4, 1, file->fh); + af_fwrite(&chunkSize, 4, 1, file->fh); + /* + Write the miscellaneous buffer and then a pad byte + if necessary. If the buffer is null, skip the space + for now. + */ + if (misc->buffer != NULL) + af_fwrite(misc->buffer, misc->size, 1, file->fh); + else + af_fseek(file->fh, misc->size, SEEK_CUR); + + if (misc->size % 2 != 0) + af_fwrite(&padByte, 1, 1, file->fh); + } + + return AF_SUCCEED; +} diff --git a/libaudiofile/audiofile.exports b/libaudiofile/audiofile.exports new file mode 100644 index 0000000..3050bd6 --- /dev/null +++ b/libaudiofile/audiofile.exports @@ -0,0 +1,104 @@ +AUpvfree +AUpvgetmaxitems +AUpvgetparam +AUpvgetval +AUpvgetvaltype +AUpvnew +AUpvsetparam +AUpvsetval +AUpvsetvaltype +afCloseFile +afFreeFileSetup +afGetAESChannelData +afGetByteOrder +afGetChannels +afGetCompression +afGetDataOffset +afGetFileFormat +afGetFrameCount +afGetFrameSize +afGetInstIDs +afGetInstParamLong +afGetInstParams +afGetLoopCount +afGetLoopEnd +afGetLoopEndFrame +afGetLoopIDs +afGetLoopMode +afGetLoopStart +afGetLoopStartFrame +afGetLoopTrack +afGetMarkComment +afGetMarkIDs +afGetMarkName +afGetMarkPosition +afGetMiscIDs +afGetMiscSize +afGetMiscType +afGetPCMMapping +afGetRate +afGetSampleFormat +afGetTrackBytes +afGetTrackIDs +afGetVirtualByteOrder +afGetVirtualChannels +afGetVirtualFrameSize +afGetVirtualPCMMapping +afGetVirtualSampleFormat +afIdentifyFD +afIdentifyNamedFD +afInitAESChannelData +afInitAESChannelDataTo +afInitByteOrder +afInitChannels +afInitCompression +afInitDataOffset +afInitFileFormat +afInitFrameCount +afInitInstIDs +afInitLoopIDs +afInitMarkComment +afInitMarkIDs +afInitMarkName +afInitMiscIDs +afInitMiscSize +afInitMiscType +afInitPCMMapping +afInitRate +afInitSampleFormat +afInitTrackIDs +afNewFileSetup +afOpenFD +afOpenFile +afOpenNamedFD +afOpenVirtualFile +afQuery +afQueryDouble +afQueryLong +afQueryPointer +afReadFrames +afReadMisc +afSeekFrame +afSeekMisc +afSetAESChannelData +afSetChannelMatrix +afSetErrorHandler +afSetInstParamLong +afSetInstParams +afSetLoopCount +afSetLoopEnd +afSetLoopEndFrame +afSetLoopMode +afSetLoopStart +afSetLoopStartFrame +afSetLoopTrack +afSetMarkPosition +afSetTrackPCMMapping +afSetVirtualByteOrder +afSetVirtualChannels +afSetVirtualPCMMapping +afSetVirtualSampleFormat +afSyncFile +afTellFrame +afWriteFrames +afWriteMisc diff --git a/libaudiofile/audiofile.h b/libaudiofile/audiofile.h new file mode 100644 index 0000000..a39c0ba --- /dev/null +++ b/libaudiofile/audiofile.h @@ -0,0 +1,601 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + audiofile.h + + This file contains the public interfaces to the Audio File Library. +*/ + +#ifndef AUDIOFILE_H +#define AUDIOFILE_H + +#include <sys/types.h> +#include <aupvlist.h> + +#define LIBAUDIOFILE_MAJOR_VERSION 0 +#define LIBAUDIOFILE_MINOR_VERSION 2 +#define LIBAUDIOFILE_MICRO_VERSION 4 + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +typedef struct _AFvirtualfile AFvirtualfile; + +typedef struct _AFfilesetup *AFfilesetup; +typedef struct _AFfilehandle *AFfilehandle; +typedef void (*AFerrfunc)(long, const char *); + +typedef off_t AFframecount; +typedef off_t AFfileoffset; + +#define AF_NULL_FILESETUP ((struct _AFfilesetup *) 0) +#define AF_NULL_FILEHANDLE ((struct _AFfilehandle *) 0) + +#define AF_ERR_BASE 3000 + +enum +{ + AF_DEFAULT_TRACK = 1001 +}; + +enum +{ + AF_DEFAULT_INST = 2001 +}; + +enum +{ + AF_NUM_UNLIMITED = 99999 +}; + +enum +{ + AF_BYTEORDER_BIGENDIAN = 501, + AF_BYTEORDER_LITTLEENDIAN = 502 +}; + +enum +{ + AF_FILE_UNKNOWN = -1, + AF_FILE_RAWDATA = 0, + AF_FILE_AIFFC = 1, + AF_FILE_AIFF = 2, + AF_FILE_NEXTSND = 3, + AF_FILE_WAVE = 4, + AF_FILE_BICSF = 5, + AF_FILE_IRCAM = AF_FILE_BICSF, + AF_FILE_MPEG1BITSTREAM = 6, /* not implemented */ + AF_FILE_SOUNDDESIGNER1 = 7, /* not implemented */ + AF_FILE_SOUNDDESIGNER2 = 8, /* not implemented */ + AF_FILE_AVR = 9, + AF_FILE_IFF_8SVX = 10, + AF_FILE_SAMPLEVISION = 11, /* not implemented */ + AF_FILE_VOC = 12, /* not implemented */ + AF_FILE_NIST_SPHERE = 13, + AF_FILE_SOUNDFONT2 = 14 /* not implemented */ +}; + +enum +{ + AF_LOOP_MODE_NOLOOP = 0, + AF_LOOP_MODE_FORW = 1, + AF_LOOP_MODE_FORWBAKW = 2 +}; + +enum +{ + AF_SAMPFMT_TWOSCOMP = 401, /* linear two's complement */ + AF_SAMPFMT_UNSIGNED = 402, /* unsigned integer */ + AF_SAMPFMT_FLOAT = 403, /* 32-bit IEEE floating-point */ + AF_SAMPFMT_DOUBLE = 404 /* 64-bit IEEE double-precision floating-point */ +}; + +enum +{ + AF_INST_LOOP_OFF = 0, /* no looping */ + AF_INST_LOOP_CONTINUOUS = 1, /* loop continuously through decay */ + AF_INST_LOOP_SUSTAIN = 3 /* loop during sustain, then continue */ +}; + +enum +{ + AF_INST_MIDI_BASENOTE = 301, + AF_INST_NUMCENTS_DETUNE = 302, + AF_INST_MIDI_LONOTE = 303, + AF_INST_MIDI_HINOTE = 304, + AF_INST_MIDI_LOVELOCITY = 305, + AF_INST_MIDI_HIVELOCITY = 306, + AF_INST_NUMDBS_GAIN = 307, + AF_INST_SUSLOOPID = 308, /* loop id for AIFF sustain loop */ + AF_INST_RELLOOPID = 309, /* loop id for AIFF release loop */ + AF_INST_SAMP_STARTFRAME = 310, /* start sample for this inst */ + AF_INST_SAMP_ENDFRAME = 311, /* end sample for this inst */ + AF_INST_SAMP_MODE = 312, /* looping mode for this inst */ + AF_INST_TRACKID = 313, + AF_INST_NAME = 314, /* name of this inst */ + AF_INST_SAMP_RATE = 315, /* sample rate of this inst's sample */ + AF_INST_PRESETID = 316, /* ID of preset containing this inst */ + AF_INST_PRESET_NAME = 317 /* name of preset containing this inst */ +}; + +enum +{ + AF_MISC_UNRECOGNIZED = 0, /* unrecognized data chunk */ + AF_MISC_COPY = 201, /* copyright string */ + AF_MISC_AUTH = 202, /* author string */ + AF_MISC_NAME = 203, /* name string */ + AF_MISC_ANNO = 204, /* annotation string */ + AF_MISC_APPL = 205, /* application-specific data */ + AF_MISC_MIDI = 206, /* MIDI exclusive data */ + AF_MISC_PCMMAP = 207, /* PCM mapping information (future use) */ + AF_MISC_NeXT = 208, /* misc binary data appended to NeXT header */ + AF_MISC_IRCAM_PEAKAMP = 209, /* peak amplitude information */ + AF_MISC_IRCAM_COMMENT = 210, /* BICSF text comment */ + AF_MISC_COMMENT = 210, /* general text comment */ + + AF_MISC_ICMT = AF_MISC_COMMENT, /* comments chunk (WAVE format) */ + AF_MISC_ICRD = 211, /* creation date (WAVE format) */ + AF_MISC_ISFT = 212 /* software name (WAVE format) */ +}; + +enum +{ + /* supported compression schemes */ + AF_COMPRESSION_UNKNOWN = -1, + AF_COMPRESSION_NONE = 0, + AF_COMPRESSION_G722 = 501, + AF_COMPRESSION_G711_ULAW = 502, + AF_COMPRESSION_G711_ALAW = 503, + + /* Apple proprietary AIFF-C compression schemes (not supported) */ + AF_COMPRESSION_APPLE_ACE2 = 504, + AF_COMPRESSION_APPLE_ACE8 = 505, + AF_COMPRESSION_APPLE_MAC3 = 506, + AF_COMPRESSION_APPLE_MAC6 = 507, + + AF_COMPRESSION_G726 = 517, + AF_COMPRESSION_G728 = 518, + AF_COMPRESSION_DVI_AUDIO = 519, + AF_COMPRESSION_IMA = AF_COMPRESSION_DVI_AUDIO, + AF_COMPRESSION_GSM = 520, + AF_COMPRESSION_FS1016 = 521, + AF_COMPRESSION_DV = 522, + AF_COMPRESSION_MS_ADPCM = 523 +}; + +/* tokens for afQuery() -- see the man page for instructions */ +/* level 1 selectors */ +enum +{ + AF_QUERYTYPE_INSTPARAM = 500, + AF_QUERYTYPE_FILEFMT = 501, + AF_QUERYTYPE_COMPRESSION = 502, + AF_QUERYTYPE_COMPRESSIONPARAM = 503, + AF_QUERYTYPE_MISC = 504, + AF_QUERYTYPE_INST = 505, + AF_QUERYTYPE_MARK = 506, + AF_QUERYTYPE_LOOP = 507 +}; + +/* level 2 selectors */ +enum +{ + AF_QUERY_NAME = 600, /* get name (1-3 words) */ + AF_QUERY_DESC = 601, /* get description */ + AF_QUERY_LABEL = 602, /* get 4- or 5-char label */ + AF_QUERY_TYPE = 603, /* get type token */ + AF_QUERY_DEFAULT = 604, /* dflt. value for param */ + AF_QUERY_ID_COUNT = 605, /* get number of ids avail. */ + AF_QUERY_IDS = 606, /* get array of id tokens */ + AF_QUERY_IMPLEMENTED = 613, /* boolean */ + AF_QUERY_TYPE_COUNT = 607, /* get number of types av. */ + AF_QUERY_TYPES = 608, /* get array of types */ + AF_QUERY_NATIVE_SAMPFMT = 609, /* for compression */ + AF_QUERY_NATIVE_SAMPWIDTH = 610, + AF_QUERY_SQUISHFAC = 611, /* 1.0 means variable */ + AF_QUERY_MAX_NUMBER = 612, /* max allowed in file */ + AF_QUERY_SUPPORTED = 613 /* insts, loops, etc., supported? */ +}; + +/* level 2 selectors which have sub-selectors */ +enum +{ + AF_QUERY_TRACKS = 620, + AF_QUERY_CHANNELS = 621, + AF_QUERY_SAMPLE_SIZES = 622, + AF_QUERY_SAMPLE_FORMATS = 623, + AF_QUERY_COMPRESSION_TYPES = 624 +}; + +/* level 3 sub-selectors */ +enum +{ + AF_QUERY_VALUE_COUNT = 650, /* number of values of the above */ + AF_QUERY_VALUES = 651 /* array of those values */ +}; + + +/* + Old Audio File Library error codes. These are still returned by the + AFerrorhandler calls, but are not used by the new digital media library + error reporting routines. See the bottom of this file for the new error + tokens. +*/ + +enum +{ + AF_BAD_NOT_IMPLEMENTED = 0, /* not implemented yet */ + AF_BAD_FILEHANDLE = 1, /* tried to use invalid filehandle */ + AF_BAD_OPEN = 3, /* unix open failed */ + AF_BAD_CLOSE = 4, /* unix close failed */ + AF_BAD_READ = 5, /* unix read failed */ + AF_BAD_WRITE = 6, /* unix write failed */ + AF_BAD_LSEEK = 7, /* unix lseek failed */ + AF_BAD_NO_FILEHANDLE = 8, /* failed to allocate a filehandle struct */ + AF_BAD_ACCMODE = 10, /* unrecognized audio file access mode */ + AF_BAD_NOWRITEACC = 11, /* file not open for writing */ + AF_BAD_NOREADACC = 12, /* file not open for reading */ + AF_BAD_FILEFMT = 13, /* unrecognized audio file format */ + AF_BAD_RATE = 14, /* invalid sample rate */ + AF_BAD_CHANNELS = 15, /* invalid number of channels*/ + AF_BAD_SAMPCNT = 16, /* invalid sample count */ + AF_BAD_WIDTH = 17, /* invalid sample width */ + AF_BAD_SEEKMODE = 18, /* invalid seek mode */ + AF_BAD_NO_LOOPDATA = 19, /* failed to allocate loop struct */ + AF_BAD_MALLOC = 20, /* malloc failed somewhere */ + AF_BAD_LOOPID = 21, + AF_BAD_SAMPFMT = 22, /* bad sample format */ + AF_BAD_FILESETUP = 23, /* bad file setup structure*/ + AF_BAD_TRACKID = 24, /* no track corresponding to id */ + AF_BAD_NUMTRACKS = 25, /* wrong number of tracks for file format */ + AF_BAD_NO_FILESETUP = 26, /* failed to allocate a filesetup struct*/ + AF_BAD_LOOPMODE = 27, /* unrecognized loop mode value */ + AF_BAD_INSTID = 28, /* invalid instrument id */ + AF_BAD_NUMLOOPS = 29, /* bad number of loops */ + AF_BAD_NUMMARKS = 30, /* bad number of markers */ + AF_BAD_MARKID = 31, /* bad marker id */ + AF_BAD_MARKPOS = 32, /* invalid marker position value */ + AF_BAD_NUMINSTS = 33, /* invalid number of instruments */ + AF_BAD_NOAESDATA = 34, + AF_BAD_MISCID = 35, + AF_BAD_NUMMISC = 36, + AF_BAD_MISCSIZE = 37, + AF_BAD_MISCTYPE = 38, + AF_BAD_MISCSEEK = 39, + AF_BAD_STRLEN = 40, /* invalid string length */ + AF_BAD_RATECONV = 45, + AF_BAD_SYNCFILE = 46, + AF_BAD_CODEC_CONFIG = 47, /* improperly configured codec */ + AF_BAD_CODEC_STATE = 48, /* invalid codec state: can't recover */ + AF_BAD_CODEC_LICENSE = 49, /* no license available for codec */ + AF_BAD_CODEC_TYPE = 50, /* unsupported codec type */ + AF_BAD_COMPRESSION = AF_BAD_CODEC_CONFIG, /* for back compat */ + AF_BAD_COMPTYPE = AF_BAD_CODEC_TYPE, /* for back compat */ + + AF_BAD_INSTPTYPE = 51, /* invalid instrument parameter type */ + AF_BAD_INSTPID = 52, /* invalid instrument parameter id */ + AF_BAD_BYTEORDER = 53, + AF_BAD_FILEFMT_PARAM = 54, /* unrecognized file format parameter */ + AF_BAD_COMP_PARAM = 55, /* unrecognized compression parameter */ + AF_BAD_DATAOFFSET = 56, /* bad data offset */ + AF_BAD_FRAMECNT = 57, /* bad frame count */ + AF_BAD_QUERYTYPE = 58, /* bad query type */ + AF_BAD_QUERY = 59, /* bad argument to afQuery() */ + AF_WARNING_CODEC_RATE = 60, /* using 8k instead of codec rate 8012 */ + AF_WARNING_RATECVT = 61, /* warning about rate conversion used */ + + AF_BAD_HEADER = 62, /* failed to parse header */ + AF_BAD_FRAME = 63, /* bad frame number */ + AF_BAD_LOOPCOUNT = 64, /* bad loop count */ + AF_BAD_DMEDIA_CALL = 65, /* error in dmedia subsystem call */ + + /* AIFF/AIFF-C specific errors when parsing file header */ + AF_BAD_AIFF_HEADER = 108, /* failed to parse chunk header */ + AF_BAD_AIFF_FORM = 109, /* failed to parse FORM chunk */ + AF_BAD_AIFF_SSND = 110, /* failed to parse SSND chunk */ + AF_BAD_AIFF_CHUNKID = 111, /* unrecognized AIFF/AIFF-C chunk id */ + AF_BAD_AIFF_COMM = 112, /* failed to parse COMM chunk */ + AF_BAD_AIFF_INST = 113, /* failed to parse INST chunk */ + AF_BAD_AIFF_MARK = 114, /* failed to parse MARK chunk */ + AF_BAD_AIFF_SKIP = 115, /* failed to skip unsupported chunk */ + AF_BAD_AIFF_LOOPMODE = 116 /* unrecognized loop mode (forw, etc)*/ +}; + +/* new error codes which may be retrieved via dmGetError() */ +/* The old error tokens continue to be retrievable via the AFerrorhandler */ +/* AF_ERR_BASE is #defined in dmedia/dmedia.h */ + +enum +{ + AF_ERR_NOT_IMPLEMENTED = 0+AF_ERR_BASE, /* not implemented yet */ + AF_ERR_BAD_FILEHANDLE = 1+AF_ERR_BASE, /* invalid filehandle */ + AF_ERR_BAD_READ = 5+AF_ERR_BASE, /* unix read failed */ + AF_ERR_BAD_WRITE = 6+AF_ERR_BASE, /* unix write failed */ + AF_ERR_BAD_LSEEK = 7+AF_ERR_BASE, /* unix lseek failed */ + AF_ERR_BAD_ACCMODE = 10+AF_ERR_BASE, /* unrecognized audio file access mode */ + AF_ERR_NO_WRITEACC = 11+AF_ERR_BASE, /* file not open for writing */ + AF_ERR_NO_READACC = 12+AF_ERR_BASE, /* file not open for reading */ + AF_ERR_BAD_FILEFMT = 13+AF_ERR_BASE, /* unrecognized audio file format */ + AF_ERR_BAD_RATE = 14+AF_ERR_BASE, /* invalid sample rate */ + AF_ERR_BAD_CHANNELS = 15+AF_ERR_BASE, /* invalid # channels*/ + AF_ERR_BAD_SAMPCNT = 16+AF_ERR_BASE, /* invalid sample count */ + AF_ERR_BAD_WIDTH = 17+AF_ERR_BASE, /* invalid sample width */ + AF_ERR_BAD_SEEKMODE = 18+AF_ERR_BASE, /* invalid seek mode */ + AF_ERR_BAD_LOOPID = 21+AF_ERR_BASE, /* invalid loop id */ + AF_ERR_BAD_SAMPFMT = 22+AF_ERR_BASE, /* bad sample format */ + AF_ERR_BAD_FILESETUP = 23+AF_ERR_BASE, /* bad file setup structure*/ + AF_ERR_BAD_TRACKID = 24+AF_ERR_BASE, /* no track corresponding to id */ + AF_ERR_BAD_NUMTRACKS = 25+AF_ERR_BASE, /* wrong number of tracks for file format */ + AF_ERR_BAD_LOOPMODE = 27+AF_ERR_BASE, /* unrecognized loop mode symbol */ + AF_ERR_BAD_INSTID = 28+AF_ERR_BASE, /* invalid instrument id */ + AF_ERR_BAD_NUMLOOPS = 29+AF_ERR_BASE, /* bad number of loops */ + AF_ERR_BAD_NUMMARKS = 30+AF_ERR_BASE, /* bad number of markers */ + AF_ERR_BAD_MARKID = 31+AF_ERR_BASE, /* bad marker id */ + AF_ERR_BAD_MARKPOS = 32+AF_ERR_BASE, /* invalid marker position value */ + AF_ERR_BAD_NUMINSTS = 33+AF_ERR_BASE, /* invalid number of instruments */ + AF_ERR_BAD_NOAESDATA = 34+AF_ERR_BASE, + AF_ERR_BAD_MISCID = 35+AF_ERR_BASE, + AF_ERR_BAD_NUMMISC = 36+AF_ERR_BASE, + AF_ERR_BAD_MISCSIZE = 37+AF_ERR_BASE, + AF_ERR_BAD_MISCTYPE = 38+AF_ERR_BASE, + AF_ERR_BAD_MISCSEEK = 39+AF_ERR_BASE, + AF_ERR_BAD_STRLEN = 40+AF_ERR_BASE, /* invalid string length */ + AF_ERR_BAD_RATECONV = 45+AF_ERR_BASE, + AF_ERR_BAD_SYNCFILE = 46+AF_ERR_BASE, + AF_ERR_BAD_CODEC_CONFIG = 47+AF_ERR_BASE, /* improperly configured codec */ + AF_ERR_BAD_CODEC_TYPE = 50+AF_ERR_BASE, /* unsupported codec type */ + AF_ERR_BAD_INSTPTYPE = 51+AF_ERR_BASE, /* invalid instrument parameter type */ + AF_ERR_BAD_INSTPID = 52+AF_ERR_BASE, /* invalid instrument parameter id */ + + AF_ERR_BAD_BYTEORDER = 53+AF_ERR_BASE, + AF_ERR_BAD_FILEFMT_PARAM = 54+AF_ERR_BASE, /* unrecognized file format parameter */ + AF_ERR_BAD_COMP_PARAM = 55+AF_ERR_BASE, /* unrecognized compression parameter */ + AF_ERR_BAD_DATAOFFSET = 56+AF_ERR_BASE, /* bad data offset */ + AF_ERR_BAD_FRAMECNT = 57+AF_ERR_BASE, /* bad frame count */ + + AF_ERR_BAD_QUERYTYPE = 58+AF_ERR_BASE, /* bad query type */ + AF_ERR_BAD_QUERY = 59+AF_ERR_BASE, /* bad argument to afQuery() */ + AF_ERR_BAD_HEADER = 62+AF_ERR_BASE, /* failed to parse header */ + AF_ERR_BAD_FRAME = 63+AF_ERR_BASE, /* bad frame number */ + AF_ERR_BAD_LOOPCOUNT = 64+AF_ERR_BASE, /* bad loop count */ + + /* AIFF/AIFF-C specific errors when parsing file header */ + + AF_ERR_BAD_AIFF_HEADER = 66+AF_ERR_BASE, /* failed to parse chunk header */ + AF_ERR_BAD_AIFF_FORM = 67+AF_ERR_BASE, /* failed to parse FORM chunk */ + AF_ERR_BAD_AIFF_SSND = 68+AF_ERR_BASE, /* failed to parse SSND chunk */ + AF_ERR_BAD_AIFF_CHUNKID = 69+AF_ERR_BASE, /* unrecognized AIFF/AIFF-C chunk id */ + AF_ERR_BAD_AIFF_COMM = 70+AF_ERR_BASE, /* failed to parse COMM chunk */ + AF_ERR_BAD_AIFF_INST = 71+AF_ERR_BASE, /* failed to parse INST chunk */ + AF_ERR_BAD_AIFF_MARK = 72+AF_ERR_BASE, /* failed to parse MARK chunk */ + AF_ERR_BAD_AIFF_SKIP = 73+AF_ERR_BASE, /* failed to skip unsupported chunk */ + AF_ERR_BAD_AIFF_LOOPMODE = 74+AF_ERR_BASE /* unrecognized loop mode (forw, etc) */ +}; + + +/* global routines */ +AFerrfunc afSetErrorHandler (AFerrfunc efunc); + +/* query routines */ +AUpvlist afQuery (int querytype, int arg1, int arg2, int arg3, int arg4); +long afQueryLong (int querytype, int arg1, int arg2, int arg3, int arg4); +double afQueryDouble (int querytype, int arg1, int arg2, int arg3, int arg4); +void *afQueryPointer (int querytype, int arg1, int arg2, int arg3, int arg4); + +/* basic operations on file handles and file setups */ +AFfilesetup afNewFileSetup (void); +void afFreeFileSetup (AFfilesetup); +int afIdentifyFD (int); +int afIdentifyNamedFD (int, const char *filename, int *implemented); + +AFfilehandle afOpenFile (const char *filename, const char *mode, + AFfilesetup setup); +AFfilehandle afOpenVirtualFile (AFvirtualfile *vfile, const char *mode, + AFfilesetup setup); +AFfilehandle afOpenFD (int fd, const char *mode, AFfilesetup setup); +AFfilehandle afOpenNamedFD (int fd, const char *mode, AFfilesetup setup, + const char *filename); + +void afSaveFilePosition (AFfilehandle file); +void afRestoreFilePosition (AFfilehandle file); +int afSyncFile (AFfilehandle file); +int afCloseFile (AFfilehandle file); + +void afInitFileFormat (AFfilesetup, int format); +int afGetFileFormat (AFfilehandle, int *version); + +/* track */ +void afInitTrackIDs (AFfilesetup, int *trackids, int trackCount); +int afGetTrackIDs (AFfilehandle, int *trackids); + +/* track data: reading, writng, seeking, sizing frames */ +int afReadFrames (AFfilehandle, int track, void *buffer, int frameCount); +int afWriteFrames (AFfilehandle, int track, const void *buffer, int frameCount); +AFframecount afSeekFrame (AFfilehandle, int track, AFframecount frameoffset); +AFframecount afTellFrame (AFfilehandle, int track); +AFfileoffset afGetTrackBytes (AFfilehandle, int track); +float afGetFrameSize (AFfilehandle, int track, int expand3to4); +float afGetVirtualFrameSize (AFfilehandle, int track, int expand3to4); + +/* track data: AES data */ +/* afInitAESChannelData is obsolete -- use afInitAESChannelDataTo() */ +void afInitAESChannelData (AFfilesetup, int track); /* obsolete */ +void afInitAESChannelDataTo (AFfilesetup, int track, int willBeData); +int afGetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); +void afSetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); + +#if 0 +/* track setup format initialized via DMparams */ +/* track format retrieved via DMparams */ +DMstatus afInitFormatParams (AFfilesetup, int track, DMparams *params); +/* virtual format set via DMparams */ +DMstatus afGetFormatParams (AFfilehandle, int track, DMparams *params); +/* virtual format retrieved via DMparams */ +DMstatus afSetVirtualFormatParams (AFfilehandle, int track, DMparams *params); +DMstatus afGetVirtualFormatParams (AFfilehandle, int track, DMparams *params); +/* conversion/compression params set via DMparams */ +DMstatus afSetConversionParams (AFfilehandle, int track, DMparams *params); +/* conversion/compression params retrieved via DMparams */ +DMstatus afGetConversionParams (AFfilehandle, int track, DMparams *params); +#endif + +/* track data: byte order */ +void afInitByteOrder (AFfilesetup, int track, int byteOrder); +int afGetByteOrder (AFfilehandle, int track); +int afSetVirtualByteOrder (AFfilehandle, int track, int byteOrder); +int afGetVirtualByteOrder (AFfilehandle, int track); + +/* track data: number of channels */ +void afInitChannels (AFfilesetup, int track, int nchannels); +int afGetChannels (AFfilehandle, int track); +int afSetVirtualChannels (AFfilehandle, int track, int channelCount); +int afGetVirtualChannels (AFfilehandle, int track); +void afSetChannelMatrix (AFfilehandle, int track, double *matrix); + +/* track data: sample format and sample width */ +void afInitSampleFormat (AFfilesetup, int track, int sampleFormat, + int sampleWidth); +void afGetSampleFormat (AFfilehandle file, int track, int *sampfmt, + int *sampwidth); +void afGetVirtualSampleFormat (AFfilehandle file, int track, int *sampfmt, + int *sampwidth); +int afSetVirtualSampleFormat (AFfilehandle, int track, + int sampleFormat, int sampleWidth); +void afGetVirtualSampleFormat (AFfilehandle, int track, + int *sampleFormat, int *sampleWidth); + +/* track data: sampling rate */ +void afInitRate (AFfilesetup, int track, double rate); +double afGetRate (AFfilehandle, int track); + +#if 0 +int afSetVirtualRate (AFfilehandle, int track, double rate); +double afGetVirtualRate (AFfilehandle, int track); +#endif + +/* track data: compression */ +void afInitCompression (AFfilesetup, int track, int compression); +#if 0 +void afInitCompressionParams (AFfilesetup, int track, int compression + AUpvlist params, int parameterCount); +#endif + +int afGetCompression (AFfilehandle, int track); +#if 0 +void afGetCompressionParams (AFfilehandle, int track, int *compression, + AUpvlist params, int parameterCount); + +int afSetVirtualCompression (AFfilesetup, int track, int compression); +void afSetVirtualCompressionParams (AFfilehandle, int track, int compression, + AUpvlist params, int parameterCount); + +int afGetVirtualCompression (AFfilesetup, int track, int compression); +void afGetVirtualCompressionParams (AFfilehandle, int track, int *compression, + AUpvlist params, int parameterCount); +#endif + +/* track data: pcm mapping */ +void afInitPCMMapping (AFfilesetup filesetup, int track, + double slope, double intercept, double minClip, double maxClip); +void afGetPCMMapping (AFfilehandle file, int track, + double *slope, double *intercept, double *minClip, double *maxClip); +/* NOTE: afSetTrackPCMMapping() is special--it does not set the virtual */ +/* format; it changes what the AF thinks the track format is! Be careful. */ +int afSetTrackPCMMapping (AFfilehandle file, int track, + double slope, double intercept, double minClip, double maxClip); +/* NOTE: afSetVirtualPCMMapping() is different from afSetTrackPCMMapping(): */ +/* see comment for afSetTrackPCMMapping(). */ +int afSetVirtualPCMMapping (AFfilehandle file, int track, + double slope, double intercept, double minClip, double maxClip); +void afGetVirtualPCMMapping (AFfilehandle file, int track, + double *slope, double *intercept, double *minClip, double *maxClip); + +/* track data: data offset within the file */ +/* initialize for raw reading only */ +void afInitDataOffset(AFfilesetup, int track, AFfileoffset offset); +AFfileoffset afGetDataOffset (AFfilehandle, int track); + +/* track data: count of frames in file */ +void afInitFrameCount (AFfilesetup, int track, AFframecount frameCount); +AFframecount afGetFrameCount (AFfilehandle file, int track); + +/* loop operations */ +void afInitLoopIDs (AFfilesetup, int instid, int ids[], int nids); +int afGetLoopIDs (AFfilehandle, int instid, int loopids[]); +void afSetLoopMode (AFfilehandle, int instid, int loop, int mode); +int afGetLoopMode (AFfilehandle, int instid, int loopid); +int afSetLoopCount (AFfilehandle, int instid, int loop, int count); +int afGetLoopCount (AFfilehandle, int instid, int loopid); +void afSetLoopStart (AFfilehandle, int instid, int loopid, int markerid); +int afGetLoopStart (AFfilehandle, int instid, int loopid); +void afSetLoopEnd (AFfilehandle, int instid, int loopid, int markerid); +int afGetLoopEnd (AFfilehandle, int instid, int loopid); + +int afSetLoopStartFrame (AFfilehandle, int instid, int loop, + AFframecount startFrame); +AFframecount afGetLoopStartFrame (AFfilehandle, int instid, int loop); +int afSetLoopEndFrame (AFfilehandle, int instid, int loop, + AFframecount startFrame); +AFframecount afGetLoopEndFrame (AFfilehandle, int instid, int loop); + +void afSetLoopTrack (AFfilehandle, int instid, int loopid, int trackid); +int afGetLoopTrack (AFfilehandle, int instid, int loopid); + +/* marker operations */ +void afInitMarkIDs (AFfilesetup, int trackid, int *ids, int nids); +int afGetMarkIDs (AFfilehandle file, int trackid, int markids[]); +void afSetMarkPosition (AFfilehandle file, int trackid, int markid, + AFframecount markpos); +AFframecount afGetMarkPosition (AFfilehandle file, int trackid, int markid); +void afInitMarkName (AFfilesetup, int trackid, int marker, const char *name); +void afInitMarkComment (AFfilesetup, int trackid, int marker, + const char *comment); +char *afGetMarkName (AFfilehandle file, int trackid, int markid); +char *afGetMarkComment (AFfilehandle file, int trackid, int markid); + +/* instrument operations */ +void afInitInstIDs (AFfilesetup, int *ids, int nids); +int afGetInstIDs (AFfilehandle file, int *instids); +void afGetInstParams (AFfilehandle file, int instid, AUpvlist pvlist, + int nparams); +void afSetInstParams (AFfilehandle file, int instid, AUpvlist pvlist, + int nparams); +long afGetInstParamLong (AFfilehandle file, int instid, int param); +void afSetInstParamLong (AFfilehandle file, int instid, int param, long value); + +/* miscellaneous data operations */ +void afInitMiscIDs (AFfilesetup, int *ids, int nids); +int afGetMiscIDs (AFfilehandle, int *ids); +void afInitMiscType (AFfilesetup, int miscellaneousid, int type); +int afGetMiscType (AFfilehandle, int miscellaneousid); +void afInitMiscSize (AFfilesetup, int miscellaneousid, int size); +int afGetMiscSize (AFfilehandle, int miscellaneousid); +int afWriteMisc (AFfilehandle, int miscellaneousid, void *buf, int bytes); +int afReadMisc (AFfilehandle, int miscellaneousid, void *buf, int bytes); +int afSeekMisc (AFfilehandle, int miscellaneousid, int offset); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* AUDIOFILE_H */ diff --git a/libaudiofile/aupv.c b/libaudiofile/aupv.c new file mode 100644 index 0000000..9ac5be1 --- /dev/null +++ b/libaudiofile/aupv.c @@ -0,0 +1,251 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aupv.c + + This file contains an implementation of SGI's Audio Library parameter + value list functions. +*/ + +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "aupvinternal.h" +#include "aupvlist.h" + +AUpvlist AUpvnew (int maxitems) +{ + AUpvlist aupvlist; + int i; + + if (maxitems <= 0) + return AU_NULL_PVLIST; + + aupvlist = (AUpvlist) malloc(sizeof (struct _AUpvlist)); + assert(aupvlist); + if (aupvlist == NULL) + return AU_NULL_PVLIST; + + aupvlist->items = calloc(maxitems, sizeof (struct _AUpvitem)); + + assert(aupvlist->items); + if (aupvlist->items == NULL) + { + free(aupvlist); + return AU_NULL_PVLIST; + } + + /* Initialize the items in the list. */ + for (i=0; i<maxitems; i++) + { + aupvlist->items[i].valid = _AU_VALID_PVITEM; + aupvlist->items[i].type = AU_PVTYPE_LONG; + aupvlist->items[i].parameter = 0; + memset(&aupvlist->items[i].value, 0, sizeof (aupvlist->items[i].value)); + } + + aupvlist->valid = _AU_VALID_PVLIST; + aupvlist->count = maxitems; + + return aupvlist; +} + +int AUpvgetmaxitems (AUpvlist list) +{ + assert(list); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + + return list->count; +} + +int AUpvfree (AUpvlist list) +{ + assert(list); + assert(list->items); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + + if ((list->items != _AU_NULL_PVITEM) && + (list->items[0].valid == _AU_VALID_PVITEM)) + { + free(list->items); + } + + free(list); + + return _AU_SUCCESS; +} + +int AUpvsetparam (AUpvlist list, int item, int param) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + list->items[item].parameter = param; + return _AU_SUCCESS; +} + +int AUpvsetvaltype (AUpvlist list, int item, int type) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + list->items[item].type = type; + return _AU_SUCCESS; +} + +int AUpvsetval (AUpvlist list, int item, void *val) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + switch (list->items[item].type) + { + case AU_PVTYPE_LONG: + list->items[item].value.l = *((long *) val); + break; + case AU_PVTYPE_DOUBLE: + list->items[item].value.d = *((double *) val); + break; + case AU_PVTYPE_PTR: + list->items[item].value.v = *((void **) val); + break; + default: + assert(0); + return AU_BAD_PVLIST; + } + + return _AU_SUCCESS; +} + +int AUpvgetparam (AUpvlist list, int item, int *param) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + *param = list->items[item].parameter; + return _AU_SUCCESS; +} + +int AUpvgetvaltype (AUpvlist list, int item, int *type) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + *type = list->items[item].type; + return _AU_SUCCESS; +} + +int AUpvgetval (AUpvlist list, int item, void *val) +{ + assert(list); + assert(list->items); + assert(item >= 0); + assert(item < list->count); + + if (list == AU_NULL_PVLIST) + return AU_BAD_PVLIST; + if (list->valid != _AU_VALID_PVLIST) + return AU_BAD_PVLIST; + if ((item < 0) || (item > list->count - 1)) + return AU_BAD_PVITEM; + if (list->items[item].valid != _AU_VALID_PVITEM) + return AU_BAD_PVLIST; + + switch (list->items[item].type) + { + case AU_PVTYPE_LONG: + *((long *) val) = list->items[item].value.l; + break; + case AU_PVTYPE_DOUBLE: + *((double *) val) = list->items[item].value.d; + break; + case AU_PVTYPE_PTR: + *((void **) val) = list->items[item].value.v; + break; + } + + return _AU_SUCCESS; +} diff --git a/libaudiofile/aupvinternal.h b/libaudiofile/aupvinternal.h new file mode 100644 index 0000000..1b8c8af --- /dev/null +++ b/libaudiofile/aupvinternal.h @@ -0,0 +1,75 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aupvinternal.h + + This file contains the private data structures for the parameter + value list data types. +*/ + +#ifndef AUPVINTERNAL_H +#define AUPVINTERNAL_H + +struct _AUpvitem +{ + int valid; + int type; + int parameter; + + union + { + long l; + double d; + void *v; + } + value; +}; + +struct _AUpvlist +{ + int valid; + size_t count; + struct _AUpvitem *items; +}; + +enum +{ + _AU_VALID_PVLIST = 30932, + _AU_VALID_PVITEM = 30933 +}; + +enum +{ + AU_BAD_PVLIST = -5, + AU_BAD_PVITEM = -6, + AU_BAD_PVTYPE = -7, + AU_BAD_ALLOC = -8 +}; + +enum +{ + _AU_FAIL = -1, + _AU_SUCCESS = 0 +}; + +#define _AU_NULL_PVITEM ((struct _AUpvitem *) NULL) + +#endif diff --git a/libaudiofile/aupvlist.h b/libaudiofile/aupvlist.h new file mode 100644 index 0000000..7286f41 --- /dev/null +++ b/libaudiofile/aupvlist.h @@ -0,0 +1,61 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + aupvlist.h + + This file contains the interface to the parameter value list data + structures and routines. +*/ + +#ifndef AUPVLIST_H +#define AUPVLIST_H + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +enum +{ + AU_PVTYPE_LONG = 1, + AU_PVTYPE_DOUBLE = 2, + AU_PVTYPE_PTR = 3 +}; + +typedef struct _AUpvlist *AUpvlist; + +#define AU_NULL_PVLIST ((struct _AUpvlist *) 0) + +AUpvlist AUpvnew (int maxItems); +int AUpvgetmaxitems (AUpvlist); +int AUpvfree (AUpvlist); +int AUpvsetparam (AUpvlist, int item, int param); +int AUpvsetvaltype (AUpvlist, int item, int type); +int AUpvsetval (AUpvlist, int item, void *val); +int AUpvgetparam (AUpvlist, int item, int *param); +int AUpvgetvaltype (AUpvlist, int item, int *type); +int AUpvgetval (AUpvlist, int item, void *val); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* AUPVLIST_H */ diff --git a/libaudiofile/avr.c b/libaudiofile/avr.c new file mode 100644 index 0000000..b7e03dc --- /dev/null +++ b/libaudiofile/avr.c @@ -0,0 +1,258 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + avr.c + + This file contains routines for parsing AVR (Audio Visual + Research) sound files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "track.h" +#include "util.h" +#include "setup.h" +#include "byteorder.h" + +#include "avr.h" + +_AFfilesetup _af_avr_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_AVR, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +bool _af_avr_recognize (AFvirtualfile *fh) +{ + u_int32_t magic; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(&magic, 4, 1, fh) != 1 || memcmp(&magic, "2BIT", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +status _af_avr_read_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t magic; + char name[8]; + u_int16_t mono, resolution, sign, loop, midi; + u_int32_t rate, size, loopStart, loopEnd; + char reserved[26]; + char user[64]; + + _Track *track; + + assert(file != NULL); + assert(file->fh != NULL); + + af_fseek(file->fh, 0, SEEK_SET); + + if (af_fread(&magic, 4, 1, file->fh) != 1) + { + _af_error(AF_BAD_READ, "could not read AVR file header"); + return AF_FAIL; + } + + if (memcmp(&magic, "2BIT", 4) != 0) + { + _af_error(AF_BAD_FILEFMT, "file is not AVR format"); + return AF_FAIL; + } + + /* Read name. */ + af_fread(name, 8, 1, file->fh); + + af_read_uint16_be(&mono, file->fh); + af_read_uint16_be(&resolution, file->fh); + af_read_uint16_be(&sign, file->fh); + af_read_uint16_be(&loop, file->fh); + af_read_uint16_be(&midi, file->fh); + + af_read_uint32_be(&rate, file->fh); + af_read_uint32_be(&size, file->fh); + af_read_uint32_be(&loopStart, file->fh); + af_read_uint32_be(&loopEnd, file->fh); + + af_fread(reserved, 26, 1, file->fh); + af_fread(user, 64, 1, file->fh); + + if ((track = _af_track_new()) == NULL) + return AF_FAIL; + + file->tracks = track; + file->trackCount = 1; + + file->instruments = NULL; + file->instrumentCount = 0; + + file->miscellaneous = NULL; + file->miscellaneousCount = 0; + + file->formatSpecific = NULL; + + /* Use only low-order three bytes of sample rate. */ + track->f.sampleRate = rate & 0xffffff; + + if (sign == 0) + track->f.sampleFormat = AF_SAMPFMT_UNSIGNED; + else if (sign == 0xffff) + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + else + { + _af_error(AF_BAD_SAMPFMT, "bad sample format in AVR file"); + return AF_FAIL; + } + + if (resolution != 8 && resolution != 16) + { + _af_error(AF_BAD_WIDTH, "bad sample width %d in AVR file", + resolution); + return AF_FAIL; + } + track->f.sampleWidth = resolution; + + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + if (mono == 0) + track->f.channelCount = 1; + else if (mono == 0xffff) + track->f.channelCount = 2; + else + { + _af_error(AF_BAD_CHANNELS, + "invalid number of channels in AVR file"); + return AF_FAIL; + } + + track->f.compressionType = AF_COMPRESSION_NONE; + + _af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth); + + track->fpos_first_frame = af_ftell(file->fh); + track->totalfframes = size; + track->data_size = track->totalfframes * + _af_format_frame_size(&track->f, AF_FALSE); + track->nextfframe = 0; + track->fpos_next_frame = track->fpos_first_frame; + + /* The file has been parsed successfully. */ + return AF_SUCCEED; +} + +AFfilesetup _af_avr_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "AVR files must have exactly 1 track"); + return AF_NULL_FILESETUP; + } + + track = _af_filesetup_get_tracksetup(setup, AF_DEFAULT_TRACK); + + /* AVR allows only unsigned and two's complement integer data. */ + if (track->f.sampleFormat != AF_SAMPFMT_UNSIGNED && + track->f.sampleFormat != AF_SAMPFMT_TWOSCOMP) + { + _af_error(AF_BAD_FILEFMT, "AVR format does supports only unsigned and two's complement integer data"); + return AF_NULL_FILESETUP; + } + + /* For now we support only 8- and 16-bit samples. */ + if (track->f.sampleWidth != 8 && track->f.sampleWidth != 16) + { + _af_error(AF_BAD_WIDTH, "invalid sample width %d for AVR file (only 8- and 16-bit sample widths are allowed)"); + return AF_NULL_FILESETUP; + } + + /* AVR does not support compression. */ + if (track->f.compressionType != AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "compression not supported for AVR files"); + return AF_NULL_FILESETUP; + } + + /* AVR audio data is big-endian. */ + if (track->f.byteOrder != AF_BYTEORDER_BIGENDIAN) + { + if (track->byteOrderSet) + { + _af_error(AF_BAD_BYTEORDER, + "AVR format supports only big-endian data"); + return AF_NULL_FILESETUP; + } + else + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + } + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "AVR files do not support AES data"); + return AF_NULL_FILESETUP; + } + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_FILESETUP, "AVR format does not support markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_FILESETUP, "AVR format does not support instruments"); + return AF_NULL_FILESETUP; + } + + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_FILESETUP, "AVR format does not support miscellaneous data"); + return AF_NULL_FILESETUP; + } + + return _af_filesetup_copy(setup, &_af_avr_default_filesetup, AF_FALSE); +} diff --git a/libaudiofile/avr.h b/libaudiofile/avr.h new file mode 100644 index 0000000..1e4296a --- /dev/null +++ b/libaudiofile/avr.h @@ -0,0 +1,39 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + avr.h + + This file contains headers and constants related to the AVR + (Audio Visual Research) sound file format. +*/ + +#include "afinternal.h" + +#ifndef AVR_H +#define AVR_H + +bool _af_avr_recognize (AFvirtualfile *fh); +status _af_avr_read_init (AFfilesetup, AFfilehandle); +status _af_avr_write_init (AFfilesetup, AFfilehandle); +status _af_avr_update (AFfilehandle); +AFfilesetup _af_avr_complete_setup (AFfilesetup); + +#endif diff --git a/libaudiofile/avrwrite.c b/libaudiofile/avrwrite.c new file mode 100644 index 0000000..8d8a896 --- /dev/null +++ b/libaudiofile/avrwrite.c @@ -0,0 +1,153 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + avrwrite.c + + This file contains routines for writing AVR (Audio Visual + Research) sound files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" + +#include "avr.h" + +status _af_avr_update (AFfilehandle file) +{ + _Track *track; + u_int32_t size, loopStart, loopEnd; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + /* Seek to the position of the size field. */ + af_fseek(file->fh, 26, SEEK_SET); + + size = track->totalfframes; + + /* For the case of no loops, loopStart = 0 and loopEnd = size. */ + loopStart = 0; + loopEnd = size; + + af_write_uint32_be(&size, file->fh); + af_write_uint32_be(&loopStart, file->fh); + af_write_uint32_be(&loopEnd, file->fh); + + return AF_SUCCEED; +} + +static char *af_basename (char *filename) +{ + char *base; + base = strrchr(filename, '/'); + if (base == NULL) + return filename; + else + return base + 1; +} + +status _af_avr_write_init (AFfilesetup setup, AFfilehandle filehandle) +{ + _Track *track; + char name[8]; + u_int16_t mono, resolution, sign, loop, midi; + u_int32_t rate, size, loopStart, loopEnd; + char reserved[26]; + char user[64]; + + if (_af_filesetup_make_handle(setup, filehandle) == AF_FAIL) + return AF_FAIL; + + filehandle->formatSpecific = NULL; + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + if (af_fseek(filehandle->fh, 0, SEEK_SET) != 0) + { + _af_error(AF_BAD_LSEEK, "bad seek"); + return AF_FAIL; + } + + af_fwrite("2BIT", 4, 1, filehandle->fh); + memset(name, 0, 8); + if (filehandle->fileName != NULL) + strncpy(name, af_basename(filehandle->fileName), 8); + af_fwrite(name, 8, 1, filehandle->fh); + + if (track->f.channelCount == 1) + mono = 0x0; + else + mono = 0xffff; + af_write_uint16_be(&mono, filehandle->fh); + + resolution = track->f.sampleWidth; + af_write_uint16_be(&resolution, filehandle->fh); + + if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + sign = 0x0; + else + sign = 0xffff; + af_write_uint16_be(&sign, filehandle->fh); + + /* We do not currently support loops. */ + loop = 0; + af_write_uint16_be(&loop, filehandle->fh); + midi = 0xffff; + af_write_uint16_be(&midi, filehandle->fh); + + rate = track->f.sampleRate; + /* Set the high-order byte of rate to 0xff. */ + rate |= 0xff000000; + size = track->totalfframes; + loopStart = 0; + loopEnd = size; + + af_write_uint32_be(&rate, filehandle->fh); + af_write_uint32_be(&size, filehandle->fh); + af_write_uint32_be(&loopStart, filehandle->fh); + af_write_uint32_be(&loopEnd, filehandle->fh); + + memset(reserved, 0, 26); + af_fwrite(reserved, 26, 1, filehandle->fh); + + memset(user, 0, 64); + af_fwrite(user, 64, 1, filehandle->fh); + + if (track->fpos_first_frame == 0) + track->fpos_first_frame = af_ftell(filehandle->fh); + + return AF_SUCCEED; +} diff --git a/libaudiofile/byteorder.c b/libaudiofile/byteorder.c new file mode 100644 index 0000000..182926a --- /dev/null +++ b/libaudiofile/byteorder.c @@ -0,0 +1,85 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + byteorder.c + + This file defines functions which swap bytes. +*/ + +#include <sys/types.h> +#include "byteorder.h" +#include "util.h" + +u_int16_t _af_byteswap_int16 (u_int16_t x) +{ + return ((x << 8) | (x >> 8)); +} + +u_int32_t _af_byteswap_int32 (u_int32_t x) +{ + u_int8_t b1, b2, b3, b4; + + b1 = x>>24; + b2 = (x>>16) & 0xff; + b3 = (x>>8) & 0xff; + b4 = x & 0xff; + + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); +} + +float _af_byteswap_float32 (float x) +{ + float f = x; + u_int32_t *l = (u_int32_t *) &f; + + *l = _af_byteswap_int32(*l); + + return f; +} + +/* +uint64_t _af_byteswap_int64 (uint64_t x) +{ + u_int8_t b1, b2, b3, b4, b5, b6, b7, b8; + + b1 = (x>>56) & 0xff; + b2 = (x>>48) & 0xff; + b3 = (x>>40) & 0xff; + b4 = (x>>32) & 0xff; + b5 = (x>>24) & 0xff; + b6 = (x>>16) & 0xff; + b7 = (x>>8) & 0xff; + b8 = x & 0xff; + + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) | + (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); +} + +main () +{ + long ldata = '1234'; + unsigned long long data = 0x1122334455667788; + printf("%llx\n", data); + printf("%llx\n", _af_byteswap_int64(data)); + printf("%x\n", ldata); + printf("%x\n", _af_byteswap_int32(ldata)); +} +*/ diff --git a/libaudiofile/byteorder.h b/libaudiofile/byteorder.h new file mode 100644 index 0000000..045b0a0 --- /dev/null +++ b/libaudiofile/byteorder.h @@ -0,0 +1,106 @@ +/* + Audio File Library + Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + byteorder.h + + This file declares functions useful for dealing with byte + swapping. +*/ + +#ifndef BYTEORDER_H +#define BYTEORDER_H + +#include <config.h> + +#if WORDS_BIGENDIAN + #define __BIGENDIAN__ + #define _AF_BYTEORDER_NATIVE (AF_BYTEORDER_BIGENDIAN) +#else + #define __LITTLEENDIAN__ + #define _AF_BYTEORDER_NATIVE (AF_BYTEORDER_LITTLEENDIAN) +#endif + +#ifndef uint16 +typedef u_int16_t uint16; +#endif + +#ifndef uint32 +typedef u_int32_t uint32; +#endif + +#ifdef __LITTLEENDIAN__ + +#define HOST_TO_LENDIAN_INT16(x) ((uint16) (x)) +#define HOST_TO_LENDIAN_INT32(x) ((uint32) (x)) +#define HOST_TO_LENDIAN_FLOAT32(x) ((float) (x)) +#define HOST_TO_LENDIAN_DOUBLE64(x) ((double) (x)) + +#define LENDIAN_TO_HOST_INT16(x) ((uint16) (x)) +#define LENDIAN_TO_HOST_INT32(x) ((uint32) (x)) +#define LENDIAN_TO_HOST_FLOAT32(x) ((float) (x)) +#define LENDIAN_TO_HOST_DOUBLE64(x) ((double) (x)) + +#else + +#define HOST_TO_LENDIAN_INT16(x) _af_byteswap_int16(x) +#define HOST_TO_LENDIAN_INT32(x) _af_byteswap_int32(x) +#define HOST_TO_LENDIAN_FLOAT32(x) _af_byteswap_float32(x) +#define HOST_TO_LENDIAN_DOUBLE64(x) _af_byteswap_double64(x) + +#define LENDIAN_TO_HOST_INT16(x) _af_byteswap_int16(x) +#define LENDIAN_TO_HOST_INT32(x) _af_byteswap_int32(x) +#define LENDIAN_TO_HOST_FLOAT32(x) _af_byteswap_float32(x) +#define LENDIAN_TO_HOST_DOUBLE64(x) _af_byteswap_double64(x) + +#endif + +#ifdef __BIGENDIAN__ + +#define HOST_TO_BENDIAN_INT16(x) ((uint16) (x)) +#define HOST_TO_BENDIAN_INT32(x) ((uint32) (x)) +#define HOST_TO_BENDIAN_FLOAT32(x) ((float) (x)) +#define HOST_TO_BENDIAN_DOUBLE64(x) ((double) (x)) + +#define BENDIAN_TO_HOST_INT16(x) ((uint16) (x)) +#define BENDIAN_TO_HOST_INT32(x) ((uint32) (x)) +#define BENDIAN_TO_HOST_FLOAT32(x) ((float) (x)) +#define BENDIAN_TO_HOST_DOUBLE64(x) ((double) (x)) + +#else + +#define HOST_TO_BENDIAN_INT16(x) _af_byteswap_int16(x) +#define HOST_TO_BENDIAN_INT32(x) _af_byteswap_int32(x) +#define HOST_TO_BENDIAN_FLOAT32(x) _af_byteswap_float32(x) +#define HOST_TO_BENDIAN_DOUBLE64(x) _af_byteswap_double64(x) + +#define BENDIAN_TO_HOST_INT16(x) _af_byteswap_int16(x) +#define BENDIAN_TO_HOST_INT32(x) _af_byteswap_int32(x) +#define BENDIAN_TO_HOST_FLOAT32(x) _af_byteswap_float32(x) +#define BENDIAN_TO_HOST_DOUBLE64(x) _af_byteswap_double64(x) + +#endif + +u_int16_t _af_byteswap_int16 (u_int16_t x); +u_int32_t _af_byteswap_int32 (u_int32_t x); +float _af_byteswap_float32 (float x); +double _af_byteswap_double64 (double x); + +#endif diff --git a/libaudiofile/compression.c b/libaudiofile/compression.c new file mode 100644 index 0000000..762751e --- /dev/null +++ b/libaudiofile/compression.c @@ -0,0 +1,111 @@ +/* + Audio File Library + Copyright (C) 1999-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + compression.c + + This file contains routines for configuring compressed audio. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "aupvlist.h" +#include "units.h" +#include "util.h" + +extern _CompressionUnit _af_compression[]; + +int _af_compression_index_from_id (int compressionid) +{ + int i; + + for (i=0; i<_AF_NUM_COMPRESSION; i++) + { + if (_af_compression[i].compressionID == compressionid) + return i; + } + + _af_error(AF_BAD_COMPTYPE, "compression type %d not available", compressionid); + + return -1; +} + +static _CompressionUnit *findCompression (int compressionid) +{ + int compressionno; + + compressionno = _af_compression_index_from_id(compressionid); + if (compressionno != -1) + return &_af_compression[compressionno]; + + return NULL; +} + +int afGetCompression (AFfilehandle file, int trackid) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->f.compressionType; +} + +void afInitCompression (AFfilesetup setup, int trackid, int compression) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (findCompression(compression) == NULL) + return; + + track->f.compressionType = compression; +} + +#if 0 +int afGetCompressionParams (AFfilehandle file, int trackid, + int *compression, AUpvlist pvlist, int numitems) +{ + assert(file); + assert(trackid == AF_DEFAULT_TRACK); +} + +void afInitCompressionParams (AFfilesetup setup, int trackid, + int compression, AUpvlist pvlist, int numitems) +{ + assert(setup); + assert(trackid == AF_DEFAULT_TRACK); +} +#endif diff --git a/libaudiofile/compression.h b/libaudiofile/compression.h new file mode 100644 index 0000000..ee190d7 --- /dev/null +++ b/libaudiofile/compression.h @@ -0,0 +1,32 @@ +/* + Audio File Library + Copyright (C) 1999, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + compression.h +*/ + +#ifndef COMPRESSION_H +#define COMPRESSION_H + +/* Provide an index into _af_compression given a compression id. */ +int _af_compression_index_from_id (int compressionid); + +#endif diff --git a/libaudiofile/data.c b/libaudiofile/data.c new file mode 100644 index 0000000..f02daed --- /dev/null +++ b/libaudiofile/data.c @@ -0,0 +1,242 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + data.c +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" +#include "modules.h" + +int afWriteFrames (AFfilehandle file, int trackid, const void *samples, + int nvframes2write) +{ + _AFmoduleinst *firstmod; + _AFchunk *userc; + _Track *track; + int bytes_per_vframe; + AFframecount vframe; + + if (!_af_filehandle_ok(file)) + return -1; + + if (!_af_filehandle_can_write(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (track->ms.modulesdirty) + { + if (_AFsetupmodules(file, track) != AF_SUCCEED) + return -1; + } + + /*if (file->seekok) {*/ + + if (af_fseek(file->fh, track->fpos_next_frame, SEEK_SET) < 0) + { + _af_error(AF_BAD_LSEEK, "unable to position write pointer at next frame"); + return -1; + } + + /* } */ + + bytes_per_vframe = _af_format_frame_size(&track->v, AF_TRUE); + + firstmod = &track->ms.module[0]; + userc = &track->ms.chunk[0]; + + track->filemodhappy = AF_TRUE; + + vframe = 0; +#ifdef UNLIMITED_CHUNK_NVFRAMES + /* + OPTIMIZATION: see the comment at the very end of + arrangemodules() in modules.c for an explanation of this: + */ + if (!trk->ms.mustuseatomicnvframes) + { + userc->buf = (char *)buf; + userc->nframes = nvframes2write; + + (*firstmod->mod->run_push)(firstmod); + + /* Count this chunk if there was no i/o error. */ + if (trk->filemodhappy) + vframe += userc->nframes; + } + else +#else + /* Optimization must be off. */ + assert(track->ms.mustuseatomicnvframes); +#endif + { + while (vframe < nvframes2write) + { + userc->buf = (char *) samples + bytes_per_vframe * vframe; + if (vframe <= nvframes2write - _AF_ATOMIC_NVFRAMES) + userc->nframes = _AF_ATOMIC_NVFRAMES; + else + userc->nframes = nvframes2write - vframe; + + (*firstmod->mod->run_push)(firstmod); + + if (track->filemodhappy == AF_FALSE) + break; + + vframe += userc->nframes; + } + } + + track->nextvframe += vframe; + track->totalvframes += vframe; + + return vframe; +} + +int afReadFrames (AFfilehandle file, int trackid, void *samples, + int nvframeswanted) +{ + _Track *track; + _AFmoduleinst *firstmod; + _AFchunk *userc; + AFframecount nvframesleft, nvframes2read; + int bytes_per_vframe; + AFframecount vframe; + + if (!_af_filehandle_ok(file)) + return -1; + + if (!_af_filehandle_can_read(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (track->ms.modulesdirty) + { + if (_AFsetupmodules(file, track) != AF_SUCCEED) + return -1; + } + + /*if (file->seekok) {*/ + + if (af_fseek(file->fh, track->fpos_next_frame, SEEK_SET) < 0) + { + _af_error(AF_BAD_LSEEK, "unable to position read pointer at next frame"); + return -1; + } + + /* } */ + + if (track->totalvframes == -1) + nvframes2read = nvframeswanted; + else + { + nvframesleft = track->totalvframes - track->nextvframe; + nvframes2read = (nvframeswanted > nvframesleft) ? + nvframesleft : nvframeswanted; + } + bytes_per_vframe = _af_format_frame_size(&track->v, AF_TRUE); + + firstmod = &track->ms.module[track->ms.nmodules-1]; + userc = &track->ms.chunk[track->ms.nmodules]; + + track->filemodhappy = AF_TRUE; + + vframe = 0; + + if (!track->ms.mustuseatomicnvframes) + { + assert(track->frames2ignore == 0); + userc->buf = samples; + userc->nframes = nvframes2read; + + (*firstmod->mod->run_pull)(firstmod); + if (track->filemodhappy) + vframe += userc->nframes; + } + else + { + bool eof = AF_FALSE; + + if (track->frames2ignore != 0) + { + userc->nframes = track->frames2ignore; + userc->buf = _af_malloc(track->frames2ignore * bytes_per_vframe); + if (userc->buf == AF_NULL) + return 0; + + (*firstmod->mod->run_pull)(firstmod); + + /* Have we hit EOF? */ + if (userc->nframes < track->frames2ignore) + eof = AF_TRUE; + + track->frames2ignore = 0; + + free(userc->buf); + userc->buf = NULL; + } + + /* + Now start reading useful frames, until EOF or + premature EOF. + */ + + while (track->filemodhappy && !eof && vframe < nvframes2read) + { + AFframecount nvframes2pull; + userc->buf = (char *) samples + bytes_per_vframe * vframe; + + if (vframe <= nvframes2read - _AF_ATOMIC_NVFRAMES) + nvframes2pull = _AF_ATOMIC_NVFRAMES; + else + nvframes2pull = nvframes2read - vframe; + + userc->nframes = nvframes2pull; + + (*firstmod->mod->run_pull)(firstmod); + + if (track->filemodhappy) + { + vframe += userc->nframes; + if (userc->nframes < nvframes2pull) + eof = AF_TRUE; + } + } + } + + track->nextvframe += vframe; + + return vframe; +} diff --git a/libaudiofile/debug.c b/libaudiofile/debug.c new file mode 100644 index 0000000..c075357 --- /dev/null +++ b/libaudiofile/debug.c @@ -0,0 +1,417 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + debug.c + + This file contains debugging routines for the Audio File + Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include <assert.h> + +#include "audiofile.h" +#include "aupvlist.h" + +#include "afinternal.h" +#include "util.h" +#include "units.h" +#include "compression.h" +#include "modules.h" +#include "byteorder.h" +#include "aupvinternal.h" +#include "print.h" +#include "debug.h" + +extern _CompressionUnit _af_compression[]; + +void _af_printid (u_int32_t id) +{ + printf("%c%c%c%c", + (id >> 24) & 0xff, + (id >> 16) & 0xff, + (id >> 8) & 0xff, + id & 0xff); +} + +void _af_print_pvlist (AUpvlist list) +{ + int i; + + assert(list); + + printf("list.valid: %d\n", list->valid); + printf("list.count: %d\n", list->count); + + for (i=0; i<list->count; i++) + { + printf("item %d valid %d, should be %d\n", + i, list->items[i].valid, _AU_VALID_PVITEM); + + switch (list->items[i].type) + { + case AU_PVTYPE_LONG: + printf("item #%d, parameter %d, long: %ld\n", + i, list->items[i].parameter, + list->items[i].value.l); + break; + case AU_PVTYPE_DOUBLE: + printf("item #%d, parameter %d, double: %f\n", + i, list->items[i].parameter, + list->items[i].value.d); + break; + case AU_PVTYPE_PTR: + printf("item #%d, parameter %d, pointer: %p\n", + i, list->items[i].parameter, + list->items[i].value.v); + break; + + default: + printf("item #%d, invalid type %d\n", i, + list->items[i].type); + assert(0); + break; + } + } +} + +void _af_print_audioformat (_AudioFormat *fmt) +{ + /* sampleRate, channelCount */ + printf("{ %7.2f Hz %d ch ", fmt->sampleRate, fmt->channelCount); + + /* sampleFormat, sampleWidth */ + switch (fmt->sampleFormat) + { + case AF_SAMPFMT_TWOSCOMP: + printf("%db 2 ", fmt->sampleWidth); + break; + case AF_SAMPFMT_UNSIGNED: + printf("%db u ", fmt->sampleWidth); + break; + case AF_SAMPFMT_FLOAT: + printf("flt "); + break; + case AF_SAMPFMT_DOUBLE: + printf("dbl "); + break; + default: + printf("%dsampfmt? ", fmt->sampleFormat); + } + + /* pcm */ + printf("(%.30g+-%.30g [%.30g,%.30g]) ", + fmt->pcm.intercept, fmt->pcm.slope, + fmt->pcm.minClip, fmt->pcm.maxClip); + + /* byteOrder */ + switch (fmt->byteOrder) + { + case AF_BYTEORDER_BIGENDIAN: + printf("big "); + break; + case AF_BYTEORDER_LITTLEENDIAN: + printf("little "); + break; + default: + printf("%dbyteorder? ", fmt->byteOrder); + break; + } + + /* compression */ + { + int idx = _af_compression_index_from_id(fmt->compressionType); + if (idx < 0) + { + printf("%dcompression?", fmt->compressionType); + } + else if (fmt->compressionType == AF_COMPRESSION_NONE) + printf("pcm"); + else + printf("%s", _af_compression[idx].label); + } + + printf(" }"); +} + +void _af_print_tracks (AFfilehandle filehandle) +{ + int i; + for (i=0; i<filehandle->trackCount; i++) + { + _Track *track = &filehandle->tracks[i]; + printf("track %d\n", i); + printf(" id %d\n", track->id); + printf(" sample format\n"); + _af_print_audioformat(&track->f); + printf(" virtual format\n"); + _af_print_audioformat(&track->v); + printf(" total file frames: %" AF_FRAMECOUNT_PRINT_FMT "\n", + track->totalfframes); + printf(" total virtual frames: %" AF_FRAMECOUNT_PRINT_FMT "\n", + track->totalvframes); + printf(" next file frame: %" AF_FRAMECOUNT_PRINT_FMT "\n", + track->nextfframe); + printf(" next virtual frame: %" AF_FRAMECOUNT_PRINT_FMT "\n", + track->nextvframe); + printf(" frames to ignore: %" AF_FRAMECOUNT_PRINT_FMT "\n", + track->frames2ignore); + + printf(" data_size: %" AF_FILEOFFSET_PRINT_FMT "\n", + track->data_size); + printf(" fpos_first_frame: %" AF_FILEOFFSET_PRINT_FMT "\n", + track->fpos_first_frame); + printf(" fpos_next_frame: %" AF_FILEOFFSET_PRINT_FMT "\n", + track->fpos_next_frame); + printf(" fpos_after_data: %" AF_FILEOFFSET_PRINT_FMT "\n", + track->fpos_after_data); + + printf(" channel matrix:"); + _af_print_channel_matrix(track->channelMatrix, + track->f.channelCount, track->v.channelCount); + printf("\n"); + + printf(" marker count: %d\n", track->markerCount); + } +} + +void _af_print_filehandle (AFfilehandle filehandle) +{ + printf("file handle: 0x%p\n", filehandle); + + if (filehandle->valid == _AF_VALID_FILEHANDLE) + printf("valid\n"); + else + printf("invalid!\n"); + + printf(" access: "); + if (filehandle->access == _AF_READ_ACCESS) + putchar('r'); + else + putchar('w'); + + printf(" fileFormat: %d\n", filehandle->fileFormat); + + printf(" instrument count: %d\n", filehandle->instrumentCount); + printf(" instruments: 0x%p\n", filehandle->instruments); + + printf(" miscellaneous count: %d\n", filehandle->miscellaneousCount); + printf(" miscellaneous: 0x%p\n", filehandle->miscellaneous); + + printf(" trackCount: %d\n", filehandle->trackCount); + printf(" tracks: 0x%p\n", filehandle->tracks); + _af_print_tracks(filehandle); +} + +void _af_print_channel_matrix (double *matrix, int fchans, int vchans) +{ + int v, f; + + if (!matrix) + { + printf("NULL"); + return; + } + + printf("{"); + for (v=0; v < vchans; v++) + { + if (v) printf(" "); + printf("{"); + for (f=0; f < fchans; f++) + { + if (f) printf(" "); + printf("%5.2f", *(matrix + v*fchans + f)); + } + printf("}"); + } + printf("}"); +} + +void _af_print_frame (AFframecount frameno, double *frame, int nchannels, + char *formatstring, int numberwidth, + double slope, double intercept, double minclip, double maxclip) +{ + char linebuf[81]; + int wavewidth = wavewidth = 78 - numberwidth*nchannels - 6; + int c; + + memset(linebuf, ' ', 80); + linebuf[0] = '|'; + linebuf[wavewidth-1] = '|'; + linebuf[wavewidth] = 0; + + printf("%05" AF_FRAMECOUNT_PRINT_FMT " ", frameno); + + for (c=0; c < nchannels; c++) + { + double pcm = frame[c]; + printf(formatstring, pcm); + } + for (c=0; c < nchannels; c++) + { + double pcm = frame[c], volts; + if (maxclip > minclip) + { + if (pcm < minclip) pcm = minclip; + if (pcm > maxclip) pcm = maxclip; + } + volts = (pcm - intercept) / slope; + linebuf[(int)((volts/2 + 0.5)*(wavewidth-3)) + 1] = '0' + c; + } + printf("%s\n", linebuf); +} + +void _af_print_chunk (_AFchunk *chnk) +{ + _AudioFormat fmt = chnk->f; + AFframecount nframes = chnk->nframes; + AFframecount nsamps = nframes * fmt.channelCount; + AFframecount fr; + + double *outbuf; + char formatstring[20]; + int digits, numberwidth; + + switch (fmt.compressionType) + { + case AF_COMPRESSION_NONE: + break; + + case AF_COMPRESSION_G711_ULAW: + printf("WARNING dumping ulaw data as if it were 8-bit unsigned\n"); + fmt.compressionType = AF_COMPRESSION_NONE; + fmt.sampleWidth = 8; + fmt.sampleFormat = AF_SAMPFMT_UNSIGNED; + break; + + default: + printf("LAME-O chunk dumper cannot deal with '%s' compression\n", + _af_compression[_af_compression_index_from_id(fmt.compressionType)].name); + return; + } + + if (fmt.sampleWidth > 8 && fmt.byteOrder != _AF_BYTEORDER_NATIVE) + { + printf("LAME-O chunk dumper cannot deal with non-native byte order\n"); + return; + } + +#define transfer(type) \ + { \ + int s; \ + for(s=0; s < nsamps; s++) \ + outbuf[s] = (double)(((type *)chnk->buf)[s]); \ + } + + /* Make the buffer large enough to hold doubles. */ + outbuf = malloc(sizeof(double) * nsamps); + + switch (fmt.sampleFormat) + { + case AF_SAMPFMT_DOUBLE: + case AF_SAMPFMT_FLOAT: + { + if (fmt.sampleFormat == AF_SAMPFMT_DOUBLE) + { + transfer(double); + } + else + { + transfer(float); + } + + digits = (int) log10(fmt.pcm.intercept + fabs(fmt.pcm.slope)) + 1; + /* Account for the sign character. */ + digits += 1; + + if (digits > 4) + { + sprintf(formatstring, "%%%d.0f ", digits); + numberwidth = digits + 1; + } + else + { + sprintf(formatstring, "%%%d.2f ", digits+3); + numberwidth = digits + 3 + 1; + } + } + break; + + case AF_SAMPFMT_TWOSCOMP: + case AF_SAMPFMT_UNSIGNED: + { + bool issigned = (fmt.sampleFormat==AF_SAMPFMT_TWOSCOMP); + + /* # of bytes taken by the value */ + int realbytes = _af_format_sample_size_uncompressed(&fmt, AF_TRUE); + + switch (realbytes) + { + case 1: + if (issigned) { transfer(schar1); } + else { transfer(uchar1); } + break; + case 2: + if (issigned) { transfer(schar2); } + else { transfer(uchar2); } + break; + case 4: + if (issigned) { transfer(schar4); } + else { transfer(uchar4); } + break; + default: + printf("LAME-O chunk dumper cannot deal with %d bits\n", + realbytes*8); + free(outbuf); + return; + } + + digits = (int) log10(fmt.pcm.intercept + fabs(fmt.pcm.slope)) + 1; + if (issigned) + digits++; + + sprintf(formatstring, "%%%d.0f ", digits); + numberwidth = digits + 1; + } + break; + + default: + assert(0); + return; + } + + for (fr=0; fr < nframes; fr++) + _af_print_frame(fr, &outbuf[fr*fmt.channelCount], + fmt.channelCount, formatstring, numberwidth, + fmt.pcm.slope, fmt.pcm.intercept, + fmt.pcm.minClip, fmt.pcm.maxClip); + + free(outbuf); +} diff --git a/libaudiofile/debug.h b/libaudiofile/debug.h new file mode 100644 index 0000000..bdcfbf5 --- /dev/null +++ b/libaudiofile/debug.h @@ -0,0 +1,47 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + debug.h + + This header file declares debugging functions for the Audio + File Library. +*/ + +#ifndef DEBUG_H +#define DEBUG_H + +#include <sys/types.h> +#include "audiofile.h" +#include "afinternal.h" + +void _af_printid (u_int32_t id); +void _af_print_filehandle (AFfilehandle filehandle); +void _af_print_tracks (AFfilehandle filehandle); +void _af_print_channel_matrix (double *matrix, int fchans, int vchans); +void _af_print_pvlist (AUpvlist list); + +void _af_print_audioformat (_AudioFormat *format); +void _af_print_chunk (_AFchunk *chunk); +void _af_print_frame (AFframecount frameno, double *frame, int nchannels, + char *formatstring, int numberwidth, + double slope, double intercept, double minclip, double maxclip); + +#endif diff --git a/libaudiofile/error.c b/libaudiofile/error.c new file mode 100644 index 0000000..108e939 --- /dev/null +++ b/libaudiofile/error.c @@ -0,0 +1,71 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + error.c + + This file contains the routines used in the Audio File Library's + error handling. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include "audiofile.h" + +static void defaultErrorFunction (long error, const char *str); + +static AFerrfunc errorFunction = defaultErrorFunction; + +AFerrfunc afSetErrorHandler (AFerrfunc efunc) +{ + AFerrfunc old; + + old = errorFunction; + errorFunction = efunc; + + return old; +} + +static void defaultErrorFunction (long error, const char *str) +{ + fprintf(stderr, "Audio File Library: "); + fprintf(stderr, "%s", str); + fprintf(stderr, " [error %ld]\n", error); +} + +void _af_error (int errorCode, const char *fmt, ...) +{ + char buf[1024]; + va_list ap; + + va_start(ap, fmt); + + vsnprintf(buf, 1024, fmt, ap); + + va_end(ap); + + if (errorFunction != NULL) + errorFunction(errorCode, buf); +} diff --git a/libaudiofile/error.h b/libaudiofile/error.h new file mode 100644 index 0000000..e3d54f6 --- /dev/null +++ b/libaudiofile/error.h @@ -0,0 +1,26 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +#ifndef ERROR_H +#define ERROR_H + +void _af_error (int errorCode, const char *fmt, ...); + +#endif diff --git a/libaudiofile/extended.c b/libaudiofile/extended.c new file mode 100644 index 0000000..b3050b7 --- /dev/null +++ b/libaudiofile/extended.c @@ -0,0 +1,175 @@ +#include <math.h> +#include "extended.h" + +/* + * C O N V E R T T O I E E E E X T E N D E D + */ + +/* Copyright (C) 1988-1991 Apple Computer, Inc. + * All rights reserved. + * + * Machine-independent I/O routines for IEEE floating-point numbers. + * + * NaN's and infinities are converted to HUGE_VAL or HUGE, which + * happens to be infinity on IEEE machines. Unfortunately, it is + * impossible to preserve NaN's in a machine-independent way. + * Infinities are, however, preserved on IEEE machines. + * + * These routines have been tested on the following machines: + * Apple Macintosh, MPW 3.1 C compiler + * Apple Macintosh, THINK C compiler + * Silicon Graphics IRIS, MIPS compiler + * Cray X/MP and Y/MP + * Digital Equipment VAX + * + * + * Implemented by Malcolm Slaney and Ken Turkowski. + * + * Malcolm Slaney contributions during 1988-1990 include big- and little- + * endian file I/O, conversion to and from Motorola's extended 80-bit + * floating-point format, and conversions to and from IEEE single- + * precision floating-point format. + * + * In 1991, Ken Turkowski implemented the conversions to and from + * IEEE double-precision format, added more precision to the extended + * conversions, and accommodated conversions involving +/- infinity, + * NaN's, and denormalized numbers. + */ + +#ifndef HUGE_VAL +#define HUGE_VAL HUGE +#endif /*HUGE_VAL*/ + +#define FloatToUnsigned(f) ((unsigned long) (((long) (f - 2147483648.0)) + 2147483647L) + 1) + +void _af_convert_to_ieee_extended (double num, unsigned char *bytes) +{ + int sign; + int expon; + double fMant, fsMant; + unsigned long hiMant, loMant; + + if (num < 0) { + sign = 0x8000; + num *= -1; + } else { + sign = 0; + } + + if (num == 0) { + expon = 0; hiMant = 0; loMant = 0; + } + else { + fMant = frexp(num, &expon); + if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */ + expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */ + } + else { /* Finite */ + expon += 16382; + if (expon < 0) { /* denormalized */ + fMant = ldexp(fMant, expon); + expon = 0; + } + expon |= sign; + fMant = ldexp(fMant, 32); + fsMant = floor(fMant); + hiMant = FloatToUnsigned(fsMant); + fMant = ldexp(fMant - fsMant, 32); + fsMant = floor(fMant); + loMant = FloatToUnsigned(fsMant); + } + } + + bytes[0] = expon >> 8; + bytes[1] = expon; + bytes[2] = hiMant >> 24; + bytes[3] = hiMant >> 16; + bytes[4] = hiMant >> 8; + bytes[5] = hiMant; + bytes[6] = loMant >> 24; + bytes[7] = loMant >> 16; + bytes[8] = loMant >> 8; + bytes[9] = loMant; +} + +/* + * C O N V E R T F R O M I E E E E X T E N D E D + */ + +/* + * Copyright (C) 1988-1991 Apple Computer, Inc. + * All rights reserved. + * + * Machine-independent I/O routines for IEEE floating-point numbers. + * + * NaN's and infinities are converted to HUGE_VAL or HUGE, which + * happens to be infinity on IEEE machines. Unfortunately, it is + * impossible to preserve NaN's in a machine-independent way. + * Infinities are, however, preserved on IEEE machines. + * + * These routines have been tested on the following machines: + * Apple Macintosh, MPW 3.1 C compiler + * Apple Macintosh, THINK C compiler + * Silicon Graphics IRIS, MIPS compiler + * Cray X/MP and Y/MP + * Digital Equipment VAX + * + * + * Implemented by Malcolm Slaney and Ken Turkowski. + * + * Malcolm Slaney contributions during 1988-1990 include big- and little- + * endian file I/O, conversion to and from Motorola's extended 80-bit + * floating-point format, and conversions to and from IEEE single- + * precision floating-point format. + * + * In 1991, Ken Turkowski implemented the conversions to and from + * IEEE double-precision format, added more precision to the extended + * conversions, and accommodated conversions involving +/- infinity, + * NaN's, and denormalized numbers. + */ + +#ifndef HUGE_VAL +# define HUGE_VAL HUGE +#endif /*HUGE_VAL*/ + +# define UnsignedToFloat(u) (((double) ((long) (u - 2147483647L - 1))) + 2147483648.0) + +/**************************************************************** + * Extended precision IEEE floating-point conversion routine. + ****************************************************************/ + +double _af_convert_from_ieee_extended (const unsigned char *bytes) +{ + double f; + int expon; + unsigned long hiMant, loMant; + + expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF); + hiMant = ((unsigned long)(bytes[2] & 0xFF) << 24) + | ((unsigned long) (bytes[3] & 0xFF) << 16) + | ((unsigned long) (bytes[4] & 0xFF) << 8) + | ((unsigned long) (bytes[5] & 0xFF)); + loMant = ((unsigned long) (bytes[6] & 0xFF) << 24) + | ((unsigned long) (bytes[7] & 0xFF) << 16) + | ((unsigned long) (bytes[8] & 0xFF) << 8) + | ((unsigned long) (bytes[9] & 0xFF)); + + if (expon == 0 && hiMant == 0 && loMant == 0) { + f = 0; + } + else { + if (expon == 0x7FFF) { /* Infinity or NaN */ + f = HUGE_VAL; + } + else { + expon -= 16383; + f = ldexp(UnsignedToFloat(hiMant), expon-=31); + f += ldexp(UnsignedToFloat(loMant), expon-=32); + } + } + + if (bytes[0] & 0x80) + return -f; + else + return f; +} diff --git a/libaudiofile/extended.h b/libaudiofile/extended.h new file mode 100644 index 0000000..c07f853 --- /dev/null +++ b/libaudiofile/extended.h @@ -0,0 +1,34 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + extended.h + + This file defines interfaces to Apple's extended floating-point + conversion routines. +*/ + +#ifndef EXTENDED_H +#define EXTENDED_H + +void _af_convert_to_ieee_extended (double num, unsigned char *bytes); +double _af_convert_from_ieee_extended (const unsigned char *bytes); + +#endif diff --git a/libaudiofile/format.c b/libaudiofile/format.c new file mode 100644 index 0000000..6ee0361 --- /dev/null +++ b/libaudiofile/format.c @@ -0,0 +1,396 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + audiofile.c + + This file implements many of the main interface routines of the + Audio File Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "audiofile.h" +#include "util.h" +#include "afinternal.h" +#include "afinternal.h" +#include "units.h" +#include "modules.h" + +extern _Unit _af_units[]; + +AFfileoffset afGetDataOffset (AFfilehandle file, int trackid) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->fpos_first_frame; +} + +AFfileoffset afGetTrackBytes (AFfilehandle file, int trackid) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + track = _af_filehandle_get_track(file, trackid); + + return track->data_size; +} + +/* + afGetFrameSize returns the size (in bytes) of a sample frame from + the specified track of an audio file. + + stretch3to4 == AF_TRUE: size which user sees + stretch3to4 == AF_FALSE: size used in file +*/ +float afGetFrameSize (AFfilehandle file, int trackid, int stretch3to4) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return _af_format_frame_size(&track->f, stretch3to4); +} + +float afGetVirtualFrameSize (AFfilehandle file, int trackid, int stretch3to4) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return _af_format_frame_size(&track->v, stretch3to4); +} + +AFframecount afSeekFrame (AFfilehandle file, int trackid, AFframecount frame) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if (!_af_filehandle_can_read(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (track->ms.modulesdirty) + if (_AFsetupmodules(file, track) != AF_SUCCEED) + return -1; + + if (frame < 0) + return track->nextvframe; + + /* Optimize the case of seeking to the current position. */ + if (frame == track->nextvframe) + return track->nextvframe; + + /* Limit request to the number of frames in the file. */ + if (track->totalvframes != -1) + if (frame > track->totalvframes) + frame = track->totalvframes - 1; + + /* + Now that the modules are not dirty and frame + represents a valid virtual frame, we call + _AFsetupmodules again after setting track->nextvframe. + + _AFsetupmodules will look at track->nextvframe and + compute track->nextfframe in clever and mysterious + ways. + */ + track->nextvframe = frame; + + if (_AFsetupmodules(file, track) != AF_SUCCEED) + return -1; + + return track->nextvframe; +} + +AFfileoffset afTellFrame (AFfilehandle file, int trackid) +{ + return afSeekFrame(file, trackid, -1); +} + +int afSetVirtualByteOrder (AFfilehandle handle, int track, int byteorder) +{ + _Track *currentTrack; + + if (!_af_filehandle_ok(handle)) + return -1; + + if (NULL == (currentTrack = _af_filehandle_get_track(handle, track))) + return AF_FAIL; + + if (byteorder != AF_BYTEORDER_BIGENDIAN && + byteorder != AF_BYTEORDER_LITTLEENDIAN) + { + _af_error(AF_BAD_BYTEORDER, "invalid byte order %d", byteorder); + return AF_FAIL; + } + + currentTrack->v.byteOrder = byteorder; + currentTrack->ms.modulesdirty = AF_TRUE; + + return AF_SUCCEED; +} + +int afGetByteOrder (AFfilehandle handle, int track) +{ + _Track *currentTrack; + + if (!_af_filehandle_ok(handle)) + return -1; + + if ((currentTrack = _af_filehandle_get_track(handle, track)) == NULL) + return -1; + + return (currentTrack->f.byteOrder); +} + +int afGetVirtualByteOrder (AFfilehandle handle, int track) +{ + _Track *currentTrack; + + if (!_af_filehandle_ok(handle)) + return -1; + + if ((currentTrack = _af_filehandle_get_track(handle, track)) == NULL) + return -1; + + return (currentTrack->v.byteOrder); +} + +AFframecount afGetFrameCount (AFfilehandle file, int trackid) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (track->ms.modulesdirty) + { + if (_AFsetupmodules(file, track) != AF_SUCCEED) + return -1; + } + + return track->totalvframes; +} + +double afGetRate (AFfilehandle file, int trackid) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->f.sampleRate; +} + +int afGetChannels (AFfilehandle file, int trackid) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->f.channelCount; +} + +void afGetSampleFormat (AFfilehandle file, int trackid, int *sampleFormat, int *sampleWidth) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (sampleFormat != NULL) + *sampleFormat = track->f.sampleFormat; + + if (sampleFormat != NULL) + *sampleWidth = track->f.sampleWidth; +} + +void afGetVirtualSampleFormat (AFfilehandle file, int trackid, int *sampleFormat, int *sampleWidth) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (sampleFormat != NULL) + *sampleFormat = track->v.sampleFormat; + + if (sampleFormat != NULL) + *sampleWidth = track->v.sampleWidth; +} + +int afSetVirtualSampleFormat (AFfilehandle file, int trackid, + int sampleFormat, int sampleWidth) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (_af_set_sample_format(&track->v, sampleFormat, sampleWidth) == AF_FAIL) + return -1; + + track->ms.modulesdirty = AF_TRUE; + + return 0; +} + +/* XXXmpruett fix the version */ +int afGetFileFormat (AFfilehandle file, int *version) +{ + if (!_af_filehandle_ok(file)) + return -1; + + if (version != NULL) + { + if (_af_units[file->fileFormat].getversion) + *version = _af_units[file->fileFormat].getversion(file); + else + *version = 0; + } + + return file->fileFormat; +} + +int afSetVirtualChannels (AFfilehandle file, int trackid, int channelCount) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + track->v.channelCount = channelCount; + track->ms.modulesdirty = AF_TRUE; + + if (track->channelMatrix) + free(track->channelMatrix); + track->channelMatrix = NULL; + + return 0; +} + +double afGetVirtualRate (AFfilehandle file, int trackid) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->v.sampleRate; +} + +int afSetVirtualRate (AFfilehandle file, int trackid, double rate) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (rate < 0) + { + _af_error(AF_BAD_RATE, "invalid sampling rate %.30g", rate); + return -1; + } + + track->v.sampleRate = rate; + track->ms.modulesdirty = AF_TRUE; + + return 0; +} + +void afSetChannelMatrix (AFfilehandle file, int trackid, double* matrix) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (track->channelMatrix != NULL) + free(track->channelMatrix); + track->channelMatrix = NULL; + + if (matrix != NULL) + { + int i, size; + + size = track->v.channelCount * track->f.channelCount; + + track->channelMatrix = (double *) malloc(size * sizeof (double)); + + for (i = 0; i < size; i++) + track->channelMatrix[i] = matrix[i]; + } +} + +int afGetVirtualChannels (AFfilehandle file, int trackid) +{ + _Track *track; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + return track->v.channelCount; +} diff --git a/libaudiofile/g711.c b/libaudiofile/g711.c new file mode 100644 index 0000000..57099fe --- /dev/null +++ b/libaudiofile/g711.c @@ -0,0 +1,288 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#define SUPERCEDED + +/* + * g711.c + * + * u-law, A-law and linear PCM conversions. + */ +#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */ +#define QUANT_MASK (0xf) /* Quantization field mask. */ +#define NSEGS (8) /* Number of A-law segments. */ +#define SEG_SHIFT (4) /* Left shift for segment number. */ +#define SEG_MASK (0x70) /* Segment field mask. */ + +/* copy from CCITT G.711 specifications */ +static unsigned char _u2a[128] = { /* u- to A-law conversions */ + 1, 1, 2, 2, 3, 3, 4, 4, + 5, 5, 6, 6, 7, 7, 8, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 27, 29, 31, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, + 46, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, + 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128}; + +static unsigned char _a2u[128] = { /* A- to u-law conversions */ + 1, 3, 5, 7, 9, 11, 13, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 32, 33, 33, 34, 34, 35, 35, + 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 48, 49, 49, + 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 64, + 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127}; + +/* see libst.h */ +#ifdef SUPERCEDED + +static short seg_end[8] = {0xFF, 0x1FF, 0x3FF, 0x7FF, + 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF}; + +static int +search(val, table, size) + int val; + short *table; + int size; +{ + int i; + + for (i = 0; i < size; i++) { + if (val <= *table++) + return (i); + } + return (size); +} + +/* + * linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law + * + * linear2alaw() accepts an 16-bit integer and encodes it as A-law data. + * + * Linear Input Code Compressed Code + * ------------------------ --------------- + * 0000000wxyza 000wxyz + * 0000001wxyza 001wxyz + * 000001wxyzab 010wxyz + * 00001wxyzabc 011wxyz + * 0001wxyzabcd 100wxyz + * 001wxyzabcde 101wxyz + * 01wxyzabcdef 110wxyz + * 1wxyzabcdefg 111wxyz + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ +unsigned char +_af_linear2alaw(pcm_val) + int pcm_val; /* 2's complement (16-bit range) */ +{ + int mask; + int seg; + unsigned char aval; + + if (pcm_val >= 0) { + mask = 0xD5; /* sign (7th) bit = 1 */ + } else { + mask = 0x55; /* sign bit = 0 */ + pcm_val = -pcm_val - 8; + } + + /* Convert the scaled magnitude to segment number. */ + seg = search(pcm_val, seg_end, 8); + + /* Combine the sign, segment, and quantization bits. */ + + if (seg >= 8) /* out of range, return maximum value. */ + return (0x7F ^ mask); + else { + aval = seg << SEG_SHIFT; + if (seg < 2) + aval |= (pcm_val >> 4) & QUANT_MASK; + else + aval |= (pcm_val >> (seg + 3)) & QUANT_MASK; + return (aval ^ mask); + } +} + +/* + * alaw2linear() - Convert an A-law value to 16-bit linear PCM + * + */ +int +_af_alaw2linear(a_val) + unsigned char a_val; +{ + int t; + int seg; + + a_val ^= 0x55; + + t = (a_val & QUANT_MASK) << 4; + seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; + switch (seg) { + case 0: + t += 8; + break; + case 1: + t += 0x108; + break; + default: + t += 0x108; + t <<= seg - 1; + } + return ((a_val & SIGN_BIT) ? t : -t); +} + +#define BIAS (0x84) /* Bias for linear code. */ + +/* + * linear2ulaw() - Convert a linear PCM value to u-law + * + * In order to simplify the encoding process, the original linear magnitude + * is biased by adding 33 which shifts the encoding range from (0 - 8158) to + * (33 - 8191). The result can be seen in the following encoding table: + * + * Biased Linear Input Code Compressed Code + * ------------------------ --------------- + * 00000001wxyza 000wxyz + * 0000001wxyzab 001wxyz + * 000001wxyzabc 010wxyz + * 00001wxyzabcd 011wxyz + * 0001wxyzabcde 100wxyz + * 001wxyzabcdef 101wxyz + * 01wxyzabcdefg 110wxyz + * 1wxyzabcdefgh 111wxyz + * + * Each biased linear code has a leading 1 which identifies the segment + * number. The value of the segment number is equal to 7 minus the number + * of leading 0's. The quantization interval is directly available as the + * four bits wxyz. * The trailing bits (a - h) are ignored. + * + * Ordinarily the complement of the resulting code word is used for + * transmission, and so the code word is complemented before it is returned. + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +/* 2's complement (16-bit range) */ +unsigned char _af_linear2ulaw (int pcm_val) +{ + int mask; + int seg; + unsigned char uval; + + /* Get the sign and the magnitude of the value. */ + if (pcm_val < 0) { + pcm_val = BIAS - pcm_val; + mask = 0x7F; + } else { + pcm_val += BIAS; + mask = 0xFF; + } + + /* Convert the scaled magnitude to segment number. */ + seg = search(pcm_val, seg_end, 8); + + /* + * Combine the sign, segment, quantization bits; + * and complement the code word. + */ + if (seg >= 8) /* out of range, return maximum value. */ + return (0x7F ^ mask); + else { + uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0xF); + return (uval ^ mask); + } + +} + +/* + * ulaw2linear() - Convert a u-law value to 16-bit linear PCM + * + * First, a biased linear code is derived from the code word. An unbiased + * output can then be obtained by subtracting 33 from the biased code. + * + * Note that this function expects to be passed the complement of the + * original code word. This is in keeping with ISDN conventions. + */ +int _af_ulaw2linear (unsigned char u_val) +{ + int t; + + /* Complement to obtain normal u-law value. */ + u_val = ~u_val; + + /* + * Extract and bias the quantization bits. Then + * shift up by the segment number and subtract out the bias. + */ + t = ((u_val & QUANT_MASK) << 3) + BIAS; + t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT; + + return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS)); +} + +#endif + +/* A-law to u-law conversion */ +static unsigned char +alaw2ulaw(aval) + unsigned char aval; +{ + aval &= 0xff; + return ((aval & 0x80) ? (0xFF ^ _a2u[aval ^ 0xD5]) : + (0x7F ^ _a2u[aval ^ 0x55])); +} + +/* u-law to A-law conversion */ +static unsigned char +ulaw2alaw(uval) + unsigned char uval; +{ + uval &= 0xff; + return ((uval & 0x80) ? (0xD5 ^ (_u2a[0xFF ^ uval] - 1)) : + (0x55 ^ (_u2a[0x7F ^ uval] - 1))); +} diff --git a/libaudiofile/g711.h b/libaudiofile/g711.h new file mode 100644 index 0000000..0423ffe --- /dev/null +++ b/libaudiofile/g711.h @@ -0,0 +1,111 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * g711.h + * + * u-law, A-law and linear PCM conversions. + */ + +#ifndef G711_H +#define G711_H + +/* + * linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law + * + * linear2alaw() accepts an 16-bit integer and encodes it as A-law data. + * + * Linear Input Code Compressed Code + * ------------------------ --------------- + * 0000000wxyza 000wxyz + * 0000001wxyza 001wxyz + * 000001wxyzab 010wxyz + * 00001wxyzabc 011wxyz + * 0001wxyzabcd 100wxyz + * 001wxyzabcde 101wxyz + * 01wxyzabcdef 110wxyz + * 1wxyzabcdefg 111wxyz + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +/* pcm_val is 2's complement (16-bit range) */ +unsigned char _af_linear2alaw (int pcm_val); + +/* + * alaw2linear() - Convert an A-law value to 16-bit linear PCM + * + */ + +int _af_alaw2linear (unsigned char a_val); + +/* + * linear2ulaw() - Convert a linear PCM value to u-law + * + * In order to simplify the encoding process, the original linear magnitude + * is biased by adding 33 which shifts the encoding range from (0 - 8158) to + * (33 - 8191). The result can be seen in the following encoding table: + * + * Biased Linear Input Code Compressed Code + * ------------------------ --------------- + * 00000001wxyza 000wxyz + * 0000001wxyzab 001wxyz + * 000001wxyzabc 010wxyz + * 00001wxyzabcd 011wxyz + * 0001wxyzabcde 100wxyz + * 001wxyzabcdef 101wxyz + * 01wxyzabcdefg 110wxyz + * 1wxyzabcdefgh 111wxyz + * + * Each biased linear code has a leading 1 which identifies the segment + * number. The value of the segment number is equal to 7 minus the number + * of leading 0's. The quantization interval is directly available as the + * four bits wxyz. * The trailing bits (a - h) are ignored. + * + * Ordinarily the complement of the resulting code word is used for + * transmission, and so the code word is complemented before it is returned. + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +/* pcm_val is 2's complement (16-bit range) */ +unsigned char _af_linear2ulaw (int pcm_val); + +/* + * ulaw2linear() - Convert a u-law value to 16-bit linear PCM + * + * First, a biased linear code is derived from the code word. An unbiased + * output can then be obtained by subtracting 33 from the biased code. + * + * Note that this function expects to be passed the complement of the + * original code word. This is in keeping with ISDN conventions. + */ + +int _af_ulaw2linear (unsigned char u_val); + +#endif /* G711_H */ diff --git a/libaudiofile/iff.c b/libaudiofile/iff.c new file mode 100644 index 0000000..b452339 --- /dev/null +++ b/libaudiofile/iff.c @@ -0,0 +1,332 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + iff.c + + This file contains routines for parsing IFF/8SVX sound + files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" +#include "track.h" +#include "marker.h" + +#include "iff.h" + +static status ParseMiscellaneous (AFfilehandle file, AFvirtualfile *fh, + u_int32_t type, size_t size); +static status ParseVHDR (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); +static status ParseBODY (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); + +_AFfilesetup _af_iff_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_IFF_8SVX, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +bool _af_iff_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[8]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 1, 8, fh) != 8 || memcmp(buffer, "FORM", 4) != 0) + return AF_FALSE; + if (af_fread(buffer, 1, 4, fh) != 4 || memcmp(buffer, "8SVX", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +/* + Parse miscellaneous data chunks such as name, author, copyright, + and annotation chunks. +*/ +static status ParseMiscellaneous (AFfilehandle file, AFvirtualfile *fh, + u_int32_t type, size_t size) +{ + int misctype = AF_MISC_UNRECOGNIZED; + + assert(!memcmp(&type, "NAME", 4) || !memcmp(&type, "AUTH", 4) || + !memcmp(&type, "(c) ", 4) || !memcmp(&type, "ANNO", 4)); + + /* Skip zero-length miscellaneous chunks. */ + if (size == 0) + return AF_FAIL; + + file->miscellaneousCount++; + file->miscellaneous = _af_realloc(file->miscellaneous, + file->miscellaneousCount * sizeof (_Miscellaneous)); + + if (!memcmp(&type, "NAME", 4)) + misctype = AF_MISC_NAME; + else if (!memcmp(&type, "AUTH", 4)) + misctype = AF_MISC_AUTH; + else if (!memcmp(&type, "(c) ", 4)) + misctype = AF_MISC_COPY; + else if (!memcmp(&type, "ANNO", 4)) + misctype = AF_MISC_ANNO; + + file->miscellaneous[file->miscellaneousCount - 1].id = file->miscellaneousCount; + file->miscellaneous[file->miscellaneousCount - 1].type = misctype; + file->miscellaneous[file->miscellaneousCount - 1].size = size; + file->miscellaneous[file->miscellaneousCount - 1].position = 0; + file->miscellaneous[file->miscellaneousCount - 1].buffer = _af_malloc(size); + af_fread(file->miscellaneous[file->miscellaneousCount - 1].buffer, + size, 1, file->fh); + + return AF_SUCCEED; +} + +/* + Parse voice header chunk. +*/ +static status ParseVHDR (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Track *track; + u_int32_t oneShotSamples, repeatSamples, samplesPerRepeat; + u_int16_t sampleRate; + u_int8_t octaves, compression; + u_int32_t volume; + + assert(!memcmp(&type, "VHDR", 4)); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_read_uint32_be(&oneShotSamples, fh); + af_read_uint32_be(&repeatSamples, fh); + af_read_uint32_be(&samplesPerRepeat, fh); + af_read_uint16_be(&sampleRate, fh); + af_fread(&octaves, 1, 1, fh); + af_fread(&compression, 1, 1, fh); + af_read_uint32_be(&volume, fh); + + track->f.sampleWidth = 8; + track->f.sampleRate = sampleRate; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_NONE; + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + track->f.channelCount = 1; + + _af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth); + + return AF_SUCCEED; +} + +static status ParseBODY (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size) +{ + _Track *track; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + /* + IFF/8SVX files have only one audio channel with one + byte per sample, so the number of frames is equal to + the number of bytes. + */ + track->totalfframes = size; + track->data_size = size; + + /* Sound data follows. */ + track->fpos_first_frame = af_ftell(fh); + + return AF_SUCCEED; +} + +status _af_iff_read_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t type, size, formtype; + size_t index; + _Track *track; + + assert(file != NULL); + assert(file->fh != NULL); + + af_fseek(file->fh, 0, SEEK_SET); + + af_fread(&type, 4, 1, file->fh); + af_read_uint32_be(&size, file->fh); + af_fread(&formtype, 4, 1, file->fh); + + if (memcmp(&type, "FORM", 4) != 0 || memcmp(&formtype, "8SVX", 4) != 0) + return AF_FAIL; + + file->instrumentCount = 0; + file->instruments = NULL; + file->miscellaneousCount = 0; + file->miscellaneous = NULL; + + /* IFF/8SVX files have only one track. */ + track = _af_track_new(); + file->trackCount = 1; + file->tracks = track; + + /* Set the index to include the form type ('8SVX' in this case). */ + index = 4; + + while (index < size) + { + u_int32_t chunkid = 0, chunksize = 0; + status result = AF_SUCCEED; + + af_fread(&chunkid, 4, 1, file->fh); + af_read_uint32_be(&chunksize, file->fh); + + if (!memcmp("VHDR", &chunkid, 4)) + { + result = ParseVHDR(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("BODY", &chunkid, 4)) + { + result = ParseBODY(file, file->fh, chunkid, chunksize); + } + else if (!memcmp("NAME", &chunkid, 4) || + !memcmp("AUTH", &chunkid, 4) || + !memcmp("(c) ", &chunkid, 4) || + !memcmp("ANNO", &chunkid, 4)) + { + ParseMiscellaneous(file, file->fh, chunkid, chunksize); + } + + if (result == AF_FAIL) + return AF_FAIL; + + /* + Increment the index by the size of the chunk + plus the size of the chunk header. + */ + index += chunksize + 8; + + /* All chunks must be aligned on an even number of bytes. */ + if ((index % 2) != 0) + index++; + + /* Set the seek position to the beginning of the next chunk. */ + af_fseek(file->fh, index + 8, SEEK_SET); + } + + /* The file has been successfully parsed. */ + return AF_SUCCEED; +} + +AFfilesetup _af_iff_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "IFF/8SVX file must have 1 track"); + return AF_NULL_FILESETUP; + } + + track = &setup->tracks[0]; + + if (track->sampleFormatSet && + track->f.sampleFormat != AF_SAMPFMT_TWOSCOMP) + { + _af_error(AF_BAD_SAMPFMT, + "IFF/8SVX format supports only two's complement integer data"); + return AF_NULL_FILESETUP; + } + + if (track->sampleFormatSet && track->f.sampleWidth != 8) + { + _af_error(AF_BAD_WIDTH, + "IFF/8SVX file allows only 8 bits per sample " + "(%d bits requested)", track->f.sampleWidth); + return AF_NULL_FILESETUP; + } + + if (track->channelCountSet && track->f.channelCount != 1) + { + _af_error(AF_BAD_CHANNELS, + "invalid channel count (%d) for IFF/8SVX format " + "(only 1 channel supported)", + track->f.channelCount); + return AF_NULL_FILESETUP; + } + + if (track->f.compressionType != AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_COMPRESSION, + "IFF/8SVX does not support compression"); + return AF_NULL_FILESETUP; + } + + /* Ignore requested byte order since samples are only one byte. */ + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + /* Either one channel was requested or no request was made. */ + track->f.channelCount = 1; + _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, 8); + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_NUMMARKS, + "IFF/8SVX format does not support markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_NUMINSTS, + "IFF/8SVX format does not support instruments"); + return AF_NULL_FILESETUP; + } + + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "IFF/8SVX format does not " + "currently support miscellaneous chunks"); + return AF_NULL_FILESETUP; + } + + return _af_filesetup_copy(setup, &_af_iff_default_filesetup, AF_TRUE); +} diff --git a/libaudiofile/iff.h b/libaudiofile/iff.h new file mode 100644 index 0000000..f072de9 --- /dev/null +++ b/libaudiofile/iff.h @@ -0,0 +1,50 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + iff.h + + This file declares constants and functions related to the + IFF/8SVX file format. +*/ + +#ifndef IFF_H +#define IFF_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "audiofile.h" + +bool _af_iff_recognize (AFvirtualfile *fh); +status _af_iff_read_init (AFfilesetup, AFfilehandle); +AFfilesetup _af_iff_complete_setup (AFfilesetup); +status _af_iff_write_init (AFfilesetup, AFfilehandle); +status _af_iff_update (AFfilehandle); + +typedef struct +{ + AFfileoffset miscellaneousPosition; + AFfileoffset VHDR_offset; + AFfileoffset BODY_offset; +} _IFFinfo; + +#endif diff --git a/libaudiofile/iffwrite.c b/libaudiofile/iffwrite.c new file mode 100644 index 0000000..7fb2e49 --- /dev/null +++ b/libaudiofile/iffwrite.c @@ -0,0 +1,247 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + iffwrite.c + + This file contains routines for writing IFF/8SVX format sound + files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> + +#include "afinternal.h" +#include "audiofile.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" + +#include "iff.h" + +status _af_iff_update (AFfilehandle file); + +static status WriteVHDR (AFfilehandle file); +static status WriteMiscellaneous (AFfilehandle file); +static status WriteBODY (AFfilehandle file); + +static _IFFinfo *iff_info_new (void) +{ + _IFFinfo *iff = _af_calloc(1, sizeof (_IFFinfo)); + + iff->miscellaneousPosition = 0; + iff->VHDR_offset = 0; + iff->BODY_offset = 0; + + return iff; +} + +status _af_iff_write_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t fileSize = 0; + + if (_af_filesetup_make_handle(setup, file) == AF_FAIL) + return AF_FAIL; + + file->formatSpecific = iff_info_new(); + + af_fwrite("FORM", 4, 1, file->fh); + af_write_uint32_be(&fileSize, file->fh); + + af_fwrite("8SVX", 4, 1, file->fh); + + WriteVHDR(file); + WriteMiscellaneous(file); + WriteBODY(file); + + return AF_SUCCEED; +} + +status _af_iff_update (AFfilehandle file) +{ + u_int32_t length; + + WriteVHDR(file); + WriteMiscellaneous(file); + WriteBODY(file); + + /* Get the length of the file. */ + length = af_flength(file->fh); + length -= 8; + + /* Set the length of the FORM chunk. */ + af_fseek(file->fh, 4, SEEK_SET); + af_write_uint32_be(&length, file->fh); + + return AF_SUCCEED; +} + +static status WriteVHDR (const AFfilehandle file) +{ + _Track *track; + _IFFinfo *iff; + u_int32_t chunkSize; + u_int32_t oneShotSamples, repeatSamples, samplesPerRepeat; + u_int16_t sampleRate; + u_int8_t octaves, compression; + u_int32_t volume; + + iff = (_IFFinfo *) file->formatSpecific; + + /* + If VHDR_offset hasn't been set yet, set it to the + current offset. + */ + if (iff->VHDR_offset == 0) + iff->VHDR_offset = af_ftell(file->fh); + else + af_fseek(file->fh, iff->VHDR_offset, SEEK_SET); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fwrite("VHDR", 4, 1, file->fh); + + chunkSize = 20; + af_write_uint32_be(&chunkSize, file->fh); + + /* + IFF/8SVX files have only one audio channel, so the + number of samples is equal to the number of frames. + */ + oneShotSamples = track->totalfframes; + af_write_uint32_be(&oneShotSamples, file->fh); + repeatSamples = 0; + af_write_uint32_be(&repeatSamples, file->fh); + samplesPerRepeat = 0; + af_write_uint32_be(&samplesPerRepeat, file->fh); + + sampleRate = track->f.sampleRate; + af_write_uint16_be(&sampleRate, file->fh); + + octaves = 0; + compression = 0; + af_fwrite(&octaves, 1, 1, file->fh); + af_fwrite(&compression, 1, 1, file->fh); + + /* Volume is in fixed-point notation; 65536 means gain of 1.0. */ + volume = 65536; + af_write_uint32_be(&volume, file->fh); + + return AF_SUCCEED; +} + +static status WriteBODY (AFfilehandle file) +{ + _Track *track; + u_int32_t chunkSize; + _IFFinfo *iff = (_IFFinfo *) file->formatSpecific; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + if (iff->BODY_offset == 0) + iff->BODY_offset = af_ftell(file->fh); + else + af_fseek(file->fh, iff->BODY_offset, SEEK_SET); + + af_fwrite("BODY", 4, 1, file->fh); + + /* + IFF/8SVX supports only one channel, so the number of + frames is equal to the number of samples, and each + sample is one byte. + */ + chunkSize = track->totalfframes; + af_write_uint32_be(&chunkSize, file->fh); + + if (track->fpos_first_frame == 0) + track->fpos_first_frame = af_ftell(file->fh); + + /* Add a pad byte to the end of the chunk if the chunk size is odd. */ + if ((chunkSize % 2) == 1) + { + u_int8_t zero = 0; + af_fseek(file->fh, iff->BODY_offset + 8 + chunkSize, SEEK_SET); + af_fwrite(&zero, 1, 1, file->fh); + } + + return AF_SUCCEED; +} + +/* + WriteMiscellaneous writes all the miscellaneous data chunks in a + file handle structure to an IFF/8SVX file. +*/ +static status WriteMiscellaneous (AFfilehandle file) +{ + _IFFinfo *iff; + int i; + + iff = (_IFFinfo *) file->formatSpecific; + + if (iff->miscellaneousPosition == 0) + iff->miscellaneousPosition = af_ftell(file->fh); + else + af_fseek(file->fh, iff->miscellaneousPosition, SEEK_SET); + + for (i=0; i<file->miscellaneousCount; i++) + { + _Miscellaneous *misc = &file->miscellaneous[i]; + u_int32_t chunkType, chunkSize; + u_int8_t padByte = 0; + + switch (misc->type) + { + case AF_MISC_NAME: + memcpy(&chunkType, "NAME", 4); break; + case AF_MISC_AUTH: + memcpy(&chunkType, "AUTH", 4); break; + case AF_MISC_COPY: + memcpy(&chunkType, "(c) ", 4); break; + case AF_MISC_ANNO: + memcpy(&chunkType, "ANNO", 4); break; + } + + af_fwrite(&chunkType, 4, 1, file->fh); + + chunkSize = misc->size; + af_write_uint32_be(&chunkSize, file->fh); + + /* + Write the miscellaneous buffer and then a pad byte + if necessary. If the buffer is null, skip the space + for now. + */ + if (misc->buffer != NULL) + af_fwrite(misc->buffer, misc->size, 1, file->fh); + else + af_fseek(file->fh, misc->size, SEEK_CUR); + + if (misc->size % 2 != 0) + af_fwrite(&padByte, 1, 1, file->fh); + } + + return AF_SUCCEED; +} diff --git a/libaudiofile/instrument.c b/libaudiofile/instrument.c new file mode 100644 index 0000000..a179c72 --- /dev/null +++ b/libaudiofile/instrument.c @@ -0,0 +1,305 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + instrument.c + + Info about instrument parameters: + + Each unit has an array of _InstParamInfo structures, one for + each instrument parameter. Each of these structures describes + the inst parameters. + + id: a 4-byte id as in AIFF file + type: data type AU_PVLIST_* + name: text name + defaultValue: default value, to which it is set when a file with + instruments is first opened for writing. + + Each inst has only an array of values (_AFPVu's). Each value in the + instrument's array is the value of the corresponding index into the + unit's instparaminfo array. + + So for a unit u and an instrument i, u.instparam[N] describes + the parameter whose value is given in i.value[N]. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <audiofile.h> +#include "afinternal.h" +#include "instrument.h" +#include "units.h" +#include "setup.h" +#include "util.h" + +#include <stdio.h> + +extern _Unit _af_units[]; + +/* + Initialize instrument id list for audio file. +*/ +void afInitInstIDs (AFfilesetup setup, int *instids, int ninsts) +{ + int i; + + if (!_af_filesetup_ok(setup)) + return; + + if (!_af_unique_ids(instids, ninsts, "instrument", AF_BAD_INSTID)) + return; + + _af_setup_free_instruments(setup); + + setup->instrumentCount = ninsts; + setup->instrumentSet = AF_TRUE; + + setup->instruments = _af_instsetup_new(setup->instrumentCount); + + for (i=0; i < setup->instrumentCount; i++) + setup->instruments[i].id = instids[i]; +} + +int afGetInstIDs (AFfilehandle file, int *instids) +{ + int i; + + if (!_af_filehandle_ok(file)) + return -1; + + if (instids) + for (i=0; i < file->instrumentCount; i++) + instids[i] = file->instruments[i].id; + + return file->instrumentCount; +} + +/* + This routine checks and sets instrument parameters. + npv is number of valid AUpvlist pairs. +*/ +void _af_instparam_set (AFfilehandle file, int instid, AUpvlist pvlist, int npv) +{ + int i, instno, j; + + if (!_af_filehandle_ok(file)) + return; + + if (!_af_filehandle_can_write(file)) + return; + + if ((instno = _af_handle_instrument_index_from_id(file, instid)) == -1) + return; + + if (AUpvgetmaxitems(pvlist) < npv) + npv = AUpvgetmaxitems(pvlist); + + for (i=0; i < npv; i++) + { + int param; + int type; + + AUpvgetparam(pvlist, i, ¶m); + + if ((j = _af_instparam_index_from_id(file->fileFormat, param)) == -1) + /* no parameter with that id; ignore */ + continue; + + if (_af_units[file->fileFormat].write.instparamvalid && + !_af_units[file->fileFormat].write.instparamvalid(file, pvlist, i)) + /* bad parameter value; ignore */ + continue; + + type = _af_units[file->fileFormat].instrumentParameters[j].type; + + switch (type) + { + case AU_PVTYPE_LONG: + AUpvgetval(pvlist, i, &file->instruments[instno].values[j].l); + break; + case AU_PVTYPE_DOUBLE: + AUpvgetval(pvlist, i, &file->instruments[instno].values[j].d); + break; + case AU_PVTYPE_PTR: + AUpvgetval(pvlist, i, &file->instruments[instno].values[j].v); + break; + default: + return; + } + } +} + +void afSetInstParams (AFfilehandle file, int instid, AUpvlist pvlist, int npv) +{ + _af_instparam_set(file, instid, pvlist, npv); +} + +void afSetInstParamLong (AFfilehandle file, int instid, int param, long value) +{ + AUpvlist pvlist = AUpvnew(1); + + AUpvsetparam(pvlist, 0, param); + AUpvsetvaltype(pvlist, 0, AU_PVTYPE_LONG); + AUpvsetval(pvlist, 0, &value); + + _af_instparam_set(file, instid, pvlist, 1); + + AUpvfree(pvlist); +} + +/* + This routine gets instrument parameters. + npv is number of valid AUpvlist pairs +*/ +void _af_instparam_get (AFfilehandle file, int instid, AUpvlist pvlist, int npv, + bool forceLong) +{ + int i, instno, j; + + if (!_af_filehandle_ok(file)) + return; + + if ((instno = _af_handle_instrument_index_from_id(file, instid)) == -1) + return; + + if (AUpvgetmaxitems(pvlist) < npv) + npv = AUpvgetmaxitems(pvlist); + + for (i=0; i < npv; i++) + { + int param; + int type; + AUpvgetparam(pvlist, i, ¶m); + + if ((j = _af_instparam_index_from_id(file->fileFormat, param)) == -1) + /* no parameter with that id; ignore */ + continue; + + type = _af_units[file->fileFormat].instrumentParameters[j].type; + + /* + forceLong is true when this routine called by + afGetInstParamLong(). + */ + if (forceLong && type != AU_PVTYPE_LONG) + { + _af_error(AF_BAD_INSTPTYPE, "type of instrument parameter %d is not AU_PVTYPE_LONG", param); + continue; + } + + AUpvsetvaltype(pvlist, i, type); + + switch (type) + { + case AU_PVTYPE_LONG: + AUpvsetval(pvlist, i, &file->instruments[instno].values[j].l); + break; + case AU_PVTYPE_DOUBLE: + AUpvsetval(pvlist, i, &file->instruments[instno].values[j].d); + break; + case AU_PVTYPE_PTR: + AUpvsetval(pvlist, i, &file->instruments[instno].values[j].v); + break; + + default: + _af_error(AF_BAD_INSTPTYPE, "invalid instrument parameter type %d", type); + return; + } + } +} + +/* + afGetInstParams -- get a parameter-value array containing + instrument parameters for the specified instrument chunk +*/ +void afGetInstParams (AFfilehandle file, int inst, AUpvlist pvlist, int npv) +{ + _af_instparam_get(file, inst, pvlist, npv, AF_FALSE); +} + +long afGetInstParamLong (AFfilehandle file, int inst, int param) +{ + long val; + AUpvlist pvlist = AUpvnew(1); + + AUpvsetparam(pvlist, 0, param); + AUpvsetvaltype(pvlist, 0, AU_PVTYPE_LONG); + + _af_instparam_get(file, inst, pvlist, 1, AF_TRUE); + + AUpvgetval(pvlist, 0, &val); + AUpvfree(pvlist); + + return(val); +} + +/* + Search _af_units[fileFormat].instrumentParameters for the instrument + parameter with the specified id. + + Report an error and return -1 if no such instrument parameter + exists. +*/ + +int _af_instparam_index_from_id (int filefmt, int id) +{ + int i; + + for (i = 0; i < _af_units[filefmt].instrumentParameterCount; i++) + if (_af_units[filefmt].instrumentParameters[i].id == id) + break; + + if (i == _af_units[filefmt].instrumentParameterCount) + { + _af_error(AF_BAD_INSTPID, "invalid instrument parameter id %d", + id); + return -1; + } + + return i; +} + +int _af_handle_instrument_index_from_id (AFfilehandle file, int id) +{ + int i; + + for (i = 0; i < file->instrumentCount; i++) + if (file->instruments[i].id == id) + return i; + + _af_error(AF_BAD_INSTID, "invalid instrument id %d", id); + return -1; +} + +int _af_setup_instrument_index_from_id (AFfilesetup setup, int id) +{ + int i; + + for (i = 0; i < setup->instrumentCount; i++) + if (setup->instruments[i].id == id) + return i; + + _af_error(AF_BAD_INSTID, "invalid instrument id %d", id); + return -1; +} diff --git a/libaudiofile/instrument.h b/libaudiofile/instrument.h new file mode 100644 index 0000000..dcad95b --- /dev/null +++ b/libaudiofile/instrument.h @@ -0,0 +1,43 @@ +/* + Audio File Library + Copyright (C) 2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + instrument.h + + This file declares routines for dealing with instruments. +*/ + +#ifndef INSTRUMENT_H +#define INSTRUMENT_H + +#include <audiofile.h> +#include <aupvlist.h> + +void _af_instparam_get (AFfilehandle file, int instid, AUpvlist pvlist, + int npv, bool forceLong); + +void _af_instparam_set (AFfilehandle file, int instid, AUpvlist pvlist, + int npv); + +int _af_instparam_index_from_id (int fileFormat, int id); +int _af_handle_instrument_index_from_id (AFfilehandle file, int id); +int _af_setup_instrument_index_from_id (AFfilesetup setup, int id); + +#endif /* INSTRUMENT_H */ diff --git a/libaudiofile/ircam.c b/libaudiofile/ircam.c new file mode 100644 index 0000000..2b5bacd --- /dev/null +++ b/libaudiofile/ircam.c @@ -0,0 +1,317 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + ircam.c + + This file contains routines for parsing Berkeley/IRCAM/CARL + format files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "afinternal.h" +#include "audiofile.h" +#include "util.h" +#include "byteorder.h" +#include "setup.h" +#include "track.h" +#include "marker.h" + +#include "ircam.h" + +/* + These magic numbers are fucking stupid. + + Here ircam_mips_magic refers to little-endian MIPS, not SGI IRIX, + which uses big-endian MIPS. +*/ +const u_int8_t _af_ircam_vax_magic[4] = {0x64, 0xa3, 0x01, 0x00}, + _af_ircam_sun_magic[4] = {0x64, 0xa3, 0x02, 0x00}, + _af_ircam_mips_magic[4] = {0x64, 0xa3, 0x03, 0x00}, + _af_ircam_next_magic[4] = {0x64, 0xa3, 0x04, 0x00}; + +_AFfilesetup _af_ircam_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_IRCAM, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +bool _af_ircam_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[4]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 4, 1, fh) != 1) + return AF_FALSE; + + /* Check to see if the file's magic number matches. */ + if (memcmp(buffer, _af_ircam_vax_magic, 4) == 0 || + memcmp(buffer, _af_ircam_sun_magic, 4) == 0 || + memcmp(buffer, _af_ircam_mips_magic, 4) == 0 || + memcmp(buffer, _af_ircam_next_magic, 4) == 0) + { + return AF_TRUE; + } + + return AF_FALSE; +} + +AFfilesetup _af_ircam_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "BICSF file must have 1 track"); + return AF_NULL_FILESETUP; + } + + track = &setup->tracks[0]; + + if (track->sampleFormatSet) + { + if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + _af_error(AF_BAD_SAMPFMT, + "BICSF format does not support unsigned data"); + return AF_NULL_FILESETUP; + } + + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP && + track->f.sampleWidth != 16) + { + _af_error(AF_BAD_WIDTH, + "BICSF format supports only 16-bit width for " + "two's complement audio data"); + return AF_NULL_FILESETUP; + } + + if (track->f.sampleFormat == AF_SAMPFMT_DOUBLE) + { + _af_error(AF_BAD_SAMPFMT, + "BICSF format does not support " + "double-precision floating-point data"); + return AF_NULL_FILESETUP; + } + } + + if (track->rateSet && track->f.sampleRate <= 0.0) + { + _af_error(AF_BAD_RATE, + "invalid sample rate %.30g for BICSF file", + track->f.sampleRate); + return AF_NULL_FILESETUP; + } + + if (track->channelCountSet && track->f.channelCount != 1 && + track->f.channelCount != 2 && track->f.channelCount != 4) + { + _af_error(AF_BAD_CHANNELS, + "invalid channel count (%d) for BICSF format " + "(1, 2, or 4 channels only)", + track->f.channelCount); + return AF_NULL_FILESETUP; + } + + if (track->compressionSet && + track->f.compressionType != AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "BICSF format does not support compression"); + return AF_NULL_FILESETUP; + } + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "BICSF file cannot have AES data"); + return AF_NULL_FILESETUP; + } + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_NUMMARKS, "BICSF format does not support markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_NUMINSTS, "BICSF format does not support instruments"); + return AF_NULL_FILESETUP; + } + + /* XXXmpruett: We don't support miscellaneous chunks for now. */ + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "BICSF format does not currently support miscellaneous chunks"); + return AF_NULL_FILESETUP; + } + + return _af_filesetup_copy(setup, &_af_ircam_default_filesetup, AF_TRUE); +} + +status _af_ircam_read_init (AFfilesetup setup, AFfilehandle handle) +{ + _Track *track; + u_int8_t magic[4]; + float rate; + u_int32_t channels; + u_int32_t packMode; + + float maxAmp = 1.0; + + bool isSwapped, isLittleEndian; + + handle->instruments = NULL; + handle->instrumentCount = 0 ; + handle->miscellaneous = NULL; + handle->miscellaneousCount = 0; + + handle->tracks = NULL; + handle->trackCount = 1; + + af_fseek(handle->fh, 0, SEEK_SET); + + if (af_fread(magic, 4, 1, handle->fh) != 1) + { + _af_error(AF_BAD_READ, "Could not read BICSF file header"); + return AF_FAIL; + } + + if (memcmp(magic, _af_ircam_vax_magic, 4) != 0 && + memcmp(magic, _af_ircam_sun_magic, 4) != 0 && + memcmp(magic, _af_ircam_mips_magic, 4) != 0 && + memcmp(magic, _af_ircam_next_magic, 4) != 0) + { + _af_error(AF_BAD_FILEFMT, + "file is not a BICSF file (bad magic number)"); + return AF_FAIL; + } + + /* + If the file's magic number is that for VAX or MIPS, + the file is little endian. + */ + isLittleEndian = (memcmp(magic, _af_ircam_vax_magic, 4) == 0 || + memcmp(magic, _af_ircam_mips_magic, 4) == 0); + +#ifdef WORDS_BIGENDIAN + isSwapped = isLittleEndian; +#else + isSwapped = !isLittleEndian; +#endif + + af_fread(&rate, 4, 1, handle->fh); + af_fread(&channels, 4, 1, handle->fh); + af_fread(&packMode, 4, 1, handle->fh); + + if (isSwapped) + { + rate = _af_byteswap_float32(rate); + channels = _af_byteswap_int32(channels); + packMode = _af_byteswap_int32(packMode); + } + + if ((handle->tracks = _af_track_new()) == NULL) + return AF_FAIL; + + track = &handle->tracks[0]; + + track->f.sampleRate = rate; + track->f.compressionType = AF_COMPRESSION_NONE; + + switch (packMode) + { + case SF_SHORT: + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.sampleWidth = 16; + break; + case SF_FLOAT: + track->f.sampleFormat = AF_SAMPFMT_FLOAT; + track->f.sampleWidth = 32; + break; + default: + _af_error(AF_BAD_NOT_IMPLEMENTED, + "BICSF data format %d not supported", packMode); + return AF_FAIL; + } + + track->f.channelCount = channels; + if (channels != 1 && channels != 2 && channels != 4) + { + _af_error(AF_BAD_FILEFMT, "invalid channel count (%d) " + "for BICSF format (1, 2, or 4 only)", + channels); + return AF_FAIL; + } + + if (isLittleEndian) + track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; + else + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + if (_af_set_sample_format(&track->f, track->f.sampleFormat, + track->f.sampleWidth) == AF_FAIL) + { + return AF_FAIL; + } + + if (track->f.sampleFormat == AF_SAMPFMT_FLOAT) + track->f.pcm.slope = maxAmp; + + track->data_size = af_flength(handle->fh) - SIZEOF_BSD_HEADER; + + /* + Only uncompressed data formats are supported for IRCAM + files right now. The following line would need to be + changed if compressed data formats were supported. + */ + track->totalfframes = track->data_size / + _af_format_frame_size(&track->f, AF_FALSE); + + track->fpos_first_frame = SIZEOF_BSD_HEADER; + track->nextfframe = 0; + track->fpos_next_frame = track->fpos_first_frame; + + handle->formatSpecific = NULL; + + return AF_SUCCEED; +} diff --git a/libaudiofile/ircam.h b/libaudiofile/ircam.h new file mode 100644 index 0000000..98b70d1 --- /dev/null +++ b/libaudiofile/ircam.h @@ -0,0 +1,59 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + ircam.h + + This file contains constants and function prototypes related to + the Berkeley/IRCAM/CARL Sound File format. +*/ + +#ifndef IRCAM_H +#define IRCAM_H + +bool _af_ircam_recognize (AFvirtualfile *fh); + +status _af_ircam_read_init (AFfilesetup, AFfilehandle); + +status _af_ircam_write_init (AFfilesetup, AFfilehandle); + +AFfilesetup _af_ircam_complete_setup (AFfilesetup); + +status _af_ircam_update (AFfilehandle); + +#define SF_SHORT 2 +#define SF_FLOAT 4 + +#define SF_MAXCHAN 4 +#define SF_MAXCOMMENT 512 +#define SF_MINCOMMENT 256 + +enum +{ + SF_END, + SF_MAXAMP, + SF_COMMENT, + SF_LINKCODE +}; + +#define SIZEOF_BSD_HEADER 1024 + +#endif /* IRCAM_H */ diff --git a/libaudiofile/ircamwrite.c b/libaudiofile/ircamwrite.c new file mode 100644 index 0000000..17fccd5 --- /dev/null +++ b/libaudiofile/ircamwrite.c @@ -0,0 +1,129 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + ircamwrite.c + + This file contains routines for writing to Berkeley/IRCAM/CARL + format files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "afinternal.h" +#include "audiofile.h" +#include "util.h" +#include "byteorder.h" +#include "setup.h" +#include "track.h" +#include "marker.h" + +#include "ircam.h" + +/* + These magic numbers are fucking stupid. + + Here ircam_mips_magic refers to little-endian MIPS, not SGI IRIX, + which uses big-endian MIPS. +*/ +extern const u_int8_t _af_ircam_vax_magic[4], _af_ircam_sun_magic[4], + _af_ircam_mips_magic[4], _af_ircam_next_magic[4]; + +/* We write IRCAM files using the native byte order. */ +status _af_ircam_write_init (AFfilesetup setup, AFfilehandle handle) +{ + _Track *track; + const u_int8_t *magic; + float rate; + u_int32_t channels; + u_int32_t packMode; + u_int32_t dataOffset; + u_int8_t zeros[SIZEOF_BSD_HEADER]; + + float maxAmp = 1.0; + + bool isSwapped, isLittleEndian; + + assert(handle->fileFormat == AF_FILE_IRCAM); + + if (_af_filesetup_make_handle(setup, handle) == AF_FAIL) + return AF_FAIL; + + dataOffset = SIZEOF_BSD_HEADER; + + track = &handle->tracks[0]; + track->totalfframes = 0; + track->fpos_first_frame = dataOffset; + track->nextfframe = 0; + track->fpos_next_frame = track->fpos_first_frame; + + handle->formatSpecific = NULL; + + /* Choose the magic number appropriate for the byte order. */ +#ifdef WORDS_BIGENDIAN + magic = _af_ircam_sun_magic; +#else + magic = _af_ircam_vax_magic; +#endif + + channels = track->f.channelCount; + rate = track->f.sampleRate; + + assert(track->f.compressionType == AF_COMPRESSION_NONE); + + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP) + { + assert(track->f.sampleWidth == 16); + packMode = SF_SHORT; + } + else if (track->f.sampleFormat == AF_SAMPFMT_FLOAT) + { + assert(track->f.sampleWidth == 32); + packMode = SF_FLOAT; + } + + af_fseek(handle->fh, 0, SEEK_SET); + af_fwrite(magic, 4, 1, handle->fh); + af_fwrite(&rate, 4, 1, handle->fh); + af_fwrite(&channels, 4, 1, handle->fh); + af_fwrite(&packMode, 4, 1, handle->fh); + + /* Zero the entire description block. */ + memset(zeros, 0, SIZEOF_BSD_HEADER); + af_fwrite(zeros, SIZEOF_BSD_HEADER - 4*4, 1, handle->fh); + + return AF_SUCCEED; +} + +status _af_ircam_update (AFfilehandle file) +{ + return AF_SUCCEED; +} diff --git a/libaudiofile/loop.c b/libaudiofile/loop.c new file mode 100644 index 0000000..c0964c0 --- /dev/null +++ b/libaudiofile/loop.c @@ -0,0 +1,352 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + loop.c + + All routines that operate on loops. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" +#include "setup.h" +#include "instrument.h" + +void afInitLoopIDs (AFfilesetup setup, int instid, int *loopids, int nloops) +{ + int instno; + + if (!_af_filesetup_ok(setup)) + return; + + if (!_af_unique_ids(loopids, nloops, "loop", AF_BAD_LOOPID)) + return; + + if ((instno = _af_setup_instrument_index_from_id(setup, instid)) == -1) + return; + + _af_setup_free_loops(setup, instno); + + setup->instruments[instno].loopCount = nloops; + setup->instruments[instno].loopSet = AF_TRUE; + + if (nloops == 0) + setup->instruments[instno].loops = NULL; + else + { + int i; + + if ((setup->instruments[instno].loops = _af_calloc(nloops, sizeof (_LoopSetup))) == NULL) + return; + + for (i=0; i < nloops; i++) + setup->instruments[instno].loops[i].id = loopids[i]; + } +} + +int afGetLoopIDs (AFfilehandle file, int instid, int *loopids) +{ + int instno; + int i; + + if (!_af_filehandle_ok(file)) + return AF_FAIL; + + if ((instno = _af_handle_instrument_index_from_id(file, instid)) == -1) + return AF_FAIL; + + if (loopids) + for (i=0; i < file->instruments[instno].loopCount; i++) + loopids[i] = file->instruments[instno].loops[i].id; + + return file->instruments[instno].loopCount; +} + +int _af_handle_loop_index_from_id (AFfilehandle file, int instno, int loopid) +{ + int i; + for (i=0; i<file->instruments[instno].loopCount; i++) + if (file->instruments[instno].loops[i].id == loopid) + return i; + + _af_error(AF_BAD_LOOPID, "no loop with id %d for instrument %d", + loopid, file->instruments[instno].id); + + return -1; +} + +/* + getLoop returns pointer to requested loop if it exists, and if + mustWrite is true, only if handle is writable. +*/ + +static _Loop *getLoop (AFfilehandle handle, int instid, int loopid, + bool mustWrite) +{ + int loopno, instno; + + if (!_af_filehandle_ok(handle)) + return NULL; + + if (mustWrite && !_af_filehandle_can_write(handle)) + return NULL; + + if ((instno = _af_handle_instrument_index_from_id(handle, instid)) == -1) + return NULL; + + if ((loopno = _af_handle_loop_index_from_id(handle, instno, loopid)) == -1) + return NULL; + + return &handle->instruments[instno].loops[loopno]; +} + +/* + Set loop mode (as in AF_LOOP_MODE_...). +*/ +void afSetLoopMode (AFfilehandle file, int instid, int loopid, int mode) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (!loop) + return; + + if (mode != AF_LOOP_MODE_NOLOOP && + mode != AF_LOOP_MODE_FORW && + mode != AF_LOOP_MODE_FORWBAKW) + { + _af_error(AF_BAD_LOOPMODE, "unrecognized loop mode %d", mode); + return; + } + + loop->mode = mode; +} + +/* + Get loop mode (as in AF_LOOP_MODE_...). +*/ +int afGetLoopMode (AFfilehandle file, int instid, int loopid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + return loop->mode; +} + +/* + Set loop count. +*/ +int afSetLoopCount (AFfilehandle file, int instid, int loopid, int count) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (loop == NULL) + return AF_FAIL; + + if (count < 1) + { + _af_error(AF_BAD_LOOPCOUNT, "invalid loop count: %d", count); + return AF_FAIL; + } + + loop->count = count; + return AF_SUCCEED; +} + +/* + Get loop count. +*/ +int afGetLoopCount(AFfilehandle file, int instid, int loopid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + return loop->count; +} + +/* + Set loop start marker id in the file structure +*/ +void +afSetLoopStart(AFfilehandle file, int instid, int loopid, int markid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (!loop) + return; + + loop->beginMarker = markid; +} + +/* + Get loop start marker id. +*/ +int afGetLoopStart (AFfilehandle file, int instid, int loopid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + return loop->beginMarker; +} + +/* + Set loop start frame in the file structure. +*/ +int afSetLoopStartFrame (AFfilehandle file, int instid, int loopid, AFframecount startFrame) +{ + int trackid, beginMarker; + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (loop == NULL) + return -1; + + if (startFrame < 0) + { + _af_error(AF_BAD_FRAME, "loop start frame must not be negative"); + return AF_FAIL; + } + + trackid = loop->trackid; + beginMarker = loop->beginMarker; + + afSetMarkPosition(file, trackid, beginMarker, startFrame); + return AF_SUCCEED; +} + +/* + Get loop start frame. +*/ +AFframecount afGetLoopStartFrame (AFfilehandle file, int instid, int loopid) +{ + int trackid, beginMarker; + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + trackid = loop->trackid; + beginMarker = loop->beginMarker; + + return afGetMarkPosition(file, trackid, beginMarker); +} + +/* + Set loop track id. +*/ +void afSetLoopTrack (AFfilehandle file, int instid, int loopid, int track) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (!loop) return; + + loop->trackid = track; +} + +/* + Get loop track. +*/ +int afGetLoopTrack (AFfilehandle file, int instid, int loopid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + return loop->trackid; +} + +/* + Set loop end frame marker id. +*/ +void afSetLoopEnd (AFfilehandle file, int instid, int loopid, int markid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (!loop) + return; + + loop->endMarker = markid; +} + +/* + Get loop end frame marker id. +*/ +int afGetLoopEnd (AFfilehandle file, int instid, int loopid) +{ + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + return loop->endMarker; +} + +/* + Set loop end frame. +*/ +int afSetLoopEndFrame (AFfilehandle file, int instid, int loopid, AFframecount endFrame) +{ + int trackid, endMarker; + _Loop *loop = getLoop(file, instid, loopid, AF_TRUE); + + if (loop == NULL) + return -1; + + if (endFrame < 0) + { + _af_error(AF_BAD_FRAME, "loop end frame must not be negative"); + return AF_FAIL; + } + + trackid = loop->trackid; + endMarker = loop->endMarker; + + afSetMarkPosition(file, trackid, endMarker, endFrame); + return AF_SUCCEED; +} + +/* + Get loop end frame. +*/ + +AFframecount afGetLoopEndFrame (AFfilehandle file, int instid, int loopid) +{ + int trackid, endMarker; + _Loop *loop = getLoop(file, instid, loopid, AF_FALSE); + + if (loop == NULL) + return -1; + + trackid = loop->trackid; + endMarker = loop->endMarker; + + return afGetMarkPosition(file, trackid, endMarker); +} diff --git a/libaudiofile/marker.c b/libaudiofile/marker.c new file mode 100644 index 0000000..aec297b --- /dev/null +++ b/libaudiofile/marker.c @@ -0,0 +1,306 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + marker.c + + This file contains routines for dealing with loop markers. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> +#include <stdlib.h> +#include <assert.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" + +_Marker *_af_marker_find_by_id (_Track *track, int markerid) +{ + int i; + + assert(track); + + for (i=0; i<track->markerCount; i++) + if (track->markers[i].id == markerid) + return &track->markers[i]; + + _af_error(AF_BAD_MARKID, "no mark with id %d found in track %d", + markerid, track->id); + + return NULL; +} + +void afInitMarkIDs(AFfilesetup setup, int trackid, int markids[], int nmarks) +{ + int i; + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (track->markers != NULL) + { + for (i=0; i<track->markerCount; i++) + { + if (track->markers[i].name != NULL) + free(track->markers[i].name); + if (track->markers[i].comment != NULL) + free(track->markers[i].comment); + } + free(track->markers); + } + + track->markers = _af_calloc(nmarks, sizeof (struct _MarkerSetup)); + track->markerCount = nmarks; + + for (i=0; i<nmarks; i++) + { + track->markers[i].id = markids[i]; + track->markers[i].name = _af_strdup(""); + track->markers[i].comment = _af_strdup(""); + } + + track->markersSet = AF_TRUE; +} + +void afInitMarkName(AFfilesetup setup, int trackid, int markid, + const char *namestr) +{ + int markno; + int length; + + _TrackSetup *track = NULL; + + assert(setup); + assert(markid > 0); + + track = _af_filesetup_get_tracksetup(setup, trackid); + assert(track); + + if (track == NULL) + { + _af_error(AF_BAD_TRACKID, "bad track id"); + return; + } + + for (markno=0; markno<track->markerCount; markno++) + { + if (track->markers[markno].id == markid) + break; + } + + if (markno == track->markerCount) + { + _af_error(AF_BAD_MARKID, "no marker id %d for file setup", markid); + return; + } + + length = strlen(namestr); + if (length > 255) + { + _af_error(AF_BAD_STRLEN, + "warning: marker name truncated to 255 characters"); + length = 255; + } + + if (track->markers[markno].name) + free(track->markers[markno].name); + if ((track->markers[markno].name = _af_malloc(length+1)) == NULL) + return; + strncpy(track->markers[markno].name, namestr, length); + /* + The null terminator is not set by strncpy if + strlen(namestr) > length. Set it here. + */ + track->markers[markno].name[length] = '\0'; +} + +void afInitMarkComment(AFfilesetup setup, int trackid, int markid, + const char *commstr) +{ + int markno; + int length; + _TrackSetup *track = NULL; + + assert(setup); + assert(markid > 0); + + track = _af_filesetup_get_tracksetup(setup, trackid); + assert(track); + + if (track == NULL) + { + _af_error(AF_BAD_TRACKID, "bad track id"); + return; + } + + for (markno=0; markno<track->markerCount; markno++) + { + if (track->markers[markno].id == markid) + break; + } + + if (markno == track->markerCount) + { + _af_error(AF_BAD_MARKID, "no marker id %d for file setup", markid); + return; + } + + length = strlen(commstr); + + if (track->markers[markno].comment) + free(track->markers[markno].comment); + if ((track->markers[markno].comment = _af_malloc(length+1)) == NULL) + return; + strcpy(track->markers[markno].comment, commstr); +} + +char *afGetMarkName (AFfilehandle file, int trackid, int markid) +{ + _Track *track; + _Marker *marker; + + assert(file != NULL); + assert(markid > 0); + + if (!_af_filehandle_ok(file)) + return NULL; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return NULL; + + if ((marker = _af_marker_find_by_id(track, markid)) == NULL) + return NULL; + + return marker->name; +} + +char *afGetMarkComment (AFfilehandle file, int trackid, int markid) +{ + _Track *track; + _Marker *marker; + + assert(file != NULL); + assert(markid > 0); + + if (!_af_filehandle_ok(file)) + return NULL; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return NULL; + + if ((marker = _af_marker_find_by_id(track, markid)) == NULL) + return NULL; + + return marker->comment; +} + +void afSetMarkPosition (AFfilehandle file, int trackid, int markid, + AFframecount pos) +{ + _Track *track; + _Marker *marker; + + assert(file != NULL); + assert(markid > 0); + + if (!_af_filehandle_ok(file)) + return; + + if (!_af_filehandle_can_write(file)) + return; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if ((marker = _af_marker_find_by_id(track, markid)) == NULL) + return; + + if (pos < 0) + { + _af_error(AF_BAD_MARKPOS, "invalid marker position %d", pos); + pos = 0; + } + + marker->position = pos; +} + +int afGetMarkIDs (AFfilehandle file, int trackid, int markids[]) +{ + _Track *track; + + assert(file); + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + if (markids != NULL) + { + int i; + + for (i=0; i<track->markerCount; i++) + { + markids[i] = track->markers[i].id; + } + } + + return track->markerCount; +} + +AFframecount afGetMarkPosition (AFfilehandle file, int trackid, int markid) +{ + _Track *track; + _Marker *marker; + + assert(file); + assert(markid > 0); + + if (!_af_filehandle_ok(file)) + return 0L; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return 0L; + + if ((marker = _af_marker_find_by_id(track, markid)) == NULL) + return 0L; + + return marker->position; +} + +_Marker *_af_marker_new (int count) +{ + _Marker *markers = _af_calloc(count, sizeof (_Marker)); + if (markers == NULL) + return NULL; + + return markers; +} diff --git a/libaudiofile/marker.h b/libaudiofile/marker.h new file mode 100644 index 0000000..94d51a0 --- /dev/null +++ b/libaudiofile/marker.h @@ -0,0 +1,27 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +#ifndef MARKER_H +#define MARKER_H + +_Marker *_af_marker_new (int count); +_Marker *_af_marker_find_by_id (_Track *track, int id); + +#endif /* MARKER_H */ diff --git a/libaudiofile/misc.c b/libaudiofile/misc.c new file mode 100644 index 0000000..c931110 --- /dev/null +++ b/libaudiofile/misc.c @@ -0,0 +1,286 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + misc.c + + This file contains routines for dealing with the Audio File + Library's internal miscellaneous data types. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" + +static _Miscellaneous *find_misc_by_id (AFfilehandle file, int id) +{ + int i; + + for (i=0; i<file->miscellaneousCount; i++) + { + if (file->miscellaneous[i].id == id) + return &file->miscellaneous[i]; + } + + _af_error(AF_BAD_MISCID, "bad miscellaneous id %d", id); + + return NULL; +} + +static _MiscellaneousSetup *find_miscsetup_by_id (AFfilesetup setup, int id) +{ + int i; + + for (i=0; i<setup->miscellaneousCount; i++) + { + if (setup->miscellaneous[i].id == id) + return &setup->miscellaneous[i]; + } + + _af_error(AF_BAD_MISCID, "bad miscellaneous id %d", id); + + return NULL; +} + +void afInitMiscIDs (AFfilesetup setup, int *ids, int nids) +{ + int i; + + if (!_af_filesetup_ok(setup)) + return; + + if (setup->miscellaneous != NULL) + { + free(setup->miscellaneous); + } + + setup->miscellaneousCount = nids; + + if (nids == 0) + setup->miscellaneous = NULL; + else + { + setup->miscellaneous = _af_calloc(nids, + sizeof (_Miscellaneous)); + + if (setup->miscellaneous == NULL) + return; + + for (i=0; i<nids; i++) + { + setup->miscellaneous[i].id = ids[i]; + setup->miscellaneous[i].type = 0; + setup->miscellaneous[i].size = 0; + } + } + + setup->miscellaneousSet = AF_TRUE; +} + +int afGetMiscIDs (AFfilehandle file, int *ids) +{ + int i; + + if (!_af_filehandle_ok(file)) + return -1; + + if (ids != NULL) + { + for (i=0; i<file->miscellaneousCount; i++) + { + ids[i] = file->miscellaneous[i].id; + } + } + + return file->miscellaneousCount; +} + +void afInitMiscType (AFfilesetup setup, int miscellaneousid, int type) +{ + _MiscellaneousSetup *miscellaneous; + + if (!_af_filesetup_ok(setup)) + return; + + miscellaneous = find_miscsetup_by_id(setup, miscellaneousid); + + if (miscellaneous) + miscellaneous->type = type; + else + _af_error(AF_BAD_MISCID, "bad miscellaneous id"); +} + +int afGetMiscType (AFfilehandle file, int miscellaneousid) +{ + _Miscellaneous *miscellaneous; + + if (!_af_filehandle_ok(file)) + return -1; + + miscellaneous = find_misc_by_id(file, miscellaneousid); + + if (miscellaneous) + { + return miscellaneous->type; + } + else + { + _af_error(AF_BAD_MISCID, "bad miscellaneous id"); + return -1; + } +} + +void afInitMiscSize (AFfilesetup setup, int miscellaneousid, int size) +{ + _MiscellaneousSetup *miscellaneous; + + if (!_af_filesetup_ok(setup)) + return; + + miscellaneous = find_miscsetup_by_id(setup, miscellaneousid); + + if (miscellaneous) + { + miscellaneous->size = size; + } + else + _af_error(AF_BAD_MISCID, "bad miscellaneous id"); +} + +int afGetMiscSize (AFfilehandle file, int miscellaneousid) +{ + _Miscellaneous *miscellaneous; + + if (!_af_filehandle_ok(file)) + return -1; + + miscellaneous = find_misc_by_id(file, miscellaneousid); + + if (miscellaneous) + { + return miscellaneous->size; + } + else + { + _af_error(AF_BAD_MISCID, "bad miscellaneous id"); + return -1; + } +} + +int afWriteMisc (AFfilehandle file, int miscellaneousid, void *buf, int bytes) +{ + _Miscellaneous *miscellaneous; + int localsize; + + if (!_af_filehandle_ok(file)) + return -1; + + if (!_af_filehandle_can_write(file)) + return -1; + + if ((miscellaneous = find_misc_by_id(file, miscellaneousid)) == NULL) + return -1; + + if (bytes <= 0) + { + _af_error(AF_BAD_MISCSIZE, "invalid size (%d) for miscellaneous chunk", bytes); + } + + if (miscellaneous->buffer == NULL && miscellaneous->size != 0) + { + miscellaneous->buffer = _af_malloc(miscellaneous->size); + memset(miscellaneous->buffer, 0, miscellaneous->size); + if (miscellaneous->buffer == NULL) + return -1; + } + + if (bytes + miscellaneous->position > miscellaneous->size) + localsize = miscellaneous->size - miscellaneous->position; + else + localsize = bytes; + + memcpy((char *) miscellaneous->buffer + miscellaneous->position, + buf, localsize); + miscellaneous->position += localsize; + return localsize; +} + +int afReadMisc (AFfilehandle file, int miscellaneousid, void *buf, int bytes) +{ + int localsize; + _Miscellaneous *miscellaneous; + + if (!_af_filehandle_ok(file)) + return -1; + + if (!_af_filehandle_can_read(file)) + return -1; + + if ((miscellaneous = find_misc_by_id(file, miscellaneousid)) == NULL) + return -1; + + if (bytes <= 0) + { + _af_error(AF_BAD_MISCSIZE, "invalid size (%d) for miscellaneous chunk", bytes); + return -1; + } + + if (bytes + miscellaneous->position > miscellaneous->size) + localsize = miscellaneous->size - miscellaneous->position; + else + localsize = bytes; + + memcpy(buf, (char *) miscellaneous->buffer + miscellaneous->position, + localsize); + miscellaneous->position += localsize; + return localsize; +} + +int afSeekMisc (AFfilehandle file, int miscellaneousid, int offset) +{ + _Miscellaneous *miscellaneous; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((miscellaneous = find_misc_by_id(file, miscellaneousid)) == NULL) + return -1; + + if (offset >= miscellaneous->size) + { + _af_error(AF_BAD_MISCSEEK, + "offset %d too big for miscellaneous chunk %d " + "(%d data bytes)", + offset, miscellaneousid, miscellaneous->size); + return -1; + } + + miscellaneous->position = offset; + + return offset; +} diff --git a/libaudiofile/modules.c b/libaudiofile/modules.c new file mode 100644 index 0000000..1154550 --- /dev/null +++ b/libaudiofile/modules.c @@ -0,0 +1,2744 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + modules.c +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include <assert.h> + +#include <audiofile.h> +#include "afinternal.h" +#include "modules.h" +#include "pcm.h" +#include "util.h" +#include "units.h" +#include "compression.h" +#include "byteorder.h" +#include "print.h" +#include "debug.h" + +#include "modules/rebuffer.h" + +#ifdef DEBUG +#define CHNK(X) X +#define DEBG(X) X +#else +#define CHNK(X) +#define DEBG(X) +#endif + +#define NULLMODULEPARAM + +extern _PCMInfo _af_default_signed_integer_pcm_mappings[]; +extern _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; +extern _PCMInfo _af_default_float_pcm_mapping; +extern _PCMInfo _af_default_double_pcm_mapping; + +extern _CompressionUnit _af_compression[]; + +/* Define rebuffering modules. */ +extern _AFmodule int2rebufferv2f, int2rebufferf2v; + +/* + module utility routines +*/ + +/* + _AFnewmodinst creates a module instance from a module. + It returns a structure, not a pointer to a structure. +*/ +_AFmoduleinst _AFnewmodinst (_AFmodule *mod) +{ + _AFmoduleinst ret; + + ret.inc = ret.outc = NULL; + ret.modspec = NULL; + ret.u.pull.source = NULL; + ret.mod = mod; + ret.free_on_close = AF_FALSE; + ret.valid = AF_FALSE; + + return(ret); +} + +/* + _AFfreemodspec: useful routine for mod.free function pointer +*/ +void _AFfreemodspec (_AFmoduleinst *i) +{ + if (i->modspec) + free(i->modspec); + i->modspec = NULL; +} + +/* + _AFpull: used a lot -- see comments in README.modules +*/ +AFframecount _AFpull (_AFmoduleinst *i, AFframecount nframes2pull) +{ + _AFmoduleinst *src = i->u.pull.source; + + i->inc->nframes = nframes2pull; + CHNK(printf("%s pulling %" AF_FRAMECOUNT_PRINT_FMT " frames from %s\n", + i->mod->name, i->inc->nframes, src->mod->name)); + (*src->mod->run_pull)(src); + CHNK(_af_print_chunk(i->inc)); + + CHNK(printf("%s received %" AF_FRAMECOUNT_PRINT_FMT " frames from %s\n", + i->mod->name, i->inc->nframes, src->mod->name)); + return i->inc->nframes; +} + +/* + _AFsimplemodrun +*/ +void _AFsimplemodrun_pull (_AFmoduleinst *i) +{ + _AFpull(i, i->outc->nframes); + (*i->mod->run)(i->inc, i->outc, i->modspec); +} + +/* + _AFpush +*/ +void _AFpush (_AFmoduleinst *i, AFframecount nframes2push) +{ + _AFmoduleinst *snk = i->u.push.sink; + i->outc->nframes = nframes2push; + CHNK(printf("%s pushing %" AF_FRAMECOUNT_PRINT_FMT " frames into %s\n", + i->mod->name, i->outc->nframes, snk->mod->name)); + CHNK(_af_print_chunk(i->outc)); + (*(snk->mod->run_push))(snk); +} + +/* + _AFpushat +*/ +void _AFpushat (_AFmoduleinst *i, AFframecount startframe, bool stretchint, + AFframecount nframes2push) +{ + _AFmoduleinst *snk = i->u.push.sink; + + void *saved_buf = i->outc->buf; + i->outc->buf = ((char *)i->outc->buf) + + (_af_format_frame_size_uncompressed(&i->outc->f,stretchint) * startframe); + + i->outc->nframes = nframes2push; + CHNK(printf("%s pushing %" AF_FRAMECOUNT_PRINT_FMT " frames into %s " + "with OFFSET %" AF_FILEOFFSET_PRINT_FMT " frames\n", + i->mod->name, i->outc->nframes, snk->mod->name, startframe)); + CHNK(_af_print_chunk(i->outc)); + (*(snk->mod->run_push))(snk); + + i->outc->buf = saved_buf; +} + +/* + _AFsimplemodrun +*/ +void _AFsimplemodrun_push (_AFmoduleinst *i) +{ + i->outc->nframes = i->inc->nframes; + (*(i->mod->run))(i->inc, i->outc, i->modspec); + _AFpush(i, i->outc->nframes); +} + +/* + These macros each declare a module. + + The module uses _AFsimplemodrun_pull and _AFsimplemodrun_push + (see comments in README.modules). Thus we only have to define + one routine that does the actual processing. + + The arguments to the macros are as follows: + + name - name of module + desc - code for module's "describe" function (see README.modules) + intype - type of elements of input buffer + outtype - type of elements of output buffer + action - action to take in inner loop -- indexes "ip" and "op" with "i" + + modspectype - (MODULEM) this will initialize a pointer "m" + to this instance's modspec data, which is of type modspectype + + Don't use _MODULE directly. + + The code in "desc" is executed once, after the module is + initialized. It can reference "i->modspec" and should modify + "i->outc->f". A pointer "f" initialized to "&i->outc->f" is + emitted prior to "desc"; use this to to keep the code cleaner. + + Note that the generated "run" routine shouldn't set outc->nframes since + + * outc->nframes is set to inc->nframes by _AFsimplemodrun_push + * inc->nframes is set to outc->nframes by _AFsimplemodrun_pull + + The whole point of the simplified "run" routine is that you don't + have to worry about push or pull. + + See README.modules for more info on how modules work. +*/ + +#define _MODULE( name, desc, \ + intype, outtype, chans, preamble, action, postamble )\ +static void name##run(_AFchunk *inc, _AFchunk *outc, void *modspec)\ +{\ + intype *ip = inc->buf;\ + outtype *op = outc->buf;\ + int count = inc->nframes * (chans);\ + int i;\ + \ + preamble;\ + for(i=0; i < count; ++i) \ + action;\ + postamble;\ +}\ +\ +static void name##describe(struct _AFmoduleinst *i)\ +{\ + _AudioFormat *f = &i->outc->f; \ + desc;\ +}\ +\ +static _AFmodule name =\ +{ \ + #name,\ + name##describe, \ + AF_NULL, AF_NULL, \ + _AFsimplemodrun_pull, AF_NULL, AF_NULL, \ + _AFsimplemodrun_push, AF_NULL, AF_NULL, \ + name##run, \ + _AFfreemodspec \ +}; + +#define MODULE(name, desc, intype, outtype, action)\ + _MODULE(name, desc, intype, outtype, inc->f.channelCount, \ + NULLMODULEPARAM, action, NULLMODULEPARAM) + +#define MODULEM(name, desc, intype, outtype, modspectype, action)\ + _MODULE(name, desc, intype, outtype, inc->f.channelCount, \ + modspectype *m = (modspectype *) modspec, action, NULLMODULEPARAM) + +/* + Byte-order-swapping modules. +*/ + +#define MODULESWAP(name, type, action) \ +MODULE(name, \ + f->byteOrder = (f->byteOrder==AF_BYTEORDER_LITTLEENDIAN) ?\ + AF_BYTEORDER_BIGENDIAN : AF_BYTEORDER_LITTLEENDIAN,\ + type, type,\ + action) + +MODULESWAP(swap2, uchar2, + { char3u u; uchar1 c; u.uchar2.s0 = ip[i]; + c = u.uchar1.c1; u.uchar1.c1 = u.uchar1.c0; u.uchar1.c0 = c; + op[i] = u.uchar2.s0; }) + +MODULESWAP(swap3, real_char3, + { char3u u; uchar1 c; u.real_char3_low.c3 = ip[i]; + c = u.uchar1.c3; u.uchar1.c3 = u.uchar1.c1; u.uchar1.c1 = c; + op[i] = u.real_char3_low.c3; }) + +MODULESWAP(swap4, uchar4, + { char3u u; uchar1 c; u.uchar4.i = ip[i]; + c = u.uchar1.c3; u.uchar1.c3 = u.uchar1.c0; u.uchar1.c0 = c; + c = u.uchar1.c1; u.uchar1.c1 = u.uchar1.c2; u.uchar1.c2 = c; + op[i] = u.uchar4.i; }) + +MODULESWAP(swap8, real_char8, + { real_char8 *i8 = &ip[i]; real_char8 *o8 = &op[i]; + o8->c0 = i8->c7; + o8->c1 = i8->c6; + o8->c2 = i8->c5; + o8->c3 = i8->c4; + o8->c4 = i8->c3; + o8->c5 = i8->c2; + o8->c6 = i8->c1; + o8->c7 = i8->c0; }) + +/* + modules for dealing with 3-byte integers +*/ + +/* convert 0xaabbcc to 0xssaabbcc */ +#ifdef WORDS_BIGENDIAN +MODULE(real_char3_to_schar3, f /* NOTUSED */, real_char3, schar3, + { + char3u u; + u.real_char3_high.c3 = ip[i]; + u.real_char3_high.pad = 0; + op[i] = u.schar3.i >> 8; + }) +#else +MODULE(real_char3_to_schar3, f /* NOTUSED */, real_char3, schar3, + { + char3u u; + u.real_char3_low.c3 = ip[i]; + u.real_char3_low.pad = 0; + op[i] = u.schar3.i >> 8; + }) +#endif + +/* convert 0xaabbcc to 0x00aabbcc */ +#ifdef WORDS_BIGENDIAN +MODULE(real_char3_to_uchar3, f /* NOTUSED */, real_char3, uchar3, + { + char3u u; + u.real_char3_high.c3 = ip[i]; + u.real_char3_high.pad = 0; + op[i] = u.uchar3.i >> 8; + }) +#else +MODULE(real_char3_to_uchar3, f /* NOTUSED */, real_char3, uchar3, + { + char3u u; + u.real_char3_low.c3 = ip[i]; + u.real_char3_low.pad = 0; + op[i] = u.uchar3.i >> 8; + }) +#endif + +/* convert 0x??aabbcc to 0xaabbcc */ +#ifdef WORDS_BIGENDIAN +MODULE(char3_to_real_char3, f /* NOTUSED */, uchar3, real_char3, + { + char3u u; + u.uchar3.i = ip[i]; + op[i] = u.real_char3_low.c3; + }) +#else +MODULE(char3_to_real_char3, f /* NOTUSED */, uchar3, real_char3, + { + char3u u; + u.uchar3.i = ip[i]; + op[i] = u.real_char3_high.c3; + }) +#endif + +/* + float <--> double ; CASTS +*/ + +MODULE(float2double, f->sampleFormat = AF_SAMPFMT_DOUBLE, + float, double, op[i] = ip[i] ) +MODULE(double2float, f->sampleFormat = AF_SAMPFMT_FLOAT, + double, float, op[i] = ip[i] ) + +/* + int2floatN - expects 8N-bit 2's comp ints, outputs floats ; CASTS +*/ + +MODULE(int2float1, f->sampleFormat = AF_SAMPFMT_FLOAT, + schar1, float, op[i] = ip[i]) +MODULE(int2float2, f->sampleFormat = AF_SAMPFMT_FLOAT, + schar2, float, op[i] = ip[i]) +MODULE(int2float3, f->sampleFormat = AF_SAMPFMT_FLOAT, + schar3, float, op[i] = ip[i]) +MODULE(int2float4, f->sampleFormat = AF_SAMPFMT_FLOAT, + schar4, float, op[i] = ip[i]) + +/* + int2doubleN - expects 8N-bit 2's comp ints, outputs doubles ; CASTS +*/ + +MODULE(int2double1, f->sampleFormat = AF_SAMPFMT_DOUBLE, + schar1, double, op[i] = ip[i]) +MODULE(int2double2, f->sampleFormat = AF_SAMPFMT_DOUBLE, + schar2, double, op[i] = ip[i]) +MODULE(int2double3, f->sampleFormat = AF_SAMPFMT_DOUBLE, + schar3, double, op[i] = ip[i]) +MODULE(int2double4, f->sampleFormat = AF_SAMPFMT_DOUBLE, + schar4, double, op[i] = ip[i]) + +/* + The following modules perform the transformation between one + pcm mapping and another. + + The modules all use MODULETRANS; some of them also perform + clipping. + + Use initpcmmod() to create an instance of any of these modules. + initpcmmod() takes an _PCMInfo describing the desired output + pcm mapping. +*/ + +typedef struct pcmmodspec +{ + /* These are the computed parameters of the transformation. */ + double m, b; + double maxv, minv; + + /* This is what goes in i->outc->f. */ + _PCMInfo output_mapping; +} pcmmodspec; + +/* + initpcmmod +*/ +static _AFmoduleinst initpcmmod (_AFmodule *mod, + _PCMInfo *input_mapping, _PCMInfo *output_mapping) +{ + _AFmoduleinst ret = _AFnewmodinst(mod); + pcmmodspec *m = _af_malloc(sizeof (pcmmodspec)); + ret.modspec = m; + + /* Remember output mapping for use in the describe function. */ + m->output_mapping = *output_mapping; + + /* + Compute values needed to perform transformation if the module + being initialized does a transformation.. + */ + if (input_mapping) + { + m->m = output_mapping->slope / input_mapping->slope; + m->b = output_mapping->intercept - m->m * input_mapping->intercept; + } + + /* Remember clip values. */ + m->minv = output_mapping->minClip; + m->maxv = output_mapping->maxClip; + return ret; +} + +#define MODULETRANS( name, xtradesc, intype, outtype, action ) \ +MODULEM(name, \ + { \ + f->pcm = ((pcmmodspec *) i->modspec)->output_mapping; \ + xtradesc; \ + }, \ + intype, outtype, pcmmodspec, \ + action) + + +MODULETRANS(floattransform, NULLMODULEPARAM, float, float, \ + op[i]=(m->b + m->m * ip[i])) +MODULETRANS(doubletransform, NULLMODULEPARAM, double, double, \ + op[i]=(m->b + m->m * ip[i])) + +/* + float2intN_clip - expects floats, + outputs CLIPped, 8N-bit, transformed 2's comp ints + double2intN_clip - same deal with doubles +*/ + +#define TRANS_CLIP(type) \ +{\ + double d=(m->b + m->m * ip[i]); \ + op[i] = \ + (((type)((d>(m->maxv)) ? (m->maxv) : ((d<(m->minv))?(m->minv):d)))); \ +} + +MODULETRANS(float2int1_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 8; }, + float, schar1, TRANS_CLIP(schar1)) +MODULETRANS(float2int2_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 16; }, + float, schar2, TRANS_CLIP(schar2)) +MODULETRANS(float2int3_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 24; }, + float, schar3, TRANS_CLIP(schar3)) +MODULETRANS(float2int4_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 32; }, + float, schar4, TRANS_CLIP(schar4)) + +MODULETRANS(double2int1_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 8; }, + double, schar1, TRANS_CLIP(schar1)) +MODULETRANS(double2int2_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 16; }, + double, schar2, TRANS_CLIP(schar2)) +MODULETRANS(double2int3_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 24; }, + double, schar3, TRANS_CLIP(schar3)) +MODULETRANS(double2int4_clip, + { f->sampleFormat = AF_SAMPFMT_TWOSCOMP; f->sampleWidth = 32; }, + double, schar4, TRANS_CLIP(schar4)) + +/* + clipping modules - use initpcmmod() to make one of these + + clips to range given as argument to init function. +*/ + +#define MODULECLIP(name, type)\ +MODULEM(name, \ + { f->pcm = ((pcmmodspec *)i->modspec)->output_mapping; }, \ + type, type, pcmmodspec, \ + { \ + type d=ip[i]; \ + type min=(type)(m->minv); \ + type max=(type)(m->maxv); \ + op[i] = ((d>max) ? max : ((d<min) ? min : d)); \ + } ) + +MODULECLIP(clipfloat, float) +MODULECLIP(clipdouble, double) +MODULECLIP(clip1, schar1) +MODULECLIP(clip2, schar2) +MODULECLIP(clip3, schar3) +MODULECLIP(clip4, schar4) + +/* + unsigned2signedN - expects 8N-bit unsigned ints, outputs 2's comp +*/ + +MODULE(unsigned2signed1, + { + double shift = (double) MIN_INT8; + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + uchar1, schar1, + op[i] = ip[i] + MIN_INT8) +MODULE(unsigned2signed2, + { + double shift = (double) MIN_INT16; + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + uchar2, schar2, + op[i] = ip[i] + MIN_INT16) +MODULE(unsigned2signed3, + { + double shift = (double) MIN_INT24; + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + uchar3, schar3, + op[i] = ip[i] + MIN_INT24) +MODULE(unsigned2signed4, + { + double shift = (double) MIN_INT32; + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + uchar4, schar4, + op[i] = ip[i] + MIN_INT32) + +/* !! unsigned2signed4 shouldn't work, but it does !! */ + + +/* + signed2unsignedN - expects 8N-bit 2's comp ints, outputs unsigned +*/ + +MODULE(signed2unsigned1, + { + double shift = -(double) MIN_INT8; + f->sampleFormat = AF_SAMPFMT_UNSIGNED; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + schar1, uchar1, + op[i] = ip[i] - MIN_INT8) +MODULE(signed2unsigned2, + { + double shift = -(double) MIN_INT16; + f->sampleFormat = AF_SAMPFMT_UNSIGNED; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + schar2, uchar2, + op[i] = ip[i] - MIN_INT16) +MODULE(signed2unsigned3, + { + double shift = -(double) MIN_INT24; + f->sampleFormat = AF_SAMPFMT_UNSIGNED; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + schar3, uchar3, + op[i] = ip[i] - MIN_INT24) +MODULE(signed2unsigned4, + { + double shift = -(double) MIN_INT32; + f->sampleFormat = AF_SAMPFMT_UNSIGNED; + f->pcm.intercept += shift; + f->pcm.minClip += shift; + f->pcm.maxClip += shift; + }, + schar4, uchar4, + op[i] = ip[i] - MIN_INT32) + +/* !! signed2unsigned4 shouldn't work, but it does !! */ + + +/* + These convert between different 2's complement integer formats + with no roundoff/asymmetric errors. They should also work faster + than converting integers to floats and back to other integers. + + They are only meant to be used when the input and output integers + have the default PCM mapping; otherwise, arrangemodules will + make the conversion go through floating point and these modules + will not be used. +*/ + +#define intmap _af_default_signed_integer_pcm_mappings /* shorthand */ + +MODULE(int1_2, { f->sampleWidth = 16; f->pcm=intmap[2]; }, + schar1, schar2, op[i] = ip[i] << 8) +MODULE(int1_3, { f->sampleWidth = 24; f->pcm=intmap[3]; }, + schar1, schar3, op[i] = ip[i] << 16) +MODULE(int1_4, { f->sampleWidth = 32; f->pcm=intmap[4]; }, + schar1, schar4, op[i] = ip[i] << 24) + +MODULE(int2_1, { f->sampleWidth = 8; f->pcm=intmap[1]; }, + schar2, schar1, op[i] = ip[i] >> 8) +MODULE(int2_3, { f->sampleWidth = 24; f->pcm=intmap[3]; }, + schar2, schar3, op[i] = ip[i] << 8) +MODULE(int2_4, { f->sampleWidth = 32; f->pcm=intmap[4]; }, + schar2, schar4, op[i] = ip[i] << 16) + +MODULE(int3_1, { f->sampleWidth = 8; f->pcm=intmap[1]; }, + schar3, schar1, op[i] = ip[i] >> 16) +MODULE(int3_2, { f->sampleWidth = 16; f->pcm=intmap[2]; }, + schar3, schar2, op[i] = ip[i] >> 8) +MODULE(int3_4, { f->sampleWidth = 32; f->pcm=intmap[4]; }, + schar3, schar4, op[i] = ip[i] << 8) + +MODULE(int4_1, { f->sampleWidth = 8; f->pcm=intmap[1]; }, + schar4, schar1, op[i] = ip[i] >> 24) +MODULE(int4_2, { f->sampleWidth = 16; f->pcm=intmap[2]; }, + schar4, schar2, op[i] = ip[i] >> 16) +MODULE(int4_3, { f->sampleWidth = 24; f->pcm=intmap[3]; }, + schar4, schar3, op[i] = ip[i] >> 8) + +#undef intmap + +/* + channel changer modules - convert channels using channel matrix + + The channel matrix is a two-dimensional array of doubles, the rows + of which correspond to the virtual format, and the columns + of which correspond to the file format. + + If the channel matrix is null (unspecified), then the default + behavior occurs (see initchannelchange). + + Internally, the module holds a copy of the matrix in which the + rows correspond to the output format, and the columns correspond + to the input format (therefore, if reading==AF_FALSE, the matrix + is transposed as it is copied). +*/ + +typedef struct channelchangedata +{ + int outchannels; + double minClip; + double maxClip; + double *matrix; +} channelchangedata; + +/* + channelchangefree +*/ +static void channelchangefree (struct _AFmoduleinst *i) +{ + channelchangedata *d = i->modspec; + + assert(d); + assert(d->matrix); + + free(d->matrix); + free(d); + + i->modspec = AF_NULL; +} + +/* + channelchangedescribe +*/ +static void channelchangedescribe (struct _AFmoduleinst *i) +{ + channelchangedata *m = (channelchangedata *) i->modspec; + i->outc->f.channelCount = m->outchannels; + i->outc->f.pcm.minClip = m->minClip; + i->outc->f.pcm.maxClip = m->maxClip; +} + +#define CHANNELMOD( name, type, zero_op, action, afteraction ) \ +static void name##run(_AFchunk *inc, _AFchunk *outc, void *modspec) \ +{ \ + type *ip = inc->buf; \ + type *op = outc->buf; \ + double *matrix = ((channelchangedata *)modspec)->matrix; \ + double *m; \ + int frame, inch, outch; \ + \ + for (frame=0; frame < outc->nframes; frame++) \ + { \ + type *ipsave; \ + \ + m = matrix; \ + ipsave = ip; \ + \ + for (outch = 0; outch < outc->f.channelCount; outch++) \ + { \ + zero_op; \ + ip = ipsave; \ + \ + for (inch = 0; inch < inc->f.channelCount; inch++) \ + action;\ + \ + afteraction; \ + op++;\ + }\ + }\ +}\ +\ +static _AFmodule name =\ +{ \ + #name, \ + channelchangedescribe, \ + AF_NULL, AF_NULL, \ + _AFsimplemodrun_pull, AF_NULL, AF_NULL, \ + _AFsimplemodrun_push, AF_NULL, AF_NULL, \ + name##run, \ + channelchangefree \ +}; + +CHANNELMOD(channelchangefloat, float, *op = 0.0, *op += *ip++ * *m++, \ + NULLMODULEPARAM) +CHANNELMOD(channelchangedouble, double, *op = 0.0, *op += *ip++ * *m++, \ + NULLMODULEPARAM) + +#define CHANNELINTMOD(name, type) \ + CHANNELMOD(name, type, \ + double d=0.0, \ + d += *ip++ * *m++, \ + { \ + double minv=outc->f.pcm.minClip; \ + double maxv=outc->f.pcm.maxClip; \ + *op = (type) ((d>maxv) ? maxv : ((d<minv) ? minv : d)); \ + } ) + +CHANNELINTMOD(channelchange1, schar1) +CHANNELINTMOD(channelchange2, schar2) +CHANNELINTMOD(channelchange3, schar3) +CHANNELINTMOD(channelchange4, schar4) + +/* + initchannelchange +*/ +static _AFmoduleinst initchannelchange (_AFmodule *mod, + double *matrix, _PCMInfo *outpcm, + int inchannels, int outchannels, + bool reading) +{ + _AFmoduleinst ret; + channelchangedata *d; + int i, j; + + ret = _AFnewmodinst(mod); + + d = _af_malloc(sizeof (channelchangedata)); + ret.modspec = d; + d->outchannels = outchannels; + d->minClip = outpcm->minClip; + d->maxClip = outpcm->maxClip; + d->matrix = _af_malloc(sizeof (double) * inchannels * outchannels); + + /* + Set d->matrix to a default matrix if a matrix was not specified. + */ + if (!matrix) + { + bool special=AF_FALSE; + + /* Handle many common special cases. */ + + if (inchannels==1 && outchannels==2) + { + static double m[]={1,1}; + matrix=m; + special=AF_TRUE; + } + else if (inchannels==1 && outchannels==4) + { + static double m[]={1,1,0,0}; + matrix=m; + special=AF_TRUE; + } + else if (inchannels==2 && outchannels==1) + { + static double m[]={.5,.5}; + matrix=m; + special=AF_TRUE; + } + else if (inchannels==2 && outchannels==4) + { + static double m[]={1,0,0,1,0,0,0,0}; + matrix=m; + special=AF_TRUE; + } + else if (inchannels==4 && outchannels==1) + { + static double m[]={.5,.5,.5,.5}; + matrix=m; + special=AF_TRUE; + } + else if (inchannels==4 && outchannels==2) + { + static double m[]={1,0,1,0,0,1,0,1}; + matrix=m; + special=AF_TRUE; + } + else + { + /* + Each input channel from 1 to N + maps to output channel 1 to N where + N=min(inchannels, outchannels). + */ + + for(i=0; i < inchannels; i++) + for(j=0; j < outchannels; j++) + d->matrix[j*inchannels + i] = + (i==j) ? 1.0 : 0.0; + } + + if (special) + memcpy(d->matrix, matrix, + sizeof (double) * inchannels * outchannels); + } + /* Otherwise transfer matrix into d->matrix. */ + else + { + /* reading: copy matrix */ + if (reading) + { + memcpy(d->matrix, matrix, sizeof (double) * inchannels * outchannels); + } + /* writing: transpose matrix */ + else + { + for (i=0; i < inchannels; i++) + for (j=0; j < outchannels; j++) + d->matrix[j*inchannels + i] = + matrix[i*outchannels + j]; + } + } + + DEBG(printf("channelchange d->matrix=")); + DEBG(_af_print_channel_matrix(d->matrix, inchannels, outchannels)); + DEBG(printf("\n")); + + return(ret); +} + +/* just used here */ +typedef struct current_state +{ + _AFmoduleinst *modinst; /* current mod instance we're creating */ + _AFchunk *inchunk; /* current input chunk */ + _AFchunk *outchunk; /* current output chunk */ +} current_state; + +/* + addmod is called once per added module instance. It does the + work of putting the module instance in the list and assigning + it an input and output chunk. +*/ +static void addmod (current_state *current, _AFmoduleinst modinst) +{ + *(current->modinst) = modinst; + current->modinst->valid = AF_TRUE; /* at this point mod must be valid */ + + /* Assign the new module instance an input and an output chunk. */ + + current->modinst->inc = current->inchunk; + current->modinst->outc = current->outchunk; + + /* + The output chunk has the same format and number of frames + as input chunk, except in whatever way the 'describe' + method tells us (see README.modules). + */ + + *(current->outchunk) = *(current->inchunk); + + if (current->modinst->mod->describe) + (*current->modinst->mod->describe)(current->modinst); + + /* + Advance to next module and next chunks. Note that next + moduleinst will have this module's out chunk as input. + */ + + current->modinst++; + current->inchunk = current->outchunk; + current->outchunk++; +} + +/* + initfilemods: + + Functions that deal with extended-lifetime file read / file write + modules and their extended-lifetime rebuffer modules. + called once in the lifetime of an AFfilehandle. + + If h->access == _AF_READ_ACCESS: + + Create the module which will be the first module in the chain, + the one which reads the file. This module does the decompression + if necessary, or it could just be a PCM file reader. + + If h->access == _AF_WRITE_ACCESS: + + Create the module which will be the last module in the chain, + the one which writes the file. This module does the compression + if necessary, or it could just be a PCM file writer. + + Also creates a rebuffer module for these modules if necessary. +*/ +static status initfilemods (_Track *track, AFfilehandle h) +{ + int compressionIndex; + _CompressionUnit *compunit; + AFframecount chunkframes; + + compressionIndex = _af_compression_index_from_id(track->f.compressionType); + compunit = &_af_compression[compressionIndex]; + + /* Invalidate everything. */ + + track->ms.filemodinst.valid = AF_FALSE; + track->ms.filemod_rebufferinst.valid = AF_FALSE; + + /* + Seek to beginning of sound data in the track. + + This is needed ONLY for those modules which have to + read/write some kind of pre-data header or table in the + sound data chunk of the file (such as aware). This is NOT + the seek that sets the file at the beginning of the data. + */ + /* XXXmpruett -- we currently don't set seekok. + if (h->seekok && af_fseek(h->fh, track->fpos_first_frame, SEEK_SET) < 0) + */ + if (af_fseek(h->fh, track->fpos_first_frame, SEEK_SET) < 0) + { + _af_error(AF_BAD_LSEEK, "unable to position file handle at beginning of sound data"); + return AF_FAIL; + } + + /* Create file read/write module. */ + + track->filemodhappy = AF_TRUE; + + if (h->access == _AF_READ_ACCESS) + track->ms.filemodinst = + (*compunit->initdecompress)(track, h->fh, h->seekok, + (h->fileFormat==AF_FILE_RAWDATA), &chunkframes); + else + track->ms.filemodinst = + (*compunit->initcompress)(track, h->fh, h->seekok, + (h->fileFormat==AF_FILE_RAWDATA), &chunkframes); + + if (!track->filemodhappy) + return AF_FAIL; + + track->ms.filemodinst.valid = AF_TRUE; + + /* + WHEN DOES THE FILE GET LSEEKED ? + + Somebody sometime has got to lseek the file to the + beginning of the audio data. Similarly, somebody + has to lseek the file at the time of reset or sync. + Furthermore, we have to make sure that we operate + correctly if more than one track is being read or written. + This is handled differently based on whether we are + reading or writing, and whether the ONE_TRACK_ONLY lseek + optimization is engaged. + + READING: + + If we are reading, the file needs to be positioned once + before we start reading and then once per seek. + + If ONE_TRACK_ONLY is not defined, then there can + be multiple tracks in the file. Thus any call to + afReadFrames could cause the file pointer to be + put anywhere: we can not rely on the file pointer + tracking only one track in the file, thus we must seek + to the current position in track N whenever we begin + an AFreadframes on track N. Thus the lseek is done in + afReadFrames. When a reset occurs (including the initial + one), we merely set trk->fpos_next_frame, and the next + afReadFrames will seek the file there before proceeding. + + If ONE_TRACK_ONLY is defined, meaning there can only + be 1 track in the file, we do not need to ever seek + during normal sequential operation, because the file + read module is the only module which ever accesses the + file after _afOpenFile returns. In this case, we do + not need to do the expensive lseek at the beginning of + every AFreadframes call. We need only seek once when the + file is first opened and once when the file is seeked. + At both of these times, we reset the modules. So we + can do the lseek in resetmodules() right after it has + called all of the modules' reset2 methods. + + WRITING: + + If we are writing, the file needs to be positioned once + before we start writing and it needs to be positioned + after every complete sync operation on the file. + + If ONE_TRACK_ONLY is not defined, then there can be + multiple tracks in the file. This assumes space for + the tracks has been preallocated. Thus any call to + AFwriteframes could cause the file pointer to be + put anywhere: we can not rely on the file pointer + tracking only one track in the file, thus we must seek + to the current position in track n whenever we begin + an AFwriteframes on track n. Thus the lseek is done + in AFwriteframes. When we first start, and when a sync + occurs, we merely set trk->fpos_next_frame, and the next + AFwriteframes will seek the file there before proceeding. + + If ONE_TRACK_ONLY is defined, meaning there can only + be 1 track in the file, we do not need to ever seek + during normal sequential operation, because the file + write module is the only module which ever accesses + the file after _AFopenfile returns. In this case, we + do not need to do the expensive lseek at the beginning + of every AFwriteframes call. We can do the lseek for + the initial case right here (that's what you see below), + and we can do the lseek for syncs in _AFsyncmodules right + after it has called all of the modules' sync2 methods. + + One annoying exceptional case is _AFeditrate, which + can get called at any time. But it saves and restores + the file position at its beginning and end, so it's + no problem. + + WHY THE F(*#&@ DON'T YOU JUST HAVE MULTIPLE FILE DESCRIPTORS? + + The obviously and blatantly better way to do this would be + to simply open one fd per track and then all the problems + go away! Too bad we offer afOpenFD() in the API, which + makes it impossible for the AF to get more than 1 fd + for the file. afOpenFD() is unfortunately used far + more often than afOpenFile(), so the benefit of doing + the optimization the "right" way in the cases where + afOpenFile() are used are not currently too great. + But one day we will have to phase out afOpenFD(). + Too bad, it seemed like such a great idea when we put + it in. + */ + +#ifdef ONE_TRACK_ONLY + if (h->access == _AF_WRITE_ACCESS) + { + if (h->seekok && af_fseek(h->fh, track->fpos_next_frame, SEEK_SET) < 0) + { + _af_error(AF_BAD_LSEEK, + "unable to position write ptr at first data frame"); + return AF_FAIL; + } + } +#endif + + /* Create its rebuffer module. */ + + if (compunit->needsRebuffer) + { + /* We assume the following for now. */ + assert(compunit->nativeSampleFormat == AF_SAMPFMT_TWOSCOMP); + assert(compunit->nativeSampleWidth == 16); + + if (h->access == _AF_WRITE_ACCESS) + track->ms.filemod_rebufferinst = + _af_initint2rebufferv2f(chunkframes*track->f.channelCount, + compunit->multiple_of); + else + track->ms.filemod_rebufferinst = + _af_initint2rebufferf2v(chunkframes*track->f.channelCount, + compunit->multiple_of); + + track->ms.filemod_rebufferinst.valid = AF_TRUE; + } + else + track->ms.filemod_rebufferinst.valid = AF_FALSE; + + /* + These modules should not get freed until the file handle + is destroyed (i.e. the file is closed). + */ + + track->ms.filemodinst.free_on_close = AF_TRUE; + track->ms.filemod_rebufferinst.free_on_close = AF_TRUE; + + return AF_SUCCEED; +} + +/* + addfilereadmods: called once per setup of the modules + for a given AFfilehandle +*/ +static status addfilereadmods (current_state *current, _Track *track, + AFfilehandle h) +{ + assert(track->ms.filemodinst.valid); + + /* Fail in case code is broken and NDEBUG is defined. */ + if (!track->ms.filemodinst.valid) + return AF_FAIL; + + addmod(current, track->ms.filemodinst); + if (track->ms.filemod_rebufferinst.valid) + addmod(current, track->ms.filemod_rebufferinst); + + return AF_SUCCEED; +} + +/* + addfilewritemods is called once per setup of the modules + for a given AFfilehandle. +*/ +static status addfilewritemods (current_state *current, _Track *track, + AFfilehandle h) +{ + assert(track->ms.filemodinst.valid); + + /* Fail in case code is broken and NDEBUG is defined. */ + if (!track->ms.filemodinst.valid) + return(AF_FAIL); + + if (track->ms.filemod_rebufferinst.valid) + addmod(current, track->ms.filemod_rebufferinst); + + addmod(current, track->ms.filemodinst); + + return(AF_SUCCEED); +} + +/* + disposefilemods: called once in the lifetime of an AFfilehandle +*/ +static status disposefilemods (_Track *track) +{ + if (track->ms.filemodinst.valid && + track->ms.filemodinst.mod->free) + (*track->ms.filemodinst.mod->free)(&track->ms.filemodinst); + + track->ms.filemodinst.valid = AF_FALSE; + + if (track->ms.filemod_rebufferinst.valid && + track->ms.filemod_rebufferinst.mod->free) + (*track->ms.filemod_rebufferinst.mod->free)(&track->ms.filemod_rebufferinst); + + track->ms.filemod_rebufferinst.valid = AF_FALSE; + + return AF_SUCCEED; +} + +/* + useAP: rate conversion AP decision maker and warner and kludger +*/ +static bool useAP (double inrate, double outrate, + double *inratep, double *outratep) +{ + bool instandard = + (inrate==8000 || inrate==11025 || inrate==16000 || + inrate==22050 || inrate==32000 || inrate==44100 || + inrate==48000); + bool outstandard = + (outrate==8000 || outrate==11025 || outrate==16000 || + outrate==22050 || outrate==32000 || outrate==44100 || + outrate==48000); + bool incodec; + bool outcodec; + + incodec = (inrate==_AF_SRATE_CODEC || inrate==(long)_AF_SRATE_CODEC); + outcodec = (outrate==_AF_SRATE_CODEC || outrate==(long)_AF_SRATE_CODEC); + + *inratep = inrate; + *outratep = outrate; + + if (instandard && outstandard) return AF_TRUE; + if (incodec && outstandard && outrate != 8000.00) + { + _af_error(AF_WARNING_CODEC_RATE, + "WARNING using input rate 8 kHz instead of %.30g Hz " + "to allow high-quality rate conversion", + inrate); + *inratep = 8000.00; + return AF_TRUE; + } + if (instandard && inrate != 8000.00 && outcodec) + { + _af_error(AF_WARNING_CODEC_RATE, + "WARNING using output rate 8 kHz instead of %.30g Hz " + "to allow high-quality rate conversion", + outrate); + *outratep = 8000.00; + return AF_TRUE; + } + + if (!instandard && !outstandard) + _af_error(AF_WARNING_RATECVT, + "WARNING using lower quality rate conversion due to " + "rates %.30g and %.30g -- " + "output file may contain audible artifacts", + inrate, outrate); + else if (!instandard) + _af_error(AF_WARNING_RATECVT, + "WARNING using lower quality rate conversion due to " + "input rate %.30g -- " + "output file may contain audible artifacts", + inrate); + else /* !outstandard */ + _af_error(AF_WARNING_RATECVT, + "WARNING using lower quality rate conversion due to " + "output rate %.30g -- " + "output file may contain audible artifacts", + outrate); + + return AF_FALSE; +} + +/* + initrateconvertmods handles the extended-life rate conversion + module and its extended-life rebuffer module called once in the + lifetime of an AFfilehandle. +*/ +static void initrateconvertmods (bool reading, _Track *track) +{ + /* no rate conversion initially */ + track->ms.rateconvertinst.valid = AF_FALSE; + track->ms.rateconvert_rebufferinst.valid = AF_FALSE; +} + +static void disposerateconvertmods (_Track *); + +/* XXXmpruett rate conversion is disabled for now */ +#if 0 +/* + addrateconvertmods: called once per setup of the modules + for a given AFfilehandle +*/ +static void addrateconvertmods (current_state *current, int nchannels, + double inrate, double outrate, + bool reading, _Track *track) +{ + AFframecount inframes, outframes; + + /* Check if we are no longer rate converting. */ + if (inrate == outrate) + { + disposerateconvertmods(track); + track->ratecvt_filter_params_set = AF_FALSE; /* XXX HACK */ + } + else + { + /* + We need new rateconverter if we didn't have one + or if rate has changed or rate conversion params + have changed. + */ + if (!track->ms.rateconvertinst.valid || + inrate != track->ms.rateconvert_inrate || + outrate != track->ms.rateconvert_outrate || + track->ratecvt_filter_params_set /* HACK */) + { + bool usingAP = useAP(inrate, outrate, &inrate, &outrate); + + disposerateconvertmods(track); + track->ratecvt_filter_params_set = AF_FALSE; /* HACK */ + + if (usingAP) + { + track->ms.rateconvertinst = InitAFRateConvert(inrate, outrate, + nchannels, + track->taper, track->dynamic_range, + &inframes, &outframes, + track, reading); + + if (!reading) + track->ms.rateconvert_rebufferinst = + initfloatrebufferv2f(inframes*nchannels, AF_FALSE); + else + track->ms.rateconvert_rebufferinst = + initfloatrebufferf2v(outframes*nchannels, AF_FALSE); + + track->ms.rateconvertinst.valid = AF_TRUE; + track->ms.rateconvert_rebufferinst.valid = AF_TRUE; + } + else + { + track->ms.rateconvertinst = initpolyratecvt(track, + inrate, outrate, + nchannels, reading); + + track->ms.rateconvertinst.valid = AF_TRUE; + track->ms.rateconvert_rebufferinst.valid = AF_FALSE; + } + + track->ms.rateconvert_inrate = inrate; + track->ms.rateconvert_outrate = outrate; + + track->ms.rateconvertinst.free_on_close = AF_TRUE; + track->ms.rateconvert_rebufferinst.free_on_close = AF_TRUE; + } + + /* Add the rate conversion modules. */ + + if (!reading && track->ms.rateconvert_rebufferinst.valid) + addmod(current, track->ms.rateconvert_rebufferinst); + + addmod(current, track->ms.rateconvertinst); + + if (reading && track->ms.rateconvert_rebufferinst.valid) + addmod(current, track->ms.rateconvert_rebufferinst); + } +} + +/* + disposerateconvertmods is called once in the lifetime of an + AFfilehandle. +*/ +static void disposerateconvertmods (_Track *track) +{ + /* + Neither module is necessarily valid--there could have been + an error, or the modules could possibly never have been set up. + */ + if (track->ms.rateconvertinst.valid && + track->ms.rateconvertinst.mod->free) + { + (*track->ms.rateconvertinst.mod->free) + (&track->ms.rateconvertinst); + } + + track->ms.rateconvertinst.valid = AF_FALSE; + + if (track->ms.rateconvert_rebufferinst.valid && + track->ms.rateconvert_rebufferinst.mod->free) + { + (*track->ms.rateconvert_rebufferinst.mod->free) + (&track->ms.rateconvert_rebufferinst); + } + + track->ms.rateconvert_rebufferinst.valid = AF_FALSE; +} +#endif /* XXXmpruett rate conversion is disabled for now */ + +/* -------------------------------------------------------------- */ + +/* The stuff in this section is used by arrangemodules(). */ + +static _AFmodule *unsigned2signed[5] = +{ + NULL, + &unsigned2signed1, &unsigned2signed2, + &unsigned2signed3, &unsigned2signed4 +}; + +static _AFmodule *signed2unsigned[5] = +{ + NULL, + &signed2unsigned1, &signed2unsigned2, + &signed2unsigned3, &signed2unsigned4 +}; + +static _AFmodule *swapbytes[9] = +{ + NULL, NULL, &swap2, &swap3, &swap4, + NULL, NULL, NULL, &swap8 +}; + +/* don't forget int24_fmt is really 24 bits right-justified in 32 bits */ + +typedef enum format_code +{ + int8_fmt, + int16_fmt, + int24_fmt, + int32_fmt, + float_fmt, + double_fmt +} format_code; + +#define isinteger(fc) ((fc) <= int32_fmt) +#define isfloating(fc) ((fc) >= float_fmt) + +/* + get_format_code +*/ +static format_code get_format_code (_AudioFormat *fmt) +{ + if (fmt->sampleFormat == AF_SAMPFMT_FLOAT) + return float_fmt; + if (fmt->sampleFormat == AF_SAMPFMT_DOUBLE) + return double_fmt; + + if (fmt->sampleFormat == AF_SAMPFMT_TWOSCOMP || + fmt->sampleFormat == AF_SAMPFMT_UNSIGNED) + { + switch (_af_format_sample_size_uncompressed(fmt, AF_FALSE)) + { + case 1: return int8_fmt; + case 2: return int16_fmt; + case 3: return int24_fmt; + case 4: return int32_fmt; + } + } + + /* NOTREACHED */ + assert(0); + return -1; +} + +static _AFmodule *to_flt[6] = +{ + &int2float1, &int2float2, &int2float3, &int2float4, + NULL, &double2float +}; + +static _AFmodule *to_dbl[6] = +{ + &int2double1, &int2double2, &int2double3, &int2double4, + &float2double, NULL +}; + +static _AFmodule *clip[6] = +{ + &clip1, &clip2, &clip3, &clip4, + &clipfloat, &clipdouble +}; + +static _AFmodule *channelchanges[6] = +{ + &channelchange1, &channelchange2, &channelchange3, &channelchange4, + &channelchangefloat, &channelchangedouble +}; + +/* indices are of type format_code: matrix[infmtcode][outfmtcode] */ +static _AFmodule *convertmatrix[6][6] = +{ + /* TO: + { + int8_fmt, int16_fmt, + int24_fmt, int32_fmt, + float_fmt, double_fmt + } + */ + + /* FROM int8_fmt */ + { + NULL, &int1_2, + &int1_3, &int1_4, + &int2float1, &int2double1 + }, + + /* FROM int16_fmt */ + { + &int2_1, NULL, + &int2_3, &int2_4, + &int2float2, &int2double2 + }, + + /* FROM int24_fmt */ + { + &int3_1, &int3_2, + NULL, &int3_4, + &int2float3, &int2double3 + }, + + /* FROM int32_fmt */ + { + &int4_1, &int4_2, + &int4_3, NULL, + &int2float4, &int2double4 + }, + + /* FROM float_fmt */ + { + &float2int1_clip, &float2int2_clip, + &float2int3_clip, &float2int4_clip, + NULL, &float2double + }, + + /* FROM double_fmt */ + { + &double2int1_clip, &double2int2_clip, + &double2int3_clip, &double2int4_clip, + &double2float, NULL + } +}; + +static _PCMInfo *intmappings[6] = +{ + &_af_default_signed_integer_pcm_mappings[1], + &_af_default_signed_integer_pcm_mappings[2], + &_af_default_signed_integer_pcm_mappings[3], + &_af_default_signed_integer_pcm_mappings[4], + AF_NULL, AF_NULL +}; + +/* + trivial_int_clip +*/ +static bool trivial_int_clip (_AudioFormat *f, format_code code) +{ + return (intmappings[code] != NULL && + f->pcm.minClip == intmappings[code]->minClip && + f->pcm.maxClip == intmappings[code]->maxClip); +} + +/* + trivial_int_mapping +*/ +static bool trivial_int_mapping (_AudioFormat *f, format_code code) +{ + return (intmappings[code] != NULL && + f->pcm.slope == intmappings[code]->slope && + f->pcm.intercept == intmappings[code]->intercept); +} + +/* + arrangemodules decides which modules to use and creates instances + of them. +*/ +static status arrangemodules (_AFfilehandle *h, _Track *track) +{ + bool reading = (h->access == _AF_READ_ACCESS); + + current_state current; + + bool rateconverting, transforming; + bool already_clipped_output, already_transformed_output; + + int insampbytes, outsampbytes; + int chans; + + format_code infc, outfc; + + /* + in and out are the formats at the start and end of the + chain of modules, respectively. + */ + + _AudioFormat in, out; + + /* in==FILE, out==virtual (user) */ + if (reading) + { + in = track->f; + out = track->v; + } + /* in==virtual (user), out==FILE */ + else + { + in = track->v; + out = track->f; + } + + infc = get_format_code(&in); + outfc = get_format_code(&out); + + /* flags */ + + rateconverting = (in.sampleRate != out.sampleRate); + + /* + throughout routine: + + current.modinst points to current module + current.inchunk points to current in chunk, always outchunk-1 + current.outchunk points to current out chunk + + The addmod() function does most of the work. It calls the + "describe" module function, during which a module looks + at inc->f and writes the format it will output in outc->f. + */ + + current.modinst = track->ms.module; + + current.inchunk = track->ms.chunk; + current.outchunk = track->ms.chunk + 1; + + current.inchunk->f = in; + + /* + max # of modules that could be needed together + may need to change this if you change this function + */ + #define MAX_MODULES 17 + + /* Actually arrange the modules. Call addmod() to add one. */ + + /* Add file reader and possibly a decompressor. */ + + if (reading) + if (AF_FAIL == addfilereadmods(¤t, track, h)) + return AF_FAIL; + + /* Make data native-endian. */ + + if (in.byteOrder != _AF_BYTEORDER_NATIVE) + { + int bytes_per_samp = _af_format_sample_size_uncompressed(&in, !reading); + + if (bytes_per_samp > 1 && + in.compressionType == AF_COMPRESSION_NONE) + { + assert(swapbytes[bytes_per_samp]); + addmod(¤t, _AFnewmodinst(swapbytes[bytes_per_samp])); + } + else + in.byteOrder = _AF_BYTEORDER_NATIVE; + } + + /* Handle nasty 3-byte input cases. */ + + insampbytes = _af_format_sample_size_uncompressed(&in, AF_FALSE); + + if (isinteger(infc) && insampbytes == 3) + { + if (reading || in.compressionType != AF_COMPRESSION_NONE) + { + /* + We're reading 3-byte ints from a file. + At this point stretch them to 4-byte ints + by sign-extending or adding a zero-valued + most significant byte. We could also + be reading/writing 3-byte samples output + from a decompressor. + */ + if (in.sampleFormat == AF_SAMPFMT_UNSIGNED) + addmod(¤t, _AFnewmodinst(&real_char3_to_uchar3)); + else + addmod(¤t, _AFnewmodinst(&real_char3_to_schar3)); + } + else /* writing, non-compressed */ + { + /* + We're processing 3-byte ints from the + user, which come in as sign-extended + 4-byte quantities. How convenient: + this is what we want. + */ + } + } + + /* Make data signed. */ + + if (in.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + addmod(¤t, _AFnewmodinst(unsigned2signed[insampbytes])); + } + + /* Standardize pcm mapping of "in" and "out". */ + + /* + Since they are used to compute transformations in the + inner section of this routine (inside of sign conversion), + we need in.pcm and out.pcm in terms of AF_SAMPFMT_TWOSCOMP + numbers. + */ + in.pcm = current.inchunk->f.pcm; /* "in" is easy */ + + if (out.sampleFormat == AF_SAMPFMT_UNSIGNED) /* "out": undo the unsigned shift */ + { + double shift = intmappings[outfc]->minClip; + out.pcm.intercept += shift; + out.pcm.minClip += shift; + out.pcm.maxClip += shift; + } + + /* ------ CLIP user's input samples if necessary */ + + if (in.pcm.minClip < in.pcm.maxClip && !trivial_int_clip(&in, infc)) + addmod(¤t, initpcmmod(clip[infc], AF_NULL, &in.pcm)); + + /* + At this point, we assume we can have doubles, floats, + and 1-, 2-, and 4-byte signed integers on the input and + on the output (or 4-byte integers with 24 significant + (low) bits, int24_fmt). + + Now we handle rate conversion and pcm transformation. + */ + + /* If rate conversion will happen, we must have floats. */ + /* + This may result in loss of precision. This bug must be + fixed eventually. + */ + if (rateconverting && infc != float_fmt) + { + addmod(¤t, _AFnewmodinst(to_flt[infc])); + infc = float_fmt; + } + + /* + We must make sure the output samples will get clipped + to SOMETHING reasonable if we are rateconverting. + The user cannot possibly expect to need to clip values + just because rate conversion is on. + */ + + if (out.pcm.minClip >= out.pcm.maxClip && rateconverting) + { + out.pcm.minClip = out.pcm.intercept - out.pcm.slope; + out.pcm.maxClip = out.pcm.intercept + out.pcm.slope; + } + + already_clipped_output = AF_FALSE; + already_transformed_output = AF_FALSE; + + /* + We need to perform a transformation (in floating point) + if the input and output PCM mappings are different. + + The only exceptions are the trivial integer conversions + (i.e., full-range integers of one # of bytes to full-range + integers to another # of bytes). + */ + + transforming = (in.pcm.slope != out.pcm.slope || + in.pcm.intercept != out.pcm.intercept) && + !(trivial_int_mapping(&in, infc) && + trivial_int_mapping(&out,outfc)); + + /* + If we have ints on input and the user is performing a + change of mapping other than a trivial one, we must go + to floats or doubles. + */ + + if (isinteger(infc) && transforming) + { + /* + Use doubles if either the in or out format has + that kind of precision. + */ + if (infc == int32_fmt || + outfc == double_fmt || outfc == int32_fmt) + { + addmod(¤t, _AFnewmodinst(to_dbl[infc])); + infc = double_fmt; + } + else + { + addmod(¤t, _AFnewmodinst(to_flt[infc])); + infc = float_fmt; + } + } + + DEBG(printf("arrangemodules in="); _af_print_audioformat(&in);); + DEBG(printf("arrangemodules out="); _af_print_audioformat(&out);); + DEBG(printf("arrangemodules transforming=%d\n", transforming)); + DEBG(printf("arrangemodules infc=%d outfc=%d\n", infc, outfc)); + + /* + invariant: + + At this point, if infc is an integer format, then we are + not rate converting, nor are we perfoming any change of + mapping other than possibly a trivial int->int conversion. + */ + + /* ----- convert format infc to format outfc */ + + /* change channels if appropriate now */ + + if (in.channelCount != out.channelCount && + (infc > outfc || (infc==outfc && out.channelCount < in.channelCount))) + { + addmod(¤t, + initchannelchange(channelchanges[infc], + track->channelMatrix, &in.pcm, + in.channelCount, out.channelCount, + reading)); + chans = out.channelCount; + } + else + chans = in.channelCount; + + /* Transform floats if appropriate now. */ + + if (transforming && + infc==double_fmt && isfloating(outfc)) + { + addmod(¤t, initpcmmod(&doubletransform, &in.pcm, &out.pcm)); + } + +#if 0 /* XXXmpruett */ + /* + Handle rate conversion (will do the right thing if + not rate converting). + */ + + addrateconvertmods(¤t, chans, in.sampleRate, out.sampleRate, reading, track); +#endif + + /* Add format conversion, if needed */ + + if (convertmatrix[infc][outfc]) + { + /* + for float/double -> int conversions, the module + we use here also does the transformation and + clipping. + + We use initpcmmod() in any case because it is harmless + for the other modules in convertmatrix[][]. + */ + if (isfloating(infc) && isinteger(outfc)) /* "float"->"int" */ + { + already_clipped_output = AF_TRUE; + already_transformed_output = AF_TRUE; + } + addmod(¤t, initpcmmod(convertmatrix[infc][outfc], + &in.pcm, &out.pcm)); + } + + /* Transform floats if appropriate now. */ + + if (transforming && !already_transformed_output && infc != double_fmt) + { + if (outfc==double_fmt) + addmod(¤t, initpcmmod(&doubletransform, + &in.pcm, &out.pcm)); + else if (outfc==float_fmt) + addmod(¤t, initpcmmod(&floattransform, + &in.pcm, &out.pcm)); + } + + /* Change channels if appropriate now. */ + + if (in.channelCount != out.channelCount && + (outfc > infc || (infc==outfc && in.channelCount < out.channelCount))) + { + addmod(¤t, + initchannelchange(channelchanges[outfc], + track->channelMatrix, &out.pcm, + in.channelCount, out.channelCount, + reading)); + } + + /* ------ CLIP user's output samples if needed */ + + if (!already_clipped_output) + { + if (out.pcm.minClip < out.pcm.maxClip && + !trivial_int_clip(&out, outfc)) + { + addmod(¤t, initpcmmod(clip[outfc], NULL, &out.pcm)); + } + } + + /* Make data unsigned if neccessary. */ + + outsampbytes = _af_format_sample_size_uncompressed(&out, AF_FALSE); + + if (out.sampleFormat == AF_SAMPFMT_UNSIGNED) + addmod(¤t, _AFnewmodinst(signed2unsigned[outsampbytes])); + + /* Handle nasty 3-byte output cases. */ + + if (isinteger(outfc) && outsampbytes == 3) + { + if (!reading || out.compressionType != AF_COMPRESSION_NONE) + { + /* + We're writing 3-byte ints into a file. + We have 4-byte ints. Squish them to + 3 by truncating the high byte off. + we could also be reading/writing ints + into a compressor. note this works for + signed and unsigned, and has to. + */ + addmod(¤t, _AFnewmodinst(&char3_to_real_char3)); + } + else /* reading, not compressed */ + { + /* + We're reading 3-byte ints into the + user's buffer. + + The user expects + 1. 4-byte sign-extended ints (3 bytes + sign extended in 4 bytes) or + 2. 4-byte unsigned ints (3 bytes in 4 bytes). + + How convenient: this is just what we have. + */ + } + } + + if (out.byteOrder != _AF_BYTEORDER_NATIVE) + { + int bytes_per_samp = _af_format_sample_size_uncompressed(&out, reading); + + if (bytes_per_samp > 1 && out.compressionType == AF_COMPRESSION_NONE) + { + assert(swapbytes[bytes_per_samp]); + addmod(¤t, _AFnewmodinst(swapbytes[bytes_per_samp])); + } + } + + /* Add file writer, possibly a compressor. */ + + if (!reading) + if (AF_FAIL == addfilewritemods(¤t, track, h)) + return(AF_FAIL); + + /* Now all modules are arranged! */ + + track->ms.nmodules = current.modinst - track->ms.module; + +#ifdef UNLIMITED_CHUNK_NVFRAMES + /* + OPTIMIZATION: normally, when we set up the modules, AFreadframes + and AFwriteframes must pull and push chunks of size at most + _AF_ATOMIC_NVFRAMES. + + For the simplest configurations of modules (1 module, no + compression), no buffering at all needs to be done by the + module system. In these cases, afReadFrames/afWriteFrames + can pull/push as many virtual frames as they want + in one call. This flag tells tells afReadFrames and + afWriteFrames whether they can do so. + + Note that if this flag is set, file modules cannot rely + on the intermediate working buffer which _AFsetupmodules + usually allocates for them in their input or output chunk + (for reading or writing, respectively). This is why if + we are reading/writing compressed data, this optimization + is turned off. + + There are warnings to this effect in the pcm + (uncompressed) file read/write module. If you want to + apply this optimization to other types, be sure to put + similar warnings in the code. + */ + if (track->ms.nmodules == 1 && + track->v.compressionType == AF_COMPRESSION_NONE && + track->f.compressionType == AF_COMPRESSION_NONE) + track->ms.mustuseatomicnvframes = AF_FALSE; + else + track->ms.mustuseatomicnvframes = AF_TRUE; +#else + track->ms.mustuseatomicnvframes = AF_TRUE; +#endif + + return AF_SUCCEED; +} + +/* + disposemodules will free old buffers and free old modules, except + those marked with free_on_close. + + The modules existing before we dispose them could be: + + 1. none (we may have only called _AFinitmodules and not _AFsetupmodules) + 2. some invalid PARTIALLY ALLOCATED ones (e.g. the last _AFsetupmodules + had an error) or + 3. a perfectly valid set of modules. + + disposemodules will deal with all three cases. +*/ +static void disposemodules (_Track *track) +{ + if (track->ms.module) + { + int i; + + for (i=0; i < MAX_MODULES; i++) + { + _AFmoduleinst *mod = &track->ms.module[i]; + +#ifdef AF_DEBUG + if (!mod->valid && i < track->ms.nmodules) + printf("disposemodules: WARNING in-range invalid module found '%s'\n", mod->mod->name); +#endif + + if (mod->valid && !mod->free_on_close && mod->mod->free) + { + (*mod->mod->free)(mod); + mod->valid = AF_FALSE; + } + } + + free(track->ms.module); + track->ms.module = AF_NULL; + } + track->ms.nmodules = 0; + + if (track->ms.chunk) + { + free(track->ms.chunk); + track->ms.chunk = AF_NULL; + } + + if (track->ms.buffer) + { + int i; + for (i=0; i < (MAX_MODULES+1); i++) + { + if (track->ms.buffer[i] != AF_NULL) + { + free(track->ms.buffer[i]); + track->ms.buffer[i] = AF_NULL; + } + } + free(track->ms.buffer); + track->ms.buffer = AF_NULL; + } +} + +/* + resetmodules: see advanced section in README.modules for more info +*/ +static status resetmodules (_AFfilehandle *h, _Track *track) +{ + int i; + + /* + We should already have called _AFsetupmodules. + (Actually this is called from the end of _AFsetupmodules + but whatever). + */ + + assert(!track->ms.modulesdirty); + + /* Assume all is well with track. */ + track->filemodhappy = AF_TRUE; + + CHNK(printf("resetmodules running reset1 routines\n")); + + /* Reset all modules. */ + for (i=track->ms.nmodules-1; i >= 0; i--) + { + /* reset1 */ + if (track->ms.module[i].mod->reset1 != AF_NULL) + (*track->ms.module[i].mod->reset1)(&track->ms.module[i]); + } + + /* Clear out frames2ignore here; the modules will increment it. */ + track->frames2ignore = 0; + + if (!track->filemodhappy) + return AF_FAIL; + + CHNK(printf("resetmodules running reset2 routines\n")); + + for (i=0; i < track->ms.nmodules; i++) + { + /* reset2 */ + if (track->ms.module[i].mod->reset2 != AF_NULL) + (*track->ms.module[i].mod->reset2)(&track->ms.module[i]); + } + + CHNK(printf("resetmodules completed\n")); + + if (!track->filemodhappy) + return AF_FAIL; + +#ifdef ONE_TRACK_ONLY + /* + For an explanation of this, see the comment in + initfilemods which explains how and when the file is + lseek'ed. + */ + if (h->seekok) + if (lseek(h->fd, track->fpos_next_frame, SEEK_SET) < 0) + { + _af_error(AF_BAD_LSEEK, + "unable to position read pointer at next data frame"); + return AF_FAIL; + } +#endif + + return AF_SUCCEED; +} + +/* + _AFsyncmodules +*/ +status _AFsyncmodules (AFfilehandle h, _Track *track) +{ + int i; + + /* We should already have called _AFsetupmodules. */ + assert(!track->ms.modulesdirty); + + /* Assume all is well with track. */ + track->filemodhappy = AF_TRUE; + + CHNK(printf("_AFsyncmodules running sync1 routines\n")); + + /* Sync all modules. */ + for(i=track->ms.nmodules-1; i >= 0; i-- ) + { + /* sync1 */ + if (AF_NULL != track->ms.module[i].mod->sync1) + (*track->ms.module[i].mod->sync1)(&track->ms.module[i]); + } + + if (!track->filemodhappy) + return AF_FAIL; + + CHNK(printf("_AFsyncmodules running sync2 routines\n")); + + for (i=0; i < track->ms.nmodules; i++) + { + /* sync2 */ + if (AF_NULL != track->ms.module[i].mod->sync2) + (*track->ms.module[i].mod->sync2)(&track->ms.module[i]); + } + + CHNK(printf("_AFsyncmodules completed\n")); + + if (!track->filemodhappy) + return AF_FAIL; + +#ifdef ONE_TRACK_ONLY + /* + For an explanation of this, see the comment in + initfilemods which explains how and when the file is + lseek'ed. + */ + if (h->seekok) + if (lseek( h->fd, track->fpos_next_frame, SEEK_SET) < 0 ) + { + _af_error(AF_BAD_LSEEK, + "unable to position write ptr at next data frame"); + return(AF_FAIL); + } +#endif + + return AF_SUCCEED; +} + +/* + _AFsetupmodules: + - frees any old modules, chunks, and buffers + - looks at the input and output format and sets up a whole new + set of input and output modules (using arrangemodules()) + - assigns those modules chunks + - allocates buffers and assigns the buffers to the chunks + - initializes various track fields pertaining to the module system + + It returns AF_FAIL on any kind of error. + + It sets modulesdirty to AF_FALSE if it was able to clean the + modules (although an error still could have occurred after + cleaning them). +*/ +status _AFsetupmodules (AFfilehandle h, _Track *track) +{ + _AFmoduleinst *modules; + _AFchunk *chunks; + void **buffers; + int maxbufsize, bufsize, i; + double rateratiof2v, fframepos; + + /* + The purpose of this function is to "clean" the modules: + + * All of the fields in trk->ms are completely set + and valid. + + * track->totalvframes and track->next[fv]frame are set + and valid and trk->modulesdirty will be set to AF_FALSE + if this function succeeds. + + This function also resets the modules on files open for read. + it will return AF_FAIL if either cleaning the modules fails, + or this reset fails. + + The comments will tell you which part does what. + */ + + /* + NOTE: we cannot trust any value in track->ms until we + have called disposemodules(), at which time things are + cleared to reasonable "zero" values. + + It is possible for track->ms to be in an illegal state + at this point, if the last _AFsetupmodules failed with + an error. + + We can trust track->totalvframes and track->next[fv]frame + because they are only modified after successfully building + the modules. + */ + + /* + Disallow compression in virtual format for now. + */ + if (track->v.compressionType != AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "library does not support compression in virtual format yet"); + return AF_FAIL; + } + + /* + Check that virtual compression parameters are ok. + */ + { + int idx = _af_compression_index_from_id(track->v.compressionType); + if ((*_af_compression[idx].fmtok)(&track->v) == AF_FALSE) + { + return AF_FAIL; + } + } + + /* + track->nextvframe and track->nextfframe: + + At this point, only track->nextvframe contains useful + information, since track->nextfframe may be swayed by + currently buffered frames. + + Also track->nextvframe is currently in the scale of the + old sampling rate, not the new one we are setting up. + + So at this point we remember where we are in the file + (in floating point) in terms of the file sampling rate. + + We will use this later in this function to set both + track->nextfframe (for reading) and track->nextvframe + (for reading and writing). + + We must be careful to use the old rates, not the ones + in track->{f,v}. + */ + + /* If modules have been set up at all */ + if (track->ms.old_v_rate > 0) + { + assert(track->ms.old_f_rate > 0); + rateratiof2v = track->ms.old_f_rate / track->ms.old_v_rate; + fframepos = track->nextvframe * rateratiof2v; + } + else + /* We start at frame zero. */ + fframepos = 0; + + /* + Dispose the existing modules (except extended-life ones). + + See the function for info on what the module state could + be at this time. + */ + + disposemodules(track); + + /* + Here we allocate the highest number of module instances + (and chunks) chained together we could possibly need. + + This is how the chunks are used: + + module[n]'s input chunk is chunk[n] + module[n]'s output chunk is chunk[n+1] + + chunk[n]'s buffer, if it is not the user's buffer, is buffer[n]. + + For reading chunk[0] is not usually used. + For writing chunk[nmodules] is not usually used. + + We allocate a buffer for chunk[0] on reading and + chunk[nmodules] when writing because the file reading + or file writing module, if it does compression or + decompression, may need extra space in which to place + the result of its processing before reading or writing it. + + Also note that chunk[0].f and chunk[nmodules].f are used in + arrangemodules(). + */ + modules = _af_malloc(sizeof (_AFmoduleinst) * MAX_MODULES); + if (modules == AF_NULL) + return AF_FAIL; + for (i=0; i < MAX_MODULES; i++) + modules[i].valid = AF_FALSE; + + chunks = _af_malloc(sizeof (_AFchunk) * (MAX_MODULES+1)); + if (chunks == AF_NULL) + return AF_FAIL; + + buffers = _af_malloc(sizeof (void *) * (MAX_MODULES+1)); + if (buffers == AF_NULL) + return AF_FAIL; + /* + It is very important to initialize each buffers[i] to NULL; + dispose frees them all if !NULL. + */ + + for (i=0; i < (MAX_MODULES+1); i++) + buffers[i] = AF_NULL; + + track->ms.module = modules; + /* + nmodules is a bogus value here, set just for sanity + (in case of broken code). + */ + + track->ms.nmodules = 0; + track->ms.chunk = chunks; + track->ms.buffer = buffers; + + /* + Figure out the best modules to use to convert the + data and initialize instances of those modules. + Fills "track->ms.module" and most of "track->ms.chunk" + arrays (all but the buffers) as it goes. Sets + "track->ms.nmodules" As a side benefit, this function + also leaves information about the data format at each + stage in the "f" field of each chunk. + */ + if (arrangemodules(h, track) == AF_FAIL) + { + /* + At this point the modules are in an incompletely + initialized and probably illegal state. nmodules + could be meaningful or not. Things are nasty. + + But as long as any API call that uses the + modules calls _AFsetupmodules() first (which + then calls disposemodules(), which can handle + this nastiness), we can restore the modules to + a sane initial state and things will be ok. + */ + + return AF_FAIL; + } + + /* + At this point modules and nmodules are almost completely + filled in (modules aren't actually connected to one + another), but buffer[n] and chunk[n].buf are still in + a null state. + + track->totalvframes and track->next[fv]frame have not yet been + set to a valid state. + */ + + /* + Now go through the modules: + + 1. Connect up the source/sink fields properly. + 2. Use the information left in the _AudioFormat field + of each chunk by setupmodules() along with the + "max_pull"/"max_push" module function to figure + out the biggest buffer size that could be needed. + */ + + /* filemod reports error here */ + track->filemodhappy = AF_TRUE; + maxbufsize = 0; + + if (h->access == _AF_READ_ACCESS) + { + track->ms.chunk[track->ms.nmodules].nframes = _AF_ATOMIC_NVFRAMES; + + for (i=track->ms.nmodules-1; i >= 0; i--) + { + _AFchunk *inc = &track->ms.chunk[i]; + _AFchunk *outc = &track->ms.chunk[i+1]; + + /* check bufsize needed for current output chunk */ + + bufsize = outc->nframes * _af_format_frame_size(&outc->f, AF_TRUE); + if (bufsize > maxbufsize) + maxbufsize = bufsize; + + if (i != 0) + { + /* Connect source pointer for this module. */ + + track->ms.module[i].u.pull.source = &track->ms.module[i-1]; + } + + /* + Determine inc->nframes from outc->nframes. + If the max_pull function is present, we use it, + otherwise we assume module does no weird + buffering or rate conversion. + */ + if (track->ms.module[i].mod->max_pull) + (*track->ms.module[i].mod->max_pull)(&track->ms.module[i]); + else + inc->nframes = outc->nframes; + } + + if (!track->filemodhappy) + return AF_FAIL; + + /* + Check bufsize needed for filemod's input chunk + (intermediate buffer) based on an uncompressed + (output chunk) framesize. + */ + + { + _AFmoduleinst *filemod = &track->ms.module[0]; + bufsize = filemod->inc->nframes * + _af_format_frame_size(&filemod->outc->f, AF_TRUE); + if (bufsize > maxbufsize) + maxbufsize = bufsize; + } + } + else + { + track->ms.chunk[0].nframes = _AF_ATOMIC_NVFRAMES; + + for (i=0; i < track->ms.nmodules; i++) + { + _AFchunk *inc = &track->ms.chunk[i]; + _AFchunk *outc = &track->ms.chunk[i+1]; + + /* Check bufsize needed for current input chunk. */ + + bufsize = inc->nframes * _af_format_frame_size(&inc->f, AF_TRUE); + if (bufsize > maxbufsize) + maxbufsize = bufsize; + + if (i != track->ms.nmodules-1) + { + /* Connect sink pointer. */ + + track->ms.module[i].u.push.sink = &track->ms.module[i+1]; + } + + /* + Determine outc->nframes from inc->nframes. + If the max_push function is present, we use it, + otherwise we assume module does no weird + buffering or rate conversion. + */ + if (track->ms.module[i].mod->max_push) + (*track->ms.module[i].mod->max_push)(&track->ms.module[i]); + else + outc->nframes = inc->nframes; + } + + if (!track->filemodhappy) + return AF_FAIL; + + /* + Check bufsize needed for filemod's output chunk + (intermediate buffer) based on an uncompressed (input + chunk) framesize. + */ + + { + _AFmoduleinst *filemod = &track->ms.module[track->ms.nmodules-1]; + bufsize = filemod->outc->nframes * + _af_format_frame_size(&filemod->inc->f, AF_TRUE); + if (bufsize > maxbufsize) + maxbufsize = bufsize; + } + } + + /* + At this point everything is totally set up with the + modules except that the chunk buffers have not been + allocated, and thus buffer[n] and chunk[n].buf have + not been set. But now we know how big they should be + (maxbufsize). + + track->totalvframes and track->next[fv]frame have not + yet been set to a valid state. + */ + DEBG(printf("_AFsetupmodules: maxbufsize=%d\n", maxbufsize)); + + /* + One of these will get overwritten to point to user's + buffer. The other one will be allocated below (for file + read/write module). + */ + + track->ms.chunk[track->ms.nmodules].buf = AF_NULL; + track->ms.chunk[0].buf = AF_NULL; + + /* + One of these will be allocated for the file read/write + module The other will be completely unused. + */ + track->ms.buffer[track->ms.nmodules] = AF_NULL; + track->ms.buffer[0] = AF_NULL; + + /* + Now that we know how big buffers have to be, allocate + buffers and assign them to the module instances. + + Note that track->ms.chunk[nmodules].buf (reading) or + track->ms.chunk[0].buf (writing) will get overwritten + in _AFreadframes or _AFwriteframes to point to the + user's buffer. + + We allocate a buffer for track->ms.chunk[0].buf (reading) + or track->ms.chunk[nmodules].buf (writing) not because + it is needed for the modules to work, but as a working + buffer for the file reading / file writing modules. + + Also note that some modules may change their inc->buf or + outc->buf to point to something internal to the module + before calling their source or sink. + + So module code must be careful not to assume that a buffer + address will not change. Only for chunk[nmodules] + (reading) or chunk[0] (writing) is such trickery + disallowed. + */ + + if (h->access == _AF_READ_ACCESS) + for (i=track->ms.nmodules-1; i >= 0; i--) + { + if ((track->ms.buffer[i] = _af_malloc(maxbufsize)) == AF_NULL) + return AF_FAIL; + track->ms.chunk[i].buf = track->ms.buffer[i]; + } + else + for (i=1; i <= track->ms.nmodules; i++) + { + if ((track->ms.buffer[i] = _af_malloc(maxbufsize)) == AF_NULL) + return AF_FAIL; + track->ms.chunk[i].buf = track->ms.buffer[i]; + } + + /* + Hooray! The modules are now in a completely valid state. + But we can't set track->ms.modulesdirty to AF_FALSE yet... + + track->totalvframes and track->next[fv]frame have not yet been + set to a valid state. + */ + if (h->access == _AF_READ_ACCESS) + { + /* + Set total number of virtual frames based on new rate. + */ + if (track->totalfframes == -1) + track->totalvframes = -1; + else + track->totalvframes = track->totalfframes * + (track->v.sampleRate / track->f.sampleRate); + + /* + track->nextvframe and track->nextfframe: + + Currently our only indication of where we were + in the file is the variable fframepos, which + contains (in floating point) our offset in file + frames based on the old track->nextvframe. + + Now we get as close as we can to that original + position, given the new sampling rate. + */ + + track->nextfframe = (AFframecount) fframepos; + track->nextvframe = (AFframecount) (fframepos * (track->v.sampleRate / track->f.sampleRate)); + + /* + Now we can say the module system is in a + clean state. Any errors we get from here on + are reported but not critical. + */ + + track->ms.modulesdirty = AF_FALSE; + + /* Set up for next time. */ + track->ms.old_f_rate = track->f.sampleRate; + track->ms.old_v_rate = track->v.sampleRate; + + /* + Now we reset all the modules. + + If we are here because the user did afSeekFrame, + the actual seek will be performed here. + Otherwise this reset will set things up so that + we are at the same file offset we were at before + (or as close as possible given a change in + rate conversion). + */ + + /* Report error, but we're still clean. */ + if (AF_SUCCEED != resetmodules(h, track)) + return AF_FAIL; + } + /* Handle the case of _AF_WRITE_ACCESS. */ + else + { + /* + Don't mess with track->nextfframe or + track->totalfframes. Scale virtual frame position + relative to old virtual position. + */ + + track->nextvframe = track->totalvframes = + (AFframecount) (fframepos * (track->v.sampleRate / track->f.sampleRate)); + + /* + Now we can say the module system is in a + clean state. Any errors we get from here on + are reported but not critical. + */ + + track->ms.modulesdirty = AF_FALSE; + + /* Set up for next time. */ + track->ms.old_f_rate = track->f.sampleRate; + track->ms.old_v_rate = track->v.sampleRate; + } + + DEBG(_af_print_filehandle(h)); + +#ifdef DEBUG + for (i=track->ms.nmodules-1; i >= 0; i--) + { + _AFmoduleinst *inst = &track->ms.module[i]; + } + + { + /* Print format summary. */ + + printf("%s ->\n", (h->access == _AF_READ_ACCESS) ? "file" : "user"); + for (i=0; i < track->ms.nmodules; i++) + { + _AFmoduleinst *inst = &track->ms.module[i]; + _af_print_audioformat(&inst->inc->f); + printf(" -> %s(%d) ->\n", inst->mod->name, i); + } + _af_print_audioformat(&track->ms.chunk[track->ms.nmodules].f); + printf(" -> %s\n", (h->access != _AF_READ_ACCESS) ? "file" : "user"); + } +#endif + + /* + If we get here, then not only are the modules clean, but + whatever we did after the modules became clean succeeded. + So we gloat about our success. + */ + return AF_SUCCEED; +} + +/* + _AFinitmodules: this routine sets the initial value of the module- + related fields of the track when the track is first created. + + It also initializes the file read or file write modules. + See README.modules for info on this. + + Set "modulesdirty" flag on each track, so that the first + read/write/seek will set up the modules. +*/ +status _AFinitmodules (AFfilehandle h, _Track *track) +{ + track->channelMatrix = NULL; + + /* HACK: see private.h for a description of this hack */ + track->taper = 10; + track->dynamic_range = 100; + track->ratecvt_filter_params_set = AF_TRUE; + + track->ms.nmodules = 0; + track->ms.module = NULL; + track->ms.chunk = NULL; + track->ms.buffer = NULL; + + track->ms.modulesdirty = AF_TRUE; + + track->ms.filemodinst.valid = AF_FALSE; + track->ms.filemod_rebufferinst.valid = AF_FALSE; + + track->ms.rateconvertinst.valid = AF_FALSE; + track->ms.rateconvert_rebufferinst.valid = AF_FALSE; + + /* bogus value in case of bad code */ + track->ms.mustuseatomicnvframes = AF_TRUE; + + /* old_f_rate and old_v_rate MUST be set to <= 0 here. */ + track->ms.old_f_rate = -1; + track->ms.old_v_rate = -1; + + /* + Initialize extended-life file read or file write modules. + */ + if (AF_FAIL == initfilemods(track, h)) + return AF_FAIL; + + /* + Initialize extended-life rate convert modules (to NULL). + */ + initrateconvertmods(h->access == _AF_READ_ACCESS, track); + + /* + NOTE: Only now that we have initialized filemods is + track->totalfframes guaranteed to be ready. (The unit + cannot always tell how many frames are in the file.) + */ + + /* totalfframes could be -1. */ + track->totalvframes = track->totalfframes; + track->nextvframe = 0; + track->frames2ignore = 0; + + return AF_SUCCEED; +} + +/* + _AFfreemodules: + called once when filehandle is being freed + opposite of initmodules + free all modules, even the active ones +*/ +void _AFfreemodules (_Track *track) +{ + disposemodules(track); + disposefilemods(track); +#if 0 /* XXXmpruett rate conversion is deactivated for now */ + disposerateconvertmods(track); +#endif +} diff --git a/libaudiofile/modules.h b/libaudiofile/modules.h new file mode 100644 index 0000000..b06729d --- /dev/null +++ b/libaudiofile/modules.h @@ -0,0 +1,112 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + modules.h +*/ + +#ifndef MODULES_H +#define MODULES_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include <sys/types.h> + +#include "audiofile.h" +#include "afinternal.h" + +typedef u_int8_t uchar1; +typedef u_int16_t uchar2; +typedef u_int32_t uchar3; +typedef u_int32_t uchar4; + +typedef int8_t schar1; +typedef int16_t schar2; +typedef int32_t schar3; +typedef int32_t schar4; + +typedef struct real_char3 { uchar1 c0; uchar1 c1; uchar1 c2; } real_char3; +typedef union char3u +{ + struct { schar4 i; } schar4; + struct { uchar4 i; } uchar4; + struct { schar3 i; } schar3; + struct { uchar3 i; } uchar3; + struct { real_char3 c3; schar1 pad; } real_char3_high; + struct { schar1 pad; real_char3 c3; } real_char3_low; + struct { uchar2 s0; uchar2 s1; } uchar2; + struct { schar2 s0; schar2 s1; } schar2; + struct { uchar1 c0; uchar1 c1; uchar1 c2; uchar1 c3; } uchar1; + struct { schar1 c0; schar1 c1; schar1 c2; schar1 c3; } schar1; +} char3u; + +typedef struct real_char8 +{ + uchar1 c0, c1, c2, c3, c4, c5, c6, c7; +} real_char8; + +typedef union char8u +{ + struct { schar4 i0, i1; } schar4; + struct { uchar4 i0, i1; } uchar4; + struct { schar2 s0, s1, s2, s3; } schar2; + struct { uchar2 s0, s1, s2, s3; } uchar2; + struct { schar1 c0, c1, c2, c3, c4, c5, c6, c7; } schar1; + struct { uchar1 c0, c1, c2, c3, c4, c5, c6, c7; } uchar1; +} char8u; + +#define AF_NULL ((void *) 0) + +/* + _AF_ATOMIC_NVFRAMES is NOT the maximum number of frames a module + can be requested to produce. + + This IS the maximum number of virtual (user) frames that will + be produced or processed per run of the modules. + + Modules can be requested more frames than this because of rate + conversion and rebuffering. +*/ + +#define _AF_ATOMIC_NVFRAMES 1024 + +AFframecount _AFpull (_AFmoduleinst *i, AFframecount nframes2pull); +void _AFpush (_AFmoduleinst *i, AFframecount nframes2push); +void _AFpushat (_AFmoduleinst *i, AFframecount startframe, bool stretchint, + AFframecount nframes2push); +void _AFsimplemodrun_pull (_AFmoduleinst *i); +void _AFsimplemodrun_push (_AFmoduleinst *i); +void _AFfreemodspec (_AFmoduleinst *i); + +/* _AFnewmodinst returns a structure, not a pointer. */ +_AFmoduleinst _AFnewmodinst (_AFmodule *mod); + +status _AFinitmodules (AFfilehandle h, _Track *trk); +status _AFsetupmodules (AFfilehandle h, _Track *trk); +status _AFsyncmodules (AFfilehandle h, _Track *trk); +void _AFfreemodules (_Track *trk); + +#endif /* MODULES_H */ diff --git a/libaudiofile/modules/Makefile.am b/libaudiofile/modules/Makefile.am new file mode 100644 index 0000000..02b8f91 --- /dev/null +++ b/libaudiofile/modules/Makefile.am @@ -0,0 +1,18 @@ +noinst_LTLIBRARIES = libmodules.la + +INCLUDES = -I$(srcdir)/.. + +libmodules_la_SOURCES = \ + g711.c g711.h \ + pcm.c pcm.h \ + msadpcm.c msadpcm.h \ + ima.c ima.h adpcm.c adpcm.h \ + rebuffer.c rebuffer.h \ + rebuffer.template + +# GNU gcc +# AM_CFLAGS = -Wall -g +# SGI MIPSpro cc +# AM_CFLAGS = -fullwarn -g +# No debugging. +AM_CFLAGS = -DNDEBUG diff --git a/libaudiofile/modules/Makefile.in b/libaudiofile/modules/Makefile.in new file mode 100644 index 0000000..7909c05 --- /dev/null +++ b/libaudiofile/modules/Makefile.in @@ -0,0 +1,337 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +noinst_LTLIBRARIES = libmodules.la + +INCLUDES = -I$(srcdir)/.. + +libmodules_la_SOURCES = \ + g711.c g711.h \ + pcm.c pcm.h \ + msadpcm.c msadpcm.h \ + ima.c ima.h adpcm.c adpcm.h \ + rebuffer.c rebuffer.h \ + rebuffer.template + + +# GNU gcc +# AM_CFLAGS = -Wall -g +# SGI MIPSpro cc +# AM_CFLAGS = -fullwarn -g +# No debugging. +AM_CFLAGS = -DNDEBUG +subdir = libaudiofile/modules +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libmodules_la_LDFLAGS = +libmodules_la_LIBADD = +am_libmodules_la_OBJECTS = g711.lo pcm.lo msadpcm.lo ima.lo adpcm.lo \ + rebuffer.lo +libmodules_la_OBJECTS = $(am_libmodules_la_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/adpcm.Plo $(DEPDIR)/g711.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/ima.Plo $(DEPDIR)/msadpcm.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/pcm.Plo $(DEPDIR)/rebuffer.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = $(libmodules_la_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(libmodules_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libaudiofile/modules/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) +libmodules.la: $(libmodules_la_OBJECTS) $(libmodules_la_DEPENDENCIES) + $(LINK) $(libmodules_la_LDFLAGS) $(libmodules_la_OBJECTS) $(libmodules_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/g711.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ima.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/msadpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rebuffer.Plo@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || 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 $(LTLIBRARIES) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libaudiofile/modules/adpcm.c b/libaudiofile/modules/adpcm.c new file mode 100644 index 0000000..9ca7305 --- /dev/null +++ b/libaudiofile/modules/adpcm.c @@ -0,0 +1,248 @@ +/*********************************************************** +Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The +Netherlands. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +/* +** Intel/DVI ADPCM coder/decoder. +** +** The algorithm for this coder was taken from the IMA Compatability Project +** proceedings, Vol 2, Number 2; May 1992. +** +** Version 1.2, 18-Dec-92. +** +** Change log: +** - Fixed a stupid bug, where the delta was computed as +** stepsize*code/4 in stead of stepsize*(code+0.5)/4. +** - There was an off-by-one error causing it to pick +** an incorrect delta once in a blue moon. +** - The NODIVMUL define has been removed. Computations are now always done +** using shifts, adds and subtracts. It turned out that, because the standard +** is defined using shift/add/subtract, you needed bits of fixup code +** (because the div/mul simulation using shift/add/sub made some rounding +** errors that real div/mul don't make) and all together the resultant code +** ran slower than just using the shifts all the time. +** - Changed some of the variable names to be more meaningful. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdio.h> /*DBG*/ + +#include "adpcm.h" + +/* Intel ADPCM step variation table */ +static const int indexTable[16] = +{ + -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8, +}; + +static const int stepsizeTable[89] = +{ + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, + 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, + 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, + 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 +}; + +void _af_adpcm_coder (int16_t *indata, u_int8_t *outdata, int len, + struct adpcm_state *state) +{ + int16_t *inp; /* Input buffer pointer */ + u_int8_t *outp; /* Output buffer pointer */ + int val; /* Current input sample value */ + int sign; /* Current adpcm sign bit */ + int delta; /* Current adpcm output value */ + int diff; /* Difference between val and valprev */ + int step; /* Stepsize */ + int valpred; /* Predicted output value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + int outputbuffer; /* place to keep previous 4-bit value */ + int bufferstep; /* toggle between outputbuffer/output */ + + outp = outdata; + inp = indata; + + valpred = state->valprev; + index = state->index; + step = stepsizeTable[index]; + + bufferstep = 1; + + for ( ; len > 0 ; len-- ) { + val = *inp++; + + /* Step 1 - compute difference with previous value */ + diff = val - valpred; + sign = (diff < 0) ? 8 : 0; + if ( sign ) diff = (-diff); + + /* Step 2 - Divide and clamp */ + /* Note: + ** This code *approximately* computes: + ** delta = diff*4/step; + ** vpdiff = (delta+0.5)*step/4; + ** but in shift step bits are dropped. The net result of this is + ** that even if you have fast mul/div hardware you cannot put it to + ** good use since the fixup would be too expensive. + */ + delta = 0; + vpdiff = (step >> 3); + + if ( diff >= step ) { + delta = 4; + diff -= step; + vpdiff += step; + } + step >>= 1; + if ( diff >= step ) { + delta |= 2; + diff -= step; + vpdiff += step; + } + step >>= 1; + if ( diff >= step ) { + delta |= 1; + vpdiff += step; + } + + /* Step 3 - Update previous value */ + if ( sign ) + valpred -= vpdiff; + else + valpred += vpdiff; + + /* Step 4 - Clamp previous value to 16 bits */ + if ( valpred > 32767 ) + valpred = 32767; + else if ( valpred < -32768 ) + valpred = -32768; + + /* Step 5 - Assemble value, update index and step values */ + delta |= sign; + + index += indexTable[delta]; + if ( index < 0 ) index = 0; + if ( index > 88 ) index = 88; + step = stepsizeTable[index]; + + /* Step 6 - Output value */ + if ( bufferstep ) { + outputbuffer = delta & 0x0f; + } else { + *outp++ = ((delta << 4) & 0xf0) | outputbuffer; + } + bufferstep = !bufferstep; + } + + /* Output last step, if needed */ + if ( !bufferstep ) + *outp++ = outputbuffer; + + state->valprev = valpred; + state->index = index; +} + +void _af_adpcm_decoder (u_int8_t *indata, int16_t *outdata, int len, + struct adpcm_state *state) +{ + u_int8_t *inp; /* Input buffer pointer */ + int16_t *outp; /* output buffer pointer */ + int sign; /* Current adpcm sign bit */ + int delta; /* Current adpcm output value */ + int step; /* Stepsize */ + int valpred; /* Predicted value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + int inputbuffer; /* place to keep next 4-bit value */ + int bufferstep; /* toggle between inputbuffer/input */ + + outp = outdata; + inp = indata; + + valpred = state->valprev; + index = state->index; + step = stepsizeTable[index]; + + bufferstep = 0; + + for ( ; len > 0 ; len-- ) { + + /* Step 1 - get the delta value */ + if ( bufferstep ) { + delta = (inputbuffer >> 4) & 0xf; + } else { + inputbuffer = *inp++; + delta = inputbuffer & 0xf; + } + bufferstep = !bufferstep; + + /* Step 2 - Find new index value (for later) */ + index += indexTable[delta]; + if ( index < 0 ) index = 0; + if ( index > 88 ) index = 88; + + /* Step 3 - Separate sign and magnitude */ + sign = delta & 8; + delta = delta & 7; + + /* Step 4 - Compute difference and new predicted value */ + /* + ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment + ** in adpcm_coder. + */ + vpdiff = step >> 3; + if ( delta & 4 ) vpdiff += step; + if ( delta & 2 ) vpdiff += step>>1; + if ( delta & 1 ) vpdiff += step>>2; + + if ( sign ) + valpred -= vpdiff; + else + valpred += vpdiff; + + /* Step 5 - clamp output value */ + if ( valpred > 32767 ) + valpred = 32767; + else if ( valpred < -32768 ) + valpred = -32768; + + /* Step 6 - Update step value */ + step = stepsizeTable[index]; + + /* Step 7 - Output value */ + *outp++ = valpred; + } + + state->valprev = valpred; + state->index = index; +} diff --git a/libaudiofile/modules/adpcm.h b/libaudiofile/modules/adpcm.h new file mode 100644 index 0000000..885893c --- /dev/null +++ b/libaudiofile/modules/adpcm.h @@ -0,0 +1,26 @@ +/* +** adpcm.h - include file for adpcm coder. +** +** Version 1.0, 7-Jul-92. +*/ + +#ifndef ADPCM_H +#define ADPCM_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +struct adpcm_state { + short valprev; /* Previous output value */ + char index; /* Index into stepsize table */ +}; + +void _af_adpcm_coder (int16_t [], u_int8_t [], int, struct adpcm_state *); +void _af_adpcm_decoder (u_int8_t [], int16_t [], int, struct adpcm_state *); + +#endif /* ADPCM_H */ diff --git a/libaudiofile/modules/g711.c b/libaudiofile/modules/g711.c new file mode 100644 index 0000000..d48ffda --- /dev/null +++ b/libaudiofile/modules/g711.c @@ -0,0 +1,346 @@ +/* + Audio File Library + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + g711.c +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> +#include <string.h> +#include <assert.h> + +#include <audiofile.h> + +#include "afinternal.h" +#include "modules.h" +#include "units.h" +#include "compression.h" +#include "g711.h" +#include "byteorder.h" +#include "util.h" + +#include "../g711.h" + +#define CHNK(X) + +static void ulaw2linear_buf (unsigned char *ulaw, signed short int *linear, + int nsamples) +{ + int i; + for (i=0; i < nsamples; i++) + { + linear[i] = _af_ulaw2linear(ulaw[i]); + } +} + +static void linear2ulaw_buf (signed short int *linear, unsigned char *ulaw, + int nsamples) +{ + int i; + for (i=0; i < nsamples; i++) + { + ulaw[i] = _af_linear2ulaw(linear[i]); + } +} + +static void alaw2linear_buf (unsigned char *alaw, signed short int *linear, + int nsamples) +{ + int i; + for (i=0; i < nsamples; i++) + { + linear[i] = _af_alaw2linear(alaw[i]); + } +} + +static void linear2alaw_buf (signed short int *linear, unsigned char *alaw, + int nsamples) +{ + int i; + for (i=0; i < nsamples; i++) + { + alaw[i] = _af_linear2alaw(linear[i]); + } +} + +bool _af_g711_format_ok (_AudioFormat *f) +{ + if (f->sampleFormat != AF_SAMPFMT_TWOSCOMP || f->sampleWidth != 16) + { + _af_error(AF_BAD_COMPRESSION, + "G711 compression requires 16-bit signed integer format"); + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->sampleWidth = 16; + /* non-fatal */ + } + + if (f->byteOrder != AF_BYTEORDER_BIGENDIAN) + { + _af_error(AF_BAD_COMPRESSION, + "G711 compression requires big endian format"); + f->byteOrder = AF_BYTEORDER_BIGENDIAN; + /* non-fatal */ + } + + return AF_TRUE; +} + +static _AFmodule g711compress, g711decompress; + +typedef unsigned char g711samp; + +typedef struct g711_data +{ + _Track *trk; + AFvirtualfile *fh; + bool seekok; + + /* saved_fpos_next_frame and saved_nextfframe apply only to writing. */ + int saved_fpos_next_frame; + int saved_nextfframe; +} g711_data; + +static void g711compressdescribe (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *)i->modspec; + i->outc->f.compressionType = d->trk->f.compressionType; +} + +_AFmoduleinst _AFg711initcompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&g711compress); + g711_data *d; + + d = (g711_data *) _af_malloc(sizeof (g711_data)); + + d->trk = trk; + d->fh = fh; + d->seekok = seekok; + + d->trk->fpos_next_frame = d->trk->fpos_first_frame; + + ret.modspec = d; + return ret; +} + +static void g711run_push (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *)i->modspec; + AFframecount frames2write = i->inc->nframes; + AFframecount samps2write = i->inc->nframes * i->inc->f.channelCount; + int framesize = sizeof (g711samp) * (i->inc->f.channelCount); + AFframecount nfr; + + assert(d->trk->f.compressionType == AF_COMPRESSION_G711_ULAW || + d->trk->f.compressionType == AF_COMPRESSION_G711_ALAW); + + /* Compress frames into i->outc. */ + + if (d->trk->f.compressionType == AF_COMPRESSION_G711_ULAW) + linear2ulaw_buf(i->inc->buf, i->outc->buf, samps2write); + else + linear2alaw_buf(i->inc->buf, i->outc->buf, samps2write); + + /* Write the compressed data. */ + + nfr = af_fwrite(i->outc->buf, framesize, frames2write, d->fh); + + CHNK(printf("writing %d frames to g711 file\n", frames2write)); + + if (nfr != frames2write) + { + /* report error if we haven't already */ + if (d->trk->filemodhappy) + { + /* i/o error */ + if (nfr < 0) + _af_error(AF_BAD_WRITE, + "unable to write data (%s) -- " + "wrote %d out of %d frames", + strerror(errno), + d->trk->nextfframe + nfr, + d->trk->nextfframe + frames2write); + + /* usual disk full error */ + else + _af_error(AF_BAD_WRITE, + "unable to write data (disk full) -- " + "wrote %d out of %d frames", + d->trk->nextfframe + nfr, + d->trk->nextfframe + frames2write); + + d->trk->filemodhappy = AF_FALSE; + } + } + + d->trk->nextfframe += nfr; + d->trk->totalfframes = d->trk->nextfframe; + d->trk->fpos_next_frame += (nfr>0) ? nfr*framesize : 0; + + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); +} + +static void g711sync1 (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *)i->modspec; + + d->saved_fpos_next_frame = d->trk->fpos_next_frame; + d->saved_nextfframe = d->trk->nextfframe; +} + +static void g711sync2 (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *) i->modspec; + + /* sanity check. */ + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); + + /* We can afford to do an lseek just in case because sync2 is rare. */ + d->trk->fpos_after_data = af_ftell(d->fh); + + d->trk->fpos_next_frame = d->saved_fpos_next_frame; + d->trk->nextfframe = d->saved_nextfframe; +} + +static void g711decompressdescribe(_AFmoduleinst *i) +{ +/* XXXmpruett this is probably the correct way to go, but other things + need to be changed first. + + i->outc->f.byteOrder = _AF_BYTEORDER_NATIVE; +*/ + i->outc->f.compressionType = AF_COMPRESSION_NONE; + i->outc->f.compressionParams = AU_NULL_PVLIST; +} + +_AFmoduleinst _AFg711initdecompress (_Track *trk, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&g711decompress); + g711_data *d; + + d = (g711_data *) _af_malloc(sizeof(g711_data)); + + d->trk = trk; + d->fh = fh; + d->seekok = seekok; + + d->trk->f.compressionParams = AU_NULL_PVLIST; + + d->trk->frames2ignore = 0; + d->trk->fpos_next_frame = d->trk->fpos_first_frame; + + ret.modspec = d; + return ret; +} + +static void g711run_pull (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *) i->modspec; + AFframecount frames2read = i->outc->nframes; + AFframecount samps2read = i->outc->nframes * i->outc->f.channelCount; + int framesize = sizeof (g711samp) * (i->outc->f.channelCount); + AFframecount nfr; + + /* Read the compressed frames. */ + + nfr = af_fread(i->inc->buf, framesize, frames2read, d->fh); + + /* Decompress into i->outc. */ + + if (d->trk->f.compressionType == AF_COMPRESSION_G711_ULAW) + ulaw2linear_buf(i->inc->buf, i->outc->buf, samps2read); + else + alaw2linear_buf(i->inc->buf, i->outc->buf, samps2read); + + CHNK(printf("reading %d frames from g711 file (got %d)\n", + frames2read, nfr)); + + d->trk->nextfframe += nfr; + d->trk->fpos_next_frame += (nfr>0) ? nfr*framesize : 0; + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); + + /* + If we got EOF from read, then we return the actual amount read. + + Complain only if there should have been more frames in the file. + */ + + if (d->trk->totalfframes != -1 && nfr != frames2read) + { + /* Report error if we haven't already */ + if (d->trk->filemodhappy) + { + _af_error(AF_BAD_READ, + "file missing data -- read %d frames, should be %d", + d->trk->nextfframe, + d->trk->totalfframes); + d->trk->filemodhappy = AF_FALSE; + } + } + + i->outc->nframes = nfr; +} + +static void g711reset1 (_AFmoduleinst *i) +{ +#ifdef DONE + g711_data *d = (g711_data *) i->modspec; +#endif + /* This function is supposed to be empty to fit into design. */ +} + +static void g711reset2 (_AFmoduleinst *i) +{ + g711_data *d = (g711_data *) i->modspec; + int framesize = sizeof (g711samp) * (i->inc->f.channelCount); + + d->trk->fpos_next_frame = + d->trk->fpos_first_frame + framesize * d->trk->nextfframe; + + d->trk->frames2ignore = 0; +} + +static _AFmodule g711compress = +{ + "g711compress", + g711compressdescribe, + AF_NULL, AF_NULL, + AF_NULL, AF_NULL, AF_NULL, + g711run_push, g711sync1, g711sync2, + AF_NULL, + _AFfreemodspec +}; + +static _AFmodule g711decompress = +{ + "g711decompress", + g711decompressdescribe, + AF_NULL, AF_NULL, + g711run_pull, g711reset1, g711reset2, + AF_NULL, AF_NULL, AF_NULL, + AF_NULL, + _AFfreemodspec +}; diff --git a/libaudiofile/modules/g711.h b/libaudiofile/modules/g711.h new file mode 100644 index 0000000..df10615 --- /dev/null +++ b/libaudiofile/modules/g711.h @@ -0,0 +1,39 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + g711.h +*/ + +#ifndef MODULES_G711_H +#define MODULES_G711_H + +#include <audiofile.h> +#include "afinternal.h" + +bool _af_g711_format_ok (_AudioFormat *f); + +_AFmoduleinst _AFg711initcompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes); + +_AFmoduleinst _AFg711initdecompress (_Track *trk, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes); + +#endif /* MODULES_G711_H */ diff --git a/libaudiofile/modules/ima.c b/libaudiofile/modules/ima.c new file mode 100644 index 0000000..a1cc391 --- /dev/null +++ b/libaudiofile/modules/ima.c @@ -0,0 +1,269 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + ima.c + + This module implements IMA ADPCM compression for the Audio File + Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> +#include <string.h> +#include <assert.h> + +#include <audiofile.h> + +#include "afinternal.h" +#include "modules.h" +#include "units.h" +#include "compression.h" +#include "byteorder.h" +#include "util.h" + +#include "adpcm.h" + +#define CHNK(X) + +static _AFmodule ima_adpcm_decompress; + +typedef struct +{ + _Track *track; + AFvirtualfile *fh; + + int blockAlign, samplesPerBlock; + AFframecount framesToIgnore; +} ima_adpcm_data; + +static int ima_adpcm_decode_block (ima_adpcm_data *ima, u_int8_t *encoded, + int16_t *decoded) +{ + int outputLength; + + struct adpcm_state state; + + outputLength = ima->samplesPerBlock * sizeof (int16_t) * + ima->track->f.channelCount; + + state.valprev = (encoded[1]<<8) | encoded[0]; + if (encoded[1] & 0x80) + state.valprev -= 0x10000; + + state.index = encoded[2]; + + *decoded++ = state.valprev; + + encoded += 4; + + _af_adpcm_decoder(encoded, decoded, ima->samplesPerBlock - 1, &state); + + return outputLength; +} + +bool _af_ima_adpcm_format_ok (_AudioFormat *f) +{ + if (f->channelCount != 1) + { + _af_error(AF_BAD_COMPRESSION, + "IMA ADPCM compression requires 1 channel"); + return AF_FALSE; + } + + if (f->sampleFormat != AF_SAMPFMT_TWOSCOMP || f->sampleWidth != 16) + { + _af_error(AF_BAD_COMPRESSION, + "IMA ADPCM compression requires 16-bit signed integer format"); + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->sampleWidth = 16; + /* non-fatal */ + } + + if (f->byteOrder != AF_BYTEORDER_BIGENDIAN) + { + _af_error(AF_BAD_COMPRESSION, + "IMA ADPCM compression requires big endian format"); + f->byteOrder = AF_BYTEORDER_BIGENDIAN; + /* non-fatal */ + } + + return AF_TRUE; +} + +static void ima_adpcm_decompress_describe (_AFmoduleinst *i) +{ +/* XXXmpruett this is probably the correct way to go, but other things + need to be changed first. + + i->outc->f.byteOrder = _AF_BYTEORDER_NATIVE; +*/ + i->outc->f.compressionType = AF_COMPRESSION_NONE; + i->outc->f.compressionParams = AU_NULL_PVLIST; +} + +_AFmoduleinst _af_ima_adpcm_init_decompress (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&ima_adpcm_decompress); + ima_adpcm_data *d; + AUpvlist pv; + int i; + long l; + void *v; + + assert(af_ftell(fh) == track->fpos_first_frame); + + d = (ima_adpcm_data *) _af_malloc(sizeof (ima_adpcm_data)); + + d->track = track; + d->fh = fh; + + d->track->frames2ignore = 0; + d->track->fpos_next_frame = d->track->fpos_first_frame; + + pv = d->track->f.compressionParams; + + if (_af_pv_getlong(pv, _AF_SAMPLES_PER_BLOCK, &l)) + d->samplesPerBlock = l; + else + _af_error(AF_BAD_CODEC_CONFIG, "samples per block not set"); + + if (_af_pv_getlong(pv, _AF_BLOCK_SIZE, &l)) + d->blockAlign = l; + else + _af_error(AF_BAD_CODEC_CONFIG, "block size not set"); + + *chunkframes = d->samplesPerBlock / d->track->f.channelCount; + + ret.modspec = d; + return ret; +} + +static void ima_adpcm_run_pull (_AFmoduleinst *module) +{ + ima_adpcm_data *d = (ima_adpcm_data *) module->modspec; + AFframecount frames2read = module->outc->nframes; + AFframecount nframes = 0; + int i, framesPerBlock, blockCount; + ssize_t blocksRead, bytesDecoded; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + assert(module->outc->nframes % framesPerBlock == 0); + blockCount = module->outc->nframes / framesPerBlock; + + /* Read the compressed frames. */ + blocksRead = af_fread(module->inc->buf, d->blockAlign, blockCount, d->fh); + + /* This condition would indicate that the file is bad. */ + if (blocksRead < 0) + { + if (d->track->filemodhappy) + { + _af_error(AF_BAD_READ, "file missing data"); + d->track->filemodhappy = AF_FALSE; + } + } + + if (blocksRead < blockCount) + blockCount = blocksRead; + + /* Decompress into module->outc. */ + for (i=0; i<blockCount; i++) + { + bytesDecoded = ima_adpcm_decode_block(d, + (u_int8_t *) module->inc->buf + i * d->blockAlign, + (int16_t *) module->outc->buf + i * d->samplesPerBlock); + + nframes += framesPerBlock; + } + + d->track->nextfframe += nframes; + + if (blocksRead > 0) + d->track->fpos_next_frame += blocksRead * d->blockAlign; + + assert(af_ftell(d->fh) == d->track->fpos_next_frame); + + /* + If we got EOF from read, then we return the actual amount read. + + Complain only if there should have been more frames in the file. + */ + + if (d->track->totalfframes != -1 && nframes != frames2read) + { + /* Report error if we haven't already */ + if (d->track->filemodhappy) + { + _af_error(AF_BAD_READ, + "file missing data -- read %d frames, should be %d", + d->track->nextfframe, + d->track->totalfframes); + d->track->filemodhappy = AF_FALSE; + } + } + + module->outc->nframes = nframes; +} + +static void ima_adpcm_reset1 (_AFmoduleinst *i) +{ + ima_adpcm_data *d = (ima_adpcm_data *) i->modspec; + AFframecount nextTrackFrame; + int framesPerBlock; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + + nextTrackFrame = d->track->nextfframe; + d->track->nextfframe = (nextTrackFrame / framesPerBlock) * + framesPerBlock; + + d->framesToIgnore = nextTrackFrame - d->track->nextfframe; + /* postroll = frames2ignore */ +} + +static void ima_adpcm_reset2 (_AFmoduleinst *i) +{ + ima_adpcm_data *d = (ima_adpcm_data *) i->modspec; + int framesPerBlock; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + + d->track->fpos_next_frame = d->track->fpos_first_frame + + d->blockAlign * (d->track->nextfframe / framesPerBlock); + d->track->frames2ignore += d->framesToIgnore; + + assert(d->track->nextfframe % framesPerBlock == 0); +} + +static _AFmodule ima_adpcm_decompress = +{ + "ima_adpcm_decompress", + ima_adpcm_decompress_describe, + AF_NULL, AF_NULL, + ima_adpcm_run_pull, ima_adpcm_reset1, ima_adpcm_reset2, + AF_NULL, AF_NULL, AF_NULL, + AF_NULL, + _AFfreemodspec +}; diff --git a/libaudiofile/modules/ima.h b/libaudiofile/modules/ima.h new file mode 100644 index 0000000..3a2a351 --- /dev/null +++ b/libaudiofile/modules/ima.h @@ -0,0 +1,40 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + afima.h + + This module declares the interface for the IMA ADPCM + compression module. +*/ + +#ifndef IMA_H +#define IMA_H + +#include <audiofile.h> + +#include "afinternal.h" + +bool _af_ima_adpcm_format_ok (_AudioFormat *f); + +_AFmoduleinst _af_ima_adpcm_init_decompress (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes); + +#endif /* IMA_H */ diff --git a/libaudiofile/modules/msadpcm.c b/libaudiofile/modules/msadpcm.c new file mode 100644 index 0000000..d6ed11c --- /dev/null +++ b/libaudiofile/modules/msadpcm.c @@ -0,0 +1,388 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + msadpcm.c + + This module implements Microsoft ADPCM compression. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> +#include <string.h> +#include <assert.h> + +#include <audiofile.h> + +#include "afinternal.h" +#include "modules.h" +#include "units.h" +#include "compression.h" +#include "byteorder.h" +#include "util.h" + +#include "msadpcm.h" + +#define CHNK(X) + +static _AFmodule ms_adpcm_decompress; + +typedef struct ms_adpcm_state +{ + u_int8_t predictor; + u_int16_t delta; + int16_t sample1, sample2; +} ms_adpcm_state; + +typedef struct ms_adpcm_data +{ + _Track *track; + AFvirtualfile *fh; + + /* + We set framesToIgnore during a reset1 and add it to + framesToIgnore during a reset2. + */ + AFframecount framesToIgnore; + + int blockAlign, samplesPerBlock; + + /* a is an array of numCoefficients ADPCM coefficient pairs. */ + int numCoefficients; + int16_t coefficients[256][2]; +} ms_adpcm_data; + +/* + Compute a linear PCM value from the given differential coded + value. +*/ +static int16_t ms_adpcm_decode_sample (struct ms_adpcm_state *state, + u_int8_t code, const int16_t *coefficient) +{ + const int32_t MAX_INT16 = 32767, MIN_INT16 = -32768; + const int32_t adaptive[] = + { + 230, 230, 230, 230, 307, 409, 512, 614, + 768, 614, 512, 409, 307, 230, 230, 230 + }; + int32_t linearSample, delta; + + linearSample = ((state->sample1 * coefficient[0]) + + (state->sample2 * coefficient[1])) / 256; + + if (code & 0x08) + linearSample += state->delta * (code-0x10); + else + linearSample += state->delta * code; + + /* Clamp linearSample to a signed 16-bit value. */ + if (linearSample < MIN_INT16) + linearSample = MIN_INT16; + else if (linearSample > MAX_INT16) + linearSample = MAX_INT16; + + delta = ((int32_t) state->delta * adaptive[code])/256; + if (delta < 16) + { + delta = 16; + } + + state->delta = delta; + state->sample2 = state->sample1; + state->sample1 = linearSample; + + /* + Because of earlier range checking, new_sample will be + in the range of an int16_t. + */ + return (int16_t) linearSample; +} + +/* Decode one block of MS ADPCM data. */ +static int ms_adpcm_decode_block (ms_adpcm_data *msadpcm, u_int8_t *encoded, + int16_t *decoded) +{ + int i, outputLength, samplesRemaining; + int channelCount; + int16_t *coefficient[2]; + ms_adpcm_state decoderState[2]; + ms_adpcm_state *state[2]; + + /* Calculate the number of bytes needed for decoded data. */ + outputLength = msadpcm->samplesPerBlock * sizeof (int16_t) * + msadpcm->track->f.channelCount; + + channelCount = msadpcm->track->f.channelCount; + + state[0] = &decoderState[0]; + if (channelCount == 2) + state[1] = &decoderState[1]; + else + state[1] = &decoderState[0]; + + /* Initialize predictor. */ + for (i=0; i<channelCount; i++) + { + state[i]->predictor = *encoded++; + assert(state[i]->predictor < msadpcm->numCoefficients); + } + + /* Initialize delta. */ + for (i=0; i<channelCount; i++) + { + state[i]->delta = (encoded[1]<<8) | encoded[0]; + encoded += sizeof (u_int16_t); + } + + /* Initialize first two samples. */ + for (i=0; i<channelCount; i++) + { + state[i]->sample1 = (encoded[1]<<8) | encoded[0]; + encoded += sizeof (u_int16_t); + } + + for (i=0; i<channelCount; i++) + { + state[i]->sample2 = (encoded[1]<<8) | encoded[0]; + encoded += sizeof (u_int16_t); + } + + coefficient[0] = msadpcm->coefficients[state[0]->predictor]; + coefficient[1] = msadpcm->coefficients[state[1]->predictor]; + + for (i=0; i<channelCount; i++) + *decoded++ = state[i]->sample2; + + for (i=0; i<channelCount; i++) + *decoded++ = state[i]->sample1; + + /* + The first two samples have already been 'decoded' in + the block header. + */ + samplesRemaining = (msadpcm->samplesPerBlock - 2) * + msadpcm->track->f.channelCount; + + while (samplesRemaining > 0) + { + u_int8_t code; + int16_t newSample; + + code = *encoded >> 4; + newSample = ms_adpcm_decode_sample(state[0], code, + coefficient[0]); + *decoded++ = newSample; + + code = *encoded & 0x0f; + newSample = ms_adpcm_decode_sample(state[1], code, + coefficient[1]); + *decoded++ = newSample; + + encoded++; + samplesRemaining -= 2; + } + + return outputLength; +} + +bool _af_ms_adpcm_format_ok (_AudioFormat *f) +{ + if (f->channelCount != 1 && f->channelCount != 2) + { + _af_error(AF_BAD_COMPRESSION, + "MS ADPCM compression requires 1 or 2 channels"); + return AF_FALSE; + } + + if (f->sampleFormat != AF_SAMPFMT_TWOSCOMP || f->sampleWidth != 16) + { + _af_error(AF_BAD_COMPRESSION, + "MS ADPCM compression requires 16-bit signed integer format"); + f->sampleFormat = AF_SAMPFMT_TWOSCOMP; + f->sampleWidth = 16; + /* non-fatal */ + } + + if (f->byteOrder != AF_BYTEORDER_BIGENDIAN) + { + _af_error(AF_BAD_COMPRESSION, + "MS ADPCM compression requires big endian format"); + f->byteOrder = AF_BYTEORDER_BIGENDIAN; + /* non-fatal */ + } + + return AF_TRUE; +} + +static void ms_adpcm_decompress_describe (_AFmoduleinst *i) +{ +/* XXXmpruett this is probably the correct way to go, but other things + need to be changed first. + + i->outc->f.byteOrder = _AF_BYTEORDER_NATIVE; +*/ + i->outc->f.compressionType = AF_COMPRESSION_NONE; + i->outc->f.compressionParams = AU_NULL_PVLIST; +} + +_AFmoduleinst _af_ms_adpcm_init_decompress (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&ms_adpcm_decompress); + ms_adpcm_data *d; + AUpvlist pv; + int i; + long l; + void *v; + + assert(af_ftell(fh) == track->fpos_first_frame); + + d = (ms_adpcm_data *) _af_malloc(sizeof (ms_adpcm_data)); + + d->track = track; + d->fh = fh; + + d->track->frames2ignore = 0; + d->track->fpos_next_frame = d->track->fpos_first_frame; + + pv = d->track->f.compressionParams; + if (_af_pv_getlong(pv, _AF_MS_ADPCM_NUM_COEFFICIENTS, &l)) + d->numCoefficients = l; + else + _af_error(AF_BAD_CODEC_CONFIG, "number of coefficients not set"); + + if (_af_pv_getptr(pv, _AF_MS_ADPCM_COEFFICIENTS, &v)) + memcpy(d->coefficients, v, sizeof (int16_t) * 256 * 2); + else + _af_error(AF_BAD_CODEC_CONFIG, "coefficient array not set"); + + if (_af_pv_getlong(pv, _AF_SAMPLES_PER_BLOCK, &l)) + d->samplesPerBlock = l; + else + _af_error(AF_BAD_CODEC_CONFIG, "samples per block not set"); + + if (_af_pv_getlong(pv, _AF_BLOCK_SIZE, &l)) + d->blockAlign = l; + else + _af_error(AF_BAD_CODEC_CONFIG, "block size not set"); + + *chunkframes = d->samplesPerBlock / d->track->f.channelCount; + + ret.modspec = d; + return ret; +} + +static void ms_adpcm_run_pull (_AFmoduleinst *module) +{ + ms_adpcm_data *d = (ms_adpcm_data *) module->modspec; + AFframecount frames2read = module->outc->nframes; + AFframecount nframes = 0; + int i, framesPerBlock, blockCount; + ssize_t blocksRead, bytesDecoded; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + assert(module->outc->nframes % framesPerBlock == 0); + blockCount = module->outc->nframes / framesPerBlock; + + /* Read the compressed frames. */ + blocksRead = af_fread(module->inc->buf, d->blockAlign, blockCount, d->fh); + + /* Decompress into module->outc. */ + for (i=0; i<blockCount; i++) + { + bytesDecoded = ms_adpcm_decode_block(d, + (u_int8_t *) module->inc->buf + i * d->blockAlign, + (int16_t *) module->outc->buf + i * d->samplesPerBlock); + + nframes += framesPerBlock; + } + + d->track->nextfframe += nframes; + + if (blocksRead > 0) + d->track->fpos_next_frame += blocksRead * d->blockAlign; + + assert(af_ftell(d->fh) == d->track->fpos_next_frame); + + /* + If we got EOF from read, then we return the actual amount read. + + Complain only if there should have been more frames in the file. + */ + + if (d->track->totalfframes != -1 && nframes != frames2read) + { + /* Report error if we haven't already */ + if (d->track->filemodhappy) + { + _af_error(AF_BAD_READ, + "file missing data -- read %d frames, should be %d", + d->track->nextfframe, + d->track->totalfframes); + d->track->filemodhappy = AF_FALSE; + } + } + + module->outc->nframes = nframes; +} + +static void ms_adpcm_reset1 (_AFmoduleinst *i) +{ + ms_adpcm_data *d = (ms_adpcm_data *) i->modspec; + AFframecount nextTrackFrame; + int framesPerBlock; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + + nextTrackFrame = d->track->nextfframe; + d->track->nextfframe = (nextTrackFrame / framesPerBlock) * + framesPerBlock; + + d->framesToIgnore = nextTrackFrame - d->track->nextfframe; + /* postroll = frames2ignore */ +} + +static void ms_adpcm_reset2 (_AFmoduleinst *i) +{ + ms_adpcm_data *d = (ms_adpcm_data *) i->modspec; + int framesPerBlock; + + framesPerBlock = d->samplesPerBlock / d->track->f.channelCount; + + d->track->fpos_next_frame = d->track->fpos_first_frame + + d->blockAlign * (d->track->nextfframe / framesPerBlock); + d->track->frames2ignore += d->framesToIgnore; + + assert(d->track->nextfframe % framesPerBlock == 0); +} + +static _AFmodule ms_adpcm_decompress = +{ + "ms_adpcm_decompress", + ms_adpcm_decompress_describe, + AF_NULL, AF_NULL, + ms_adpcm_run_pull, ms_adpcm_reset1, ms_adpcm_reset2, + AF_NULL, AF_NULL, AF_NULL, + AF_NULL, + _AFfreemodspec +}; diff --git a/libaudiofile/modules/msadpcm.h b/libaudiofile/modules/msadpcm.h new file mode 100644 index 0000000..b9b751e --- /dev/null +++ b/libaudiofile/modules/msadpcm.h @@ -0,0 +1,40 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + msadpcm.h + + This module declares the interface for the Microsoft ADPCM + compression module. +*/ + +#ifndef MSADPCM_H +#define MSADPCM_H + +#include <audiofile.h> + +#include "afinternal.h" + +bool _af_ms_adpcm_format_ok (_AudioFormat *f); + +_AFmoduleinst _af_ms_adpcm_init_decompress (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes); + +#endif /* MSADPCM_H */ diff --git a/libaudiofile/modules/pcm.c b/libaudiofile/modules/pcm.c new file mode 100644 index 0000000..4691d90 --- /dev/null +++ b/libaudiofile/modules/pcm.c @@ -0,0 +1,274 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + pcm.c - read and file write module for uncompressed data +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> +#include <assert.h> +#include <string.h> +#include <math.h> + +#include <audiofile.h> +#include "afinternal.h" +#include "compression.h" +#include "modules.h" +#include "util.h" +#include "print.h" + +#ifdef DEBUG +#define CHNK(X) (X) +#else +#define CHNK(X) +#endif + +bool _af_pcm_format_ok (_AudioFormat *f) +{ + assert(!isnan(f->pcm.slope)); + assert(!isnan(f->pcm.intercept)); + assert(!isnan(f->pcm.minClip)); + assert(!isnan(f->pcm.maxClip)); + + return AF_TRUE; +} + +/* + The pcm module does both reading and writing. +*/ + +static _AFmodule pcm; + +typedef struct pcm_data +{ + _Track *trk; + AFvirtualfile *fh; + bool seekok; + int bytes_per_frame; + + /* saved_fpos_next_frame and saved_nextfframe apply only to writing. */ + int saved_fpos_next_frame; + int saved_nextfframe; +} pcm_data; + +_AFmoduleinst _AFpcminitcompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&pcm); + pcm_data *d; + + d = (pcm_data *) _af_malloc(sizeof (pcm_data)); + + d->trk = trk; + d->fh = fh; + d->seekok = seekok; + d->bytes_per_frame = _af_format_frame_size(&trk->f, AF_FALSE); + + d->trk->fpos_next_frame = d->trk->fpos_first_frame; + + ret.modspec = d; + return ret; +} + +static void pcmrun_push (_AFmoduleinst *i) +{ + pcm_data *d = (pcm_data *) i->modspec; + AFframecount frames2write = i->inc->nframes; + AFframecount n; + + /* + WARNING: due to the optimization explained at the end + of arrangemodules(), the pcm file module cannot depend + on the presence of the intermediate working buffer + which _AFsetupmodules usually allocates for file + modules in their input or output chunk (for reading or + writing, respectively). + + Fortunately, the pcm module has no need for such a buffer. + */ + + n = af_fwrite(i->inc->buf, d->bytes_per_frame, frames2write, d->fh); + + CHNK(printf("writing %" AF_FRAMECOUNT_PRINT_FMT " frames to pcm file\n", + frames2write)); + + if (n != frames2write) + { + /* Report error if we haven't already. */ + if (d->trk->filemodhappy) + { + /* I/O error */ + if (n < 0) + _af_error(AF_BAD_WRITE, + "unable to write data (%s) -- " + "wrote %d out of %d frames", + strerror(errno), + d->trk->nextfframe + n, + d->trk->nextfframe + frames2write); + /* usual disk full error */ + else + _af_error(AF_BAD_WRITE, + "unable to write data (disk full) -- " + "wrote %d out of %d frames", + d->trk->nextfframe + n, + d->trk->nextfframe + frames2write); + d->trk->filemodhappy = AF_FALSE; + } + } + + d->trk->nextfframe += n; + d->trk->totalfframes = d->trk->nextfframe; + d->trk->fpos_next_frame += (n>0) ? n*d->bytes_per_frame : 0; + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); +} + +static void pcmsync1 (_AFmoduleinst *i) +{ + pcm_data *d = (pcm_data *)i->modspec; + + d->saved_fpos_next_frame = d->trk->fpos_next_frame; + d->saved_nextfframe = d->trk->nextfframe; +} + +static void pcmsync2 (_AFmoduleinst *i) +{ + pcm_data *d = (pcm_data *)i->modspec; + + /* sanity check */ + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); + + /* We can afford to do an lseek just in case cuz sync2 is rare. */ + d->trk->fpos_after_data = af_ftell(d->fh); + + d->trk->fpos_next_frame = d->saved_fpos_next_frame; + d->trk->nextfframe = d->saved_nextfframe; +} + +_AFmoduleinst _AFpcminitdecompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes) +{ + _AFmoduleinst ret = _AFnewmodinst(&pcm); + pcm_data *d; + + d = (pcm_data *) _af_malloc(sizeof (pcm_data)); + + d->trk = trk; + d->fh = fh; + d->seekok = seekok; + + d->trk->f.compressionParams = AU_NULL_PVLIST; + + d->bytes_per_frame = _af_format_frame_size(&trk->f, AF_FALSE); + + ret.modspec = d; + return ret; +} + +static void pcmrun_pull (_AFmoduleinst *i) +{ + pcm_data *d = (pcm_data *) i->modspec; + AFframecount n, frames2read = i->outc->nframes; + + /* + WARNING: Due to the optimization explained at the end of + arrangemodules(), the pcm file module cannot depend on + the presence of the intermediate working buffer which + _AFsetupmodules usually allocates for file modules in + their input or output chunk (for reading or writing, + respectively). + + Fortunately, the pcm module has no need for such a buffer. + */ + + /* + Limit the number of frames to be read to the number of + frames left in the track. + */ + if (d->trk->totalfframes != -1 && + d->trk->nextfframe + frames2read > d->trk->totalfframes) + { + frames2read = d->trk->totalfframes - d->trk->nextfframe; + } + + n = af_fread(i->outc->buf, d->bytes_per_frame, frames2read, d->fh); + + CHNK(printf("reading %" AF_FRAMECOUNT_PRINT_FMT " frames from pcm file " + "(got %" AF_FRAMECOUNT_PRINT_FMT ")\n", + frames2read, n)); + + d->trk->nextfframe += n; + d->trk->fpos_next_frame += (n>0) ? n*d->bytes_per_frame : 0; + assert(!d->seekok || (af_ftell(d->fh) == d->trk->fpos_next_frame)); + + /* + If we got EOF from read, then we return the actual amount read. + + Complain only if there should have been more frames in the file. + */ + + if (n != frames2read && d->trk->totalfframes != -1) + { + /* Report error if we haven't already. */ + if (d->trk->filemodhappy) + { + _af_error(AF_BAD_READ, + "file missing data -- read %d frames, " + "should be %d", + d->trk->nextfframe, + d->trk->totalfframes); + d->trk->filemodhappy = AF_FALSE; + } + } + + i->outc->nframes = n; +} + +static void pcmreset1 (_AFmoduleinst *i) +{ +#ifdef DONE + pcm_data *d = (pcm_data *) i->modspec; +#endif + /* This function is supposed to be empty to fit into design. */ +} + +static void pcmreset2 (_AFmoduleinst *i) +{ + pcm_data *d = (pcm_data *) i->modspec; + + d->trk->fpos_next_frame = d->trk->fpos_first_frame + + d->bytes_per_frame * d->trk->nextfframe; + + d->trk->frames2ignore = 0; +} + +static _AFmodule pcm = +{ + "pcm", + AF_NULL, + AF_NULL, AF_NULL, + pcmrun_pull, pcmreset1, pcmreset2, + pcmrun_push, pcmsync1, pcmsync2, + AF_NULL, + _AFfreemodspec +}; diff --git a/libaudiofile/modules/pcm.h b/libaudiofile/modules/pcm.h new file mode 100644 index 0000000..0c9a006 --- /dev/null +++ b/libaudiofile/modules/pcm.h @@ -0,0 +1,41 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + pcm.h +*/ + +#ifndef MODULES_PCM_H +#define MODULES_PCM_H + +#include <audiofile.h> +#include "afinternal.h" +#include "compression.h" +#include "modules.h" + +bool _af_pcm_format_ok (_AudioFormat *f); + +_AFmoduleinst _AFpcminitcompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes); + +_AFmoduleinst _AFpcminitdecompress (_Track *trk, AFvirtualfile *fh, bool seekok, + bool headerless, AFframecount *chunkframes); + +#endif /* MODULES_PCM_H */ diff --git a/libaudiofile/modules/rebuffer.c b/libaudiofile/modules/rebuffer.c new file mode 100644 index 0000000..ee9a187 --- /dev/null +++ b/libaudiofile/modules/rebuffer.c @@ -0,0 +1,58 @@ +/* + rebuffer.c +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include <assert.h> + +#include <audiofile.h> +#include "afinternal.h" +#include "modules.h" +#include "pcm.h" +#include "util.h" +#include "units.h" + +#define CHNK(X) +#define DEBG(X) + +#ifndef min +#define min(a,b) ((a)<(b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a,b) ((a)>(b) ? (a) : (b)) +#endif + +/* ===== REBUFFERING modules (use templates) */ + +/* defines module floatrebufferv2f and floatrebufferf2v */ + +#define PRFX(word) float ## word +#define INITFUNC(word) _af_initfloat ## word +#define NAMESTRING(word) "float" #word +#define TYPE float +#include "rebuffer.template" +#undef PRFX +#undef INITFUNC +#undef NAMESTRING +#undef TYPE + +/* defines module int2rebufferv2f and int2rebufferf2v */ + +#define PRFX(word) int2 ## word +#define INITFUNC(word) _af_initint2 ## word +#define NAMESTRING(word) "int2" #word +#define TYPE schar2 +#include "rebuffer.template" +#undef PRFX +#undef INITFUNC +#undef NAMESTRING +#undef TYPE diff --git a/libaudiofile/modules/rebuffer.h b/libaudiofile/modules/rebuffer.h new file mode 100644 index 0000000..4c6fae1 --- /dev/null +++ b/libaudiofile/modules/rebuffer.h @@ -0,0 +1,10 @@ +#ifndef REBUFFER_H +#define REBUFFER_H + +_AFmoduleinst _af_initfloatrebufferv2f (AFframecount nsamps, bool multiple_of); +_AFmoduleinst _af_initfloatrebufferf2v (AFframecount nsamps, bool multiple_of); + +_AFmoduleinst _af_initint2rebufferv2f (AFframecount nsamps, bool multiple_of); +_AFmoduleinst _af_initint2rebufferf2v (AFframecount nsamps, bool multiple_of); + +#endif /* REBUFFER_H */ diff --git a/libaudiofile/modules/rebuffer.template b/libaudiofile/modules/rebuffer.template new file mode 100644 index 0000000..ae994ca --- /dev/null +++ b/libaudiofile/modules/rebuffer.template @@ -0,0 +1,555 @@ +/* + rebuffer.template -- this is a TEMPLATE for a rebuffer module + + since C has no templates I use this method to get a type-independent + rebuffering module. This avoids enormous amounts of duplicated code. + + to use this file, #include it with the following tokens defined: + + #define PRFX(word) XXXX ## word + #define INITFUNC(word) initXXXX ## word + #define NAMESTRING(word) "XXXX" #word + #define TYPE YYYY + + where XXXX is replaced with the prefix you want for the module + name and YYYY is replaced with the type the routine works with. + All the other stuff above stays the same. Here is an example: + + #define PRFX(word) int2 ## word + #define INITFUNC(word) initint2 ## word + #define NAMESTRING(word) "int2" #word + #define TYPE signed short int + #include "rebuffer.template" + + I would just have you set two variables and do the above myself, + but the C preprocessor is so brain dead that it does not evaluate + actual arguments to preprocessor functions until after they are + substituted in! (and thus concatenated, and thus unable to be + substituted). + + The alternative to this (other than to use C++, which would make this + whole damn library so much easier to write and to read) is to have + large numbers of almost identical copies of the rebuffering routines + with a few type fields different. This is to be avoided. + + This code will then define a module called (using above example) + int2rebufferv2f and another called int2rebufferf2v. +*/ + +/* instance data of rebuffering modules */ + +typedef struct PRFX(rebuffer_data) +{ + bool multiple_of; /* TRUE=buffer to multiple-of not exactly... */ + AFframecount nsamps; /* # of fixed samples / multiple-of */ + TYPE *buf; /* buf of nsamps samples */ + long offset; /* see code for meaning */ + bool eof; /* (pull only) end of input stream reached */ + bool sent_short_chunk; /* (pull only) end of output stream indicated */ + + TYPE *saved_buf; /* (push only) saved buffer */ + long saved_offset; /* (push only) saved buffer offset */ +} PRFX(rebuffer_data); + +#define REBUFFER_DATA PRFX(rebuffer_data) + +/* REBUFFER variable to fixed -- PUSH ONLY */ + +static void PRFX(rebufferv2fmax_push)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + int nframes = d->nsamps/i->inc->f.channelCount; + + if (d->multiple_of) + /* actually, it can be less, but this is ok */ + i->outc->nframes = i->inc->nframes + nframes; + else + i->outc->nframes = nframes; +} + +static void PRFX(rebufferv2frun_push)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + long samples2push = i->inc->nframes * i->inc->f.channelCount; + TYPE *inbufp = i->inc->buf; + + /* d->offset could be from 0 to nsamps. 0 is no saved samples, + nsamps is all saved samples (should never be nsamps though) + offset thus contains a count of the valid data samples */ + + assert(d->offset >= 0 && d->offset < d->nsamps); + + /* check that we will be able to push even one block */ + if (d->offset + samples2push >= d->nsamps) + { + /* push the currently buffered samples through */ + if (d->offset != 0) + memcpy(i->outc->buf, d->buf, sizeof(TYPE)*d->offset); + + if (d->multiple_of) + { + /* round down to nearest d->nsamps */ + int n = (((d->offset+samples2push) / d->nsamps) * d->nsamps); + + /* + Example with d->nsamps==5, d->offset==3, and samples2push=10. + B=a buffered sample + N=a new sample (pushed into module on this call) + Note that we group samples in groups of d->nsamps since they must + be pushed that way (any # of groups at a time): + + offset samples2push + |-||------------| + BBBNN NNNNN NNN.... + |-------| + n-offset + |----------| + n + + n is the number of samples we will push on this run. What's + left over (3 samples in this case) will get buffered for use + in the next run. + */ + + assert(n > d->offset); + memcpy((TYPE *)i->outc->buf + d->offset, inbufp, + sizeof(TYPE)*(n - d->offset)); /* fill in rest of outbuf */ + + _AFpush(i, n / i->outc->f.channelCount); + + inbufp += n - d->offset; + samples2push -= n - d->offset; + assert(samples2push >= 0); + d->offset = 0; /* the buffer is now empty */ + } + else + { + while (d->offset + samples2push >= d->nsamps) + { + int n = d->nsamps - d->offset; + /* + Same example as above. Everything is the same except now + we can only push one group of d->nsamps samples at a time, + so we must loop through groups, and n takes on several + values: + + offset samples2push + |-||------------| + BBBNN NNNNN NNN.... + || |---| + n n + + n says how many samples to take from the input chunk. + n first has the value d->nsamps - d->offset, and then it + always has the value d->nsamps. + */ + memcpy((TYPE *)i->outc->buf + d->offset, inbufp, + sizeof(TYPE)*n); /* fill in rest of outbuf */ + + _AFpush(i, d->nsamps / i->outc->f.channelCount); + + inbufp += n; + samples2push -= n; + assert(samples2push >= 0); + d->offset = 0; /* clear out the buffer */ + } + } + + /* if we pushed blocks, then we must have used all stored samples */ + assert(d->offset == 0); + } + + /* at this point: guaranteed that d->offset + samples2push < d->nsamps */ + assert(d->offset + samples2push < d->nsamps); + + /* save remaining samples in buffer */ + if ( samples2push != 0 ) + { + memcpy(d->buf+d->offset, inbufp, sizeof(TYPE)*samples2push); + d->offset += samples2push; + } + + assert(d->offset >= 0 && d->offset < d->nsamps); +} + +static void PRFX(rebufferv2fsync1)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + + assert(d->offset >= 0 && d->offset < d->nsamps); + + /* + save all the samples and the offset so we can + restore our state later. + */ + memcpy(d->saved_buf, d->buf, sizeof(TYPE)*d->nsamps); + d->saved_offset = d->offset; +} + +static void PRFX(rebufferv2fsync2)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + + /* d->offset could be from 0 to nsamps. 0 is no saved samples, + nsamps is all saved samples (should never be nsamps though) + offset thus contains a count of the valid data samples */ + + assert(d->offset >= 0 && d->offset < d->nsamps); + + /* + push the currently buffered samples through--even if there + are none! + + in other words, push a SHORT CHUNK -- see modules.c TOF for more info ! + */ + if (d->offset != 0) + { + memcpy(i->outc->buf, d->buf, sizeof(TYPE)*d->offset); + } + + _AFpush(i, d->offset / i->outc->f.channelCount); /* SHORT CHUNK */ + + /* restore state saved in sync1 */ + + memcpy(d->buf, d->saved_buf, sizeof(TYPE)*d->nsamps); + d->offset = d->saved_offset; + + assert(d->offset >= 0 && d->offset < d->nsamps); +} + +static void PRFX(rebufferv2ffree)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + if (d->buf) + free(d->buf); + if (d->saved_buf) + free(d->saved_buf); +} + +static _AFmodule PRFX(rebufferv2f) = +{ + NAMESTRING(rebufferv2f), + AF_NULL, + AF_NULL, PRFX(rebufferv2fmax_push), + AF_NULL, AF_NULL, AF_NULL, + PRFX(rebufferv2frun_push), PRFX(rebufferv2fsync1), PRFX(rebufferv2fsync2), + AF_NULL, + PRFX(rebufferv2ffree) +}; + +_AFmoduleinst INITFUNC(rebufferv2f)(AFframecount nsamps, bool multiple_of) +{ + _AFmoduleinst ret = _AFnewmodinst(&PRFX(rebufferv2f)); + REBUFFER_DATA *d = _af_malloc(sizeof (REBUFFER_DATA)); + d->nsamps = nsamps; + d->offset = 0; + d->buf = _af_malloc(sizeof (TYPE) * nsamps); + d->multiple_of = multiple_of; + d->saved_buf = _af_malloc(sizeof (TYPE) * nsamps); + ret.modspec = d; + + DEBG(printf("%s nsamps=%d multiple_of=%d\n", NAMESTRING(rebufferv2f), + nsamps, multiple_of)); + + return(ret); +} + +/* ===== REBUFFER fixed to variable -- PULL ONLY */ + +static void PRFX(rebufferf2vmax_pull)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + long nframes = d->nsamps / i->inc->f.channelCount; + + if (d->multiple_of) + /* actually, it can be less, but this is ok */ + i->inc->nframes = i->outc->nframes + nframes; + else + i->inc->nframes = nframes; +} + +static void PRFX(rebufferf2vrun_pull)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + long samples2pull = i->outc->nframes * i->outc->f.channelCount; + TYPE *outbufp = i->outc->buf; + + /* d->offset could be from 0 to nsamps. 0=saved all samples, + nsamps=saved no samples (should never be 0 though) + offset is thus offset of first valid sample in buffer + */ + assert(d->offset > 0 && d->offset <= d->nsamps); + + /* + as explained TOF modules.c, a module should not pull more + frames from its input after receiving the short chunk, + otherwise it is an error. This checks if the next module + in the chain is attempting to do so: + */ + assert(!d->sent_short_chunk); + + /* + Here is a way of thinking about the stream of data being pulled + from this module (say d->nsamps=5, d->offset=2, samples2pull=11). + We arrange samples in groups of d->nsamps as they arrived from the + input stream (since the chunk size constraint comes only from + that side): + + X=old data long gone + B=data we got from d->buf + N=new data we have to pull from our input module + + samples2pull=11 + >-------------| + XXXXX XXBBB NNNNN NNNNN + |---| |---| |---| |---| + nsamps nsamps nsamps nsamps + + Think of samples2pull as a distance which shrinks as we satisfy the + request. The way it shrinks is that the left side of it (shown as '>' + above) moves gradually left until it meets the fixed right side + (shown as '|'), at which time we have completely satisfied the + output's request. + + As the diagram indicates, some of those samples are buffered up from + the last run (BBB), and some of those samples have to be pulled + from our input right now. + + If the '>' moves PAST the '|' to the right, then this means we have pulled + more samples that we needed for the output's request, and so we should + buffer up those samples for the next run_pull. + */ + + + /* ----- first try and use currently buffered samples */ + + CHNK(printf("%*.*s%s buffer holds %d samples\n", + i->margin, i->margin, "", i->mod->name, + d->nsamps-d->offset)); + + if (d->offset != d->nsamps) + { + int buffered = d->nsamps - d->offset; + int n = min(samples2pull, buffered); + memcpy(outbufp, d->buf+d->offset, sizeof(TYPE)*n); + CHNK(printf("%*.*s%s taking %d currently buffered samples\n", + i->margin, i->margin, "", i->mod->name, + n)); + /* + this may make samples2pull negative and outbufp invalid: + that's ok, it means we have some samples left over after + satisfying the output's request + */ + outbufp += buffered; + samples2pull -= buffered; + /* + we have taken n samples from the buffer so we indicate + that the buffer is that much smaller + */ + d->offset += n; + } + + CHNK(printf("%*.*s%s now samples2pull=%d\n", + i->margin, i->margin, "", i->mod->name, + samples2pull)); + + /* + at this point the picture from above looks something like: + + samples2pull=8 + >--------| + XXXXX XXBBB NNNNN NNNNN + |---| |---| |---| |---| + nsamps nsamps nsamps nsamps + + note that samples2pull has shrunk by the number of samples we + had buffered up. + + If it happened that samples2pull was originally less than the + number of samples we have buffered up, as in + + samples2pull=2 + >| + XXXXX XXBBB + |---| |---| + nsamps nsamps + + Then at this point things look like: + + samples2pull=-1 + |> + XXXXX XXBBB + |---| |---| + nsamps nsamps + + Which is just fine. It means we should re-save that 1 sample for + later use. + */ + + /* ----- then try and pull more samples from the source */ + + while (!d->eof && samples2pull > 0) + { + int req, got; + + /* + req is the number of "N" frames (from the pictures above) which + we want to pull at a time. + */ + if (d->multiple_of) + /* round samples2pull up to nearest d->nsamps */ + req = ( ( ((samples2pull-1)/d->nsamps) + 1) * d->nsamps); + else + req = d->nsamps; + + assert(req > 0); + + /* pull chunk(s) of data from source */ + + _AFpull(i, req / i->inc->f.channelCount); + + got = i->inc->nframes * i->inc->f.channelCount; /* may be short chunk */ + + if (got != req) /* short chunk on input */ + d->eof = AF_TRUE; + + memcpy(outbufp, i->inc->buf, sizeof(TYPE)*min(samples2pull, got)); + + /* + this may make samples2pull negative and outbufp invalid: + that's ok, it means we have some samples left over after + satisfying the output's request + */ + outbufp += got; + samples2pull -= got; + + /* we should only do loop once for multiple_of */ + + if (d->multiple_of) + assert(d->eof || samples2pull <= 0); + + if (samples2pull < 0) + { + /* + we pulled more frames than needed for the user's request + (and the loop is about to exit) so save the remaining samples + in d->buf. + */ + assert(d->offset==d->nsamps); /* if we pulled, buffer must be used up */ + + /* samples2pull is -(the number of samples the next mod didn't want) */ + d->offset = d->nsamps + samples2pull; + + assert(d->offset > 0 && d->offset <= d->nsamps); + + memcpy(d->buf+d->offset, (TYPE *)i->inc->buf+d->offset, + sizeof(TYPE)*(d->nsamps-d->offset)); + } + else + { + assert(d->offset==d->nsamps); /* if we pulled, buffer must be used up */ + } + } + + CHNK(printf("%*.*s%s ... and now samples2pull=%d\n", + i->margin, i->margin, "", i->mod->name, + samples2pull)); + + /* ----- + at this point we have done all we can to try and satisfy the output's + request. We may have hit eof on input. + + If samples2pull <= 0, we have pulled enough samples to satisfy the + request. + + If d->eof==AF_TRUE, then we hit EOF on input. + + If we did not hit end of file, then we must have satisfied the request. + If we did hit end of file, then we may or may not have satisfied the request. + + If we hit eof and we did not satisfy the request, then we push the + SHORT CHUNK, after which the module on our output is not allowed to + pull any more samples. + + Otherwise we save any samples left over into d->buf. + + Note that just because we hit EOF on input doesn't mean we're going to + push the short chunk on output right away. Because we buffer up samples + internally, there could be any number of run_push calls between hitting + eof on input and sending the short chunk on output. d->eof indicates + the first condition, d->send_short_chunk indicates the second. + */ + + if (d->eof && samples2pull > 0) /* EOF reached and not enough data */ + { + i->outc->nframes -= samples2pull / i->inc->f.channelCount; /* SHORT CHUNK out */ + d->sent_short_chunk = AF_TRUE; + assert(d->offset == d->nsamps); /* we must have used all buffered frames */ + } + else + { + /* !d->eof && samples2pull > 0 is impossible */ + assert(samples2pull <= 0); + + /* samples2pull is -(the number of samples the next mod didn't want) */ + assert(d->offset == d->nsamps + samples2pull); + } + assert(d->offset > 0 && d->offset <= d->nsamps); + + CHNK(printf("%*.*s%s ... and now buffer holds %d samples\n", + i->margin, i->margin, "", i->mod->name, + d->nsamps-d->offset)); +} + +static void PRFX(rebufferf2vreset1)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + d->offset = d->nsamps; + d->eof = AF_FALSE; + d->sent_short_chunk = AF_FALSE; + assert(d->offset > 0 && d->offset <= d->nsamps); +} + +static void PRFX(rebufferf2vreset2)(struct _AFmoduleinst *i) +{ +#ifdef AF_DEBUG + REBUFFER_DATA *d = i->modspec; + assert(d->offset > 0 && d->offset <= d->nsamps); +#endif +} + +static void PRFX(rebufferf2vfree)(struct _AFmoduleinst *i) +{ + REBUFFER_DATA *d = i->modspec; + if (d->buf) + free(d->buf); +} + +static _AFmodule PRFX(rebufferf2v) = +{ + NAMESTRING(rebufferf2v), + AF_NULL, + PRFX(rebufferf2vmax_pull), AF_NULL, + PRFX(rebufferf2vrun_pull), PRFX(rebufferf2vreset1), PRFX(rebufferf2vreset2), + AF_NULL, AF_NULL, AF_NULL, + AF_NULL, + PRFX(rebufferf2vfree) +}; + +_AFmoduleinst INITFUNC(rebufferf2v)(AFframecount nsamps, bool multiple_of) +{ + _AFmoduleinst ret = _AFnewmodinst(&PRFX(rebufferf2v)); + REBUFFER_DATA *d = _af_malloc(sizeof (REBUFFER_DATA)); + d->nsamps = nsamps; + d->offset = d->nsamps; + d->buf = _af_malloc(sizeof (TYPE) * nsamps); + d->multiple_of = multiple_of; + d->eof = AF_FALSE; + d->sent_short_chunk = AF_FALSE; + ret.modspec = d; + + DEBG(printf("%s nsamps=%d multiple_of=%d\n", NAMESTRING(rebufferf2v), + nsamps, multiple_of)); + + return(ret); +} diff --git a/libaudiofile/next.c b/libaudiofile/next.c new file mode 100644 index 0000000..e8f9bca --- /dev/null +++ b/libaudiofile/next.c @@ -0,0 +1,266 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + next.c + + This file contains routines for parsing NeXT/Sun .snd format sound + files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "next.h" +#include "audiofile.h" +#include "afinternal.h" +#include "track.h" +#include "util.h" +#include "setup.h" +#include "byteorder.h" + +int _af_next_compression_types[_AF_NEXT_NUM_COMPTYPES] = +{ + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +}; + +_AFfilesetup _af_next_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_NEXTSND, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +status _af_next_read_init (AFfilesetup setup, AFfilehandle file) +{ + u_int32_t id, offset, length, encoding, sampleRate, channelCount; + _Track *track; + + assert(file != NULL); + assert(file->fh != NULL); + + file->formatSpecific = NULL; + + file->instruments = NULL; + file->instrumentCount = 0; + + file->miscellaneous = NULL; + file->miscellaneousCount = 0; + + file->tracks = NULL; /* Allocate this later. */ + file->trackCount = 1; + + af_fseek(file->fh, 0, SEEK_SET); + + af_fread(&id, 4, 1, file->fh); + assert(!memcmp(&id, ".snd", 4)); + + af_fread(&offset, 4, 1, file->fh); + af_fread(&length, 4, 1, file->fh); + af_fread(&encoding, 4, 1, file->fh); + af_fread(&sampleRate, 4, 1, file->fh); + af_fread(&channelCount, 4, 1, file->fh); + + offset = BENDIAN_TO_HOST_INT32(offset); + length = BENDIAN_TO_HOST_INT32(length); + encoding = BENDIAN_TO_HOST_INT32(encoding); + sampleRate = BENDIAN_TO_HOST_INT32(sampleRate); + channelCount = BENDIAN_TO_HOST_INT32(channelCount); + +#ifdef DEBUG + printf("id, offset, length, encoding, sampleRate, channelCount:\n" + " %d %d %d %d %d %d\n", + id, offset, length, encoding, sampleRate, channelCount); +#endif + + if ((track = _af_track_new()) == NULL) + return AF_FAIL; + + file->tracks = track; + + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + /* Override the compression type later if necessary. */ + track->f.compressionType = AF_COMPRESSION_NONE; + + track->fpos_first_frame = offset; + track->data_size = af_flength(file->fh) - offset; + + switch (encoding) + { + case _AU_FORMAT_MULAW_8: + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_G711_ULAW; + break; + case _AU_FORMAT_ALAW_8: + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_G711_ALAW; + break; + case _AU_FORMAT_LINEAR_8: + track->f.sampleWidth = 8; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + break; + case _AU_FORMAT_LINEAR_16: + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + break; + case _AU_FORMAT_LINEAR_24: + track->f.sampleWidth = 24; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + break; + case _AU_FORMAT_LINEAR_32: + track->f.sampleWidth = 32; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + break; + case _AU_FORMAT_FLOAT: + track->f.sampleWidth = 32; + track->f.sampleFormat = AF_SAMPFMT_FLOAT; + break; + case _AU_FORMAT_DOUBLE: + track->f.sampleWidth = 64; + track->f.sampleFormat = AF_SAMPFMT_DOUBLE; + break; + + default: + /* + This encoding method is not recognized. + */ + _af_error(AF_BAD_SAMPFMT, "bad sample format"); + return AF_FAIL; + } + + _af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth); + + track->f.sampleRate = sampleRate; + track->f.channelCount = channelCount; + track->totalfframes = length / _af_format_frame_size(&track->f, AF_FALSE); + +#ifdef DEBUG + printf("_af_next_read_init\n"); + _af_print_filehandle(file); +#endif + + /* The file has been parsed successfully. */ + return AF_SUCCEED; +} + +bool _af_next_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[4]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 1, 4, fh) != 4 || memcmp(buffer, ".snd", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +AFfilesetup _af_next_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "NeXT files must have exactly 1 track"); + return AF_NULL_FILESETUP; + } + + track = _af_filesetup_get_tracksetup(setup, AF_DEFAULT_TRACK); + if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + _af_error(AF_BAD_FILEFMT, "NeXT format does not support unsigned data"); + _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, track->f.sampleWidth); + } + + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP) + { + if (track->f.sampleWidth != 8 && + track->f.sampleWidth != 16 && + track->f.sampleWidth != 24 && + track->f.sampleWidth != 32) + { + _af_error(AF_BAD_WIDTH, "invalid sample width %d for NeXT file (only 8-, 16-, 24-, and 32-bit data are allowed)"); + return AF_NULL_FILESETUP; + } + } + + if (track->f.compressionType != AF_COMPRESSION_NONE && + track->f.compressionType != AF_COMPRESSION_G711_ULAW && + track->f.compressionType != AF_COMPRESSION_G711_ALAW) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "compression format not implemented for NeXT files"); + return AF_NULL_FILESETUP; + } + + if (track->f.byteOrder != AF_BYTEORDER_BIGENDIAN && track->byteOrderSet) + { + _af_error(AF_BAD_BYTEORDER, "NeXT format supports only big-endian data"); + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + } + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "NeXT files cannot have AES data"); + return AF_NULL_FILESETUP; + } + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_FILESETUP, "NeXT format does not support markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_FILESETUP, "NeXT format does not support instruments"); + return AF_NULL_FILESETUP; + } + + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_FILESETUP, "NeXT format does not support miscellaneous data"); + return AF_NULL_FILESETUP; + } + + return _af_filesetup_copy(setup, &_af_next_default_filesetup, AF_FALSE); +} diff --git a/libaudiofile/next.h b/libaudiofile/next.h new file mode 100644 index 0000000..a4dfcbd --- /dev/null +++ b/libaudiofile/next.h @@ -0,0 +1,74 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + next.h + + This file contains headers and constants related to the NeXT/Sun + .snd audio file format. +*/ + +#include "afinternal.h" + +#ifndef NEXTSND_H +#define NEXTSND_H + +enum +{ + _AU_FORMAT_UNSPECIFIED = 0, + _AU_FORMAT_MULAW_8 = 1, /* CCITT G.711 mu-law 8-bit */ + _AU_FORMAT_LINEAR_8 = 2, + _AU_FORMAT_LINEAR_16 = 3, + _AU_FORMAT_LINEAR_24 = 4, + _AU_FORMAT_LINEAR_32 = 5, + _AU_FORMAT_FLOAT = 6, + _AU_FORMAT_DOUBLE = 7, + _AU_FORMAT_INDIRECT = 8, + _AU_FORMAT_NESTED = 9, + _AU_FORMAT_DSP_CORE = 10, + _AU_FORMAT_DSP_DATA_8 = 11, /* 8-bit fixed point */ + _AU_FORMAT_DSP_DATA_16 = 12, /* 16-bit fixed point */ + _AU_FORMAT_DSP_DATA_24 = 13, /* 24-bit fixed point */ + _AU_FORMAT_DSP_DATA_32 = 14, /* 32-bit fixed point */ + _AU_FORMAT_DISPLAY = 16, + _AU_FORMAT_MULAW_SQUELCH = 17, /* 8-bit mu-law, squelched */ + _AU_FORMAT_EMPHASIZED = 18, + _AU_FORMAT_COMPRESSED = 19, + _AU_FORMAT_COMPRESSED_EMPHASIZED = 20, + _AU_FORMAT_DSP_COMMANDS = 21, + _AU_FORMAT_DSP_COMMANDS_SAMPLES = 22, + _AU_FORMAT_ADPCM_G721 = 23, /* CCITT G.721 ADPCM 32 kbits/s */ + _AU_FORMAT_ADPCM_G722 = 24, /* CCITT G.722 ADPCM */ + _AU_FORMAT_ADPCM_G723_3 = 25, /* CCITT G.723 ADPCM 24 kbits/s */ + _AU_FORMAT_ADPCM_G723_5 = 26, /* CCITT G.723 ADPCM 40 kbits/s */ + _AU_FORMAT_ALAW_8 = 27, /* CCITT G.711 a-law */ + _AU_FORMAT_AES = 28, + _AU_FORMAT_DELTA_MULAW_8 = 29 +}; + +#define _AF_NEXT_NUM_COMPTYPES 2 + +bool _af_next_recognize (AFvirtualfile *fh); +status _af_next_read_init (AFfilesetup, AFfilehandle); +status _af_next_write_init (AFfilesetup, AFfilehandle); +status _af_next_update (AFfilehandle); +AFfilesetup _af_next_complete_setup (AFfilesetup); + +#endif diff --git a/libaudiofile/nextwrite.c b/libaudiofile/nextwrite.c new file mode 100644 index 0000000..a674ae0 --- /dev/null +++ b/libaudiofile/nextwrite.c @@ -0,0 +1,141 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + nextwrite.c + + This file contains routines for writing NeXT/Sun format sound files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "next.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" + +status _af_next_update (AFfilehandle file); + +static u_int32_t nextencodingtype (_AudioFormat *format); +static status next_write_header (AFfilehandle file); + +/* A return value of zero indicates successful synchronisation. */ +status _af_next_update (AFfilehandle file) +{ + next_write_header(file); + return AF_SUCCEED; +} + +static status next_write_header (AFfilehandle file) +{ + _Track *track; + int frameSize; + u_int32_t offset, length, encoding, sampleRate, channelCount; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + frameSize = _af_format_frame_size(&track->f, AF_FALSE); + + offset = HOST_TO_BENDIAN_INT32(track->fpos_first_frame); + length = HOST_TO_BENDIAN_INT32(track->totalfframes * frameSize); + encoding = HOST_TO_BENDIAN_INT32(nextencodingtype(&track->f)); + sampleRate = HOST_TO_BENDIAN_INT32(track->f.sampleRate); + channelCount = HOST_TO_BENDIAN_INT32(track->f.channelCount); + + if (af_fseek(file->fh, 0, SEEK_SET) != 0) + _af_error(AF_BAD_LSEEK, "bad seek"); + + af_fwrite(".snd", 4, 1, file->fh); + af_fwrite(&offset, 4, 1, file->fh); + af_fwrite(&length, 4, 1, file->fh); + af_fwrite(&encoding, 4, 1, file->fh); + af_fwrite(&sampleRate, 4, 1, file->fh); + af_fwrite(&channelCount, 4, 1, file->fh); + + return AF_SUCCEED; +} + +static u_int32_t nextencodingtype (_AudioFormat *format) +{ + u_int32_t encoding = 0; + + if (format->compressionType != AF_COMPRESSION_NONE) + { + if (format->compressionType == AF_COMPRESSION_G711_ULAW) + encoding = _AU_FORMAT_MULAW_8; + else if (format->compressionType == AF_COMPRESSION_G711_ALAW) + encoding = _AU_FORMAT_ALAW_8; + } + else if (format->sampleFormat == AF_SAMPFMT_TWOSCOMP) + { + if (format->sampleWidth == 8) + encoding = _AU_FORMAT_LINEAR_8; + else if (format->sampleWidth == 16) + encoding = _AU_FORMAT_LINEAR_16; + else if (format->sampleWidth == 24) + encoding = _AU_FORMAT_LINEAR_24; + else if (format->sampleWidth == 32) + encoding = _AU_FORMAT_LINEAR_32; + } + else if (format->sampleFormat == AF_SAMPFMT_FLOAT) + encoding = _AU_FORMAT_FLOAT; + else if (format->sampleFormat == AF_SAMPFMT_DOUBLE) + encoding = _AU_FORMAT_DOUBLE; + + return encoding; +} + +status _af_next_write_init (AFfilesetup setup, AFfilehandle filehandle) +{ + _Track *track; + + if (_af_filesetup_make_handle(setup, filehandle) == AF_FAIL) + return AF_FAIL; + + filehandle->formatSpecific = NULL; + + if (filehandle->miscellaneousCount > 0) + { + _af_error(AF_BAD_NUMMISC, "NeXT format supports no miscellaneous chunks"); + return AF_FAIL; + } + + next_write_header(filehandle); + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + track->fpos_first_frame = 28; + + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + return AF_SUCCEED; +} diff --git a/libaudiofile/nist.c b/libaudiofile/nist.c new file mode 100644 index 0000000..4872dec --- /dev/null +++ b/libaudiofile/nist.c @@ -0,0 +1,394 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + nist.c + + This file contains code for reading NIST SPHERE files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "afinternal.h" +#include "audiofile.h" +#include "util.h" +#include "byteorder.h" +#include "setup.h" +#include "track.h" + +#include "nist.h" + +_AFfilesetup _af_nist_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_NIST_SPHERE, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +bool _af_nist_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[16]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 16, 1, fh) != 1) + return AF_FALSE; + + /* Check to see if the file's magic number matches. */ + if (memcmp(buffer, "NIST_1A\n 1024\n", 16) == 0) + return AF_TRUE; + + return AF_FALSE; +} + +AFfilesetup _af_nist_complete_setup (AFfilesetup setup) +{ + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "NIST SPHERE file must have 1 track"); + return AF_NULL_FILESETUP; + } + + track = &setup->tracks[0]; + + if (track->sampleFormatSet) + { + /* XXXmpruett: Currently we allow only 1-16 bit sample width. */ + if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP && + (track->f.sampleWidth < 1 || track->f.sampleWidth > 16)) + { + _af_error(AF_BAD_WIDTH, + "invalid sample width %d bits for NIST SPHERE format"); + return AF_NULL_FILESETUP; + } + else if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + _af_error(AF_BAD_SAMPFMT, + "NIST SPHERE format does not support unsigned data"); + return AF_NULL_FILESETUP; + } + else if (track->f.sampleFormat == AF_SAMPFMT_FLOAT || + track->f.sampleFormat == AF_SAMPFMT_DOUBLE) + { + _af_error(AF_BAD_SAMPFMT, + "NIST SPHERE format does not support floating-point data"); + return AF_NULL_FILESETUP; + } + } + + if (track->rateSet && track->f.sampleRate <= 0.0) + { + _af_error(AF_BAD_RATE, + "invalid sample rate %.30g for NIST SPHERE file", + track->f.sampleRate); + return AF_NULL_FILESETUP; + } + + if (track->channelCountSet && track->f.channelCount < 1) + { + _af_error(AF_BAD_CHANNELS, + "invalid channel count (%d) for NIST SPHERE format", + track->f.channelCount); + return AF_NULL_FILESETUP; + } + + if (track->compressionSet && track->f.compressionType != AF_COMPRESSION_NONE && + track->f.compressionType != AF_COMPRESSION_G711_ULAW && + track->f.compressionType != AF_COMPRESSION_G711_ALAW) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "NIST SPHERE format supports only G.711 u-law or A-law compression"); + return AF_NULL_FILESETUP; + } + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "NIST SPHERE file cannot have AES data"); + return AF_NULL_FILESETUP; + } + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_NUMMARKS, "NIST SPHERE format does not support markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_NUMINSTS, "NIST SPHERE format does not support instruments"); + return AF_NULL_FILESETUP; + } + + /* XXXmpruett: We don't support miscellaneous chunks for now. */ + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "NIST SPHERE format does not currently support miscellaneous chunks"); + return AF_NULL_FILESETUP; + } + + return _af_filesetup_copy(setup, &_af_nist_default_filesetup, AF_TRUE); +} + +static bool nist_header_read_int (char *header, char *key, int *val) +{ + char *cp; + char keystring[256], scanstring[256]; + + snprintf(keystring, 256, "\n%s -i", key); + + if ((cp = strstr(header, keystring)) != NULL) + { + snprintf(scanstring, 256, "\n%s -i %%d", key); + sscanf(cp, scanstring, val); + return AF_TRUE; + } + + return AF_FALSE; +} + +static bool nist_header_read_string (char *header, char *key, int *length, char *val) +{ + char *cp; + char keystring[256], scanstring[256]; + + snprintf(keystring, 256, "\n%s -s", key); + + if ((cp = strstr(header, keystring)) != NULL) + { + snprintf(scanstring, 256, "\n%s -s%%d %%79s", key); + sscanf(cp, scanstring, length, val); + return AF_TRUE; + } + + return AF_FALSE; +} + +status _af_nist_read_init (AFfilesetup setup, AFfilehandle handle) +{ + _Track *track; + char header[NIST_SPHERE_HEADER_LENGTH + 1]; + int intval; + char strval[NIST_SPHERE_MAX_FIELD_LENGTH]; + int sample_n_bytes; + + handle->instruments = NULL; + handle->instrumentCount = 0 ; + handle->miscellaneous = NULL; + handle->miscellaneousCount = 0; + + handle->tracks = NULL; + handle->trackCount = 1; + + af_fseek(handle->fh, 0, SEEK_SET); + + if (af_fread(header, NIST_SPHERE_HEADER_LENGTH, 1, handle->fh) != 1) + { + _af_error(AF_BAD_READ, "Could not read NIST SPHERE file header"); + return AF_FAIL; + } + + header[NIST_SPHERE_HEADER_LENGTH] = '\0'; + + if (memcmp(header, "NIST_1A\n 1024\n", 16) != 0) + { + _af_error(AF_BAD_FILEFMT, "Bad NIST SPHERE file header"); + return AF_FAIL; + } + + if ((handle->tracks = _af_track_new()) == NULL) + return AF_FAIL; + track = &handle->tracks[0]; + + /* Read number of bytes per sample. */ + if (!nist_header_read_int(header, "sample_n_bytes", &sample_n_bytes)) + { + _af_error(AF_BAD_HEADER, "bytes per sample not specified"); + return AF_FAIL; + } + + /* + Since some older NIST SPHERE files lack a sample_coding + field, if sample_n_bytes is 1, assume mu-law; + otherwise assume linear PCM. + */ + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + if (sample_n_bytes == 1) + { + track->f.compressionType = AF_COMPRESSION_G711_ULAW; + track->f.sampleWidth = 16; + } + else + { + track->f.compressionType = AF_COMPRESSION_NONE; + track->f.sampleWidth = sample_n_bytes * 8; + } + + if (nist_header_read_string(header, "sample_coding", &intval, strval)) + { + if (strcmp(strval, "pcm") == 0) + ; + else if (strcmp(strval, "ulaw") == 0 || strcmp(strval, "mu-law") == 0) + { + track->f.compressionType = AF_COMPRESSION_G711_ULAW; + track->f.sampleWidth = 16; + } + else if (strcmp(strval, "alaw") == 0) + { + track->f.compressionType = AF_COMPRESSION_G711_ALAW; + track->f.sampleWidth = 16; + } + else + { + _af_error(AF_BAD_SAMPFMT, + "unrecognized NIST SPHERE sample format %s", strval); + return AF_FAIL; + } + } + + /* Read channel count. */ + if (nist_header_read_int(header, "channel_count", &intval)) + { + if (intval < 1) + { + _af_error(AF_BAD_CHANNELS, "invalid number of channels %d", + intval); + return AF_FAIL; + } + track->f.channelCount = intval; + } + else + { + _af_error(AF_BAD_HEADER, "number of channels not specified"); + return AF_FAIL; + } + + /* Read string representing byte order. */ + if (nist_header_read_string(header, "sample_byte_format", &intval, strval)) + { + if (intval > 1) + { + if (strncmp(strval, "01", 2) == 0) + track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; + else + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + } + else + track->f.byteOrder = _AF_BYTEORDER_NATIVE; + } + else + { + /* + Fail if this field is not present and sample + width is more than one byte. + */ + if (track->f.compressionType == AF_COMPRESSION_NONE && + track->f.sampleWidth > 8) + { + _af_error(AF_BAD_HEADER, "sample byte order not specified"); + return AF_FAIL; + } + } + + /* Read significant bits per sample. */ + if (nist_header_read_int(header, "sample_sig_bits", &intval)) + { + if (intval < 1 || intval > 32) + { + _af_error(AF_BAD_WIDTH, "invalid sample width %d bits\n", + intval); + return AF_FAIL; + } + + /* + Use specified significant bits value as the + sample width for uncompressed data as long + as the number of bytes per sample remains + unchanged. + */ + if (track->f.compressionType == AF_COMPRESSION_NONE && + (intval + 7) / 8 == sample_n_bytes) + { + track->f.sampleWidth = intval; + } + } + + /* Read sample rate. */ + if (nist_header_read_int(header, "sample_rate", &intval)) + { + if (intval <= 0) + { + _af_error(AF_BAD_RATE, "invalid sample rate %d Hz\n", intval); + return AF_FAIL; + } + track->f.sampleRate = intval; + } + else + { + _af_error(AF_BAD_HEADER, "sample rate not specified"); + return AF_FAIL; + } + + /* Read sample count. */ + if (nist_header_read_int(header, "sample_count", &intval)) + { + track->totalfframes = intval / track->f.channelCount; + } + else + { + _af_error(AF_BAD_HEADER, "number of samples not specified"); + return AF_FAIL; + } + + if (_af_set_sample_format(&track->f, track->f.sampleFormat, + track->f.sampleWidth) == AF_FAIL) + { + return AF_FAIL; + } + + track->fpos_first_frame = NIST_SPHERE_HEADER_LENGTH; + track->data_size = af_flength(handle->fh) - NIST_SPHERE_HEADER_LENGTH; + track->nextfframe = 0; + track->fpos_next_frame = track->fpos_first_frame; + + handle->formatSpecific = NULL; + + return AF_SUCCEED; +} diff --git a/libaudiofile/nist.h b/libaudiofile/nist.h new file mode 100644 index 0000000..63c12a7 --- /dev/null +++ b/libaudiofile/nist.h @@ -0,0 +1,41 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + nist.h + + This file declares code for reading and writing NIST SPHERE files. +*/ + +#ifndef NIST_H +#define NIST_H + +#include "audiofile.h" + +#define NIST_SPHERE_HEADER_LENGTH 1024 +#define NIST_SPHERE_MAX_FIELD_LENGTH 80 + +bool _af_nist_recognize (AFvirtualfile *fh); +AFfilesetup _af_nist_complete_setup (AFfilesetup setup); +status _af_nist_read_init (AFfilesetup setup, AFfilehandle handle); +status _af_nist_write_init (AFfilesetup setup, AFfilehandle handle); +status _af_nist_update (AFfilehandle file); + +#endif /* NIST_H */ diff --git a/libaudiofile/nistwrite.c b/libaudiofile/nistwrite.c new file mode 100644 index 0000000..f26932e --- /dev/null +++ b/libaudiofile/nistwrite.c @@ -0,0 +1,146 @@ +/* + Audio File Library + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + nistwrite.c + + This file contains routines for writing to NIST SPHERE + format files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "afinternal.h" +#include "audiofile.h" +#include "util.h" +#include "byteorder.h" +#include "setup.h" +#include "track.h" + +#include "nist.h" + +static char *sample_byte_format (_AudioFormat *fmt) +{ + int nbytes = _af_format_sample_size(fmt, AF_FALSE); + + assert(nbytes == 1 || nbytes == 2); + + if (nbytes == 1) + return "0"; + else if (nbytes == 2) + { + if (fmt->byteOrder == AF_BYTEORDER_BIGENDIAN) + return "10"; + else + return "01"; + } + + /* NOTREACHED */ + return NULL; +} + +static char *sample_coding (_AudioFormat *fmt) +{ + if (fmt->compressionType == AF_COMPRESSION_NONE) + return "pcm"; + else if (fmt->compressionType == AF_COMPRESSION_G711_ULAW) + return "ulaw"; + else if (fmt->compressionType == AF_COMPRESSION_G711_ALAW) + return "alaw"; + + /* NOTREACHED */ + return NULL; +} + +status WriteNISTHeader (AFfilehandle file) +{ + AFvirtualfile *fp = file->fh; + _Track *track; + char header[NIST_SPHERE_HEADER_LENGTH]; + int printed; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + printed = snprintf(header, NIST_SPHERE_HEADER_LENGTH, + "NIST_1A\n 1024\n" + "channel_count -i %d\n" + "sample_count -i %d\n" + "sample_rate -i %d\n" + "sample_n_bytes -i %d\n" + "sample_byte_format -s%d %s\n" + "sample_sig_bits -i %d\n" + "sample_coding -s%d %s\n" + "end_head\n", + track->f.channelCount, + (int) (track->totalfframes * track->f.channelCount), + (int) track->f.sampleRate, + (int) _af_format_sample_size(&track->f, AF_FALSE), + (int) _af_format_sample_size(&track->f, AF_FALSE), sample_byte_format(&track->f), + track->f.sampleWidth, + (int) strlen(sample_coding(&track->f)), sample_coding(&track->f)); + + /* Fill the remaining space in the buffer with space characters. */ + if (printed < NIST_SPHERE_HEADER_LENGTH) + memset(header + printed, ' ', NIST_SPHERE_HEADER_LENGTH - printed); + + return af_fwrite(header, NIST_SPHERE_HEADER_LENGTH, 1, fp); +} + +status _af_nist_write_init (AFfilesetup setup, AFfilehandle handle) +{ + _Track *track; + + assert(handle->fileFormat == AF_FILE_NIST_SPHERE); + + if (_af_filesetup_make_handle(setup, handle) == AF_FAIL) + return AF_FAIL; + + track = &handle->tracks[0]; + track->totalfframes = 0; + track->fpos_first_frame = NIST_SPHERE_HEADER_LENGTH; + track->nextfframe = 0; + track->fpos_next_frame = track->fpos_first_frame; + + handle->formatSpecific = NULL; + + af_fseek(handle->fh, 0, SEEK_SET); + WriteNISTHeader(handle); + + return AF_SUCCEED; +} + +status _af_nist_update (AFfilehandle file) +{ + af_fseek(file->fh, 0, SEEK_SET); + WriteNISTHeader(file); + + return AF_SUCCEED; +} diff --git a/libaudiofile/openclose.c b/libaudiofile/openclose.c new file mode 100644 index 0000000..dd0a121 --- /dev/null +++ b/libaudiofile/openclose.c @@ -0,0 +1,648 @@ +/* + Audio File Library + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <assert.h> +#include <string.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <audiofile.h> + +#include "afinternal.h" +#include "units.h" +#include "util.h" +#include "modules.h" + +#if defined(WIN32) || defined(__CYGWIN__) +#include <io.h> +#include <fcntl.h> +#define SETBINARYMODE(fp) _setmode(_fileno(fp), _O_BINARY) +#else +#define SETBINARYMODE(x) +#endif /* WIN32 || __CYGWIN__ */ + +extern _Unit _af_units[]; + +static void freeFileHandle (AFfilehandle filehandle); +static void freeInstParams (AFPVu *values, int fileFormat); +static status _afOpenFile (int access, AFvirtualfile *vf, const char *filename, + AFfilehandle *file, AFfilesetup filesetup); + +int _af_identify (AFvirtualfile *vf, int *implemented) +{ + AFfileoffset curpos; + int i; + + curpos = af_ftell(vf); + + for (i=0; i<_AF_NUM_UNITS; i++) + { + if (_af_units[i].read.recognize && + _af_units[i].read.recognize(vf)) + { + if (implemented != NULL) + *implemented = _af_units[i].implemented; + af_fseek(vf, curpos, SEEK_SET); + return _af_units[i].fileFormat; + } + } + + af_fseek(vf, curpos, SEEK_SET); + + if (implemented != NULL) + *implemented = AF_FALSE; + + return AF_FILE_UNKNOWN; +} + +int afIdentifyFD (int fd) +{ + FILE *fp; + AFvirtualfile *vf; + int result; + + /* + Duplicate the file descriptor since otherwise the + original file descriptor would get closed when we close + the virtual file below. + */ + fd = dup(fd); + + fp = fdopen(fd, "r"); + if (fp == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file"); + return AF_FILE_UNKNOWN; + } + + SETBINARYMODE(fp); + + vf = af_virtual_file_new_for_file(fp); + if (vf == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file"); + return AF_FILE_UNKNOWN; + } + + result = _af_identify(vf, NULL); + + af_fclose(vf); + + return result; +} + +int afIdentifyNamedFD (int fd, const char *filename, int *implemented) +{ + FILE *fp; + AFvirtualfile *vf; + int result; + + /* + Duplicate the file descriptor since otherwise the + original file descriptor would get closed when we close + the virtual file below. + */ + fd = dup(fd); + + fp = fdopen(fd, "r"); + if (fp == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file '%s'", filename); + return AF_FILE_UNKNOWN; + } + + SETBINARYMODE(fp); + + vf = af_virtual_file_new_for_file(fp); + if (vf == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file '%s'", filename); + return AF_FILE_UNKNOWN; + } + + result = _af_identify(vf, implemented); + + af_fclose(vf); + + return result; +} + +AFfilehandle afOpenFD (int fd, const char *mode, AFfilesetup setup) +{ + FILE *fp; + AFvirtualfile *vf; + AFfilehandle filehandle; + int access; + + if (mode == NULL) + { + _af_error(AF_BAD_ACCMODE, "null access mode"); + return AF_NULL_FILEHANDLE; + } + + if (mode[0] == 'r') + access = _AF_READ_ACCESS; + else if (mode[0] == 'w') + access = _AF_WRITE_ACCESS; + else + { + _af_error(AF_BAD_ACCMODE, "unrecognized access mode '%s'", mode); + return AF_NULL_FILEHANDLE; + } + + if ((fp = fdopen(fd, mode)) == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file"); + return AF_NULL_FILEHANDLE; + } + + SETBINARYMODE(fp); + + vf = af_virtual_file_new_for_file(fp); + + if (_afOpenFile(access, vf, NULL, &filehandle, setup) != AF_SUCCEED) + af_fclose(vf); + + return filehandle; +} + +AFfilehandle afOpenNamedFD (int fd, const char *mode, AFfilesetup setup, + const char *filename) +{ + FILE *fp; + AFvirtualfile *vf; + AFfilehandle filehandle; + int access; + + if (mode == NULL) + { + _af_error(AF_BAD_ACCMODE, "null access mode"); + return AF_NULL_FILEHANDLE; + } + + if (mode[0] == 'r') + access = _AF_READ_ACCESS; + else if (mode[0] == 'w') + access = _AF_WRITE_ACCESS; + else + { + _af_error(AF_BAD_ACCMODE, "unrecognized access mode '%s'", mode); + return AF_NULL_FILEHANDLE; + } + + if ((fp = fdopen(fd, mode)) == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file '%s'", filename); + return AF_NULL_FILEHANDLE; + } + + SETBINARYMODE(fp); + + vf = af_virtual_file_new_for_file(fp); + + if (_afOpenFile(access, vf, filename, &filehandle, setup) != AF_SUCCEED) + af_fclose(vf); + + return filehandle; +} + +AFfilehandle afOpenFile (const char *filename, const char *mode, AFfilesetup setup) +{ + FILE *fp; + AFvirtualfile *vf; + AFfilehandle filehandle; + int access; + + if (mode == NULL) + { + _af_error(AF_BAD_ACCMODE, "null access mode"); + return AF_NULL_FILEHANDLE; + } + + if (mode[0] == 'r') + access = _AF_READ_ACCESS; + else if (mode[0] == 'w') + access = _AF_WRITE_ACCESS; + else + { + _af_error(AF_BAD_ACCMODE, "unrecognized access mode '%s'", mode); + return AF_NULL_FILEHANDLE; + } + + if ((fp = fopen(filename, mode)) == NULL) + { + _af_error(AF_BAD_OPEN, "could not open file '%s'", filename); + return AF_NULL_FILEHANDLE; + } + + SETBINARYMODE(fp); + + vf = af_virtual_file_new_for_file(fp); + + if (_afOpenFile(access, vf, filename, &filehandle, setup) != AF_SUCCEED) + af_fclose(vf); + + return filehandle; +} + +AFfilehandle afOpenVirtualFile (AFvirtualfile *vfile, const char *mode, + AFfilesetup setup) +{ + AFfilehandle filehandle; + int access; + + if (vfile == NULL) + { + _af_error(AF_BAD_FILEHANDLE, "null virtual filehandle"); + return AF_NULL_FILEHANDLE; + } + + if (mode == NULL) + { + _af_error(AF_BAD_ACCMODE, "null access mode"); + return AF_NULL_FILEHANDLE; + } + + if (mode[0] == 'r') + access = _AF_READ_ACCESS; + else if (mode[0] == 'w') + access = _AF_WRITE_ACCESS; + else + { + _af_error(AF_BAD_ACCMODE, "unrecognized access mode '%s'", mode); + return AF_NULL_FILEHANDLE; + } + + if (_afOpenFile(access, vfile, NULL, &filehandle, setup) != AF_SUCCEED) + af_fclose(vfile); + + return filehandle; +} + +static status _afOpenFile (int access, AFvirtualfile *vf, const char *filename, + AFfilehandle *file, AFfilesetup filesetup) +{ + int fileFormat = AF_FILE_UNKNOWN; + bool implemented = AF_TRUE; + char *formatName; + status (*initfunc) (AFfilesetup, AFfilehandle); + + int userSampleFormat = 0; + double userSampleRate = 0.0; + _PCMInfo userPCM; + bool userFormatSet = AF_FALSE; + + int t; + + AFfilehandle filehandle = AF_NULL_FILEHANDLE; + AFfilesetup completesetup = AF_NULL_FILESETUP; + + *file = AF_NULL_FILEHANDLE; + + if (access == _AF_WRITE_ACCESS || filesetup != AF_NULL_FILESETUP) + { + if (!_af_filesetup_ok(filesetup)) + return AF_FAIL; + + fileFormat = filesetup->fileFormat; + if (access == _AF_READ_ACCESS && fileFormat != AF_FILE_RAWDATA) + { + _af_error(AF_BAD_FILESETUP, + "warning: opening file for read access: " + "ignoring file setup with non-raw file format"); + filesetup = AF_NULL_FILESETUP; + fileFormat = _af_identify(vf, &implemented); + } + } + else if (filesetup == AF_NULL_FILESETUP) + fileFormat = _af_identify(vf, &implemented); + + if (fileFormat == AF_FILE_UNKNOWN) + { + if (filename != NULL) + _af_error(AF_BAD_NOT_IMPLEMENTED, + "'%s': unrecognized audio file format", + filename); + else + _af_error(AF_BAD_NOT_IMPLEMENTED, + "unrecognized audio file format"); + return AF_FAIL; + } + + formatName = _af_units[fileFormat].name; + + if (implemented == AF_FALSE) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "%s format not currently supported", formatName); + } + + assert(_af_units[fileFormat].completesetup != NULL); + assert(_af_units[fileFormat].read.init != NULL); + + if (access == _AF_WRITE_ACCESS && + _af_units[fileFormat].write.init == NULL) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "%s format is currently supported for reading only", + formatName); + return AF_FAIL; + } + + completesetup = NULL; + if (filesetup != AF_NULL_FILESETUP) + { + userSampleFormat = filesetup->tracks[0].f.sampleFormat; + userPCM = filesetup->tracks[0].f.pcm; + userSampleRate = filesetup->tracks[0].f.sampleRate; + userFormatSet = AF_TRUE; + if ((completesetup = _af_units[fileFormat].completesetup(filesetup)) == NULL) + return AF_FAIL; + } + + filehandle = _af_malloc(sizeof (_AFfilehandle)); + if (filehandle == NULL) + { + if (completesetup) + afFreeFileSetup(completesetup); + return AF_FAIL; + } + memset(filehandle, 0, sizeof (_AFfilehandle)); + + filehandle->valid = _AF_VALID_FILEHANDLE; + filehandle->fh = vf; + filehandle->access = access; + if (filename != NULL) + filehandle->fileName = strdup(filename); + else + filehandle->fileName = NULL; + filehandle->fileFormat = fileFormat; + filehandle->formatSpecific = NULL; + + initfunc = (access == _AF_READ_ACCESS) ? + _af_units[fileFormat].read.init : _af_units[fileFormat].write.init; + + if (initfunc(completesetup, filehandle) != AF_SUCCEED) + { + freeFileHandle(filehandle); + filehandle = AF_NULL_FILEHANDLE; + if (completesetup) + afFreeFileSetup(completesetup); + return AF_FAIL; + } + + if (completesetup) + { + afFreeFileSetup(completesetup); + completesetup = NULL; + } + + /* + Initialize virtual format. + */ + for (t=0; t<filehandle->trackCount; t++) + { + _Track *track = &filehandle->tracks[t]; + + track->v = track->f; + + if (userFormatSet) + { + track->v.sampleFormat = userSampleFormat; + track->v.pcm = userPCM; + track->v.sampleRate = userSampleRate; + } + + track->v.compressionType = AF_COMPRESSION_NONE; + track->v.compressionParams = NULL; + +#if WORDS_BIGENDIAN + track->v.byteOrder = AF_BYTEORDER_BIGENDIAN; +#else + track->v.byteOrder = AF_BYTEORDER_LITTLEENDIAN; +#endif + + if (_AFinitmodules(filehandle, track) == AF_FAIL) + { + freeFileHandle(filehandle); + return AF_FAIL; + } + } + + *file = filehandle; + + return AF_SUCCEED; +} + +int afSyncFile (AFfilehandle handle) +{ + if (!_af_filehandle_ok(handle)) + return -1; + + if (handle->access == _AF_WRITE_ACCESS) + { + int filefmt = handle->fileFormat; + int trackno; + + /* Finish writes on all tracks. */ + for (trackno = 0; trackno < handle->trackCount; trackno++) + { + _Track *track = &handle->tracks[trackno]; + + if (track->ms.modulesdirty) + { + if (_AFsetupmodules(handle, track) == AF_FAIL) + return -1; + } + + if (_AFsyncmodules(handle, track) != AF_SUCCEED) + return -1; + } + + /* Update file headers. */ + if (_af_units[filefmt].write.update != NULL && + _af_units[filefmt].write.update(handle) != AF_SUCCEED) + return AF_FAIL; + } + else if (handle->access == _AF_READ_ACCESS) + { + /* Do nothing. */ + } + else + { + _af_error(AF_BAD_ACCMODE, "unrecognized access mode %d", + handle->access); + return AF_FAIL; + } + + return AF_SUCCEED; +} + +int afCloseFile (AFfilehandle file) +{ + int err; + + if (!_af_filehandle_ok(file)) + return -1; + + afSyncFile(file); + + err = af_fclose(file->fh); + if (err < 0) + _af_error(AF_BAD_CLOSE, "close returned %d", err); + + freeFileHandle(file); + + return 0; +} + +static void freeFileHandle (AFfilehandle filehandle) +{ + int fileFormat; + if (filehandle == NULL || filehandle->valid != _AF_VALID_FILEHANDLE) + { + _af_error(AF_BAD_FILEHANDLE, "bad filehandle"); + return; + } + + filehandle->valid = 0; + + if (filehandle->fileName != NULL) + free(filehandle->fileName); + + fileFormat = filehandle->fileFormat; + + if (filehandle->formatSpecific != NULL) + { + free(filehandle->formatSpecific); + filehandle->formatSpecific = NULL; + } + + if (filehandle->tracks) + { + int i; + for (i=0; i<filehandle->trackCount; i++) + { + /* Free the compression parameters. */ + if (filehandle->tracks[i].f.compressionParams) + { + AUpvfree(filehandle->tracks[i].f.compressionParams); + filehandle->tracks[i].f.compressionParams = AU_NULL_PVLIST; + } + + if (filehandle->tracks[i].v.compressionParams) + { + AUpvfree(filehandle->tracks[i].v.compressionParams); + filehandle->tracks[i].v.compressionParams = AU_NULL_PVLIST; + } + + /* Free the track's modules. */ + + _AFfreemodules(&filehandle->tracks[i]); + + if (filehandle->tracks[i].channelMatrix) + { + free(filehandle->tracks[i].channelMatrix); + filehandle->tracks[i].channelMatrix = NULL; + } + + if (filehandle->tracks[i].markers) + { + int j; + for (j=0; j<filehandle->tracks[i].markerCount; j++) + { + if (filehandle->tracks[i].markers[j].name) + { + free(filehandle->tracks[i].markers[j].name); + filehandle->tracks[i].markers[j].name = NULL; + } + if (filehandle->tracks[i].markers[j].comment) + { + free(filehandle->tracks[i].markers[j].comment); + filehandle->tracks[i].markers[j].comment = NULL; + } + + } + + free(filehandle->tracks[i].markers); + filehandle->tracks[i].markers = NULL; + } + } + + free(filehandle->tracks); + filehandle->tracks = NULL; + } + filehandle->trackCount = 0; + + if (filehandle->instruments) + { + int i; + for (i=0; i<filehandle->instrumentCount; i++) + { + if (filehandle->instruments[i].loops) + { + free(filehandle->instruments[i].loops); + filehandle->instruments[i].loops = NULL; + } + filehandle->instruments[i].loopCount = 0; + + if (filehandle->instruments[i].values) + { + freeInstParams(filehandle->instruments[i].values, fileFormat); + filehandle->instruments[i].values = NULL; + } + } + free(filehandle->instruments); + filehandle->instruments = NULL; + } + filehandle->instrumentCount = 0; + + if (filehandle->miscellaneous) + { + free(filehandle->miscellaneous); + filehandle->miscellaneous = NULL; + } + filehandle->miscellaneousCount = 0; + + memset(filehandle, 0, sizeof (_AFfilehandle)); + free(filehandle); +} + +static void freeInstParams (AFPVu *values, int fileFormat) +{ + int i; + int parameterCount = _af_units[fileFormat].instrumentParameterCount; + + for (i=0; i<parameterCount; i++) + { + if (_af_units[fileFormat].instrumentParameters[i].type == AU_PVTYPE_PTR) + if (values[i].v != NULL) + free(values[i].v); + } + + free(values); +} diff --git a/libaudiofile/pcm.c b/libaudiofile/pcm.c new file mode 100644 index 0000000..d2d0777 --- /dev/null +++ b/libaudiofile/pcm.c @@ -0,0 +1,173 @@ +/* + Audio File Library + Copyright (C) 1999-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + pcm.c + + This file declares default PCM mappings. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "afinternal.h" +#include "pcm.h" +#include "util.h" + +_PCMInfo _af_default_signed_integer_pcm_mappings[] = +{ + {0, 0, 0, 0}, + {SLOPE_INT8, 0, MIN_INT8, MAX_INT8}, + {SLOPE_INT16, 0, MIN_INT16, MAX_INT16}, + {SLOPE_INT24, 0, MIN_INT24, MAX_INT24}, + {SLOPE_INT32, 0, MIN_INT32, MAX_INT32} +}; + +_PCMInfo _af_default_unsigned_integer_pcm_mappings[] = +{ + {0, 0, 0, 0}, + {SLOPE_INT8, INTERCEPT_U_INT8, 0, MAX_U_INT8}, + {SLOPE_INT16, INTERCEPT_U_INT16, 0, MAX_U_INT16}, + {SLOPE_INT24, INTERCEPT_U_INT24, 0, MAX_U_INT24}, + {SLOPE_INT32, INTERCEPT_U_INT32, 0, MAX_U_INT32} +}; + +_PCMInfo _af_default_float_pcm_mapping = +{1, 0, 0, 0}; + +_PCMInfo _af_default_double_pcm_mapping = +{1, 0, 0, 0}; + +/* + Initialize the PCM mapping for a given track. +*/ +void afInitPCMMapping (AFfilesetup setup, int trackid, + double slope, double intercept, double minClip, double maxClip) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + track->f.pcm.slope = slope; + track->f.pcm.intercept = intercept; + track->f.pcm.minClip = minClip; + track->f.pcm.maxClip = maxClip; +} + +int afSetVirtualPCMMapping (AFfilehandle file, int trackid, + double slope, double intercept, double minClip, double maxClip) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + track->v.pcm.slope = slope; + track->v.pcm.intercept = intercept; + track->v.pcm.minClip = minClip; + track->v.pcm.maxClip = maxClip; + + track->ms.modulesdirty = AF_TRUE; + + return 0; +} + +int afSetTrackPCMMapping (AFfilehandle file, int trackid, + double slope, double intercept, double minClip, double maxClip) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return -1; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return -1; + + /* + NOTE: this is highly unusual: we don't ordinarily + change track.f after the file is opened. + + PCM mapping is the exception because this information + is not encoded in sound files' headers using today's + formats, so the user will probably want to set this + information on a regular basis. The defaults may or + may not be what the user wants. + */ + + track->f.pcm.slope = slope; + track->f.pcm.intercept = intercept; + track->f.pcm.minClip = minClip; + track->f.pcm.maxClip = maxClip; + + track->ms.modulesdirty = AF_TRUE; + + return 0; +} + +void afGetPCMMapping (AFfilehandle file, int trackid, + double *slope, double *intercept, double *minClip, double *maxClip) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (slope) + *slope = track->f.pcm.slope; + if (intercept) + *intercept = track->f.pcm.intercept; + if (minClip) + *minClip = track->f.pcm.minClip; + if (maxClip) + *maxClip = track->f.pcm.maxClip; +} + +void afGetVirtualPCMMapping (AFfilehandle file, int trackid, + double *slope, double *intercept, double *minClip, double *maxClip) +{ + _Track *track; + + if (!_af_filehandle_ok(file)) + return; + + if ((track = _af_filehandle_get_track(file, trackid)) == NULL) + return; + + if (slope) + *slope = track->v.pcm.slope; + if (intercept) + *intercept = track->v.pcm.intercept; + if (minClip) + *minClip = track->v.pcm.minClip; + if (maxClip) + *maxClip = track->v.pcm.maxClip; +} diff --git a/libaudiofile/pcm.h b/libaudiofile/pcm.h new file mode 100644 index 0000000..413fdc2 --- /dev/null +++ b/libaudiofile/pcm.h @@ -0,0 +1,70 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + pcm.h + + This file defines various constants for PCM mapping. +*/ + +#ifndef PCM_H +#define PCM_H + +/* + SLOPE_INTN = 2^(N-1) - 1 +*/ +#define SLOPE_INT8 (127.0) +#define SLOPE_INT16 (32767.0) +#define SLOPE_INT24 (8388607.0) +#define SLOPE_INT32 (2147483647.0) + +/* + INTERCEPT_U_INTN = 2^(N-1) +*/ +#define INTERCEPT_U_INT8 (128.0) +#define INTERCEPT_U_INT16 (32768.0) +#define INTERCEPT_U_INT24 (8388608.0) +#define INTERCEPT_U_INT32 (2147483648.0) + +/* + MIN_INTN = -(2^(N-1)) +*/ +#define MIN_INT8 (-128.0) +#define MIN_INT16 (-32768.0) +#define MIN_INT24 (-8388608.0) +#define MIN_INT32 (-2147483648.0) + +/* + MAX_INTN = 2^(N-1) - 1 +*/ +#define MAX_INT8 127.0 +#define MAX_INT16 32767.0 +#define MAX_INT24 8388607.0 +#define MAX_INT32 2147483647.0 + +/* + MAX_U_INTN = 2^N - 1 +*/ +#define MAX_U_INT8 255.0 +#define MAX_U_INT16 65535.0 +#define MAX_U_INT24 16777215.0 +#define MAX_U_INT32 4294967295.0 + +#endif /* PCM_H */ diff --git a/libaudiofile/print.h b/libaudiofile/print.h new file mode 100644 index 0000000..d67ca54 --- /dev/null +++ b/libaudiofile/print.h @@ -0,0 +1,55 @@ +/* + Audio File Library + Copyright (C) 2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + print.h + + Declare format specifiers for off_t and size_t for use with printf. +*/ + +#ifndef PRINT_H +#define PRINT_H + +#include <config.h> + +#if (SIZEOF_OFF_T == SIZEOF_LONG) +#define AF_OFF_T_PRINT_FMT "ld" +#endif +#if (SIZEOF_OFF_T > SIZEOF_LONG) +#define AF_OFF_T_PRINT_FMT "lld" +#endif +#if (SIZEOF_OFF_T < SIZEOF_LONG) +#define AF_OFF_T_PRINT_FMT "d" +#endif + +#if (SIZEOF_SIZE_T == SIZEOF_LONG) +#define AF_SIZE_T_PRINT_FMT "lu" +#endif +#if (SIZEOF_SIZE_T > SIZEOF_LONG) +#define AF_SIZE_T_PRINT_FMT "llu" +#endif +#if (SIZEOF_SIZE_T < SIZEOF_LONG) +#define AF_SIZE_T_PRINT_FMT "u" +#endif + +#define AF_FRAMECOUNT_PRINT_FMT AF_OFF_T_PRINT_FMT +#define AF_FILEOFFSET_PRINT_FMT AF_OFF_T_PRINT_FMT + +#endif /* PRINT_H */ diff --git a/libaudiofile/query.c b/libaudiofile/query.c new file mode 100644 index 0000000..18a0941 --- /dev/null +++ b/libaudiofile/query.c @@ -0,0 +1,478 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + query.c + + This file contains the implementation of the Audio File Library's + query mechanism. Querying through the afQuery calls can allow the + programmer to determine the capabilities and characteristics of + the Audio File Library implementation and its supported formats. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <stdlib.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "aupvlist.h" +#include "error.h" +#include "util.h" +#include "units.h" +#include "compression.h" +#include "instrument.h" + +extern _Unit _af_units[]; +extern _CompressionUnit _af_compression[]; + +AUpvlist _afQueryFileFormat (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryInstrument (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryInstrumentParameter (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryLoop (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryMarker (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryMiscellaneous (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryCompression (int arg1, int arg2, int arg3, int arg4); +AUpvlist _afQueryCompressionParameter (int arg1, int arg2, int arg3, int arg4); + +AUpvlist afQuery (int querytype, int arg1, int arg2, int arg3, int arg4) +{ + switch (querytype) + { + case AF_QUERYTYPE_INST: + return _afQueryInstrument(arg1, arg2, arg3, arg4); + case AF_QUERYTYPE_INSTPARAM: + return _afQueryInstrumentParameter(arg1, arg2, arg3, arg4); + case AF_QUERYTYPE_LOOP: + return _afQueryLoop(arg1, arg2, arg3, arg4); + case AF_QUERYTYPE_FILEFMT: + return _afQueryFileFormat(arg1, arg2, arg3, arg4); + case AF_QUERYTYPE_COMPRESSION: + return _afQueryCompression(arg1, arg2, arg3, arg4); + case AF_QUERYTYPE_COMPRESSIONPARAM: + /* FIXME: This selector is not implemented. */ + return AU_NULL_PVLIST; + case AF_QUERYTYPE_MISC: + /* FIXME: This selector is not implemented. */ + return AU_NULL_PVLIST; + case AF_QUERYTYPE_MARK: + return _afQueryMarker(arg1, arg2, arg3, arg4); + default: + _af_error(AF_BAD_QUERYTYPE, "bad query type"); + return AU_NULL_PVLIST; + } + + /* NOTREACHED */ + return AU_NULL_PVLIST; +} + +/* ARGSUSED3 */ +AUpvlist _afQueryFileFormat (int arg1, int arg2, int arg3, int arg4) +{ + switch (arg1) + { + /* The following select only on arg1. */ + case AF_QUERY_ID_COUNT: + { + int count = 0, idx; + for (idx = 0; idx < _AF_NUM_UNITS; idx++) + if (_af_units[idx].implemented) + count++; + return _af_pv_long(count); + } + /* NOTREACHED */ + break; + + case AF_QUERY_IDS: + { + int count = 0, idx; + int *buffer; + + buffer = _af_calloc(_AF_NUM_UNITS, sizeof (int)); + if (buffer == NULL) + return AU_NULL_PVLIST; + + for (idx = 0; idx < _AF_NUM_UNITS; idx++) + if (_af_units[idx].implemented) + buffer[count++] = idx; + + if (count == 0) + { + free(buffer); + return AU_NULL_PVLIST; + } + + return _af_pv_pointer(buffer); + } + /* NOTREACHED */ + break; + + /* The following select on arg2. */ + case AF_QUERY_LABEL: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_pointer(_af_units[arg2].label); + + case AF_QUERY_NAME: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_pointer(_af_units[arg2].name); + + case AF_QUERY_DESC: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_pointer(_af_units[arg2].description); + + case AF_QUERY_IMPLEMENTED: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].implemented); + + /* The following select on arg3. */ + case AF_QUERY_SAMPLE_FORMATS: + if (arg3 < 0 || arg3 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + switch (arg2) + { + case AF_QUERY_DEFAULT: + return _af_pv_long(_af_units[arg3].defaultSampleFormat); + default: + return AU_NULL_PVLIST; + } + /* NOTREACHED */ + break; + + case AF_QUERY_SAMPLE_SIZES: + if (arg3 < 0 || arg3 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + + switch (arg2) + { + case AF_QUERY_DEFAULT: + return _af_pv_long(_af_units[arg3].defaultSampleWidth); + default: + break; + } + /* NOTREACHED */ + break; + + case AF_QUERY_COMPRESSION_TYPES: + { + int idx, count; + int *buffer; + + if (arg3 < 0 || arg3 >= _AF_NUM_UNITS) + { + _af_error(AF_BAD_QUERY, + "unrecognized file format %d", arg3); + return AU_NULL_PVLIST; + } + + switch (arg2) + { + case AF_QUERY_VALUE_COUNT: + count = _af_units[arg3].compressionTypeCount; + return _af_pv_long(count); + + case AF_QUERY_VALUES: + count = _af_units[arg3].compressionTypeCount; + if (count == 0) + return AU_NULL_PVLIST; + + buffer = _af_calloc(count, sizeof (int)); + if (buffer == NULL) + return AU_NULL_PVLIST; + + for (idx = 0; idx < count; idx++) + { + buffer[idx] = _af_units[arg3].compressionTypes[idx]; + } + + return _af_pv_pointer(buffer); + } + } + break; + } + + return AU_NULL_PVLIST; +} + +long afQueryLong (int querytype, int arg1, int arg2, int arg3, int arg4) +{ + AUpvlist list; + int type; + long value; + + list = afQuery(querytype, arg1, arg2, arg3, arg4); + if (list == AU_NULL_PVLIST) + return -1; + AUpvgetvaltype(list, 0, &type); + if (type != AU_PVTYPE_LONG) + return -1; + AUpvgetval(list, 0, &value); + AUpvfree(list); + return value; +} + +double afQueryDouble (int querytype, int arg1, int arg2, int arg3, int arg4) +{ + AUpvlist list; + int type; + double value; + + list = afQuery(querytype, arg1, arg2, arg3, arg4); + if (list == AU_NULL_PVLIST) + return -1; + AUpvgetvaltype(list, 0, &type); + if (type != AU_PVTYPE_DOUBLE) + return -1; + AUpvgetval(list, 0, &value); + AUpvfree(list); + return value; +} + +void *afQueryPointer (int querytype, int arg1, int arg2, int arg3, int arg4) +{ + AUpvlist list; + int type; + void *value; + + list = afQuery(querytype, arg1, arg2, arg3, arg4); + if (list == AU_NULL_PVLIST) + return NULL; + AUpvgetvaltype(list, 0, &type); + if (type != AU_PVTYPE_PTR) + return NULL; + AUpvgetval(list, 0, &value); + AUpvfree(list); + return value; +} + +/* ARGSUSED3 */ +AUpvlist _afQueryInstrumentParameter (int arg1, int arg2, int arg3, int arg4) +{ + switch (arg1) + { + /* For the following query types, arg2 is the file format. */ + case AF_QUERY_SUPPORTED: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].instrumentParameterCount != 0); + + case AF_QUERY_ID_COUNT: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].instrumentParameterCount); + + case AF_QUERY_IDS: + { + int i, count; + int *buffer; + + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + count = _af_units[arg2].instrumentParameterCount; + if (count == 0) + return AU_NULL_PVLIST; + buffer = _af_calloc(count, sizeof (int)); + if (buffer == NULL) + return AU_NULL_PVLIST; + for (i=0; i<count; i++) + buffer[i] = _af_units[arg2].instrumentParameters[i].id; + return _af_pv_pointer(buffer); + } + /* NOTREACHED */ + break; + + /* + For the next few query types, arg2 is the file + format and arg3 is the instrument parameter id. + */ + case AF_QUERY_TYPE: + { + int idx; + + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + + idx = _af_instparam_index_from_id(arg2, arg3); + if (idx<0) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].instrumentParameters[idx].type); + } + + case AF_QUERY_NAME: + { + int idx; + + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + idx = _af_instparam_index_from_id(arg2, arg3); + if (idx < 0) + return AU_NULL_PVLIST; + return _af_pv_pointer(_af_units[arg2].instrumentParameters[idx].name); + } + + case AF_QUERY_DEFAULT: + { + int idx; + + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + idx = _af_instparam_index_from_id(arg2, arg3); + if (idx >= 0) + { + AUpvlist ret = AUpvnew(1); + AUpvsetparam(ret, 0, _af_units[arg2].instrumentParameters[idx].id); + AUpvsetvaltype(ret, 0, _af_units[arg2].instrumentParameters[idx].type); + AUpvsetval(ret, 0, &_af_units[arg2].instrumentParameters[idx].defaultValue); + return ret; + } + return AU_NULL_PVLIST; + } + + default: + break; + } + + return AU_NULL_PVLIST; +} + +/* ARGSUSED2 */ +AUpvlist _afQueryLoop (int arg1, int arg2, int arg3, int arg4) +{ + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + + switch (arg1) + { + case AF_QUERY_SUPPORTED: + return _af_pv_long(_af_units[arg2].loopPerInstrumentCount != 0); + case AF_QUERY_MAX_NUMBER: + return _af_pv_long(_af_units[arg2].loopPerInstrumentCount); + default: + break; + } + + return AU_NULL_PVLIST; +} + +/* ARGSUSED2 */ +AUpvlist _afQueryInstrument (int arg1, int arg2, int arg3, int arg4) +{ + switch (arg1) + { + case AF_QUERY_SUPPORTED: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].instrumentCount != 0); + + case AF_QUERY_MAX_NUMBER: + if (arg2 < 0 || arg2 >= _AF_NUM_UNITS) + return AU_NULL_PVLIST; + return _af_pv_long(_af_units[arg2].instrumentCount); + + default: + break; + } + + return AU_NULL_PVLIST; +} + +/* ARGSUSED0 */ +AUpvlist _afQueryMiscellaneous (int arg1, int arg2, int arg3, int arg4) +{ + _af_error(AF_BAD_NOT_IMPLEMENTED, "not implemented yet"); + return AU_NULL_PVLIST; +} + +/* ARGSUSED2 */ +AUpvlist _afQueryMarker (int arg1, int arg2, int arg3, int arg4) +{ + switch (arg1) + { + case AF_QUERY_SUPPORTED: + return _af_pv_long(_af_units[arg2].markerCount != 0); + case AF_QUERY_MAX_NUMBER: + return _af_pv_long(_af_units[arg2].markerCount); + default: + _af_error(AF_BAD_QUERY, "bad query"); + return AU_NULL_PVLIST; + } + + /* NOTREACHED */ + return AU_NULL_PVLIST; +} + +/* ARGSUSED0 */ +AUpvlist _afQueryCompression (int arg1, int arg2, int arg3, int arg4) +{ + int count, i, index; + int *buf; + + switch (arg1) + { + case AF_QUERY_ID_COUNT: + count = 0; + for (i = 0; i < _AF_NUM_COMPRESSION; i++) + if (_af_compression[i].implemented == AF_TRUE) + count++; + return _af_pv_long(count); + + case AF_QUERY_IDS: + buf = _af_calloc(_AF_NUM_COMPRESSION, sizeof (int)); + if (!buf) + return AU_NULL_PVLIST; + + count = 0; + for (i = 0; i < _AF_NUM_COMPRESSION; i++) + { + if (_af_compression[i].implemented) + buf[count++] = _af_compression[i].compressionID; + } + return _af_pv_pointer(buf); + + case AF_QUERY_NATIVE_SAMPFMT: + index = _af_compression_index_from_id(arg2); + return _af_pv_long(_af_compression[index].nativeSampleFormat); + + case AF_QUERY_NATIVE_SAMPWIDTH: + index = _af_compression_index_from_id(arg2); + return _af_pv_long(_af_compression[_af_compression_index_from_id(arg2)].nativeSampleWidth); + + case AF_QUERY_LABEL: + index = _af_compression_index_from_id(arg2); + return _af_pv_pointer(_af_compression[index].label); + + case AF_QUERY_NAME: + index = _af_compression_index_from_id(arg2); + return _af_pv_pointer(_af_compression[index].shortname); + + case AF_QUERY_DESC: + index = _af_compression_index_from_id(arg2); + return _af_pv_pointer(_af_compression[index].name); + } + + _af_error(AF_BAD_QUERY, "unrecognized query selector %d\n", arg1); + return AU_NULL_PVLIST; +} diff --git a/libaudiofile/raw.c b/libaudiofile/raw.c new file mode 100644 index 0000000..5410086 --- /dev/null +++ b/libaudiofile/raw.c @@ -0,0 +1,188 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + raw.c + + This file contains code for reading and writing raw audio + data files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "afinternal.h" +#include "audiofile.h" +#include "raw.h" +#include "util.h" +#include "setup.h" + +_AFfilesetup _af_raw_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_RAWDATA, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +int _af_raw_compression_types[_AF_RAW_NUM_COMPTYPES] = +{ + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +}; + +bool _af_raw_recognize (AFvirtualfile *fh) +{ + return AF_FALSE; +} + +status _af_raw_read_init (AFfilesetup filesetup, AFfilehandle filehandle) +{ + _Track *track; + + if (filesetup == NULL) + { + _af_error(AF_BAD_FILEHANDLE, "a valid AFfilesetup is required for reading raw data"); + return AF_FAIL; + } + + if (_af_filesetup_make_handle(filesetup, filehandle) == AF_FAIL) + return AF_FAIL; + + track = &filehandle->tracks[0]; + + /* Set the track's data offset. */ + if (filesetup->tracks[0].dataOffsetSet) + track->fpos_first_frame = filesetup->tracks[0].dataOffset; + else + track->fpos_first_frame = 0; + + /* Set the track's frame count. */ + if (filesetup->tracks[0].frameCountSet) + { + track->totalfframes = filesetup->tracks[0].frameCount; + } + else + { + AFfileoffset filesize; + filesize = af_flength(filehandle->fh); + if (filesize == -1) + track->totalfframes = -1; + else + { + /* Ensure that the data offset is valid. */ + if (track->fpos_first_frame > filesize) + { + _af_error(AF_BAD_FILESETUP, "data offset is larger than file size"); + return AF_FAIL; + } + + filesize -= track->fpos_first_frame; + track->totalfframes = filesize / _af_format_frame_size(&track->f, AF_FALSE); + } + track->data_size = filesize; + } + + return AF_SUCCEED; +} + +status _af_raw_write_init (AFfilesetup filesetup, AFfilehandle filehandle) +{ + _Track *track; + + if (_af_filesetup_make_handle(filesetup, filehandle) == AF_FAIL) + return AF_FAIL; + + track = &filehandle->tracks[0]; + track->totalfframes = 0; + if (filesetup->tracks[0].dataOffsetSet) + track->fpos_first_frame = filesetup->tracks[0].dataOffset; + else + track->fpos_first_frame = 0; + + return AF_SUCCEED; +} + +status _af_raw_update (AFfilehandle filehandle) +{ + return AF_SUCCEED; +} + +AFfilesetup _af_raw_complete_setup (AFfilesetup setup) +{ + AFfilesetup newSetup; + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_FILESETUP, "raw file must have exactly one track"); + return AF_NULL_FILESETUP; + } + + if ((track = _af_filesetup_get_tracksetup(setup, AF_DEFAULT_TRACK)) == NULL) + { + _af_error(AF_BAD_FILESETUP, "could not access track in file setup"); + return AF_NULL_FILESETUP; + } + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "raw file cannot have AES data"); + return AF_NULL_FILESETUP; + } + + if (track->markersSet && track->markerCount != 0) + { + _af_error(AF_BAD_NUMMARKS, "raw file cannot have markers"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet && setup->instrumentCount != 0) + { + _af_error(AF_BAD_NUMINSTS, "raw file cannot have instruments"); + return AF_NULL_FILESETUP; + } + + if (setup->miscellaneousSet && setup->miscellaneousCount != 0) + { + _af_error(AF_BAD_NUMMISC, "raw file cannot have miscellaneous data"); + return AF_NULL_FILESETUP; + } + + newSetup = _af_malloc(sizeof (_AFfilesetup)); + *newSetup = _af_raw_default_filesetup; + + newSetup->tracks = _af_malloc(sizeof (_TrackSetup)); + newSetup->tracks[0] = setup->tracks[0]; + newSetup->tracks[0].f.compressionParams = NULL; + + newSetup->tracks[0].markerCount = 0; + newSetup->tracks[0].markers = NULL; + + return newSetup; +} diff --git a/libaudiofile/raw.h b/libaudiofile/raw.h new file mode 100644 index 0000000..a716b06 --- /dev/null +++ b/libaudiofile/raw.h @@ -0,0 +1,36 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + raw.h +*/ + +#ifndef RAW_H +#define RAW_H + +bool _af_raw_recognize (AFvirtualfile *fh); +status _af_raw_read_init (AFfilesetup filesetup, AFfilehandle filehandle); +status _af_raw_write_init (AFfilesetup filesetup, AFfilehandle filehandle); +status _af_raw_update (AFfilehandle filehandle); +AFfilesetup _af_raw_complete_setup (AFfilesetup); + +#define _AF_RAW_NUM_COMPTYPES 2 + +#endif /* RAW_H */ diff --git a/libaudiofile/setup.c b/libaudiofile/setup.c new file mode 100644 index 0000000..8c3ab42 --- /dev/null +++ b/libaudiofile/setup.c @@ -0,0 +1,744 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + setup.c +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <string.h> + +#include <audiofile.h> + +#include "afinternal.h" +#include "pcm.h" +#include "util.h" +#include "units.h" +#include "marker.h" + +extern _Unit _af_units[]; + +_AFfilesetup _af_default_file_setup = +{ + _AF_VALID_FILESETUP, /* valid */ +#if WORDS_BIGENDIAN + AF_FILE_AIFFC, /* file format */ +#else + AF_FILE_WAVE, /* file format */ +#endif + AF_FALSE, /* trackSet */ + AF_FALSE, /* instrumentSet */ + AF_FALSE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 1, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +_InstrumentSetup _af_default_instrumentsetup = +{ + 0, /* id */ + 2, /* loopCount */ + NULL, /* loops */ + AF_FALSE /* loopSet */ +}; + +_TrackSetup _af_default_tracksetup = +{ + 0, + { + 44100.0, + AF_SAMPFMT_TWOSCOMP, + 16, +#if WORDS_BIGENDIAN + AF_BYTEORDER_BIGENDIAN, +#else + AF_BYTEORDER_LITTLEENDIAN, +#endif + { SLOPE_INT16, 0, MIN_INT16, MAX_INT16 }, + 2, + AF_COMPRESSION_NONE, + NULL + }, + AF_FALSE, /* rateSet */ + AF_FALSE, /* sampleFormatSet */ + AF_FALSE, /* sampleWidthSet */ + AF_FALSE, /* byteOrderSet */ + AF_FALSE, /* channelCountSet */ + AF_FALSE, /* compressionSet */ + AF_FALSE, /* aesDataSet */ + AF_FALSE, /* markersSet */ + AF_FALSE, /* dataOffsetSet */ + AF_FALSE, /* frameCountSet */ + + 4, /* markerCount */ + NULL, /* markers */ + 0, /* dataOffset */ + 0 /* frameCount */ +}; + +_TrackSetup *_af_tracksetup_new (int trackCount) +{ + int i; + _TrackSetup *tracks; + + if (trackCount == 0) + return NULL; + + tracks = _af_calloc(trackCount, sizeof (_TrackSetup)); + if (tracks == NULL) + return NULL; + + for (i=0; i<trackCount; i++) + { + tracks[i] = _af_default_tracksetup; + + tracks[i].id = AF_DEFAULT_TRACK + i; + + /* XXXmpruett deal with compression */ + + _af_set_sample_format(&tracks[i].f, tracks[i].f.sampleFormat, + tracks[i].f.sampleWidth); + + if (tracks[i].markerCount == 0) + tracks[i].markers = NULL; + else + { + int j; + tracks[i].markers = _af_calloc(tracks[i].markerCount, + sizeof (_MarkerSetup)); + + if (tracks[i].markers == NULL) + return NULL; + + for (j=0; j<tracks[i].markerCount; j++) + { + tracks[i].markers[j].id = j+1; + + tracks[i].markers[j].name = _af_strdup(""); + if (tracks[i].markers[j].name == NULL) + return NULL; + + tracks[i].markers[j].comment = _af_strdup(""); + if (tracks[i].markers[j].comment == NULL) + return NULL; + } + } + } + + return tracks; +} + +_InstrumentSetup *_af_instsetup_new (int instrumentCount) +{ + int i; + + _InstrumentSetup *instruments; + + if (instrumentCount == 0) + return NULL; + instruments = _af_calloc(instrumentCount, sizeof (_InstrumentSetup)); + if (instruments == NULL) + return NULL; + + for (i=0; i<instrumentCount; i++) + { + instruments[i] = _af_default_instrumentsetup; + instruments[i].id = AF_DEFAULT_INST + i; + if (instruments[i].loopCount == 0) + instruments[i].loops = NULL; + else + { + int j; + instruments[i].loops = _af_calloc(instruments[i].loopCount, sizeof (_LoopSetup)); + if (instruments[i].loops == NULL) + return NULL; + + for (j=0; j<instruments[i].loopCount; j++) + instruments[i].loops[j].id = j+1; + } + } + + return instruments; +} + +AFfilesetup afNewFileSetup (void) +{ + AFfilesetup setup; + + setup = _af_malloc(sizeof (_AFfilesetup)); + if (setup == NULL) return AF_NULL_FILESETUP; + + *setup = _af_default_file_setup; + + setup->tracks = _af_tracksetup_new(setup->trackCount); + + setup->instruments = _af_instsetup_new(setup->instrumentCount); + + if (setup->miscellaneousCount == 0) + setup->miscellaneous = NULL; + else + { + int i; + + setup->miscellaneous = _af_calloc(setup->miscellaneousCount, + sizeof (_MiscellaneousSetup)); + for (i=0; i<setup->miscellaneousCount; i++) + { + setup->miscellaneous[i].id = i+1; + setup->miscellaneous[i].type = 0; + setup->miscellaneous[i].size = 0; + } + } + + return setup; +} + +/* + Free the specified track's markers and their subfields. +*/ +void _af_setup_free_markers (AFfilesetup setup, int trackno) +{ + if (setup->tracks[trackno].markerCount != 0) + { + int i; + for (i=0; i<setup->tracks[trackno].markerCount; i++) + { + free(setup->tracks[trackno].markers[i].name); + free(setup->tracks[trackno].markers[i].comment); + } + + free(setup->tracks[trackno].markers); + } + + setup->tracks[trackno].markers = NULL; + setup->tracks[trackno].markerCount = 0; +} + +/* + Free the specified setup's tracks and their subfields. +*/ +void _af_setup_free_tracks (AFfilesetup setup) +{ + int i; + + if (setup->tracks) + { + for (i=0; i<setup->trackCount; i++) + { + _af_setup_free_markers(setup, i); + } + + free(setup->tracks); + } + + setup->tracks = NULL; + setup->trackCount = 0; +} + +/* + Free the specified instrument's loops. +*/ +void _af_setup_free_loops (AFfilesetup setup, int instno) +{ + if (setup->instruments[instno].loops) + { + free(setup->instruments[instno].loops); + } + + setup->instruments[instno].loops = NULL; + setup->instruments[instno].loopCount = 0; +} + +/* + Free the specified setup's instruments and their subfields. +*/ +void _af_setup_free_instruments (AFfilesetup setup) +{ + int i; + + if (setup->instruments) + { + for (i = 0; i < setup->instrumentCount; i++) + _af_setup_free_loops(setup, i); + + free(setup->instruments); + } + + setup->instruments = NULL; + setup->instrumentCount = 0; +} + +void afFreeFileSetup (AFfilesetup setup) +{ + if (!_af_filesetup_ok(setup)) + return; + + _af_setup_free_tracks(setup); + + _af_setup_free_instruments(setup); + + if (setup->miscellaneousCount) + { + free(setup->miscellaneous); + setup->miscellaneous = NULL; + setup->miscellaneousCount = 0; + } + + memset(setup, 0, sizeof (_AFfilesetup)); + free(setup); +} + +void afInitFileFormat (AFfilesetup setup, int filefmt) +{ + if (!_af_filesetup_ok(setup)) + return; + + if (filefmt < 0 || filefmt > _AF_NUM_UNITS) + { + _af_error(AF_BAD_FILEFMT, "unrecognized file format %d", + filefmt); + return; + } + + if (_af_units[filefmt].implemented == AF_FALSE) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "%s format not currently supported", + _af_units[filefmt].name); + return; + } + + setup->fileFormat = filefmt; +} + +void afInitChannels (AFfilesetup setup, int trackid, int channels) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (channels < 1) + { + _af_error(AF_BAD_CHANNELS, "invalid number of channels %d", + channels); + return; + } + + track->f.channelCount = channels; + track->channelCountSet = AF_TRUE; +} + +void afInitSampleFormat (AFfilesetup setup, int trackid, int sampfmt, int sampwidth) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + _af_set_sample_format(&track->f, sampfmt, sampwidth); + + track->sampleFormatSet = AF_TRUE; + track->sampleWidthSet = AF_TRUE; +} + +void afInitByteOrder (AFfilesetup setup, int trackid, int byteorder) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (byteorder != AF_BYTEORDER_BIGENDIAN && + byteorder != AF_BYTEORDER_LITTLEENDIAN) + { + _af_error(AF_BAD_BYTEORDER, "invalid byte order %d", byteorder); + return; + } + + track->f.byteOrder = byteorder; + track->byteOrderSet = AF_TRUE; +} + +void afInitRate (AFfilesetup setup, int trackid, double rate) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (rate <= 0.0) + { + _af_error(AF_BAD_RATE, "invalid sample rate %.30g", rate); + return; + } + + track->f.sampleRate = rate; + track->rateSet = AF_TRUE; +} + +/* + track data: data offset within the file (initialized for raw reading only) +*/ +void afInitDataOffset (AFfilesetup setup, int trackid, AFfileoffset offset) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (offset < 0) + { + _af_error(AF_BAD_DATAOFFSET, "invalid data offset %d", offset); + return; + } + + track->dataOffset = offset; + track->dataOffsetSet = AF_TRUE; +} + +/* + track data: data offset within the file (initialized for raw reading only) +*/ +void afInitFrameCount (AFfilesetup setup, int trackid, AFfileoffset count) +{ + _TrackSetup *track; + + if (!_af_filesetup_ok(setup)) + return; + + if ((track = _af_filesetup_get_tracksetup(setup, trackid)) == NULL) + return; + + if (count < 0) + { + _af_error(AF_BAD_FRAMECNT, "invalid frame count %d", count); + return; + } + + track->frameCount = count; + track->frameCountSet = AF_TRUE; +} + +#define alloccopy(type, n, var, copyfrom) \ +{ \ + if (n == 0) \ + var = NULL; \ + else \ + { \ + if ((var = _af_calloc(n, sizeof (type))) == NULL) \ + goto fail; \ + memcpy((var), (copyfrom), (n) * sizeof (type)); \ + } \ +} + +AFfilesetup _af_filesetup_copy (AFfilesetup setup, AFfilesetup defaultSetup, + bool copyMarks) +{ + AFfilesetup newsetup; + int i; + int instrumentCount, miscellaneousCount, trackCount; + + newsetup = _af_malloc(sizeof (_AFfilesetup)); + if (newsetup == AF_NULL_FILESETUP) + return AF_NULL_FILESETUP; + +#ifdef DEBUG + printf("default: trackset=%d instset=%d miscset=%d\n", + defaultSetup->trackSet, defaultSetup->instrumentSet, + defaultSetup->miscellaneousSet); + printf("setup: trackset=%d instset=%d miscset=%d\n", + setup->trackSet, setup->instrumentSet, setup->miscellaneousSet); +#endif + + *newsetup = *defaultSetup; + + newsetup->tracks = NULL; + newsetup->instruments = NULL; + newsetup->miscellaneous = NULL; + + /* Copy tracks. */ + trackCount = setup->trackSet ? setup->trackCount : + newsetup->trackSet ? newsetup->trackCount : 0; + alloccopy(_TrackSetup, trackCount, newsetup->tracks, setup->tracks); + newsetup->trackCount = trackCount; + + /* Copy instruments. */ + instrumentCount = setup->instrumentSet ? setup->instrumentCount : + newsetup->instrumentSet ? newsetup->instrumentCount : 0; + alloccopy(_InstrumentSetup, instrumentCount, newsetup->instruments, setup->instruments); + newsetup->instrumentCount = instrumentCount; + + /* Copy miscellaneous information. */ + miscellaneousCount = setup->miscellaneousSet ? setup->miscellaneousCount : + newsetup->miscellaneousSet ? newsetup->miscellaneousCount : 0; + alloccopy(_MiscellaneousSetup, miscellaneousCount, newsetup->miscellaneous, setup->miscellaneous); + newsetup->miscellaneousCount = miscellaneousCount; + + for (i=0; i<setup->trackCount; i++) + { + int j; + _TrackSetup *track = &newsetup->tracks[i]; + + /* XXXmpruett set compression information */ + + if (setup->tracks[i].markersSet == AF_FALSE && + copyMarks == AF_FALSE) + { + track->markers = NULL; + track->markerCount = 0; + continue; + } + + alloccopy(_MarkerSetup, setup->tracks[i].markerCount, + track->markers, setup->tracks[i].markers); + track->markerCount = setup->tracks[i].markerCount; + + for (j=0; j<setup->tracks[i].markerCount; j++) + { + track->markers[j].name = + _af_strdup(setup->tracks[i].markers[j].name); + if (track->markers[j].name == NULL) + goto fail; + + track->markers[j].comment = + _af_strdup(setup->tracks[i].markers[j].comment); + if (track->markers[j].comment == NULL) + goto fail; + } + } + + for (i=0; i<newsetup->instrumentCount; i++) + { + _InstrumentSetup *instrument = &newsetup->instruments[i]; + alloccopy(_LoopSetup, setup->instruments[i].loopCount, + instrument->loops, setup->instruments[i].loops); + } + + return newsetup; + + fail: + if (newsetup->miscellaneous) + free(newsetup->miscellaneous); + if (newsetup->instruments) + free(newsetup->instruments); + if (newsetup->tracks) + free(newsetup->tracks); + if (newsetup) + free(newsetup); + + return AF_NULL_FILESETUP; +} + +/* + Do all the non-file-format dependent things necessary to "convert" + a filesetup into a filehandle. + + This function assumes that the track count, instrument count, + etc. of given filesetup is okay for the file format. + + Called from write.init and raw read.init unit functions. + + This function does NOT SET ALL THE FIELDS of the filesetup. + You must be careful when writing a unit to set the fields + you are supposed to (described below). + + These fields are not set here, so are somebody else's problem: + - handle: valid, fd, access, filename, fileFormat, seekok (set in afOpenFile) + - handle: formatSpecific (UNIT MUST SET! (set to NULL if no data)) + + - track: virtual format v, modulesdirty, nmodules, module, chunk, + (buffers), totalvframes, nextvframe, channelmatrix, frames2ignore + (these are handled by _AFinitmodules and _AFsetupmodules) + + - track: totalfframes, nextfframe, fpos_first_frame, + fpos_next_frame, data_size (UNIT MUST SET!) + + - mark: fpos_position (UNIT MUST SET!) +*/ + +status _af_filesetup_make_handle (AFfilesetup setup, AFfilehandle handle) +{ + int i; + + handle->valid = _AF_VALID_FILEHANDLE; + + if ((handle->trackCount = setup->trackCount) == 0) + handle->tracks = NULL; + else + { + handle->tracks = _af_calloc(handle->trackCount, sizeof (_Track)); + if (handle->tracks == NULL) + return AF_FAIL; + + for (i=0; i<handle->trackCount; i++) + { + _Track *track = &handle->tracks[i]; + _TrackSetup *tracksetup = &setup->tracks[i]; + + track->id = tracksetup->id; + + track->f = tracksetup->f; + track->channelMatrix = NULL; + + /* XXXmpruett copy compression stuff too */ + + if ((track->markerCount = tracksetup->markerCount) == 0) + track->markers = NULL; + else + { + int j; + + track->markers = _af_marker_new(track->markerCount); + if (track->markers == NULL) + return AF_FAIL; + for (j=0; j<track->markerCount; j++) + { + track->markers[j].id = tracksetup->markers[j].id; + track->markers[j].name = + _af_strdup(tracksetup->markers[j].name); + if (track->markers[j].name == NULL) + return AF_FAIL; + + track->markers[j].comment = + _af_strdup(tracksetup->markers[j].comment); + if (track->markers[j].comment == NULL) + return AF_FAIL; + track->markers[j].position = 0; + } + } + + track->hasAESData = tracksetup->aesDataSet; + + track->ms.modulesdirty = AF_TRUE; + track->ms.nmodules = 0; + track->ms.chunk = NULL; + track->ms.module = NULL; + track->ms.buffer = NULL; + + track->ms.filemodinst.valid = AF_FALSE; + track->ms.filemod_rebufferinst.valid = AF_FALSE; + track->ms.rateconvertinst.valid = AF_FALSE; + track->ms.rateconvert_rebufferinst.valid = AF_FALSE; + } + } + + /* Copy instrument data. */ + if ((handle->instrumentCount = setup->instrumentCount) == 0) + handle->instruments = NULL; + else + { + handle->instruments = _af_calloc(handle->instrumentCount, + sizeof (_Instrument)); + if (handle->instruments == NULL) + return AF_FAIL; + + for (i=0; i<handle->instrumentCount; i++) + { + int instParamCount; + + handle->instruments[i].id = setup->instruments[i].id; + + /* Copy loops. */ + if ((handle->instruments[i].loopCount = + setup->instruments[i].loopCount) == 0) + handle->instruments[i].loops = NULL; + else + { + int j; + + handle->instruments[i].loops = _af_calloc(handle->instruments[i].loopCount, sizeof (_Loop)); + if (handle->instruments[i].loops == NULL) + return AF_FAIL; + for (j=0; j<handle->instruments[i].loopCount; j++) + { + _Loop *loop; + loop = &handle->instruments[i].loops[j]; + loop->id = setup->instruments[i].loops[j].id; + loop->mode = AF_LOOP_MODE_NOLOOP; + loop->count = 0; + loop->trackid = AF_DEFAULT_TRACK; + loop->beginMarker = 1 + (2*j); + loop->endMarker = 2 + (2*j); + } + } + + /* Copy instrument parameters. */ + if ((instParamCount = _af_units[setup->fileFormat].instrumentParameterCount) == 0) + handle->instruments[i].values = NULL; + else + { + int j; + handle->instruments[i].values = _af_calloc(instParamCount, sizeof (AFPVu)); + if (handle->instruments[i].values == NULL) + return AF_FAIL; + for (j=0; j<instParamCount; j++) + { + handle->instruments[i].values[j] = + _af_units[setup->fileFormat].instrumentParameters[j].defaultValue; + } + } + } + } + + /* Copy miscellaneous information. */ + + if ((handle->miscellaneousCount = setup->miscellaneousCount) == 0) + handle->miscellaneous = NULL; + else + { + handle->miscellaneous = _af_calloc(handle->miscellaneousCount, + sizeof (_Miscellaneous)); + if (handle->miscellaneous == NULL) + return AF_FAIL; + for (i=0; i<handle->miscellaneousCount; i++) + { + handle->miscellaneous[i].id = setup->miscellaneous[i].id; + handle->miscellaneous[i].type = setup->miscellaneous[i].type; + handle->miscellaneous[i].size = setup->miscellaneous[i].size; + handle->miscellaneous[i].position = 0; + handle->miscellaneous[i].buffer = NULL; + } + } + + return AF_SUCCEED; +} diff --git a/libaudiofile/setup.h b/libaudiofile/setup.h new file mode 100644 index 0000000..aed9edc --- /dev/null +++ b/libaudiofile/setup.h @@ -0,0 +1,37 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +#ifndef SETUP_H +#define SETUP_H + +AFfilesetup _af_filesetup_copy (AFfilesetup setup, AFfilesetup defaultSetup, + bool copyMarks); + +void _af_setup_free_markers (AFfilesetup setup, int trackno); +void _af_setup_free_tracks (AFfilesetup setup); +void _af_setup_free_loops (AFfilesetup setup, int instno); +void _af_setup_free_instruments (AFfilesetup setup); +AFfilesetup _af_filesetup_copy (AFfilesetup setup, AFfilesetup defaultSetup, + bool copyMarks); +status _af_filesetup_make_handle (AFfilesetup setup, AFfilehandle handle); + +_InstrumentSetup *_af_instsetup_new (int count); + +#endif /* SETUP_H */ diff --git a/libaudiofile/track.c b/libaudiofile/track.c new file mode 100644 index 0000000..53d5900 --- /dev/null +++ b/libaudiofile/track.c @@ -0,0 +1,97 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + track.c + + This file contains functions for dealing with tracks within an + audio file. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stddef.h> +#include <string.h> +#include <assert.h> + +#include "audiofile.h" +#include "afinternal.h" +#include "util.h" + +void afInitTrackIDs (AFfilesetup file, int *trackids, int trackCount) +{ + assert(file); + assert(trackids); + assert(trackCount == 1); + assert(trackids[0] == AF_DEFAULT_TRACK); +} + +int afGetTrackIDs (AFfilehandle file, int *trackids) +{ + assert(file); + + if (trackids != NULL) + trackids[0] = AF_DEFAULT_TRACK; + + return 1; +} + +_Track *_af_track_new (void) +{ + _Track *t = _af_malloc(sizeof (_Track)); + + t->id = AF_DEFAULT_TRACK; + + t->f.compressionParams = NULL; + t->v.compressionParams = NULL; + + t->channelMatrix = NULL; + + t->markerCount = 0; + t->markers = NULL; + + t->hasAESData = AF_FALSE; + memset(t->aesData, 0, 24); + + t->totalfframes = 0; + t->nextfframe = 0; + t->frames2ignore = 0; + t->fpos_first_frame = 0; + t->fpos_next_frame = 0; + t->fpos_after_data = 0; + t->totalvframes = 0; + t->nextvframe = 0; + t->data_size = 0; + + t->ms.modulesdirty = AF_TRUE; + t->ms.nmodules = 0; + t->ms.chunk = NULL; + t->ms.module = NULL; + t->ms.buffer = NULL; + + t->ms.filemodinst.valid = AF_FALSE; + t->ms.filemod_rebufferinst.valid = AF_FALSE; + t->ms.rateconvertinst.valid = AF_FALSE; + t->ms.rateconvert_rebufferinst.valid = AF_FALSE; + + return t; +} diff --git a/libaudiofile/track.h b/libaudiofile/track.h new file mode 100644 index 0000000..d92d73c --- /dev/null +++ b/libaudiofile/track.h @@ -0,0 +1,30 @@ +/* + Audio File Library + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + track.h +*/ + +#ifndef TRACK_H +#define TRACK_H + +_Track *_af_track_new (void); + +#endif /* TRACK_H */ diff --git a/libaudiofile/units.c b/libaudiofile/units.c new file mode 100644 index 0000000..8f8741c --- /dev/null +++ b/libaudiofile/units.c @@ -0,0 +1,291 @@ +/* + Audio File Library + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + units.c + + This file contains the file format units. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "units.h" + +#include "raw.h" +#include "aiff.h" +#include "next.h" +#include "wave.h" +#include "ircam.h" +#include "avr.h" +#include "iff.h" +#include "nist.h" + +#include "compression.h" + +#include "modules/pcm.h" +#include "modules/g711.h" +#include "modules/ima.h" +#include "modules/msadpcm.h" + +extern _InstParamInfo _af_aiff_inst_params[]; +extern _InstParamInfo _af_wave_inst_params[]; + +extern int _af_raw_compression_types[]; +extern int _af_aiffc_compression_types[]; +extern int _af_next_compression_types[]; +extern int _af_wave_compression_types[]; + +_Unit _af_units[_AF_NUM_UNITS] = +{ + { + AF_FILE_RAWDATA, + "Raw Data", "Raw Sound Data", "raw", + AF_TRUE, NULL, _af_raw_complete_setup, + {_af_raw_recognize, _af_raw_read_init}, + {_af_raw_write_init, NULL, NULL}, + AF_SAMPFMT_TWOSCOMP, 16, + _AF_RAW_NUM_COMPTYPES, + _af_raw_compression_types, + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maxium number of loops per instrument */ + 0, NULL, + }, + { + AF_FILE_AIFFC, + "AIFF-C", "AIFF-C File Format", "aifc", + AF_TRUE, _af_aifc_get_version, _af_aiff_complete_setup, + {_af_aifc_recognize, _af_aiff_read_init}, + {_af_aiff_write_init, _af_aiff_instparam_valid, _af_aiff_update}, + AF_SAMPFMT_TWOSCOMP, 16, + _AF_AIFFC_NUM_COMPTYPES, + _af_aiffc_compression_types, + 65535, /* maximum marker count */ + 1, /* maximum instrument count */ + 2, /* maximum number of loops per instrument */ + _AF_AIFF_NUM_INSTPARAMS, + _af_aiff_inst_params + }, + { + AF_FILE_AIFF, + "AIFF", "Audio Interchange File Format", "aiff", + AF_TRUE, NULL, _af_aiff_complete_setup, + {_af_aiff_recognize, _af_aiff_read_init}, + {_af_aiff_write_init, _af_aiff_instparam_valid, _af_aiff_update}, + AF_SAMPFMT_TWOSCOMP, 16, + 0, /* supported compression types */ + NULL, + 65535, /* maximum marker count */ + 1, /* maximum instrument count */ + 2, /* maximum number of loops per instrument */ + _AF_AIFF_NUM_INSTPARAMS, + _af_aiff_inst_params + }, + { + AF_FILE_NEXTSND, + "NeXT .snd/Sun .au", "NeXT .snd/Sun .au Format", "next", + AF_TRUE, NULL, _af_next_complete_setup, + {_af_next_recognize, _af_next_read_init}, + {_af_next_write_init, NULL, _af_next_update}, + AF_SAMPFMT_TWOSCOMP, 16, + _AF_NEXT_NUM_COMPTYPES, + _af_next_compression_types, + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maximum number of loops per instrument */ + 0, NULL + }, + { + AF_FILE_WAVE, + "MS RIFF WAVE", "Microsoft RIFF WAVE Format", "wave", + AF_TRUE, NULL, _af_wave_complete_setup, + {_af_wave_recognize, _af_wave_read_init}, + {_af_wave_write_init, _af_wave_instparam_valid, _af_wave_update}, + AF_SAMPFMT_TWOSCOMP, 16, + _AF_WAVE_NUM_COMPTYPES, + _af_wave_compression_types, + AF_NUM_UNLIMITED, /* maximum marker count */ + 1, /* maximum instrument count */ + AF_NUM_UNLIMITED, /* maximum number of loops per instrument */ + _AF_WAVE_NUM_INSTPARAMS, + _af_wave_inst_params + }, + { + AF_FILE_IRCAM, + "BICSF", "Berkeley/IRCAM/CARL Sound Format", "bicsf", + AF_TRUE, NULL, _af_ircam_complete_setup, + {_af_ircam_recognize, _af_ircam_read_init}, + {_af_ircam_write_init, NULL, _af_ircam_update}, + AF_SAMPFMT_TWOSCOMP, 16, + 0, /* number of compression types */ + NULL, /* compression types */ + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maximum number of loops per instrument */ + 0, /* number of instrument parameters */ + NULL /* instrument parameters */ + }, + { + AF_FILE_MPEG1BITSTREAM, + "MPEG", "MPEG Audio Bitstream", "mpeg", + AF_FALSE + }, + { + AF_FILE_SOUNDDESIGNER1, + "Sound Designer 1", "Sound Designer 1 File Format", "sd1", + AF_FALSE + }, + { + AF_FILE_SOUNDDESIGNER2, + "Sound Designer 2", "Sound Designer 2 File Format", "sd2", + AF_FALSE + }, + { + AF_FILE_AVR, + "AVR", "Audio Visual Research File Format", "avr", + AF_TRUE, NULL, _af_avr_complete_setup, + {_af_avr_recognize, _af_avr_read_init}, + {_af_avr_write_init, NULL, _af_avr_update}, + AF_SAMPFMT_TWOSCOMP, 16, + 0, /* number of compression types */ + NULL, /* compression types */ + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maximum number of loops per instrument */ + 0, /* number of instrument parameters */ + }, + { + AF_FILE_IFF_8SVX, + "IFF/8SVX", "Amiga IFF/8SVX Sound File Format", "iff", + AF_TRUE, NULL, _af_iff_complete_setup, + {_af_iff_recognize, _af_iff_read_init}, + {_af_iff_write_init, NULL, _af_iff_update}, + AF_SAMPFMT_TWOSCOMP, 8, + 0, /* number of compression types */ + NULL, /* compression types */ + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maximum number of loops per instrument */ + 0, /* number of instrument parameters */ + }, + { + AF_FILE_SAMPLEVISION, + "Sample Vision", "Sample Vision File Format", "smp", + AF_FALSE + }, + { + AF_FILE_VOC, + "VOC", "Creative Voice File Format", "voc", + AF_FALSE + }, + { + AF_FILE_NIST_SPHERE, + "NIST SPHERE", "NIST SPHERE File Format", "nist", + AF_TRUE, NULL, _af_nist_complete_setup, + {_af_nist_recognize, _af_nist_read_init}, + {_af_nist_write_init, NULL, _af_nist_update}, + AF_SAMPFMT_TWOSCOMP, 16, + 0, /* number of compression types */ + NULL, /* compression types */ + 0, /* maximum marker count */ + 0, /* maximum instrument count */ + 0, /* maximum number of loops per instrument */ + 0, /* number of instrument parameters */ + NULL /* instrument parameters */ + }, + { + AF_FILE_SOUNDFONT2, + "SoundFont 2", "SoundFont 2 File Format", "sf2", + AF_FALSE + } +}; + +_CompressionUnit _af_compression[_AF_NUM_COMPRESSION] = +{ + { + AF_COMPRESSION_NONE, + AF_TRUE, + "none", /* label */ + "none", /* short name */ + "not compressed", + 1.0, + AF_SAMPFMT_TWOSCOMP, 16, + AF_FALSE, /* needsRebuffer */ + AF_FALSE, /* multiple_of */ + _af_pcm_format_ok, + _AFpcminitcompress, _AFpcminitdecompress + }, + { + AF_COMPRESSION_G711_ULAW, + AF_TRUE, + "ulaw", /* label */ + "CCITT G.711 u-law", /* shortname */ + "CCITT G.711 u-law", + 2.0, + AF_SAMPFMT_TWOSCOMP, 16, + AF_FALSE, /* needsRebuffer */ + AF_FALSE, /* multiple_of */ + _af_g711_format_ok, + _AFg711initcompress, _AFg711initdecompress + }, + { + AF_COMPRESSION_G711_ALAW, + AF_TRUE, + "alaw", /* label */ + "CCITT G.711 A-law", /* short name */ + "CCITT G.711 A-law", + 2.0, + AF_SAMPFMT_TWOSCOMP, 16, + AF_FALSE, /* needsRebuffer */ + AF_FALSE, /* multiple_of */ + _af_g711_format_ok, + _AFg711initcompress, _AFg711initdecompress + }, + { + AF_COMPRESSION_IMA, + AF_TRUE, + "ima4", /* label */ + "IMA ADPCM", /* short name */ + "IMA DVI ADPCM", + 4.0, + AF_SAMPFMT_TWOSCOMP, 16, + AF_TRUE, /* needsRebuffer */ + AF_FALSE, /* multiple_of */ + _af_ima_adpcm_format_ok, + NULL, _af_ima_adpcm_init_decompress + }, + { + AF_COMPRESSION_MS_ADPCM, + AF_TRUE, + "msadpcm", /* label */ + "MS ADPCM", /* short name */ + "Microsoft ADPCM", + 4.0, + AF_SAMPFMT_TWOSCOMP, 16, + AF_TRUE, /* needsRebuffer */ + AF_FALSE, /* multiple_of */ + _af_ms_adpcm_format_ok, + NULL, _af_ms_adpcm_init_decompress + } +}; diff --git a/libaudiofile/units.h b/libaudiofile/units.h new file mode 100644 index 0000000..389afb5 --- /dev/null +++ b/libaudiofile/units.h @@ -0,0 +1,100 @@ +/* + Audio File Library + Copyright (C) 2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + units.h + + This file defines the internal _Unit and _CompressionUnit + structures for the Audio File Library. +*/ + +#ifndef UNIT_H +#define UNIT_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" + +typedef struct _Unit +{ + int fileFormat; /* AF_FILEFMT_... */ + char *name; /* a 2-3 word name of the file format */ + char *description; /* a more descriptive name for the format */ + char *label; /* a 4-character label for the format */ + bool implemented; /* if implemented */ + + int (*getversion) (AFfilehandle handle); + AFfilesetup (*completesetup) (AFfilesetup setup); + + struct + { + bool (*recognize) (AFvirtualfile *fh); + status (*init) (AFfilesetup, AFfilehandle); + } read; + + struct + { + status (*init) (AFfilesetup, AFfilehandle); + bool (*instparamvalid) (AFfilehandle, AUpvlist, int); + status (*update) (AFfilehandle); + } write; + + int defaultSampleFormat; + int defaultSampleWidth; + + int compressionTypeCount; + int *compressionTypes; + + int markerCount; + + int instrumentCount; + int loopPerInstrumentCount; + + int instrumentParameterCount; + _InstParamInfo *instrumentParameters; +} _Unit; + +typedef struct _CompressionUnit +{ + int compressionID; /* AF_COMPRESSION_... */ + bool implemented; + char *label; /* 4-character (approximately) label */ + char *shortname; /* short name in English */ + char *name; /* long name in English */ + double squishFactor; /* compression ratio */ + int nativeSampleFormat; /* AF_SAMPFMT_... */ + int nativeSampleWidth; /* sample width in bits */ + bool needsRebuffer; /* if there are chunk boundary requirements */ + bool multiple_of; /* can accept any multiple of chunksize */ + bool (*fmtok) (_AudioFormat *format); + + _AFmoduleinst (*initcompress) (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes); + _AFmoduleinst (*initdecompress) (_Track *track, AFvirtualfile *fh, + bool seekok, bool headerless, AFframecount *chunkframes); +} _CompressionUnit; + +#define _AF_NUM_UNITS 15 +#define _AF_NUM_COMPRESSION 5 + +#endif /* UNIT_H */ diff --git a/libaudiofile/util.c b/libaudiofile/util.c new file mode 100644 index 0000000..f18b3e4 --- /dev/null +++ b/libaudiofile/util.c @@ -0,0 +1,528 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + util.c + + This file contains general utility routines for the Audio File + Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "audiofile.h" +#include "aupvlist.h" + +#include "afinternal.h" +#include "util.h" +#include "units.h" +#include "compression.h" +#include "modules.h" +#include "byteorder.h" +#include "aupvinternal.h" + +extern _PCMInfo _af_default_signed_integer_pcm_mappings[]; +extern _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; +extern _PCMInfo _af_default_float_pcm_mapping; +extern _PCMInfo _af_default_double_pcm_mapping; + +extern _CompressionUnit _af_compression[]; + +/* + _af_filesetup_ok and _af_filehandle_ok are sanity check routines + which are called at the beginning of every external subroutine. +*/ +bool _af_filesetup_ok (AFfilesetup setup) +{ + if (setup == AF_NULL_FILESETUP) + { + _af_error(AF_BAD_FILESETUP, "null file setup"); + return AF_FALSE; + } + if (setup->valid != _AF_VALID_FILESETUP) + { + _af_error(AF_BAD_FILESETUP, "invalid file setup"); + return AF_FALSE; + } + return AF_TRUE; +} + +bool _af_filehandle_can_read (AFfilehandle file) +{ + if (file->access != _AF_READ_ACCESS) + { + _af_error(AF_BAD_NOREADACC, "file not opened for read access"); + return AF_FALSE; + } + + return AF_TRUE; +} + +bool _af_filehandle_can_write (AFfilehandle file) +{ + if (file->access != _AF_WRITE_ACCESS) + { + _af_error(AF_BAD_NOWRITEACC, "file not opened for write access"); + return AF_FALSE; + } + + return AF_TRUE; +} + +bool _af_filehandle_ok (AFfilehandle file) +{ + if (file == AF_NULL_FILEHANDLE) + { + _af_error(AF_BAD_FILEHANDLE, "null file handle"); + return AF_FALSE; + } + if (file->valid != _AF_VALID_FILEHANDLE) + { + _af_error(AF_BAD_FILEHANDLE, "invalid file handle"); + return AF_FALSE; + } + return AF_TRUE; +} + +void *_af_malloc (size_t size) +{ + void *p; + + if (size <= 0) + { + _af_error(AF_BAD_MALLOC, "bad memory allocation size request %d", size); + return NULL; + } + + p = malloc(size); + +#ifdef AF_DEBUG + if (p) + memset(p, 0xff, size); +#endif + + if (p == NULL) + { + _af_error(AF_BAD_MALLOC, "allocation of %d bytes failed", size); + return NULL; + } + + return p; +} + +char *_af_strdup (char *s) +{ + char *p = malloc(strlen(s) + 1); + + if (p) + strcpy(p, s); + + return p; +} + +void *_af_realloc (void *p, size_t size) +{ + if (size <= 0) + { + _af_error(AF_BAD_MALLOC, "bad memory allocation size request %d", size); + return NULL; + } + + p = realloc(p, size); + + if (p == NULL) + { + _af_error(AF_BAD_MALLOC, "allocation of %d bytes failed", size); + return NULL; + } + + return p; +} + +void *_af_calloc (size_t nmemb, size_t size) +{ + void *p; + + if (nmemb <= 0 || size <= 0) + { + _af_error(AF_BAD_MALLOC, "bad memory allocation size request " + "%d elements of %d bytes each", nmemb, size); + return NULL; + } + + p = calloc(nmemb, size); + + if (p == NULL) + { + _af_error(AF_BAD_MALLOC, "allocation of %d bytes failed", + nmemb*size); + return NULL; + } + + return p; +} + +AUpvlist _af_pv_long (long val) +{ + AUpvlist ret = AUpvnew(1); + AUpvsetparam(ret, 0, 0); + AUpvsetvaltype(ret, 0, AU_PVTYPE_LONG); + AUpvsetval(ret, 0, &val); + return ret; +} + +AUpvlist _af_pv_double (double val) +{ + AUpvlist ret = AUpvnew(1); + AUpvsetparam(ret, 0, 0); + AUpvsetvaltype(ret, 0, AU_PVTYPE_DOUBLE); + AUpvsetval(ret, 0, &val); + return ret; +} + +AUpvlist _af_pv_pointer (void *val) +{ + AUpvlist ret = AUpvnew(1); + AUpvsetparam(ret, 0, 0); + AUpvsetvaltype(ret, 0, AU_PVTYPE_PTR); + AUpvsetval(ret, 0, &val); + return ret; +} + +bool _af_pv_getlong (AUpvlist pvlist, int param, long *l) +{ + int i; + + for (i=0; i<AUpvgetmaxitems(pvlist); i++) + { + int p, t; + + AUpvgetparam(pvlist, i, &p); + + if (p != param) + continue; + + AUpvgetvaltype(pvlist, i, &t); + + /* Ensure that this parameter is of type AU_PVTYPE_LONG. */ + if (t != AU_PVTYPE_LONG) + return AF_FALSE; + + AUpvgetval(pvlist, i, l); + return AF_TRUE; + } + + return AF_FALSE; +} + +bool _af_pv_getdouble (AUpvlist pvlist, int param, double *d) +{ + int i; + + for (i=0; i<AUpvgetmaxitems(pvlist); i++) + { + int p, t; + + AUpvgetparam(pvlist, i, &p); + + if (p != param) + continue; + + AUpvgetvaltype(pvlist, i, &t); + + /* Ensure that this parameter is of type AU_PVTYPE_DOUBLE. */ + if (t != AU_PVTYPE_DOUBLE) + return AF_FALSE; + + AUpvgetval(pvlist, i, d); + return AF_TRUE; + } + + return AF_FALSE; +} + +bool _af_pv_getptr (AUpvlist pvlist, int param, void **v) +{ + int i; + + for (i=0; i<AUpvgetmaxitems(pvlist); i++) + { + int p, t; + + AUpvgetparam(pvlist, i, &p); + + if (p != param) + continue; + + AUpvgetvaltype(pvlist, i, &t); + + /* Ensure that this parameter is of type AU_PVTYPE_PTR. */ + if (t != AU_PVTYPE_PTR) + return AF_FALSE; + + AUpvgetval(pvlist, i, v); + return AF_TRUE; + } + + return AF_FALSE; +} + +_TrackSetup *_af_filesetup_get_tracksetup (AFfilesetup setup, int trackid) +{ + int i; + for (i=0; i<setup->trackCount; i++) + { + if (setup->tracks[i].id == trackid) + return &setup->tracks[i]; + } + + _af_error(AF_BAD_TRACKID, "bad track id %d", trackid); + + return NULL; +} + +_Track *_af_filehandle_get_track (AFfilehandle file, int trackid) +{ + int i; + for (i=0; i<file->trackCount; i++) + { + if (file->tracks[i].id == trackid) + return &file->tracks[i]; + } + + _af_error(AF_BAD_TRACKID, "bad track id %d", trackid); + + return NULL; +} + +int _af_format_sample_size_uncompressed (_AudioFormat *format, bool stretch3to4) +{ + int size = 0; + + switch (format->sampleFormat) + { + case AF_SAMPFMT_FLOAT: + size = sizeof (float); + break; + case AF_SAMPFMT_DOUBLE: + size = sizeof (double); + break; + default: + size = (int) (format->sampleWidth + 7) / 8; + if (format->compressionType == AF_COMPRESSION_NONE && + size == 3 && stretch3to4) + size = 4; + break; + } + + return size; +} + +float _af_format_sample_size (_AudioFormat *fmt, bool stretch3to4) +{ + int compressionIndex; + float squishFactor; + + compressionIndex = _af_compression_index_from_id(fmt->compressionType); + squishFactor = _af_compression[compressionIndex].squishFactor; + + return _af_format_sample_size_uncompressed(fmt, stretch3to4) / + squishFactor; +} + +int _af_format_frame_size_uncompressed (_AudioFormat *fmt, bool stretch3to4) +{ + return _af_format_sample_size_uncompressed(fmt, stretch3to4) * + fmt->channelCount; +} + +float _af_format_frame_size (_AudioFormat *fmt, bool stretch3to4) +{ + int compressionIndex; + float squishFactor; + + compressionIndex = _af_compression_index_from_id(fmt->compressionType); + squishFactor = _af_compression[compressionIndex].squishFactor; + + return _af_format_frame_size_uncompressed(fmt, stretch3to4) / + squishFactor; +} + +/* + Set the sampleFormat and sampleWidth fields in f, and set the + PCM info to the appropriate default values for the given sample + format and sample width. +*/ +status _af_set_sample_format (_AudioFormat *f, int sampleFormat, int sampleWidth) +{ + switch (sampleFormat) + { + case AF_SAMPFMT_UNSIGNED: + case AF_SAMPFMT_TWOSCOMP: + if (sampleWidth < 1 || sampleWidth > 32) + { + _af_error(AF_BAD_SAMPFMT, + "illegal sample width %d for integer data", + sampleWidth); + return AF_FAIL; + } + else + { + int bytes; + + f->sampleFormat = sampleFormat; + f->sampleWidth = sampleWidth; + + bytes = _af_format_sample_size_uncompressed(f, AF_FALSE); + + if (sampleFormat == AF_SAMPFMT_TWOSCOMP) + f->pcm = _af_default_signed_integer_pcm_mappings[bytes]; + else + f->pcm = _af_default_unsigned_integer_pcm_mappings[bytes]; + } + break; + + case AF_SAMPFMT_FLOAT: + f->sampleFormat = sampleFormat; + f->sampleWidth = 32; + f->pcm = _af_default_float_pcm_mapping; + break; + case AF_SAMPFMT_DOUBLE: + f->sampleFormat = sampleFormat; + f->sampleWidth = 64; /*for convenience */ + f->pcm = _af_default_double_pcm_mapping; + break; + default: + _af_error(AF_BAD_SAMPFMT, "unknown sample format %d", + sampleFormat); + return AF_FAIL; + } + + return AF_SUCCEED; +} + +/* + Verify the uniqueness of the nids ids given. + + idname is the name of what the ids identify, as in "loop" + iderr is an error as in AF_BAD_LOOPID +*/ +bool _af_unique_ids (int *ids, int nids, char *idname, int iderr) +{ + int i; + + for (i = 0; i < nids; i++) + { + int j; + for (j = 0; j < i; j++) + if (ids[i] == ids[j]) + { + _af_error(iderr, "nonunique %s id %d", + idname, ids[i]); + return AF_FALSE; + } + } + + return AF_TRUE; +} + +status af_read_uint32_be (u_int32_t *value, AFvirtualfile *vf) +{ + u_int32_t v; + + if (af_fread(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + *value = BENDIAN_TO_HOST_INT32(v); + return AF_SUCCEED; +} + +status af_read_uint32_le (u_int32_t *value, AFvirtualfile *vf) +{ + u_int32_t v; + + if (af_fread(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + *value = LENDIAN_TO_HOST_INT32(v); + return AF_SUCCEED; +} + +status af_read_uint16_be (u_int16_t *value, AFvirtualfile *vf) +{ + u_int16_t v; + + if (af_fread(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + *value = BENDIAN_TO_HOST_INT16(v); + return AF_SUCCEED; +} + +status af_read_uint16_le (u_int16_t *value, AFvirtualfile *vf) +{ + u_int16_t v; + + if (af_fread(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + *value = LENDIAN_TO_HOST_INT16(v); + return AF_SUCCEED; +} + +status af_write_uint32_be (const u_int32_t *value, AFvirtualfile *vf) +{ + u_int32_t v; + v = HOST_TO_BENDIAN_INT32(*value); + if (af_fwrite(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + return AF_SUCCEED; +} + +status af_write_uint32_le (const u_int32_t *value, AFvirtualfile *vf) +{ + u_int32_t v; + v = HOST_TO_LENDIAN_INT32(*value); + if (af_fwrite(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + return AF_SUCCEED; +} + +status af_write_uint16_be (const u_int16_t *value, AFvirtualfile *vf) +{ + u_int16_t v; + v = HOST_TO_BENDIAN_INT16(*value); + if (af_fwrite(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + return AF_SUCCEED; +} + +status af_write_uint16_le (const u_int16_t *value, AFvirtualfile *vf) +{ + u_int16_t v; + v = HOST_TO_LENDIAN_INT16(*value); + if (af_fwrite(&v, sizeof (v), 1, vf) != 1) + return AF_FAIL; + return AF_SUCCEED; +} diff --git a/libaudiofile/util.h b/libaudiofile/util.h new file mode 100644 index 0000000..4018427 --- /dev/null +++ b/libaudiofile/util.h @@ -0,0 +1,78 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + util.h + + This file contains some general utility functions for the Audio + File Library. +*/ + +#ifndef UTIL_H +#define UTIL_H + +#include <sys/types.h> +#include "audiofile.h" +#include "afinternal.h" + +bool _af_filesetup_ok (AFfilesetup setup); +bool _af_filehandle_ok (AFfilehandle file); + +bool _af_filehandle_can_read (AFfilehandle file); + +void *_af_malloc (size_t size); +void *_af_realloc (void *ptr, size_t size); +void *_af_calloc (size_t nmemb, size_t size); +char *_af_strdup (char *s); + +AUpvlist _af_pv_long (long val); +AUpvlist _af_pv_double (double val); +AUpvlist _af_pv_pointer (void *val); + +bool _af_pv_getlong (AUpvlist pvlist, int param, long *l); +bool _af_pv_getdouble (AUpvlist pvlist, int param, double *d); +bool _af_pv_getptr (AUpvlist pvlist, int param, void **v); + +_TrackSetup *_af_filesetup_get_tracksetup (AFfilesetup setup, int trackid); +_Track *_af_filehandle_get_track (AFfilehandle file, int trackid); + +bool _af_unique_ids (int *ids, int nids, char *idname, int iderr); + +float _af_format_frame_size (_AudioFormat *format, bool stretch3to4); +int _af_format_frame_size_uncompressed (_AudioFormat *format, bool stretch3to4); +float _af_format_sample_size (_AudioFormat *format, bool stretch3to4); +int _af_format_sample_size_uncompressed (_AudioFormat *format, bool stretch3to4); + +status _af_set_sample_format (_AudioFormat *f, int sampleFormat, int sampleWidth); + +bool _af_filehandle_can_read (AFfilehandle file); +bool _af_filehandle_can_write (AFfilehandle file); + +status af_read_uint32_be (u_int32_t *value, AFvirtualfile *vf); +status af_read_uint32_le (u_int32_t *value, AFvirtualfile *vf); +status af_read_uint16_be (u_int16_t *value, AFvirtualfile *vf); +status af_read_uint16_le (u_int16_t *value, AFvirtualfile *vf); + +status af_write_uint32_be (const u_int32_t *value, AFvirtualfile *vf); +status af_write_uint32_le (const u_int32_t *value, AFvirtualfile *vf); +status af_write_uint16_be (const u_int16_t *value, AFvirtualfile *vf); +status af_write_uint16_le (const u_int16_t *value, AFvirtualfile *vf); + +#endif diff --git a/libaudiofile/wave.c b/libaudiofile/wave.c new file mode 100644 index 0000000..229b2b7 --- /dev/null +++ b/libaudiofile/wave.c @@ -0,0 +1,1036 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + wave.c + + This file contains code for parsing RIFF WAVE format sound files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "util.h" +#include "afinternal.h" +#include "byteorder.h" +#include "wave.h" +#include "track.h" +#include "setup.h" +#include "marker.h" + +int _af_wave_compression_types[_AF_WAVE_NUM_COMPTYPES] = +{ + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +}; + +_InstParamInfo _af_wave_inst_params[_AF_WAVE_NUM_INSTPARAMS] = +{ + { AF_INST_MIDI_BASENOTE, AU_PVTYPE_LONG, "MIDI base note", {60} }, + { AF_INST_NUMCENTS_DETUNE, AU_PVTYPE_LONG, "Detune in cents", {0} }, + { AF_INST_MIDI_LOVELOCITY, AU_PVTYPE_LONG, "Low velocity", {1} }, + { AF_INST_MIDI_HIVELOCITY, AU_PVTYPE_LONG, "High velocity", {127} }, + { AF_INST_MIDI_LONOTE, AU_PVTYPE_LONG, "Low note", {0} }, + { AF_INST_MIDI_HINOTE, AU_PVTYPE_LONG, "High note", {127} }, + { AF_INST_NUMDBS_GAIN, AU_PVTYPE_LONG, "Gain in dB", {0} } +}; + +_AFfilesetup _af_wave_default_filesetup = +{ + _AF_VALID_FILESETUP, /* valid */ + AF_FILE_WAVE, /* fileFormat */ + AF_TRUE, /* trackSet */ + AF_TRUE, /* instrumentSet */ + AF_TRUE, /* miscellaneousSet */ + 1, /* trackCount */ + NULL, /* tracks */ + 0, /* instrumentCount */ + NULL, /* instruments */ + 0, /* miscellaneousCount */ + NULL /* miscellaneous */ +}; + +static status ParseFrameCount (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + u_int32_t totalFrames; + _Track *track; + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + af_fread(&totalFrames, 1, 4, fp); + + track->totalfframes = LENDIAN_TO_HOST_INT32(totalFrames); + + return AF_SUCCEED; +} + +static status ParseFormat (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + _Track *track; + u_int16_t formatTag, channelCount; + u_int32_t sampleRate, averageBytesPerSecond; + u_int16_t blockAlign; + _WAVEInfo *wave; + + assert(filehandle != NULL); + assert(fp != NULL); + assert(!memcmp(&id, "fmt ", 4)); + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + assert(filehandle->formatSpecific != NULL); + wave = (_WAVEInfo *) filehandle->formatSpecific; + + af_fread(&formatTag, 1, 2, fp); + formatTag = LENDIAN_TO_HOST_INT16(formatTag); + + af_fread(&channelCount, 1, 2, fp); + channelCount = LENDIAN_TO_HOST_INT16(channelCount); + track->f.channelCount = channelCount; + + af_fread(&sampleRate, 1, 4, fp); + sampleRate = LENDIAN_TO_HOST_INT32(sampleRate); + track->f.sampleRate = sampleRate; + + af_fread(&averageBytesPerSecond, 1, 4, fp); + averageBytesPerSecond = LENDIAN_TO_HOST_INT32(averageBytesPerSecond); + + af_fread(&blockAlign, 1, 2, fp); + blockAlign = LENDIAN_TO_HOST_INT16(blockAlign); + + track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; + + /* Default to uncompressed audio data. */ + track->f.compressionType = AF_COMPRESSION_NONE; + + switch (formatTag) + { + case WAVE_FORMAT_PCM: + { + u_int16_t bitsPerSample; + + af_fread(&bitsPerSample, 1, 2, fp); + bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample); + + track->f.sampleWidth = bitsPerSample; + + if (bitsPerSample == 0 || bitsPerSample > 32) + { + _af_error(AF_BAD_WIDTH, + "bad sample width of %d bits", + bitsPerSample); + return AF_FAIL; + } + + if (bitsPerSample <= 8) + track->f.sampleFormat = AF_SAMPFMT_UNSIGNED; + else + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + } + break; + + case WAVE_FORMAT_MULAW: + case IBM_FORMAT_MULAW: + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_G711_ULAW; + break; + + case WAVE_FORMAT_ALAW: + case IBM_FORMAT_ALAW: + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_G711_ALAW; + break; + + case WAVE_FORMAT_IEEE_FLOAT: + { + u_int16_t bitsPerSample; + + af_fread(&bitsPerSample, 1, 2, fp); + bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample); + + if (bitsPerSample == 64) + { + track->f.sampleWidth = 64; + track->f.sampleFormat = AF_SAMPFMT_DOUBLE; + } + else + { + track->f.sampleWidth = 32; + track->f.sampleFormat = AF_SAMPFMT_FLOAT; + } + } + break; + + case WAVE_FORMAT_ADPCM: + { + u_int16_t bitsPerSample, extraByteCount, + samplesPerBlock, numCoefficients; + int i; + AUpvlist pv; + long l; + void *v; + + if (track->f.channelCount != 1 && + track->f.channelCount != 2) + { + _af_error(AF_BAD_CHANNELS, + "WAVE file with MS ADPCM compression " + "must have 1 or 2 channels"); + } + + af_fread(&bitsPerSample, 1, 2, fp); + bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample); + + af_fread(&extraByteCount, 1, 2, fp); + extraByteCount = LENDIAN_TO_HOST_INT16(extraByteCount); + + af_fread(&samplesPerBlock, 1, 2, fp); + samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock); + + af_fread(&numCoefficients, 1, 2, fp); + numCoefficients = LENDIAN_TO_HOST_INT16(numCoefficients); + + /* numCoefficients should be at least 7. */ + assert(numCoefficients >= 7 && numCoefficients <= 255); + + for (i=0; i<numCoefficients; i++) + { + int16_t a0, a1; + + af_fread(&a0, 1, 2, fp); + af_fread(&a1, 1, 2, fp); + + a0 = LENDIAN_TO_HOST_INT16(a0); + a1 = LENDIAN_TO_HOST_INT16(a1); + + wave->msadpcmCoefficients[i][0] = a0; + wave->msadpcmCoefficients[i][1] = a1; + } + + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_MS_ADPCM; + track->f.byteOrder = _AF_BYTEORDER_NATIVE; + + /* Create the parameter list. */ + pv = AUpvnew(4); + AUpvsetparam(pv, 0, _AF_MS_ADPCM_NUM_COEFFICIENTS); + AUpvsetvaltype(pv, 0, AU_PVTYPE_LONG); + l = numCoefficients; + AUpvsetval(pv, 0, &l); + + AUpvsetparam(pv, 1, _AF_MS_ADPCM_COEFFICIENTS); + AUpvsetvaltype(pv, 1, AU_PVTYPE_PTR); + v = wave->msadpcmCoefficients; + AUpvsetval(pv, 1, &v); + + AUpvsetparam(pv, 2, _AF_SAMPLES_PER_BLOCK); + AUpvsetvaltype(pv, 2, AU_PVTYPE_LONG); + l = samplesPerBlock; + AUpvsetval(pv, 2, &l); + + AUpvsetparam(pv, 3, _AF_BLOCK_SIZE); + AUpvsetvaltype(pv, 3, AU_PVTYPE_LONG); + l = blockAlign; + AUpvsetval(pv, 3, &l); + + track->f.compressionParams = pv; + } + break; + + case WAVE_FORMAT_DVI_ADPCM: + { + AUpvlist pv; + long l; + + u_int16_t bitsPerSample, extraByteCount, + samplesPerBlock; + + af_fread(&bitsPerSample, 1, 2, fp); + bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample); + + af_fread(&extraByteCount, 1, 2, fp); + extraByteCount = LENDIAN_TO_HOST_INT16(extraByteCount); + + af_fread(&samplesPerBlock, 1, 2, fp); + samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock); + + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + track->f.compressionType = AF_COMPRESSION_IMA; + track->f.byteOrder = _AF_BYTEORDER_NATIVE; + + /* Create the parameter list. */ + pv = AUpvnew(2); + AUpvsetparam(pv, 0, _AF_SAMPLES_PER_BLOCK); + AUpvsetvaltype(pv, 0, AU_PVTYPE_LONG); + l = samplesPerBlock; + AUpvsetval(pv, 0, &l); + + AUpvsetparam(pv, 1, _AF_BLOCK_SIZE); + AUpvsetvaltype(pv, 1, AU_PVTYPE_LONG); + l = blockAlign; + AUpvsetval(pv, 1, &l); + + track->f.compressionParams = pv; + } + break; + + case WAVE_FORMAT_YAMAHA_ADPCM: + case WAVE_FORMAT_OKI_ADPCM: + case WAVE_FORMAT_CREATIVE_ADPCM: + case IBM_FORMAT_ADPCM: + _af_error(AF_BAD_NOT_IMPLEMENTED, "WAVE ADPCM data format 0x%x is not currently supported", formatTag); + return AF_FAIL; + break; + + case WAVE_FORMAT_MPEG: + _af_error(AF_BAD_NOT_IMPLEMENTED, "WAVE MPEG data format is not supported"); + return AF_FAIL; + break; + + case WAVE_FORMAT_MPEGLAYER3: + _af_error(AF_BAD_NOT_IMPLEMENTED, "WAVE MPEG layer 3 data format is not supported"); + return AF_FAIL; + break; + + default: + _af_error(AF_BAD_NOT_IMPLEMENTED, "WAVE file data format 0x%x not currently supported", formatTag); + return AF_FAIL; + break; + } + + _af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth); + + return AF_SUCCEED; +} + +static status ParseData (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + _Track *track; + + assert(filehandle != NULL); + assert(fp != NULL); + assert(!memcmp(&id, "data", 4)); + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + track->fpos_first_frame = af_ftell(fp); + track->data_size = size; + + return AF_SUCCEED; +} + +static status ParsePlayList (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + _Instrument *instrument; + u_int32_t segmentCount; + int segment; + + af_fread(&segmentCount, 4, 1, fp); + segmentCount = LENDIAN_TO_HOST_INT32(segmentCount); + + if (segmentCount == 0) + { + filehandle->instrumentCount = 0; + filehandle->instruments = NULL; + return AF_SUCCEED; + } + + for (segment=0; segment<segmentCount; segment++) + { + u_int32_t startMarkID, loopLength, loopCount; + + af_fread(&startMarkID, 4, 1, fp); + startMarkID = LENDIAN_TO_HOST_INT32(startMarkID); + af_fread(&loopLength, 4, 1, fp); + loopLength = LENDIAN_TO_HOST_INT32(loopLength); + af_fread(&loopCount, 4, 1, fp); + loopCount = LENDIAN_TO_HOST_INT32(loopCount); + } + + return AF_SUCCEED; +} + +static status ParseCues (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + _Track *track; + u_int32_t markerCount; + int i; + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + af_fread(&markerCount, 4, 1, fp); + markerCount = LENDIAN_TO_HOST_INT32(markerCount); + track->markerCount = markerCount; + + if (markerCount == 0) + { + track->markers = NULL; + return AF_SUCCEED; + } + + if ((track->markers = _af_marker_new(markerCount)) == NULL) + return AF_FAIL; + + for (i=0; i<markerCount; i++) + { + u_int32_t id, position, chunkid; + u_int32_t chunkByteOffset, blockByteOffset; + u_int32_t sampleFrameOffset; + _Marker *marker = &track->markers[i]; + + af_fread(&id, 4, 1, fp); + id = LENDIAN_TO_HOST_INT32(id); + + af_fread(&position, 4, 1, fp); + position = LENDIAN_TO_HOST_INT32(position); + + af_fread(&chunkid, 4, 1, fp); + chunkid = LENDIAN_TO_HOST_INT32(chunkid); + + af_fread(&chunkByteOffset, 4, 1, fp); + chunkByteOffset = LENDIAN_TO_HOST_INT32(chunkByteOffset); + + af_fread(&blockByteOffset, 4, 1, fp); + blockByteOffset = LENDIAN_TO_HOST_INT32(blockByteOffset); + + /* + sampleFrameOffset represents the position of + the mark in units of frames. + */ + af_fread(&sampleFrameOffset, 4, 1, fp); + sampleFrameOffset = LENDIAN_TO_HOST_INT32(sampleFrameOffset); + + marker->id = id; + marker->position = sampleFrameOffset; + marker->name = _af_strdup(""); + marker->comment = _af_strdup(""); + } + + return AF_SUCCEED; +} + +/* Parse an adtl sub-chunk within a LIST chunk. */ +static status ParseADTLSubChunk (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + _Track *track; + AFfileoffset endPos=af_ftell(fp)+size; + + track = _af_filehandle_get_track(filehandle, AF_DEFAULT_TRACK); + + while (af_ftell(fp) < endPos) + { + char chunkID[4]; + u_int32_t chunkSize; + + af_fread(chunkID, 4, 1, fp); + af_fread(&chunkSize, 4, 1, fp); + chunkSize = LENDIAN_TO_HOST_INT32(chunkSize); + + if (memcmp(chunkID, "labl", 4)==0 || memcmp(chunkID, "note", 4)==0) + { + _Marker *marker=NULL; + u_int32_t id; + long length=chunkSize-4; + char *p=_af_malloc(length); + + af_fread(&id, 4, 1, fp); + af_fread(p, length, 1, fp); + + id = LENDIAN_TO_HOST_INT32(id); + + marker = _af_marker_find_by_id(track, id); + + if (marker != NULL) + { + if (memcmp(chunkID, "labl", 4)==0) + { + free(marker->name); + marker->name = p; + } + else if (memcmp(chunkID, "note", 4)==0) + { + free(marker->comment); + marker->comment = p; + } + else + free(p); + } + else + free(p); + + /* + If chunkSize is odd, skip an extra byte + at the end of the chunk. + */ + if ((chunkSize % 2) != 0) + af_fseek(fp, 1, SEEK_CUR); + } + else + { + /* If chunkSize is odd, skip an extra byte. */ + af_fseek(fp, chunkSize + (chunkSize % 2), SEEK_CUR); + } + } + return AF_SUCCEED; +} + +/* Parse an INFO sub-chunk within a LIST chunk. */ +static status ParseINFOSubChunk (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + AFfileoffset endPos=af_ftell(fp)+size; + + while (af_ftell(fp) < endPos) + { + int misctype = AF_MISC_UNRECOGNIZED; + u_int32_t miscid, miscsize; + + af_fread(&miscid, 4, 1, fp); + af_fread(&miscsize, 4, 1, fp); + miscsize = LENDIAN_TO_HOST_INT32(miscsize); + + if (memcmp(&miscid, "IART", 4) == 0) + misctype = AF_MISC_AUTH; + else if (memcmp(&miscid, "INAM", 4) == 0) + misctype = AF_MISC_NAME; + else if (memcmp(&miscid, "ICOP", 4) == 0) + misctype = AF_MISC_COPY; + else if (memcmp(&miscid, "ICMT", 4) == 0) + misctype = AF_MISC_ICMT; + else if (memcmp(&miscid, "ICRD", 4) == 0) + misctype = AF_MISC_ICRD; + else if (memcmp(&miscid, "ISFT", 4) == 0) + misctype = AF_MISC_ISFT; + + if (misctype != AF_MISC_UNRECOGNIZED) + { + char *string = _af_malloc(miscsize); + + af_fread(string, miscsize, 1, fp); + + filehandle->miscellaneousCount++; + filehandle->miscellaneous = _af_realloc(filehandle->miscellaneous, sizeof (_Miscellaneous) * filehandle->miscellaneousCount); + + filehandle->miscellaneous[filehandle->miscellaneousCount-1].id = filehandle->miscellaneousCount; + filehandle->miscellaneous[filehandle->miscellaneousCount-1].type = misctype; + filehandle->miscellaneous[filehandle->miscellaneousCount-1].size = miscsize; + filehandle->miscellaneous[filehandle->miscellaneousCount-1].position = 0; + filehandle->miscellaneous[filehandle->miscellaneousCount-1].buffer = string; + } + else + { + af_fseek(fp, miscsize, SEEK_CUR); + } + + /* Make the current position an even number of bytes. */ + if (miscsize % 2 != 0) + af_fseek(fp, 1, SEEK_CUR); + } + return AF_SUCCEED; +} + +static status ParseList (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + u_int32_t typeID; + + af_fread(&typeID, 4, 1, fp); + size-=4; + + if (memcmp(&typeID, "adtl", 4) == 0) + { + /* Handle adtl sub-chunks. */ + return ParseADTLSubChunk(filehandle, fp, typeID, size); + } + else if (memcmp(&typeID, "INFO", 4) == 0) + { + /* Handle INFO sub-chunks. */ + return ParseINFOSubChunk(filehandle, fp, typeID, size); + } + else + { + /* Skip unhandled sub-chunks. */ + af_fseek(fp, size, SEEK_CUR); + return AF_SUCCEED; + } + return AF_SUCCEED; +} + +static status ParseInstrument (AFfilehandle filehandle, AFvirtualfile *fp, + u_int32_t id, size_t size) +{ + u_int8_t baseNote; + int8_t detune, gain; + u_int8_t lowNote, highNote, lowVelocity, highVelocity; + u_int8_t padByte; + + af_fread(&baseNote, 1, 1, fp); + af_fread(&detune, 1, 1, fp); + af_fread(&gain, 1, 1, fp); + af_fread(&lowNote, 1, 1, fp); + af_fread(&highNote, 1, 1, fp); + af_fread(&lowVelocity, 1, 1, fp); + af_fread(&highVelocity, 1, 1, fp); + af_fread(&padByte, 1, 1, fp); + + return AF_SUCCEED; +} + +bool _af_wave_recognize (AFvirtualfile *fh) +{ + u_int8_t buffer[8]; + + af_fseek(fh, 0, SEEK_SET); + + if (af_fread(buffer, 1, 8, fh) != 8 || memcmp(buffer, "RIFF", 4) != 0) + return AF_FALSE; + if (af_fread(buffer, 1, 4, fh) != 4 || memcmp(buffer, "WAVE", 4) != 0) + return AF_FALSE; + + return AF_TRUE; +} + +status _af_wave_read_init (AFfilesetup setup, AFfilehandle filehandle) +{ + _Track *track; + u_int32_t type, size, formtype; + u_int32_t index = 0; + bool hasFormat, hasData, hasCue, hasList, hasPlayList, hasFrameCount, + hasINST, hasINFO; + _WAVEInfo *wave = _af_malloc(sizeof (_WAVEInfo)); + + assert(filehandle != NULL); + assert(filehandle->fh != NULL); + + hasFormat = AF_FALSE; + hasData = AF_FALSE; + hasCue = AF_FALSE; + hasList = AF_FALSE; + hasPlayList = AF_FALSE; + hasFrameCount = AF_FALSE; + hasINST = AF_FALSE; + hasINFO = AF_FALSE; + + filehandle->formatSpecific = wave; + filehandle->instruments = NULL; + filehandle->instrumentCount = 0; + filehandle->miscellaneous = NULL; + filehandle->miscellaneousCount = 0; + + track = _af_track_new(); + filehandle->tracks = track; + filehandle->trackCount = 1; + + af_fseek(filehandle->fh, 0, SEEK_SET); + + af_fread(&type, 4, 1, filehandle->fh); + af_fread(&size, 4, 1, filehandle->fh); + size = LENDIAN_TO_HOST_INT32(size); + af_fread(&formtype, 4, 1, filehandle->fh); + + assert(!memcmp(&type, "RIFF", 4)); + assert(!memcmp(&formtype, "WAVE", 4)); + +#ifdef DEBUG + printf("size: %d\n", size); +#endif + + /* Include the offset of the form type. */ + index += 4; + + while (index < size) + { + u_int32_t chunkid = 0, chunksize = 0; + status result; + +#ifdef DEBUG + printf("index: %d\n", index); +#endif + af_fread(&chunkid, 4, 1, filehandle->fh); + + af_fread(&chunksize, 4, 1, filehandle->fh); + chunksize = LENDIAN_TO_HOST_INT32(chunksize); + +#ifdef DEBUG + _af_printid(BENDIAN_TO_HOST_INT32(chunkid)); + printf(" size: %d\n", chunksize); +#endif + + if (memcmp(&chunkid, "fmt ", 4) == 0) + { + result = ParseFormat(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + + hasFormat = AF_TRUE; + } + else if (memcmp(&chunkid, "data", 4) == 0) + { + /* The format chunk must precede the data chunk. */ + if (!hasFormat) + { + _af_error(AF_BAD_HEADER, "missing format chunk in WAVE file"); + return AF_FAIL; + } + + result = ParseData(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + + hasData = AF_TRUE; + } + else if (memcmp(&chunkid, "inst", 4) == 0) + { + result = ParseInstrument(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + else if (memcmp(&chunkid, "fact", 4) == 0) + { + hasFrameCount = AF_TRUE; + result = ParseFrameCount(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + else if (memcmp(&chunkid, "cue ", 4) == 0) + { + hasCue = AF_TRUE; + result = ParseCues(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + else if (memcmp(&chunkid, "LIST", 4) == 0 || memcmp(&chunkid, "list", 4) == 0) + { + hasList = AF_TRUE; + result = ParseList(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + else if (memcmp(&chunkid, "INST", 4) == 0) + { + hasINST = AF_TRUE; + result = ParseInstrument(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + else if (memcmp(&chunkid, "plst", 4) == 0) + { + hasPlayList = AF_TRUE; + result = ParsePlayList(filehandle, filehandle->fh, chunkid, chunksize); + if (result == AF_FAIL) + return AF_FAIL; + } + + index += chunksize + 8; + + /* All chunks must be aligned on an even number of bytes */ + if ((index % 2) != 0) + index++; + + af_fseek(filehandle->fh, index + 8, SEEK_SET); + } + + /* The format chunk and the data chunk are required. */ + if (!hasFormat || !hasData) + { + return AF_FAIL; + } + + /* + At this point we know that the file has a format chunk + and a data chunk, so we can assume that track->f and + track->data_size have been initialized. + */ + if (hasFrameCount == AF_FALSE) + { + /* + Perform arithmetic in double-precision so as + to preserve accuracy. + */ + track->totalfframes = ceil((double) track->data_size / + _af_format_frame_size(&track->f, AF_FALSE)); + } + + if (track->f.compressionType != AF_COMPRESSION_NONE && + (track->f.compressionType == AF_COMPRESSION_G711_ULAW || + track->f.compressionType == AF_COMPRESSION_G711_ALAW)) + { + track->totalfframes = track->data_size / track->f.channelCount; + } + + /* + A return value of AF_SUCCEED indicates successful parsing. + */ + return AF_SUCCEED; +} + +AFfilesetup _af_wave_complete_setup (AFfilesetup setup) +{ + AFfilesetup newsetup; + _TrackSetup *track; + + if (setup->trackSet && setup->trackCount != 1) + { + _af_error(AF_BAD_NUMTRACKS, "WAVE file must have 1 track"); + return AF_NULL_FILESETUP; + } + + track = _af_filesetup_get_tracksetup(setup, AF_DEFAULT_TRACK); + + if (track->sampleFormatSet) + { + switch (track->f.sampleFormat) + { + case AF_SAMPFMT_FLOAT: + if (track->sampleWidthSet && + track->f.sampleWidth != 32) + { + _af_error(AF_BAD_WIDTH, + "Warning: invalid sample width for floating-point WAVE file: %d (must be 32 bits)\n", + track->f.sampleWidth); + _af_set_sample_format(&track->f, AF_SAMPFMT_FLOAT, 32); + } + break; + + case AF_SAMPFMT_DOUBLE: + _af_error(AF_BAD_SAMPFMT, "WAVE format does not support double-precision floating-point data"); + return AF_NULL_FILESETUP; + break; + + case AF_SAMPFMT_UNSIGNED: + if (track->sampleWidthSet) + { + if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) + { + _af_error(AF_BAD_WIDTH, "invalid sample width for WAVE file: %d (must be 1-32 bits)\n", track->f.sampleWidth); + return AF_NULL_FILESETUP; + } + if (track->f.sampleWidth > 8) + { + _af_error(AF_BAD_SAMPFMT, "WAVE integer data of more than 8 bits must be two's complement signed"); + _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, track->f.sampleWidth); + } + } + else + /* + If the sample width is not set but the user requests + unsigned data, set the width to 8 bits. + */ + _af_set_sample_format(&track->f, track->f.sampleFormat, 8); + break; + + case AF_SAMPFMT_TWOSCOMP: + if (track->sampleWidthSet) + { + if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) + { + _af_error(AF_BAD_WIDTH, "invalid sample width %d for WAVE file (must be 1-32)", track->f.sampleWidth); + return AF_NULL_FILESETUP; + } + else if (track->f.sampleWidth <= 8) + { + _af_error(AF_BAD_SAMPFMT, "Warning: WAVE format integer data of 1-8 bits must be unsigned; setting sample format to unsigned"); + _af_set_sample_format(&track->f, AF_SAMPFMT_UNSIGNED, track->f.sampleWidth); + } + } + else + /* + If no sample width was specified, we default to 16 bits + for signed integer data. + */ + _af_set_sample_format(&track->f, track->f.sampleFormat, 16); + break; + } + } + /* + Otherwise set the sample format depending on the sample + width or set completely to default. + */ + else + { + if (track->sampleWidthSet == AF_FALSE) + { + track->f.sampleWidth = 16; + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + } + else + { + if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) + { + _af_error(AF_BAD_WIDTH, "invalid sample width %d for WAVE file (must be 1-32)", track->f.sampleWidth); + return AF_NULL_FILESETUP; + } + else if (track->f.sampleWidth > 8) + /* Here track->f.sampleWidth is in {1..32}. */ + track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; + else + /* Here track->f.sampleWidth is in {1..8}. */ + track->f.sampleFormat = AF_SAMPFMT_UNSIGNED; + } + } + + if (track->f.compressionType != AF_COMPRESSION_NONE && + track->f.compressionType != AF_COMPRESSION_G711_ULAW && + track->f.compressionType != AF_COMPRESSION_G711_ALAW) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, "compression format not supported in WAVE format"); + return AF_NULL_FILESETUP; + } + + if (track->byteOrderSet && + track->f.byteOrder != AF_BYTEORDER_LITTLEENDIAN && + track->f.compressionType == AF_COMPRESSION_NONE) + { + _af_error(AF_BAD_BYTEORDER, "WAVE format only supports little-endian data"); + return AF_NULL_FILESETUP; + } + + if (track->f.compressionType == AF_COMPRESSION_NONE) + track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; + else + track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; + + if (track->aesDataSet) + { + _af_error(AF_BAD_FILESETUP, "WAVE files cannot have AES data"); + return AF_NULL_FILESETUP; + } + + if (setup->instrumentSet) + { + if (setup->instrumentCount > 1) + { + _af_error(AF_BAD_NUMINSTS, "WAVE files can have 0 or 1 instrument"); + return AF_NULL_FILESETUP; + } + else if (setup->instrumentCount == 1) + { + if (setup->instruments[0].loopSet && + setup->instruments[0].loopCount > 0 && + (track->markersSet == AF_FALSE || track->markerCount == 0)) + { + _af_error(AF_BAD_NUMMARKS, "WAVE files with loops must contain at least 1 marker"); + return AF_NULL_FILESETUP; + } + } + } + + /* Make sure the miscellaneous data is of an acceptable type. */ + if (setup->miscellaneousSet) + { + int i; + for (i=0; i<setup->miscellaneousCount; i++) + { + switch (setup->miscellaneous[i].type) + { + case AF_MISC_COPY: + case AF_MISC_AUTH: + case AF_MISC_NAME: + case AF_MISC_ICRD: + case AF_MISC_ISFT: + case AF_MISC_ICMT: + break; + default: + _af_error(AF_BAD_MISCTYPE, "illegal miscellaneous type [%d] for WAVE file", setup->miscellaneous[i].type); + return AF_NULL_FILESETUP; + } + } + } + + /* + Allocate an AFfilesetup and make all the unset fields correct. + */ + newsetup = _af_filesetup_copy(setup, &_af_wave_default_filesetup, AF_FALSE); + + /* Make sure we do not copy loops if they are not specified in setup. */ + if (setup->instrumentSet && setup->instrumentCount > 0 && + setup->instruments[0].loopSet) + { + free(newsetup->instruments[0].loops); + newsetup->instruments[0].loopCount = 0; + } + + return newsetup; +} + +bool _af_wave_instparam_valid (AFfilehandle filehandle, AUpvlist list, int i) +{ + int param, type, lval; + + AUpvgetparam(list, i, ¶m); + AUpvgetvaltype(list, i, &type); + if (type != AU_PVTYPE_LONG) + return AF_FALSE; + + AUpvgetval(list, i, &lval); + + switch (param) + { + case AF_INST_MIDI_BASENOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_NUMCENTS_DETUNE: + return ((lval >= -50) && (lval <= 50)); + + case AF_INST_MIDI_LOVELOCITY: + return ((lval >= 1) && (lval <= 127)); + + case AF_INST_MIDI_HIVELOCITY: + return ((lval >= 1) && (lval <= 127)); + + case AF_INST_MIDI_LONOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_MIDI_HINOTE: + return ((lval >= 0) && (lval <= 127)); + + case AF_INST_NUMDBS_GAIN: + return AF_TRUE; + + default: + return AF_FALSE; + } + + return AF_TRUE; +} diff --git a/libaudiofile/wave.h b/libaudiofile/wave.h new file mode 100644 index 0000000..cf7a88a --- /dev/null +++ b/libaudiofile/wave.h @@ -0,0 +1,109 @@ +/* + Audio File Library + Copyright (C) 1998, Michael Pruett <michael@68k.org> + Copyright (C) 2000, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + wave.h + + This file contains structures and constants pertinent to the RIFF + WAVE file format. +*/ + +#ifndef WAVE_H +#define WAVE_H + +/* These constants are from RFC 2361. */ +enum +{ + WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Unknown Wave Format */ + WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM Format */ + WAVE_FORMAT_ADPCM = 0x0002, /* Microsoft ADPCM Format */ + WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* IEEE Float */ + WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer's VSELP */ + WAVE_FORMAT_IBM_CVSD = 0x0005, /* IBM CVSD */ + WAVE_FORMAT_ALAW = 0x0006, /* Microsoft ALAW */ + WAVE_FORMAT_MULAW = 0x0007, /* Microsoft MULAW */ + WAVE_FORMAT_OKI_ADPCM = 0x0010, /* OKI ADPCM */ + WAVE_FORMAT_DVI_ADPCM = 0x0011, /* Intel's DVI ADPCM */ + WAVE_FORMAT_MEDIASPACE_ADPCM = 0x0012, /* Videologic's MediaSpace ADPCM */ + WAVE_FORMAT_SIERRA_ADPCM = 0x0013, /* Sierra ADPCM */ + WAVE_FORMAT_G723_ADPCM = 0x0014, /* G.723 ADPCM */ + WAVE_FORMAT_DIGISTD = 0x0015, /* DSP Solutions' DIGISTD */ + WAVE_FORMAT_DIGIFIX = 0x0016, /* DSP Solutions' DIGIFIX */ + WAVE_FORMAT_DIALOGIC_OKI_ADPCM = 0x0017, /* Dialogic OKI ADPCM */ + WAVE_FORMAT_MEDIAVISION_ADPCM = 0x0018, /* MediaVision ADPCM */ + WAVE_FORMAT_CU_CODEC = 0x0019, /* HP CU */ + WAVE_FORMAT_YAMAHA_ADPCM = 0x0020, /* Yamaha ADPCM */ + WAVE_FORMAT_SONARC = 0x0021, /* Speech Compression's Sonarc */ + WAVE_FORMAT_DSP_TRUESPEECH = 0x0022, /* DSP Group's True Speech */ + WAVE_FORMAT_ECHOSC1 = 0x0023, /* Echo Speech's EchoSC1 */ + WAVE_FORMAT_AUDIOFILE_AF36 = 0x0024, /* Audiofile AF36 */ + WAVE_FORMAT_APTX = 0x0025, /* APTX */ + WAVE_FORMAT_DOLBY_AC2 = 0x0030, /* Dolby AC2 */ + WAVE_FORMAT_GSM610 = 0x0031, /* GSM610 */ + WAVE_FORMAT_MSNAUDIO = 0x0032, /* MSNAudio */ + WAVE_FORMAT_ANTEX_ADPCME = 0x0033, /* Antex ADPCME */ + + WAVE_FORMAT_MPEG = 0x0050, /* MPEG */ + WAVE_FORMAT_MPEGLAYER3 = 0x0055, /* MPEG layer 3 */ + WAVE_FORMAT_LUCENT_G723 = 0x0059, /* Lucent G.723 */ + WAVE_FORMAT_G726_ADPCM = 0x0064, /* G.726 ADPCM */ + WAVE_FORMAT_G722_ADPCM = 0x0065, /* G.722 ADPCM */ + + IBM_FORMAT_MULAW = 0x0101, + IBM_FORMAT_ALAW = 0x0102, + IBM_FORMAT_ADPCM = 0x0103, + + WAVE_FORMAT_CREATIVE_ADPCM = 0x0200 +}; + +#define _AF_WAVE_NUM_INSTPARAMS 7 +#define _AF_WAVE_NUM_COMPTYPES 2 + +bool _af_wave_recognize (AFvirtualfile *fh); +status _af_wave_read_init (AFfilesetup, AFfilehandle); +status _af_wave_write_init (AFfilesetup, AFfilehandle); +bool _af_wave_update (AFfilehandle); +AFfilesetup _af_wave_complete_setup (AFfilesetup); +bool _af_wave_instparam_valid (AFfilehandle, AUpvlist, int); + +typedef struct _WAVEInfo +{ + AFfileoffset factOffset; /* start of fact (frame count) chunk */ + AFfileoffset miscellaneousStartOffset; + AFfileoffset totalMiscellaneousSize; + AFfileoffset markOffset; + AFfileoffset dataSizeOffset; + + /* + The following information is specified in the format + chunk and is for use with compressed data formats. + */ + u_int32_t blockAlign, samplesPerBlock; + + /* + The index into the coefficient array is of type + u_int8_t, so we can safely limit msadpcmCoefficients to + be 256 coefficient pairs. + */ + int16_t msadpcmCoefficients[256][2]; +} _WAVEInfo; + +#endif diff --git a/libaudiofile/wavewrite.c b/libaudiofile/wavewrite.c new file mode 100644 index 0000000..af9acda --- /dev/null +++ b/libaudiofile/wavewrite.c @@ -0,0 +1,551 @@ +/* + Audio File Library + Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> + Copyright (C) 2000-2001, Silicon Graphics, Inc. + + 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; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. +*/ + +/* + wavewrite.c + + This file contains routines which facilitate writing to WAVE files. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include "audiofile.h" +#include "afinternal.h" +#include "byteorder.h" +#include "util.h" +#include "setup.h" +#include "wave.h" + +status _af_wave_update (AFfilehandle file); + +static status WriteFormat (AFfilehandle file); +static status WriteFrameCount (AFfilehandle file); +static status WriteMiscellaneous (AFfilehandle file); +static status WriteCues (AFfilehandle file); +static status WriteData (AFfilehandle file); + +_WAVEInfo *waveinfo_new (void) +{ + _WAVEInfo *waveinfo = _af_malloc(sizeof (_WAVEInfo)); + + waveinfo->factOffset = 0; + waveinfo->miscellaneousStartOffset = 0; + waveinfo->totalMiscellaneousSize = 0; + waveinfo->markOffset = 0; + waveinfo->dataSizeOffset = 0; + + return waveinfo; +} + +static status WriteFormat (AFfilehandle file) +{ + _Track *track = NULL; + + u_int16_t formatTag, channelCount; + u_int32_t sampleRate, averageBytesPerSecond; + u_int16_t blockAlign; + u_int32_t chunkSize; + u_int16_t bitsPerSample; + + assert(file != NULL); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fwrite("fmt ", 4, 1, file->fh); + + switch (track->f.compressionType) + { + case AF_COMPRESSION_NONE: + chunkSize = 16; + if (track->f.sampleFormat == AF_SAMPFMT_FLOAT) + { + formatTag = WAVE_FORMAT_IEEE_FLOAT; + } + else if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP || + track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) + { + formatTag = WAVE_FORMAT_PCM; + } + else + { + _af_error(AF_BAD_COMPTYPE, "bad sample format"); + return AF_FAIL; + } + + blockAlign = _af_format_frame_size(&track->f, AF_FALSE); + bitsPerSample = 8 * _af_format_sample_size(&track->f, AF_FALSE); + break; + + /* + G.711 compression uses eight bits per sample. + */ + case AF_COMPRESSION_G711_ULAW: + chunkSize = 18; + formatTag = IBM_FORMAT_MULAW; + blockAlign = track->f.channelCount; + bitsPerSample = 8; + break; + + case AF_COMPRESSION_G711_ALAW: + chunkSize = 18; + formatTag = IBM_FORMAT_ALAW; + blockAlign = track->f.channelCount; + bitsPerSample = 8; + break; + + default: + _af_error(AF_BAD_COMPTYPE, "bad compression type"); + return AF_FAIL; + } + + chunkSize = HOST_TO_LENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, 4, 1, file->fh); + + formatTag = HOST_TO_LENDIAN_INT16(formatTag); + af_fwrite(&formatTag, 2, 1, file->fh); + formatTag = LENDIAN_TO_HOST_INT16(formatTag); + + channelCount = track->f.channelCount; + channelCount = HOST_TO_LENDIAN_INT16(channelCount); + af_fwrite(&channelCount, 2, 1, file->fh); + + sampleRate = track->f.sampleRate; + sampleRate = HOST_TO_LENDIAN_INT32(sampleRate); + af_fwrite(&sampleRate, 4, 1, file->fh); + + averageBytesPerSecond = + track->f.sampleRate * _af_format_frame_size(&track->f, AF_FALSE); + averageBytesPerSecond = HOST_TO_LENDIAN_INT32(averageBytesPerSecond); + af_fwrite(&averageBytesPerSecond, 4, 1, file->fh); + + blockAlign = _af_format_frame_size(&track->f, AF_FALSE); + blockAlign = HOST_TO_LENDIAN_INT16(blockAlign); + af_fwrite(&blockAlign, 2, 1, file->fh); + + bitsPerSample = HOST_TO_LENDIAN_INT16(bitsPerSample); + af_fwrite(&bitsPerSample, 2, 1, file->fh); + + if (track->f.compressionType == AF_COMPRESSION_G711_ULAW || + track->f.compressionType == AF_COMPRESSION_G711_ALAW) + { + u_int16_t zero = 0; + af_fwrite(&zero, 2, 1, file->fh); + } + + return AF_SUCCEED; +} + +static status WriteFrameCount (AFfilehandle file) +{ + _Track *track = NULL; + _WAVEInfo *waveinfo = NULL; + u_int32_t factSize = 4; + u_int32_t totalFrameCount; + + assert(file != NULL); + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + waveinfo = (_WAVEInfo *) file->formatSpecific; + + /* We only write the fact chunk for compressed audio. */ + if (track->f.compressionType == AF_COMPRESSION_NONE) + return AF_SUCCEED; + + /* + If the offset for the fact chunk hasn't been set yet, + set it to the file's current position. + */ + if (waveinfo->factOffset == 0) + waveinfo->factOffset = af_ftell(file->fh); + else + af_fseek(file->fh, waveinfo->factOffset, SEEK_SET); + + af_fwrite("fact", 4, 1, file->fh); + factSize = HOST_TO_LENDIAN_INT32(factSize); + af_fwrite(&factSize, 4, 1, file->fh); + + totalFrameCount = HOST_TO_LENDIAN_INT32(track->totalfframes); + af_fwrite(&totalFrameCount, 4, 1, file->fh); + + return AF_SUCCEED; +} + +static status WriteData (AFfilehandle file) +{ + _Track *track; + u_int32_t chunkSize; + _WAVEInfo *waveinfo; + + assert(file); + + waveinfo = file->formatSpecific; + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + af_fwrite("data", 4, 1, file->fh); + waveinfo->dataSizeOffset = af_ftell(file->fh); + + chunkSize = _af_format_frame_size(&track->f, AF_FALSE) * + track->totalfframes; + + chunkSize = HOST_TO_LENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, 4, 1, file->fh); + track->fpos_first_frame = af_ftell(file->fh); + + return AF_SUCCEED; +} + +status _af_wave_update (AFfilehandle file) +{ + _Track *track; + _WAVEInfo *wave = (_WAVEInfo *) file->formatSpecific; + + track = _af_filehandle_get_track(file, AF_DEFAULT_TRACK); + + if (track->fpos_first_frame != 0) + { + u_int32_t dataLength, fileLength; + + /* Update the frame count chunk if present. */ + WriteFrameCount(file); + + /* Update the length of the data chunk. */ + af_fseek(file->fh, wave->dataSizeOffset, SEEK_SET); + + /* + We call _af_format_frame_size to calculate the + frame size of normal PCM data or compressed data. + */ + dataLength = (u_int32_t) track->totalfframes * + _af_format_frame_size(&track->f, AF_FALSE); + dataLength = HOST_TO_LENDIAN_INT32(dataLength); + af_fwrite(&dataLength, 4, 1, file->fh); + + /* Update the length of the RIFF chunk. */ + fileLength = (u_int32_t) af_flength(file->fh); + fileLength -= 8; + fileLength = HOST_TO_LENDIAN_INT32(fileLength); + + af_fseek(file->fh, 4, SEEK_SET); + af_fwrite(&fileLength, 4, 1, file->fh); + } + + /* + Write the actual data that was set after initializing + the miscellaneous IDs. The size of the data will be + unchanged. + */ + WriteMiscellaneous(file); + + /* Write the new positions; the size of the data will be unchanged. */ + WriteCues(file); + + return AF_SUCCEED; +} + +/* Convert an Audio File Library miscellaneous type to a WAVE type. */ +static status misc_type_to_wave (int misctype, u_int32_t *miscid) +{ + if (misctype == AF_MISC_AUTH) + memcpy(miscid, "IART", 4); + else if (misctype == AF_MISC_NAME) + memcpy(miscid, "INAM", 4); + else if (misctype == AF_MISC_COPY) + memcpy(miscid, "ICOP", 4); + else if (misctype == AF_MISC_ICMT) + memcpy(miscid, "ICMT", 4); + else if (misctype == AF_MISC_ICRD) + memcpy(miscid, "ICRD", 4); + else if (misctype == AF_MISC_ISFT) + memcpy(miscid, "ISFT", 4); + else + return AF_FAIL; + + return AF_SUCCEED; +} + +status WriteMiscellaneous (AFfilehandle filehandle) +{ + _WAVEInfo *wave = (_WAVEInfo *) filehandle->formatSpecific; + + if (filehandle->miscellaneousCount != 0) + { + int i; + u_int32_t miscellaneousBytes; + u_int32_t chunkSize; + + /* Start at 12 to account for 'LIST', size, and 'INFO'. */ + miscellaneousBytes = 12; + + /* Then calculate the size of the whole INFO chunk. */ + for (i=0; i<filehandle->miscellaneousCount; i++) + { + u_int32_t miscid; + + /* Skip miscellaneous data of an unsupported type. */ + if (misc_type_to_wave(filehandle->miscellaneous[i].type, + &miscid) == AF_FAIL) + continue; + + /* Account for miscellaneous type and size. */ + miscellaneousBytes += 8; + miscellaneousBytes += filehandle->miscellaneous[i].size; + + /* Add a pad byte if necessary. */ + if (filehandle->miscellaneous[i].size % 2 != 0) + miscellaneousBytes++; + + assert(miscellaneousBytes % 2 == 0); + } + + if (wave->miscellaneousStartOffset == 0) + wave->miscellaneousStartOffset = af_ftell(filehandle->fh); + else + af_fseek(filehandle->fh, wave->miscellaneousStartOffset, SEEK_SET); + + wave->totalMiscellaneousSize = miscellaneousBytes; + + /* + Write the data. On the first call to this + function (from _af_wave_write_init), the + data won't be available, af_fseek is used to + reserve space until the data has been provided. + On subseuent calls to this function (from + _af_wave_update), the data will really be written. + */ + + /* Write 'LIST'. */ + af_fwrite("LIST", 4, 1, filehandle->fh); + + /* Write the size of the following chunk. */ + chunkSize = miscellaneousBytes-8; + chunkSize = HOST_TO_LENDIAN_INT32(chunkSize); + af_fwrite(&chunkSize, sizeof (u_int32_t), 1, filehandle->fh); + + /* Write 'INFO'. */ + af_fwrite("INFO", 4, 1, filehandle->fh); + + /* Write each miscellaneous chunk. */ + for (i=0; i<filehandle->miscellaneousCount; i++) + { + u_int32_t miscsize = HOST_TO_LENDIAN_INT32(filehandle->miscellaneous[i].size); + u_int32_t miscid = 0; + + /* Skip miscellaneous data of an unsupported type. */ + if (misc_type_to_wave(filehandle->miscellaneous[i].type, + &miscid) == AF_FAIL) + continue; + + af_fwrite(&miscid, 4, 1, filehandle->fh); + af_fwrite(&miscsize, 4, 1, filehandle->fh); + if (filehandle->miscellaneous[i].buffer != NULL) + { + u_int8_t zero = 0; + + af_fwrite(filehandle->miscellaneous[i].buffer, filehandle->miscellaneous[i].size, 1, filehandle->fh); + + /* Pad if necessary. */ + if ((filehandle->miscellaneous[i].size%2) != 0) + af_fwrite(&zero, 1, 1, filehandle->fh); + } + else + { + int size; + size = filehandle->miscellaneous[i].size; + + /* Pad if necessary. */ + if ((size % 2) != 0) + size++; + af_fseek(filehandle->fh, size, SEEK_CUR); + } + } + } + + return AF_SUCCEED; +} + +static status WriteCues (AFfilehandle file) +{ + int i, *markids, markCount; + u_int32_t numCues, cueChunkSize, listChunkSize; + _Track *track = &file->tracks[0]; + _WAVEInfo *wave; + + assert(file); + + markCount = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); + if (markCount == 0) + return AF_SUCCEED; + + wave = file->formatSpecific; + + if (wave->markOffset == 0) + wave->markOffset = af_ftell(file->fh); + else + af_fseek(file->fh, wave->markOffset, SEEK_SET); + + af_fwrite("cue ", 4, 1, file->fh); + + /* + The cue chunk consists of 4 bytes for the number of cue points + followed by 24 bytes for each cue point record. + */ + cueChunkSize = 4 + markCount * 24; + cueChunkSize = HOST_TO_LENDIAN_INT32(cueChunkSize); + af_fwrite(&cueChunkSize, sizeof (u_int32_t), 1, file->fh); + numCues = HOST_TO_LENDIAN_INT32(markCount); + af_fwrite(&numCues, sizeof (u_int32_t), 1, file->fh); + + markids = _af_calloc(markCount, sizeof (int)); + assert(markids != NULL); + afGetMarkIDs(file, AF_DEFAULT_TRACK, markids); + + /* Write each marker to the file. */ + for (i=0; i < markCount; i++) + { + u_int32_t identifier, position, chunkStart, blockStart; + u_int32_t sampleOffset; + AFframecount markposition; + + identifier = HOST_TO_LENDIAN_INT32(markids[i]); + af_fwrite(&identifier, sizeof (u_int32_t), 1, file->fh); + + position = HOST_TO_LENDIAN_INT32(i); + af_fwrite(&position, sizeof (u_int32_t), 1, file->fh); + + /* For now the RIFF id is always the first data chunk. */ + af_fwrite("data", 4, 1, file->fh); + + /* + For an uncompressed WAVE file which contains + only one data chunk, chunkStart and blockStart + are zero. + */ + chunkStart = 0; + af_fwrite(&chunkStart, sizeof (u_int32_t), 1, file->fh); + + blockStart = 0; + af_fwrite(&blockStart, sizeof (u_int32_t), 1, file->fh); + + markposition = afGetMarkPosition(file, AF_DEFAULT_TRACK, markids[i]); + + /* Sample offsets are stored in the WAVE file as frames. */ + sampleOffset = HOST_TO_LENDIAN_INT32(markposition); + af_fwrite(&sampleOffset, sizeof (u_int32_t), 1, file->fh); + } + + /* + Now write the cue names which is in a master list chunk + with a subchunk for each cue's name. + */ + + listChunkSize = 4; + for (i=0; i<markCount; i++) + { + const char *name; + + name = afGetMarkName(file, AF_DEFAULT_TRACK, markids[i]); + + /* + Each label chunk consists of 4 bytes for the + "labl" chunk ID, 4 bytes for the chunk data + size, 4 bytes for the cue point ID, and then + the length of the label as a Pascal-style string. + + In all, this is 12 bytes plus the length of the + string, its size byte, and a trailing pad byte + if the length of the chunk is otherwise odd. + */ + listChunkSize += 12 + (strlen(name) + 1) + + ((strlen(name) + 1) % 2); + } + + af_fwrite("LIST", 4, 1, file->fh); + listChunkSize = HOST_TO_LENDIAN_INT32(listChunkSize); + af_fwrite(&listChunkSize, sizeof (u_int32_t), 1, file->fh); + af_fwrite("adtl", 4, 1, file->fh); + + for (i=0; i<markCount; i++) + { + const char *name; + u_int32_t labelSize, cuePointID; + + name = afGetMarkName(file, AF_DEFAULT_TRACK, markids[i]); + + /* Make labelSize even if it is not already. */ + labelSize = 4+(strlen(name)+1) + ((strlen(name) + 1) % 2); + labelSize = HOST_TO_LENDIAN_INT32(labelSize); + cuePointID = HOST_TO_LENDIAN_INT32(markids[i]); + + af_fwrite("labl", 4, 1, file->fh); + af_fwrite(&labelSize, 4, 1, file->fh); + af_fwrite(&cuePointID, 4, 1, file->fh); + af_fwrite(name, strlen(name) + 1, 1, file->fh); + /* + If the name plus the size byte comprises an odd + length, add another byte to make the string an + even length. + */ + if (((strlen(name) + 1) % 2) != 0) + { + u_int8_t c=0; + af_fwrite(&c, 1, 1, file->fh); + } + } + + free(markids); + + return AF_SUCCEED; +} + +status _af_wave_write_init (AFfilesetup setup, AFfilehandle filehandle) +{ + u_int32_t zero = 0; + + if (_af_filesetup_make_handle(setup, filehandle) == AF_FAIL) + return AF_FAIL; + + filehandle->formatSpecific = waveinfo_new(); + + af_fseek(filehandle->fh, 0, SEEK_SET); + af_fwrite("RIFF", 4, 1, filehandle->fh); + af_fwrite(&zero, 4, 1, filehandle->fh); + af_fwrite("WAVE", 4, 1, filehandle->fh); + + WriteMiscellaneous(filehandle); + WriteCues(filehandle); + WriteFormat(filehandle); + WriteFrameCount(filehandle); + WriteData(filehandle); + + return AF_SUCCEED; +} diff --git a/ltmain.sh b/ltmain.sh new file mode 100644 index 0000000..1a09cd0 --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,5040 @@ +# 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 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# 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 "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# The name of this program. +progname=`$echo "$0" | sed 's%^.*/%%'` +modename="$progname" + +# Constants. +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.4.2a +TIMESTAMP=" (1.922.2.79 2001/11/28 21:50:31)" + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# 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='s/\([\\`\\"$\\\\]\)/\\\1/g' +SP2NL='tr \040 \012' +NL2SP='tr \015\012 \040\040' + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +# We save the old values to restore during execute mode. +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi + +# Make sure IFS has a sensible default +: ${IFS=" "} + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# 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" + ;; + *) + 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" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --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 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# 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 + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + 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 1 + 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= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -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. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + 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 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 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 1" 1 2 15 + else + 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 "$0" "$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 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/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 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/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 1 + fi + + # Just move the object if needed + if 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 + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_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 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$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 1 + ;; + 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 + ;; + *) + 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 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + 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* | no/*-*-nonstopux*) + 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 + exit 1 + 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*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # 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 + ;; + + -o) prev=output ;; + + -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 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # 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 + ;; + + -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 + ;; + + # 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 + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + 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 1 + 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 + + # 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 + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + 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 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + 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 + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain 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 1 + ;; + 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 = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + 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 + 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" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 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) + if test "$deplibs_check_method" != pass_all; 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 = 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 + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + 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 variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + 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 1 + 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 1 + 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 1 + 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 1 + 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. + dlprefiles="$dlprefiles $lib" + 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 + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + 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 1 + 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" + 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... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { 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 + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + 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 + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + 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*) + 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='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $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='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $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" + 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" + 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 1 + 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" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + 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 + 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 + + # Try to link the static library + # 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 + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + 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="-L$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 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $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 + test $pass != scan && dependency_libs="$newdependency_libs" + 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 + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + 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 + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + 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' 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 libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + 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 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 1 + 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. + libext=al + 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' 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 1 + fi + + current="$2" + revision="$3" + age="$4" + + # 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]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + 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 1 + 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` + 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) + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + major=`expr $current - $age + 1` + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 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 != 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 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + 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. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + 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*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # 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 behaviour. + 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 <<EOF + int main() { return 0; } +EOF + $rm conftest + $CC -o conftest conftest.c $deplibs + if test $? -eq 0 ; then + ldd_output=`ldd conftest` + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + 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 I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + 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 a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + else + droppeddeps=yes + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method + file_magic_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 + 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 + # 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 + 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 + 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 below 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 + 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="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -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 + + # 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" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + 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 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 + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + 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 + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + 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 + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + 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 -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" + fi + done + deplibs="$tmp_deplibs" + done + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || 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 $? + exit 0 + 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) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + 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 1 + 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 + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + 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" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $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 0 + 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 0 + 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" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + 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 + + 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*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + 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/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + 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" | sort +2 | 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. */ +const struct { + 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 -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -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. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + 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" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test $need_relink = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + 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 $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 0 + 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" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + 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" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --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 ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 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' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +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 1 + 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 + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + 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 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + 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="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + 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 $0 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # 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 1 + 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 1 + 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 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + 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) 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 + +# 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 0 + ;; + + # 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" | $Xsed | 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) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -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 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + 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 1 + 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 1 + 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 1 + ;; + 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 | egrep "^# 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 1 + 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 + $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 + continue + 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. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || 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 1 + ;; + 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 0 + ;; + + *) + # 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 + + # 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 | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file 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 1 + 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= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $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" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + 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 "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $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 $0 --finish$current_libdirs' + else + exit 0 + 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. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $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 0 + + echo "----------------------------------------------------------------------" + 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 "----------------------------------------------------------------------" + exit 0 + ;; + + # 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 1 + 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 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# 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 1 + 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 + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + 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 | egrep "^# 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 enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # 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 0 + 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 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + 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 | egrep "^# 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" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 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. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # 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 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +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 + --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." + exit 0 + ;; + +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 + -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 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 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: @@ -0,0 +1,283 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.3 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..4f58503 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/packaging/audiofile-CVE-2008-5824.diff b/packaging/audiofile-CVE-2008-5824.diff new file mode 100644 index 0000000..26a1c58 --- /dev/null +++ b/packaging/audiofile-CVE-2008-5824.diff @@ -0,0 +1,23 @@ +diff -r 247fd11d763d libaudiofile/modules/msadpcm.c +--- a/libaudiofile/modules/msadpcm.c Sat Jan 03 20:35:58 2009 +0100 ++++ b/libaudiofile/modules/msadpcm.c Sun Jan 04 01:43:06 2009 +0100 +@@ -129,8 +129,7 @@ + ms_adpcm_state *state[2]; + + /* Calculate the number of bytes needed for decoded data. */ +- outputLength = msadpcm->samplesPerBlock * sizeof (int16_t) * +- msadpcm->track->f.channelCount; ++ outputLength = msadpcm->samplesPerBlock * sizeof (int16_t); + + channelCount = msadpcm->track->f.channelCount; + +@@ -180,8 +179,7 @@ + The first two samples have already been 'decoded' in + the block header. + */ +- samplesRemaining = (msadpcm->samplesPerBlock - 2) * +- msadpcm->track->f.channelCount; ++ samplesRemaining = msadpcm->samplesPerBlock - 2; + + while (samplesRemaining > 0) + { diff --git a/packaging/audiofile-const.patch b/packaging/audiofile-const.patch new file mode 100644 index 0000000..11e947b --- /dev/null +++ b/packaging/audiofile-const.patch @@ -0,0 +1,316 @@ +diff -ur audiofile-0.2.6-orig/libaudiofile/aiff.c audiofile-0.2.6-mine/libaudiofile/aiff.c +--- audiofile-0.2.6-orig/libaudiofile/aiff.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/aiff.c 2006-03-22 02:15:50.058306000 -0500 +@@ -64,7 +64,7 @@ + static status ParseSSND (AFfilehandle file, AFvirtualfile *fh, u_int32_t type, + size_t size); + +-_InstParamInfo _af_aiff_inst_params[_AF_AIFF_NUM_INSTPARAMS] = ++const _InstParamInfo _af_aiff_inst_params[_AF_AIFF_NUM_INSTPARAMS] = + { + { AF_INST_MIDI_BASENOTE, AU_PVTYPE_LONG, "MIDI base note", {60} }, + { AF_INST_NUMCENTS_DETUNE, AU_PVTYPE_LONG, "Detune in cents", {0} }, +@@ -77,7 +77,7 @@ + { AF_INST_RELLOOPID, AU_PVTYPE_LONG, "Release loop id", {0} } + }; + +-int _af_aiffc_compression_types[_AF_AIFF_NUM_COMPTYPES] = ++const int _af_aiffc_compression_types[_AF_AIFF_NUM_COMPTYPES] = + { + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +diff -ur audiofile-0.2.6-orig/libaudiofile/compression.c audiofile-0.2.6-mine/libaudiofile/compression.c +--- audiofile-0.2.6-orig/libaudiofile/compression.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/compression.c 2006-03-22 02:04:44.948739250 -0500 +@@ -37,7 +37,7 @@ + #include "units.h" + #include "util.h" + +-extern _CompressionUnit _af_compression[]; ++extern const _CompressionUnit _af_compression[]; + + int _af_compression_index_from_id (int compressionid) + { +@@ -54,7 +54,7 @@ + return -1; + } + +-static _CompressionUnit *findCompression (int compressionid) ++static const _CompressionUnit *findCompression (int compressionid) + { + int compressionno; + +diff -ur audiofile-0.2.6-orig/libaudiofile/debug.c audiofile-0.2.6-mine/libaudiofile/debug.c +--- audiofile-0.2.6-orig/libaudiofile/debug.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/debug.c 2006-03-22 01:56:31.187180000 -0500 +@@ -49,7 +49,7 @@ + #include "print.h" + #include "debug.h" + +-extern _CompressionUnit _af_compression[]; ++extern const _CompressionUnit _af_compression[]; + + void _af_printid (u_int32_t id) + { +diff -ur audiofile-0.2.6-orig/libaudiofile/format.c audiofile-0.2.6-mine/libaudiofile/format.c +--- audiofile-0.2.6-orig/libaudiofile/format.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/format.c 2006-03-22 01:56:21.586580000 -0500 +@@ -43,7 +43,7 @@ + #include "units.h" + #include "modules.h" + +-extern _Unit _af_units[]; ++extern const _Unit _af_units[]; + + AFfileoffset afGetDataOffset (AFfilehandle file, int trackid) + { +diff -ur audiofile-0.2.6-orig/libaudiofile/g711.c audiofile-0.2.6-mine/libaudiofile/g711.c +--- audiofile-0.2.6-orig/libaudiofile/g711.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/g711.c 2006-03-21 22:57:37.356130750 -0500 +@@ -38,7 +38,7 @@ + #define SEG_MASK (0x70) /* Segment field mask. */ + + /* copy from CCITT G.711 specifications */ +-static unsigned char _u2a[128] = { /* u- to A-law conversions */ ++static const unsigned char _u2a[128] = { /* u- to A-law conversions */ + 1, 1, 2, 2, 3, 3, 4, 4, + 5, 5, 6, 6, 7, 7, 8, 8, + 9, 10, 11, 12, 13, 14, 15, 16, +@@ -56,7 +56,7 @@ + 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128}; + +-static unsigned char _a2u[128] = { /* A- to u-law conversions */ ++static const unsigned char _a2u[128] = { /* A- to u-law conversions */ + 1, 3, 5, 7, 9, 11, 13, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, +@@ -77,7 +77,7 @@ + /* see libst.h */ + #ifdef SUPERCEDED + +-static short seg_end[8] = {0xFF, 0x1FF, 0x3FF, 0x7FF, ++static const short seg_end[8] = {0xFF, 0x1FF, 0x3FF, 0x7FF, + 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF}; + + static int +diff -ur audiofile-0.2.6-orig/libaudiofile/instrument.c audiofile-0.2.6-mine/libaudiofile/instrument.c +--- audiofile-0.2.6-orig/libaudiofile/instrument.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/instrument.c 2006-03-22 01:56:12.642021000 -0500 +@@ -55,7 +55,7 @@ + + #include <stdio.h> + +-extern _Unit _af_units[]; ++extern const _Unit _af_units[]; + + /* + Initialize instrument id list for audio file. +diff -ur audiofile-0.2.6-orig/libaudiofile/modules.c audiofile-0.2.6-mine/libaudiofile/modules.c +--- audiofile-0.2.6-orig/libaudiofile/modules.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/modules.c 2006-03-22 02:07:29.411017500 -0500 +@@ -56,15 +56,15 @@ + + #define NULLMODULEPARAM + +-extern _PCMInfo _af_default_signed_integer_pcm_mappings[]; +-extern _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; +-extern _PCMInfo _af_default_float_pcm_mapping; +-extern _PCMInfo _af_default_double_pcm_mapping; ++extern const _PCMInfo _af_default_signed_integer_pcm_mappings[]; ++extern const _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; ++extern const _PCMInfo _af_default_float_pcm_mapping; ++extern const _PCMInfo _af_default_double_pcm_mapping; + + extern _CompressionUnit _af_compression[]; + + /* Define rebuffering modules. */ +-extern _AFmodule int2rebufferv2f, int2rebufferf2v; ++extern const _AFmodule int2rebufferv2f, int2rebufferf2v; + + /* + module utility routines +@@ -1511,7 +1511,7 @@ + } + }; + +-static _PCMInfo *intmappings[6] = ++static const _PCMInfo *intmappings[6] = + { + &_af_default_signed_integer_pcm_mappings[1], + &_af_default_signed_integer_pcm_mappings[2], +diff -ur audiofile-0.2.6-orig/libaudiofile/next.c audiofile-0.2.6-mine/libaudiofile/next.c +--- audiofile-0.2.6-orig/libaudiofile/next.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/next.c 2006-03-22 02:15:59.742911250 -0500 +@@ -47,7 +47,7 @@ + #include "setup.h" + #include "byteorder.h" + +-int _af_next_compression_types[_AF_NEXT_NUM_COMPTYPES] = ++const int _af_next_compression_types[_AF_NEXT_NUM_COMPTYPES] = + { + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +diff -ur audiofile-0.2.6-orig/libaudiofile/openclose.c audiofile-0.2.6-mine/libaudiofile/openclose.c +--- audiofile-0.2.6-orig/libaudiofile/openclose.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/openclose.c 2006-03-22 01:55:33.067547750 -0500 +@@ -45,7 +45,7 @@ + #define SETBINARYMODE(x) + #endif /* WIN32 || __CYGWIN__ */ + +-extern _Unit _af_units[]; ++extern const _Unit _af_units[]; + + static void freeFileHandle (AFfilehandle filehandle); + static void freeInstParams (AFPVu *values, int fileFormat); +diff -ur audiofile-0.2.6-orig/libaudiofile/pcm.c audiofile-0.2.6-mine/libaudiofile/pcm.c +--- audiofile-0.2.6-orig/libaudiofile/pcm.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/pcm.c 2006-03-21 22:56:53.581395000 -0500 +@@ -33,7 +33,7 @@ + #include "pcm.h" + #include "util.h" + +-_PCMInfo _af_default_signed_integer_pcm_mappings[] = ++const _PCMInfo _af_default_signed_integer_pcm_mappings[] = + { + {0, 0, 0, 0}, + {SLOPE_INT8, 0, MIN_INT8, MAX_INT8}, +@@ -42,7 +42,7 @@ + {SLOPE_INT32, 0, MIN_INT32, MAX_INT32} + }; + +-_PCMInfo _af_default_unsigned_integer_pcm_mappings[] = ++const _PCMInfo _af_default_unsigned_integer_pcm_mappings[] = + { + {0, 0, 0, 0}, + {SLOPE_INT8, INTERCEPT_U_INT8, 0, MAX_U_INT8}, +@@ -51,10 +51,10 @@ + {SLOPE_INT32, INTERCEPT_U_INT32, 0, MAX_U_INT32} + }; + +-_PCMInfo _af_default_float_pcm_mapping = ++const _PCMInfo _af_default_float_pcm_mapping = + {1, 0, 0, 0}; + +-_PCMInfo _af_default_double_pcm_mapping = ++const _PCMInfo _af_default_double_pcm_mapping = + {1, 0, 0, 0}; + + /* +diff -ur audiofile-0.2.6-orig/libaudiofile/query.c audiofile-0.2.6-mine/libaudiofile/query.c +--- audiofile-0.2.6-orig/libaudiofile/query.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/query.c 2006-03-22 01:55:23.070923000 -0500 +@@ -43,8 +43,8 @@ + #include "compression.h" + #include "instrument.h" + +-extern _Unit _af_units[]; +-extern _CompressionUnit _af_compression[]; ++extern const _Unit _af_units[]; ++extern const _CompressionUnit _af_compression[]; + + AUpvlist _afQueryFileFormat (int arg1, int arg2, int arg3, int arg4); + AUpvlist _afQueryInstrument (int arg1, int arg2, int arg3, int arg4); +diff -ur audiofile-0.2.6-orig/libaudiofile/raw.c audiofile-0.2.6-mine/libaudiofile/raw.c +--- audiofile-0.2.6-orig/libaudiofile/raw.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/raw.c 2006-03-22 02:16:08.563462500 -0500 +@@ -50,7 +50,7 @@ + NULL /* miscellaneous */ + }; + +-int _af_raw_compression_types[_AF_RAW_NUM_COMPTYPES] = ++const int _af_raw_compression_types[_AF_RAW_NUM_COMPTYPES] = + { + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW +diff -ur audiofile-0.2.6-orig/libaudiofile/setup.c audiofile-0.2.6-mine/libaudiofile/setup.c +--- audiofile-0.2.6-orig/libaudiofile/setup.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/setup.c 2006-03-22 02:16:14.567837750 -0500 +@@ -39,7 +39,7 @@ + + extern _Unit _af_units[]; + +-_AFfilesetup _af_default_file_setup = ++const _AFfilesetup _af_default_file_setup = + { + _AF_VALID_FILESETUP, /* valid */ + #if WORDS_BIGENDIAN +@@ -58,7 +58,7 @@ + NULL /* miscellaneous */ + }; + +-_InstrumentSetup _af_default_instrumentsetup = ++const _InstrumentSetup _af_default_instrumentsetup = + { + 0, /* id */ + 2, /* loopCount */ +@@ -66,7 +66,7 @@ + AF_FALSE /* loopSet */ + }; + +-_TrackSetup _af_default_tracksetup = ++const _TrackSetup _af_default_tracksetup = + { + 0, + { +diff -ur audiofile-0.2.6-orig/libaudiofile/units.c audiofile-0.2.6-mine/libaudiofile/units.c +--- audiofile-0.2.6-orig/libaudiofile/units.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/units.c 2006-03-22 02:02:12.335201500 -0500 +@@ -56,7 +56,7 @@ + extern int _af_next_compression_types[]; + extern int _af_wave_compression_types[]; + +-_Unit _af_units[_AF_NUM_UNITS] = ++const _Unit _af_units[_AF_NUM_UNITS] = + { + { + AF_FILE_RAWDATA, +@@ -221,7 +221,7 @@ + } + }; + +-_CompressionUnit _af_compression[_AF_NUM_COMPRESSION] = ++const _CompressionUnit _af_compression[_AF_NUM_COMPRESSION] = + { + { + AF_COMPRESSION_NONE, +diff -ur audiofile-0.2.6-orig/libaudiofile/util.c audiofile-0.2.6-mine/libaudiofile/util.c +--- audiofile-0.2.6-orig/libaudiofile/util.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/util.c 2006-03-22 01:54:41.944352750 -0500 +@@ -46,12 +46,12 @@ + #include "byteorder.h" + #include "aupvinternal.h" + +-extern _PCMInfo _af_default_signed_integer_pcm_mappings[]; +-extern _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; +-extern _PCMInfo _af_default_float_pcm_mapping; +-extern _PCMInfo _af_default_double_pcm_mapping; ++extern const _PCMInfo _af_default_signed_integer_pcm_mappings[]; ++extern const _PCMInfo _af_default_unsigned_integer_pcm_mappings[]; ++extern const _PCMInfo _af_default_float_pcm_mapping; ++extern const _PCMInfo _af_default_double_pcm_mapping; + +-extern _CompressionUnit _af_compression[]; ++extern const _CompressionUnit _af_compression[]; + + /* + _af_filesetup_ok and _af_filehandle_ok are sanity check routines +diff -ur audiofile-0.2.6-orig/libaudiofile/wave.c audiofile-0.2.6-mine/libaudiofile/wave.c +--- audiofile-0.2.6-orig/libaudiofile/wave.c 2004-03-06 01:39:23.000000000 -0500 ++++ audiofile-0.2.6-mine/libaudiofile/wave.c 2006-03-22 02:16:29.568775250 -0500 +@@ -49,13 +49,13 @@ + #include "setup.h" + #include "marker.h" + +-int _af_wave_compression_types[_AF_WAVE_NUM_COMPTYPES] = ++const int _af_wave_compression_types[_AF_WAVE_NUM_COMPTYPES] = + { + AF_COMPRESSION_G711_ULAW, + AF_COMPRESSION_G711_ALAW + }; + +-_InstParamInfo _af_wave_inst_params[_AF_WAVE_NUM_INSTPARAMS] = ++const _InstParamInfo _af_wave_inst_params[_AF_WAVE_NUM_INSTPARAMS] = + { + { AF_INST_MIDI_BASENOTE, AU_PVTYPE_LONG, "MIDI base note", {60} }, + { AF_INST_NUMCENTS_DETUNE, AU_PVTYPE_LONG, "Detune in cents", {0} }, diff --git a/packaging/audiofile-multilib.patch b/packaging/audiofile-multilib.patch new file mode 100644 index 0000000..1d600db --- /dev/null +++ b/packaging/audiofile-multilib.patch @@ -0,0 +1,33 @@ +--- audiofile-0.2.6/audiofile-config.in.multilib 2006-07-27 19:23:38.000000000 -0400 ++++ audiofile-0.2.6/audiofile-config.in 2006-07-27 19:25:18.000000000 -0400 +@@ -1,7 +1,7 @@ + #!/bin/sh + +-prefix=@prefix@ +-exec_prefix=@exec_prefix@ ++prefix=`pkg-config --variable prefix audiofile` ++exec_prefix=`pkg-config --variable exec_prefix audiofile` + exec_prefix_set=no + + usage="\ +@@ -36,17 +36,13 @@ + echo $exec_prefix + ;; + --version) +- echo @AUDIOFILE_VERSION@ ++ pkg-config --modversion audiofile + ;; + --cflags) +- if test @includedir@ != /usr/include ; then +- includes=-I@includedir@ +- fi +- echo $includes ++ pkg-config --cflags audiofile + ;; + --libs) +- libdirs=-L@libdir@ +- echo $libdirs -laudiofile -lm ++ pkg-config --libs audiofile + ;; + *) + echo "${usage}" 1>&2 diff --git a/packaging/audiofile-underquoted.patch b/packaging/audiofile-underquoted.patch new file mode 100644 index 0000000..fd892a3 --- /dev/null +++ b/packaging/audiofile-underquoted.patch @@ -0,0 +1,11 @@ +--- audiofile-0.2.5/audiofile.m4.underquoted 2004-07-15 13:18:34.963462705 +0100 ++++ audiofile-0.2.5/audiofile.m4 2004-07-15 13:18:43.976738116 +0100 +@@ -9,7 +9,7 @@ + dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) + dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS. + dnl +-AC_DEFUN(AM_PATH_AUDIOFILE, ++AC_DEFUN([AM_PATH_AUDIOFILE], + [dnl + dnl Get compiler flags and libraries from the audiofile-config script. + dnl diff --git a/packaging/audiofile.changes b/packaging/audiofile.changes new file mode 100644 index 0000000..5037d70 --- /dev/null +++ b/packaging/audiofile.changes @@ -0,0 +1,149 @@ +* Fri Mar 26 2010 Anas Nashif <anas.nashif@intel.com> - 0.2.6 +- Remove Epoch requirement on pkgconfig + +* Thu Apr 23 2009 Passion Zhao <passion.zhao@intel.com> 0.2.6 +- Add audiofile-CVE-2008-5824.diff + +* Mon Apr 13 2009 Anas Nashif <anas.nashif@intel.com> 0.2.6 +- Initial import into Moblin + +* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:0.2.6-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Jul 14 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1:0.2.6-9 +- fix license tag + +* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1:0.2.6-8 +- Autorebuild for GCC 4.3 + +* Fri Aug 24 2007 Adam Jackson <ajax@redhat.com> - 1:0.2.6-7 +- Rebuild for build ID + +* Sat Feb 3 2007 Matthias Clasen <mclasen@redhat.com> - 1:0.2.6-6 +- Corrections from package review + +* Thu Jul 27 2006 Matthias Clasen <mclasen@redhat.com> - 1:0.2.6-5 +- Fix multilib conflicts +- Don't ship static libraries + +* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1:0.2.6-4.1 +- rebuild + +* Mon Apr 17 2006 John (J5) Palmieri <johnp@redhat.com> - 1:0.2.6-4 +- Remove Makefile* from docs so they are not installed + +* Fri Mar 24 2006 Matthias Clasen <mclasen@redhat.com> - 1:0.2.6-3 +- Reduce memory consumption by making data tables const + +* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1:0.2.6-2.2.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1:0.2.6-2.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com> - 0.2.6-2.1 +- rebuilt + +* Thu Mar 17 2005 John (J5) Palmieri <johnp@redhat.com> - 0.2.6-2 +- rebuild for gcc 4.0 + +* Thu Jul 30 2004 Colin Walters <walters@redhat.com> +- Update to 0.2.6 +- Rework description to not contain apostrophe that + makes emacs unhappy + +* Thu Jul 15 2004 Tim Waugh <twaugh@redhat.com> +- Fixed warnings in shipped m4 file. + +* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com> +- rebuilt + +* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com> +- rebuilt + +* Wed Feb 25 2004 Alexander Larsson <alexl@redhat.com> 1:0.2.5-1 +- update to 0.2.5 + +* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com> +- rebuilt + +* Sun Jun 8 2003 Tim Powers <timp@redhat.com> 1:0.2.3-7.1 +- rebuild for RHEL + +* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com> +- rebuilt + +* Tue Jun 3 2003 Jeff Johnson <jbj@redhat.com> +- add explicit epoch's where needed. + +* Mon Feb 10 2003 Bill Nottingham <notting@redhat.com> +- fix URL (#71010) + +* Wed Jan 22 2003 Tim Powers <timp@redhat.com> +- rebuilt + +* Tue Dec 03 2002 Elliot Lee <sopwith@redhat.com> +- Remove unpackaged files + +* Fri Jun 21 2002 Tim Powers <timp@redhat.com> +- automated rebuild + +* Thu May 23 2002 Tim Powers <timp@redhat.com> +- automated rebuild + +* Tue Jan 8 2002 Owen Taylor <otaylor@redhat.com> +- Update to 0.2.3, update URLs + +* Mon Jun 25 2001 Preston Brown <pbrown@redhat.com> +- explicit requirement of -devel package on main package (#45205) + +* Tue Apr 17 2001 Jonathan Blandford <jrb@redhat.com> +- Bumped version to 0.2.1 + +* Mon Dec 11 2000 Preston Brown <pbrown@redhat.com> +- upgrade to 0.1.11. + +* Mon Aug 14 2000 Than Ngo <than@redhat.com> +- add ldconfig to %post and %postun (Bug #15413) + +* Fri Aug 11 2000 Jonathan Blandford <jrb@redhat.com> +- Up Epoch and release + +* Wed Jul 12 2000 Prospector <bugzilla@redhat.com> +- automatic rebuild + +* Mon Jun 12 2000 Preston Brown <pbrown@redhat.com> +- use FHS macros + +* Thu Feb 03 2000 Preston Brown <pbrown@redhat.com> +- strip library, use configure macro. + +* Tue Sep 14 1999 Elliot Lee <sopwith@redhat.com> +- 0.1.8pre (take whatever is in CVS). + +* Fri Aug 13 1999 Michael Fulbrght <drmike@redhat.com> +- version 1.7.0 + +* Sun Apr 18 1999 Matt Wilson <msw@redhat.com> +- updated patch from DaveM + +* Fri Apr 16 1999 Matt Wilson <msw@redhat.com> +- added patch from Dave Miller to disable byte swapping in decoding + +* Fri Mar 19 1999 Michael Fulbright <drmike@redhat.com> +- strip binaries before packaging + +* Thu Feb 25 1999 Michael Fulbright <drmike@redhat.com> +- Version 0.1.6 + +* Sun Feb 21 1999 Michael Fulbright <drmike@redhat.com> +- Removed libtoolize from %build + +* Wed Feb 3 1999 Jonathan Blandfor <jrb@redhat.com> +- Newer version with bug fix. Upped release. + +* Wed Dec 16 1998 Michael Fulbright <drmike@redhat.com> +- integrating into rawhide release at GNOME freeze + +* Fri Nov 20 1998 Michael Fulbright <drmike@redhat.com> +- First try at a spec file diff --git a/packaging/audiofile.spec b/packaging/audiofile.spec new file mode 100644 index 0000000..1a8fb7d --- /dev/null +++ b/packaging/audiofile.spec @@ -0,0 +1,73 @@ +Summary: A library for accessing various audio file formats +Name: audiofile +Version: 0.2.6 +Release: 10 +License: LGPLv2+ +Group: System/Libraries +Source: ftp://ftp.gnome.org/pub/gnome/sources/audiofile/0.2/audiofile-%{version}.tar.bz2 +URL: http://www.68k.org/~michael/audiofile/ +Patch0: audiofile-underquoted.patch +Patch1: audiofile-const.patch +Patch2: audiofile-multilib.patch +Patch3: audiofile-CVE-2008-5824.diff +BuildRequires: libtool + +%description +The Audio File library is an implementation of the Audio File Library +from SGI, which provides an API for accessing audio file formats like +AIFF/AIFF-C, WAVE, and NeXT/Sun .snd/.au files. This library is used +by the EsounD daemon. + +Install audiofile if you are installing EsounD or you need an API for +any of the sound file formats it can handle. + +%package devel +Summary: Development files for Audio File applications +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +The audiofile-devel package contains libraries, include files, and +other resources you can use to develop Audio File applications. + +%prep +%setup -q +%patch0 -p1 -b .underquoted +%patch1 -p1 -b .const +%patch2 -p1 -b .multilib +%patch3 -p1 -b .CVE-2008-5824 + +%build +%configure --disable-static +make %{?_smp_mflags} LIBTOOL="/usr/bin/libtool" + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR="$RPM_BUILD_ROOT" install + +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/*.a +rm -f docs/Makefile* + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) +%doc COPYING TODO README ChangeLog docs +%{_bindir}/sfconvert +%{_bindir}/sfinfo +%{_libdir}/lib*.so.* + +%files devel +%defattr(-, root, root) +%{_bindir}/audiofile-config +%{_libdir}/lib*.so +%{_libdir}/pkgconfig/*.pc +%{_includedir}/* +%{_datadir}/aclocal/* + diff --git a/sfcommands/Makefile.am b/sfcommands/Makefile.am new file mode 100644 index 0000000..f897435 --- /dev/null +++ b/sfcommands/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(top_srcdir)/libaudiofile + +EXTRA_DIST = README + +bin_PROGRAMS = sfconvert sfinfo + +sfconvert_SOURCES = sfconvert.c printinfo.c + +sfinfo_SOURCES = sfinfo.c printinfo.c + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la diff --git a/sfcommands/Makefile.in b/sfcommands/Makefile.in new file mode 100644 index 0000000..caaed51 --- /dev/null +++ b/sfcommands/Makefile.in @@ -0,0 +1,358 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +INCLUDES = -I$(top_srcdir)/libaudiofile + +EXTRA_DIST = README + +bin_PROGRAMS = sfconvert sfinfo + +sfconvert_SOURCES = sfconvert.c printinfo.c + +sfinfo_SOURCES = sfinfo.c printinfo.c + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +subdir = sfcommands +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = sfconvert$(EXEEXT) sfinfo$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_sfconvert_OBJECTS = sfconvert.$(OBJEXT) printinfo.$(OBJEXT) +sfconvert_OBJECTS = $(am_sfconvert_OBJECTS) +sfconvert_LDADD = $(LDADD) +sfconvert_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +sfconvert_LDFLAGS = +am_sfinfo_OBJECTS = sfinfo.$(OBJEXT) printinfo.$(OBJEXT) +sfinfo_OBJECTS = $(am_sfinfo_OBJECTS) +sfinfo_LDADD = $(LDADD) +sfinfo_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +sfinfo_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/printinfo.Po $(DEPDIR)/sfconvert.Po \ +@AMDEP_TRUE@ $(DEPDIR)/sfinfo.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = $(sfconvert_SOURCES) $(sfinfo_SOURCES) +DIST_COMMON = README Makefile.am Makefile.in +SOURCES = $(sfconvert_SOURCES) $(sfinfo_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu sfcommands/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed '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) +sfconvert$(EXEEXT): $(sfconvert_OBJECTS) $(sfconvert_DEPENDENCIES) + @rm -f sfconvert$(EXEEXT) + $(LINK) $(sfconvert_LDFLAGS) $(sfconvert_OBJECTS) $(sfconvert_LDADD) $(LIBS) +sfinfo$(EXEEXT): $(sfinfo_OBJECTS) $(sfinfo_DEPENDENCIES) + @rm -f sfinfo$(EXEEXT) + $(LINK) $(sfinfo_LDFLAGS) $(sfinfo_OBJECTS) $(sfinfo_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/printinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sfconvert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sfinfo.Po@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +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)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +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 clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/sfcommands/README b/sfcommands/README new file mode 100644 index 0000000..51b1d87 --- /dev/null +++ b/sfcommands/README @@ -0,0 +1,5 @@ +For the most part, sfinfo is just as it is under Irix. + +For the most part, sfconvert is much more limited than its Irix +counterpart. This will be improved as I implement more of the Audio +File Library. For now it is capable of converting only file formats. diff --git a/sfcommands/printinfo.c b/sfcommands/printinfo.c new file mode 100644 index 0000000..0214180 --- /dev/null +++ b/sfcommands/printinfo.c @@ -0,0 +1,185 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + printinfo.c + + This file contains the function used by the sf commands to print + information regarding a file. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdio.h> +#include <stdlib.h> + +char *copyrightstring (AFfilehandle file); + +void printfileinfo (char *filename) +{ + int version; + AFfilehandle file; + int sampleFormat, sampleWidth, byteOrder, compressionType; + char *copyright, *formatstring, *labelstring; + + file = afOpenFile(filename, "r", NULL); + + if (file == NULL) + return; + + formatstring = afQueryPointer(AF_QUERYTYPE_FILEFMT, AF_QUERY_DESC, + afGetFileFormat(file, &version), 0, 0); + labelstring = afQueryPointer(AF_QUERYTYPE_FILEFMT, AF_QUERY_LABEL, + afGetFileFormat(file, &version), 0, 0); + + if (formatstring == NULL || labelstring == NULL) + return; + + printf("File Name %s\n", filename); + printf("File Format %s (%s)\n", formatstring, labelstring); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + byteOrder = afGetByteOrder(file, AF_DEFAULT_TRACK); + + printf("Data Format "); + + compressionType = afGetCompression(file, AF_DEFAULT_TRACK); + + if (compressionType == AF_COMPRESSION_NONE) + { + switch (sampleFormat) + { + case AF_SAMPFMT_TWOSCOMP: + printf("%d-bit integer (2's complement, %s)", + sampleWidth, + byteOrder == AF_BYTEORDER_BIGENDIAN ? + "big endian" : "little endian"); + break; + case AF_SAMPFMT_UNSIGNED: + printf("%d-bit integer (unsigned, %s)", + sampleWidth, + byteOrder == AF_BYTEORDER_BIGENDIAN ? + "big endian" : "little endian"); + break; + case AF_SAMPFMT_FLOAT: + printf("single-precision (32-bit) floating point, %s", + byteOrder == AF_BYTEORDER_BIGENDIAN ? + "big endian" : "little endian"); + break; + case AF_SAMPFMT_DOUBLE: + printf("double-precision (64-bit) floating point, %s", + byteOrder == AF_BYTEORDER_BIGENDIAN ? + "big endian" : "little endian"); + break; + default: + printf("unknown"); + break; + } + } + else + { + char *compressionName; + compressionName = afQueryPointer(AF_QUERYTYPE_COMPRESSION, + AF_QUERY_NAME, compressionType, + 0, 0); + + if (compressionName == NULL) + printf("unknown compression"); + else + printf("%s compression", compressionName); + } + printf("\n"); + +#if SIZEOF_OFF_T > SIZEOF_LONG + printf("Audio Data %lld bytes begins at offset %lld (%llx hex)\n", +#else + printf("Audio Data %ld bytes begins at offset %ld (%lx hex)\n", +#endif + afGetTrackBytes(file, AF_DEFAULT_TRACK), + afGetDataOffset(file, AF_DEFAULT_TRACK), + afGetDataOffset(file, AF_DEFAULT_TRACK)); + +#if SIZEOF_OFF_T > SIZEOF_LONG + printf(" %d channel%s, %lld frames\n", +#else + printf(" %d channel%s, %ld frames\n", +#endif + afGetChannels(file, AF_DEFAULT_TRACK), + afGetChannels(file, AF_DEFAULT_TRACK) > 1 ? "s" : "", + afGetFrameCount(file, AF_DEFAULT_TRACK)); + + printf("Sampling Rate %.2f Hz\n", afGetRate(file, AF_DEFAULT_TRACK)); + + printf("Duration %.3f seconds\n", + afGetFrameCount(file, AF_DEFAULT_TRACK) / + afGetRate(file, AF_DEFAULT_TRACK)); + + copyright = copyrightstring(file); + if (copyright) + { + printf("Copyright %s\n", copyright); + free(copyright); + } + + afCloseFile(file); +} + +char *copyrightstring (AFfilehandle file) +{ + char *copyright = NULL; + int *miscids; + int i, misccount; + + misccount = afGetMiscIDs(file, NULL); + miscids = malloc(sizeof (int) * misccount); + afGetMiscIDs(file, miscids); + + for (i=0; i<misccount; i++) + { + char *data; + int datasize; + + if (afGetMiscType(file, miscids[i]) != AF_MISC_COPY) + continue; + + /* + If this code executes, the miscellaneous chunk is a + copyright chunk. + */ + datasize = afGetMiscSize(file, miscids[i]); + data = malloc(datasize); + afReadMisc(file, miscids[i], data, datasize); + copyright = data; + break; + } + + free(miscids); + + return copyright; +} diff --git a/sfcommands/sfconvert.c b/sfcommands/sfconvert.c new file mode 100644 index 0000000..ee389cc --- /dev/null +++ b/sfcommands/sfconvert.c @@ -0,0 +1,305 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, Inc. + Copyright (C) 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + sfconvert.c + + sfconvert is a program which can convert various parameters of + sound files. + + The real IRIX version has a lot of options. Mine can only + convert the file format. I'm working on expanding the + capabilities of this command. +*/ + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +typedef int bool; + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#define BUFFER_FRAME_COUNT 65536 + +void usageerror (void); +void printfileinfo (char *filename); +int copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid, + AFframecount totalFrameCount); + +int main (int argc, char **argv) +{ + int i = 1; + char *infilename, *outfilename; + int fileFormat, outFileFormat = AF_FILE_UNKNOWN; + + AFfilehandle infile, outfile; + AFfilesetup outfilesetup; + int sampleFormat, sampleWidth, channelCount; + double sampleRate; + int outSampleFormat = -1, outSampleWidth = -1, + outChannelCount = -1; + double outMaxAmp = 1.0; + + AFframecount totalFrames; + + if (argc < 3) + usageerror(); + + infilename = argv[1]; + outfilename = argv[2]; + + i = 3; + + while (i < argc) + { + if (!strcmp(argv[i], "format")) + { + if (i + 1 >= argc) + usageerror(); + if (!strcmp(argv[i+1], "aiff")) + outFileFormat = AF_FILE_AIFF; + else if (!strcmp(argv[i+1], "aifc")) + outFileFormat = AF_FILE_AIFFC; + else if (!strcmp(argv[i+1], "wave")) + outFileFormat = AF_FILE_WAVE; + else if (!strcmp(argv[i+1], "next")) + outFileFormat = AF_FILE_NEXTSND; + else if (!strcmp(argv[i+1], "bics")) + outFileFormat = AF_FILE_BICSF; + else + { + fprintf(stderr, "sfconvert: Unknown format %s.\n", argv[i+1]); + exit(EXIT_FAILURE); + } + + /* Increment for argument. */ + i++; + } + else if (!strcmp(argv[i], "channels")) + { + if (i + 1 >= argc) + usageerror(); + + outChannelCount = atoi(argv[i+1]); + if (outChannelCount < 1) + usageerror(); + + /* Increment for argument. */ + i++; + } + else if (!strcmp(argv[i], "float")) + { + if (i + 1 >= argc) + usageerror(); + + outSampleFormat = AF_SAMPFMT_FLOAT; + outSampleWidth = 32; + outMaxAmp = atof(argv[i+1]); + + /* Increment for argument. */ + i++; + } + else if (!strcmp(argv[i], "integer")) + { + if (i + 2 >= argc) + usageerror(); + + outSampleWidth = atoi(argv[i+1]); + if (outSampleWidth < 1 || outSampleWidth > 32) + usageerror(); + + if (!strcmp(argv[i+2], "2scomp")) + outSampleFormat = AF_SAMPFMT_TWOSCOMP; + else if (!strcmp(argv[i+2], "unsigned")) + outSampleFormat = AF_SAMPFMT_UNSIGNED; + else + usageerror(); + + /* Increment for arguments. */ + i += 2; + } + else + { + printf("Unrecognized command %s\n", argv[i]); + } + + i++; + } + + infile = afOpenFile(infilename, "r", AF_NULL_FILESETUP); + if (infile == AF_NULL_FILEHANDLE) + { + printf("Could not open file '%s' for reading.\n", infilename); + return 1; + } + + /* Get audio format parameters from input file. */ + fileFormat = afGetFileFormat(infile, NULL); + totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK); + channelCount = afGetChannels(infile, AF_DEFAULT_TRACK); + sampleRate = afGetRate(infile, AF_DEFAULT_TRACK); + afGetSampleFormat(infile, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + + /* Initialize output audio format parameters. */ + outfilesetup = afNewFileSetup(); + + if (outFileFormat == -1) + outFileFormat = fileFormat; + + if (outSampleFormat == -1 || outSampleWidth == -1) + { + outSampleFormat = sampleFormat; + outSampleWidth = sampleWidth; + } + + if (outChannelCount == -1) + outChannelCount = channelCount; + + afInitFileFormat(outfilesetup, outFileFormat); + afInitSampleFormat(outfilesetup, AF_DEFAULT_TRACK, outSampleFormat, + outSampleWidth); + afInitChannels(outfilesetup, AF_DEFAULT_TRACK, outChannelCount); + afInitRate(outfilesetup, AF_DEFAULT_TRACK, sampleRate); + + outfile = afOpenFile(outfilename, "w", outfilesetup); + if (outfile == AF_NULL_FILEHANDLE) + { + printf("Could not open file '%s' for writing.\n", outfilename); + return 1; + } + + /* + Set the output file's virtual audio format parameters + to match the audio format parameters of the input file. + */ + afSetVirtualChannels(outfile, AF_DEFAULT_TRACK, channelCount); + afSetVirtualSampleFormat(outfile, AF_DEFAULT_TRACK, sampleFormat, + sampleWidth); + + afFreeFileSetup(outfilesetup); + + copyaudiodata(infile, outfile, AF_DEFAULT_TRACK, totalFrames); + + afCloseFile(infile); + afCloseFile(outfile); + + printfileinfo(infilename); + putchar('\n'); + printfileinfo(outfilename); + + return EXIT_SUCCESS; +} + +void usageerror (void) +{ + printf("usage: sfconvert infile outfile [ options ... ] [ output keywords ... ]\n"); + printf("\n"); + + printf("Where keywords specify format of input or output soundfile:\n"); + printf(" byteorder e endian (e is big or little)\n"); + printf(" channels n n-channel file (1 or 2)\n"); + printf(" format f file format f (see below)\n"); + printf(" integer n s n-bit integer file, where s is one of\n"); + printf(" 2scomp: 2's complement signed data\n"); + printf(" unsigned: unsigned data\n"); + printf(" float m floating point file, maxamp m (usually 1.0)\n"); + printf("\n"); + + printf("Currently supported formats are:\n"); + printf("\n"); + printf(" aiff Audio Interchange File Format\n"); + printf(" aifc AIFF-C File Format\n"); + printf(" next NeXT/Sun Format\n"); + printf(" wave MS RIFF WAVE Format\n"); + printf(" bics Berkeley/IRCAM/CARL Sound File Format\n"); + printf("\n"); + + exit(EXIT_FAILURE); +} + +/* + Copy audio data from one file to another. This function + assumes that the virtual sample formats of the two files + match. +*/ +int copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid, + AFframecount totalFrameCount) +{ + AFframecount totalFramesWritten = 0; + void *buffer; + int frameSize; + bool ok = TRUE, done = FALSE; + + frameSize = afGetVirtualFrameSize(infile, trackid, 1); + + buffer = malloc(BUFFER_FRAME_COUNT * frameSize); + + while (done == FALSE) + { + AFframecount framesToRead = BUFFER_FRAME_COUNT; + AFframecount framesRead, framesWritten; + + framesRead = afReadFrames(infile, trackid, buffer, + framesToRead); + + if (framesRead < 0) + { + fprintf(stderr, "Bad read of audio track data.\n"); + ok = FALSE; + done = TRUE; + } + + framesWritten = afWriteFrames(outfile, trackid, buffer, + framesRead); + + if (framesWritten < 0) + { + fprintf(stderr, "Bad write of audio track data.\n"); + ok = FALSE; + done = TRUE; + } + else + { + totalFramesWritten += framesWritten; + } + + if (totalFramesWritten == totalFrameCount) + done = TRUE; + } + + free(buffer); + + return ok; +} diff --git a/sfcommands/sfinfo.c b/sfcommands/sfinfo.c new file mode 100644 index 0000000..bb81568 --- /dev/null +++ b/sfcommands/sfinfo.c @@ -0,0 +1,61 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + sfinfo.c + + This program displays information about audio files. +*/ + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdio.h> + +/* +File Name satan.aiff +File Format Audio Interchange File Format (aiff) +Data Format 16-bit integer (2's complement, big endian) +Audio Data 512 KBytes begins at offset 124 (7C hex) + 2 channels, 131072 frames +Sampling Rate 44.1 KHz +Duration 2.97 seconds +*/ + +void printfileinfo (char *filename); + +int main (int argc, char **argv) +{ + int i = 1; + + while (i < argc) + { + printfileinfo(argv[i]); + i++; + if (i < argc) + putchar('\n'); + } + + return 0; +} diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..1dda51c --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,45 @@ +INCLUDES = -I$(top_srcdir)/libaudiofile + +noinst_PROGRAMS = \ + error \ + floatto24 \ + transparency \ + miscread \ + miscwrite \ + query2 \ + testaupv \ + writeaiff \ + writeircam \ + writenext \ + writewave \ + writeraw \ + writeavr \ + writeiff \ + writenist \ + writeulaw \ + writealaw \ + loop \ + instparamwrite \ + instparamtest \ + sixteen-to-eight \ + testfloat \ + twentyfour \ + twentyfour2 \ + pipe \ + testmarkers \ + testchannelmatrix \ + printmarkers \ + seek + +EXTRA_DIST = transparency.sh misc.sh pipe.sh + +TESTS = error writeaiff writeircam writenext writewave writeraw \ + writeavr writeiff writenist \ + writeulaw writealaw \ + misc.sh transparency.sh pipe.sh \ + query2 sixteen-to-eight twentyfour twentyfour2 floatto24 \ + testfloat testmarkers testchannelmatrix seek + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la diff --git a/test/Makefile.in b/test/Makefile.in new file mode 100644 index 0000000..4287dbd --- /dev/null +++ b/test/Makefile.in @@ -0,0 +1,702 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +INCLUDES = -I$(top_srcdir)/libaudiofile + +noinst_PROGRAMS = \ + error \ + floatto24 \ + transparency \ + miscread \ + miscwrite \ + query2 \ + testaupv \ + writeaiff \ + writeircam \ + writenext \ + writewave \ + writeraw \ + writeavr \ + writeiff \ + writenist \ + writeulaw \ + writealaw \ + loop \ + instparamwrite \ + instparamtest \ + sixteen-to-eight \ + testfloat \ + twentyfour \ + twentyfour2 \ + pipe \ + testmarkers \ + testchannelmatrix \ + printmarkers \ + seek + + +EXTRA_DIST = transparency.sh misc.sh pipe.sh + +TESTS = error writeaiff writeircam writenext writewave writeraw \ + writeavr writeiff writenist \ + writeulaw writealaw \ + misc.sh transparency.sh pipe.sh \ + query2 sixteen-to-eight twentyfour twentyfour2 floatto24 \ + testfloat testmarkers testchannelmatrix seek + + +LDADD = $(top_builddir)/libaudiofile/libaudiofile.la + +DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +subdir = test +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +noinst_PROGRAMS = error$(EXEEXT) floatto24$(EXEEXT) \ + transparency$(EXEEXT) miscread$(EXEEXT) miscwrite$(EXEEXT) \ + query2$(EXEEXT) testaupv$(EXEEXT) writeaiff$(EXEEXT) \ + writeircam$(EXEEXT) writenext$(EXEEXT) writewave$(EXEEXT) \ + writeraw$(EXEEXT) writeavr$(EXEEXT) writeiff$(EXEEXT) \ + writenist$(EXEEXT) writeulaw$(EXEEXT) writealaw$(EXEEXT) \ + loop$(EXEEXT) instparamwrite$(EXEEXT) instparamtest$(EXEEXT) \ + sixteen-to-eight$(EXEEXT) testfloat$(EXEEXT) \ + twentyfour$(EXEEXT) twentyfour2$(EXEEXT) pipe$(EXEEXT) \ + testmarkers$(EXEEXT) testchannelmatrix$(EXEEXT) \ + printmarkers$(EXEEXT) seek$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +error_SOURCES = error.c +error_OBJECTS = error.$(OBJEXT) +error_LDADD = $(LDADD) +error_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +error_LDFLAGS = +floatto24_SOURCES = floatto24.c +floatto24_OBJECTS = floatto24.$(OBJEXT) +floatto24_LDADD = $(LDADD) +floatto24_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +floatto24_LDFLAGS = +instparamtest_SOURCES = instparamtest.c +instparamtest_OBJECTS = instparamtest.$(OBJEXT) +instparamtest_LDADD = $(LDADD) +instparamtest_DEPENDENCIES = \ + $(top_builddir)/libaudiofile/libaudiofile.la +instparamtest_LDFLAGS = +instparamwrite_SOURCES = instparamwrite.c +instparamwrite_OBJECTS = instparamwrite.$(OBJEXT) +instparamwrite_LDADD = $(LDADD) +instparamwrite_DEPENDENCIES = \ + $(top_builddir)/libaudiofile/libaudiofile.la +instparamwrite_LDFLAGS = +loop_SOURCES = loop.c +loop_OBJECTS = loop.$(OBJEXT) +loop_LDADD = $(LDADD) +loop_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +loop_LDFLAGS = +miscread_SOURCES = miscread.c +miscread_OBJECTS = miscread.$(OBJEXT) +miscread_LDADD = $(LDADD) +miscread_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +miscread_LDFLAGS = +miscwrite_SOURCES = miscwrite.c +miscwrite_OBJECTS = miscwrite.$(OBJEXT) +miscwrite_LDADD = $(LDADD) +miscwrite_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +miscwrite_LDFLAGS = +pipe_SOURCES = pipe.c +pipe_OBJECTS = pipe.$(OBJEXT) +pipe_LDADD = $(LDADD) +pipe_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +pipe_LDFLAGS = +printmarkers_SOURCES = printmarkers.c +printmarkers_OBJECTS = printmarkers.$(OBJEXT) +printmarkers_LDADD = $(LDADD) +printmarkers_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +printmarkers_LDFLAGS = +query2_SOURCES = query2.c +query2_OBJECTS = query2.$(OBJEXT) +query2_LDADD = $(LDADD) +query2_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +query2_LDFLAGS = +seek_SOURCES = seek.c +seek_OBJECTS = seek.$(OBJEXT) +seek_LDADD = $(LDADD) +seek_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +seek_LDFLAGS = +sixteen_to_eight_SOURCES = sixteen-to-eight.c +sixteen_to_eight_OBJECTS = sixteen-to-eight.$(OBJEXT) +sixteen_to_eight_LDADD = $(LDADD) +sixteen_to_eight_DEPENDENCIES = \ + $(top_builddir)/libaudiofile/libaudiofile.la +sixteen_to_eight_LDFLAGS = +testaupv_SOURCES = testaupv.c +testaupv_OBJECTS = testaupv.$(OBJEXT) +testaupv_LDADD = $(LDADD) +testaupv_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +testaupv_LDFLAGS = +testchannelmatrix_SOURCES = testchannelmatrix.c +testchannelmatrix_OBJECTS = testchannelmatrix.$(OBJEXT) +testchannelmatrix_LDADD = $(LDADD) +testchannelmatrix_DEPENDENCIES = \ + $(top_builddir)/libaudiofile/libaudiofile.la +testchannelmatrix_LDFLAGS = +testfloat_SOURCES = testfloat.c +testfloat_OBJECTS = testfloat.$(OBJEXT) +testfloat_LDADD = $(LDADD) +testfloat_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +testfloat_LDFLAGS = +testmarkers_SOURCES = testmarkers.c +testmarkers_OBJECTS = testmarkers.$(OBJEXT) +testmarkers_LDADD = $(LDADD) +testmarkers_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +testmarkers_LDFLAGS = +transparency_SOURCES = transparency.c +transparency_OBJECTS = transparency.$(OBJEXT) +transparency_LDADD = $(LDADD) +transparency_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +transparency_LDFLAGS = +twentyfour_SOURCES = twentyfour.c +twentyfour_OBJECTS = twentyfour.$(OBJEXT) +twentyfour_LDADD = $(LDADD) +twentyfour_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +twentyfour_LDFLAGS = +twentyfour2_SOURCES = twentyfour2.c +twentyfour2_OBJECTS = twentyfour2.$(OBJEXT) +twentyfour2_LDADD = $(LDADD) +twentyfour2_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +twentyfour2_LDFLAGS = +writeaiff_SOURCES = writeaiff.c +writeaiff_OBJECTS = writeaiff.$(OBJEXT) +writeaiff_LDADD = $(LDADD) +writeaiff_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeaiff_LDFLAGS = +writealaw_SOURCES = writealaw.c +writealaw_OBJECTS = writealaw.$(OBJEXT) +writealaw_LDADD = $(LDADD) +writealaw_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writealaw_LDFLAGS = +writeavr_SOURCES = writeavr.c +writeavr_OBJECTS = writeavr.$(OBJEXT) +writeavr_LDADD = $(LDADD) +writeavr_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeavr_LDFLAGS = +writeiff_SOURCES = writeiff.c +writeiff_OBJECTS = writeiff.$(OBJEXT) +writeiff_LDADD = $(LDADD) +writeiff_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeiff_LDFLAGS = +writeircam_SOURCES = writeircam.c +writeircam_OBJECTS = writeircam.$(OBJEXT) +writeircam_LDADD = $(LDADD) +writeircam_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeircam_LDFLAGS = +writenext_SOURCES = writenext.c +writenext_OBJECTS = writenext.$(OBJEXT) +writenext_LDADD = $(LDADD) +writenext_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writenext_LDFLAGS = +writenist_SOURCES = writenist.c +writenist_OBJECTS = writenist.$(OBJEXT) +writenist_LDADD = $(LDADD) +writenist_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writenist_LDFLAGS = +writeraw_SOURCES = writeraw.c +writeraw_OBJECTS = writeraw.$(OBJEXT) +writeraw_LDADD = $(LDADD) +writeraw_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeraw_LDFLAGS = +writeulaw_SOURCES = writeulaw.c +writeulaw_OBJECTS = writeulaw.$(OBJEXT) +writeulaw_LDADD = $(LDADD) +writeulaw_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writeulaw_LDFLAGS = +writewave_SOURCES = writewave.c +writewave_OBJECTS = writewave.$(OBJEXT) +writewave_LDADD = $(LDADD) +writewave_DEPENDENCIES = $(top_builddir)/libaudiofile/libaudiofile.la +writewave_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/error.Po $(DEPDIR)/floatto24.Po \ +@AMDEP_TRUE@ $(DEPDIR)/instparamtest.Po \ +@AMDEP_TRUE@ $(DEPDIR)/instparamwrite.Po $(DEPDIR)/loop.Po \ +@AMDEP_TRUE@ $(DEPDIR)/miscread.Po $(DEPDIR)/miscwrite.Po \ +@AMDEP_TRUE@ $(DEPDIR)/pipe.Po $(DEPDIR)/printmarkers.Po \ +@AMDEP_TRUE@ $(DEPDIR)/query2.Po $(DEPDIR)/seek.Po \ +@AMDEP_TRUE@ $(DEPDIR)/sixteen-to-eight.Po $(DEPDIR)/testaupv.Po \ +@AMDEP_TRUE@ $(DEPDIR)/testchannelmatrix.Po \ +@AMDEP_TRUE@ $(DEPDIR)/testfloat.Po $(DEPDIR)/testmarkers.Po \ +@AMDEP_TRUE@ $(DEPDIR)/transparency.Po $(DEPDIR)/twentyfour.Po \ +@AMDEP_TRUE@ $(DEPDIR)/twentyfour2.Po $(DEPDIR)/writeaiff.Po \ +@AMDEP_TRUE@ $(DEPDIR)/writealaw.Po $(DEPDIR)/writeavr.Po \ +@AMDEP_TRUE@ $(DEPDIR)/writeiff.Po $(DEPDIR)/writeircam.Po \ +@AMDEP_TRUE@ $(DEPDIR)/writenext.Po $(DEPDIR)/writenist.Po \ +@AMDEP_TRUE@ $(DEPDIR)/writeraw.Po $(DEPDIR)/writeulaw.Po \ +@AMDEP_TRUE@ $(DEPDIR)/writewave.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +DIST_SOURCES = error.c floatto24.c instparamtest.c instparamwrite.c \ + loop.c miscread.c miscwrite.c pipe.c printmarkers.c query2.c \ + seek.c sixteen-to-eight.c testaupv.c testchannelmatrix.c \ + testfloat.c testmarkers.c transparency.c twentyfour.c \ + twentyfour2.c writeaiff.c writealaw.c writeavr.c writeiff.c \ + writeircam.c writenext.c writenist.c writeraw.c writeulaw.c \ + writewave.c +DIST_COMMON = Makefile.am Makefile.in +SOURCES = error.c floatto24.c instparamtest.c instparamwrite.c loop.c miscread.c miscwrite.c pipe.c printmarkers.c query2.c seek.c sixteen-to-eight.c testaupv.c testchannelmatrix.c testfloat.c testmarkers.c transparency.c twentyfour.c twentyfour2.c writeaiff.c writealaw.c writeavr.c writeiff.c writeircam.c writenext.c writenist.c writeraw.c writeulaw.c writewave.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +error$(EXEEXT): $(error_OBJECTS) $(error_DEPENDENCIES) + @rm -f error$(EXEEXT) + $(LINK) $(error_LDFLAGS) $(error_OBJECTS) $(error_LDADD) $(LIBS) +floatto24$(EXEEXT): $(floatto24_OBJECTS) $(floatto24_DEPENDENCIES) + @rm -f floatto24$(EXEEXT) + $(LINK) $(floatto24_LDFLAGS) $(floatto24_OBJECTS) $(floatto24_LDADD) $(LIBS) +instparamtest$(EXEEXT): $(instparamtest_OBJECTS) $(instparamtest_DEPENDENCIES) + @rm -f instparamtest$(EXEEXT) + $(LINK) $(instparamtest_LDFLAGS) $(instparamtest_OBJECTS) $(instparamtest_LDADD) $(LIBS) +instparamwrite$(EXEEXT): $(instparamwrite_OBJECTS) $(instparamwrite_DEPENDENCIES) + @rm -f instparamwrite$(EXEEXT) + $(LINK) $(instparamwrite_LDFLAGS) $(instparamwrite_OBJECTS) $(instparamwrite_LDADD) $(LIBS) +loop$(EXEEXT): $(loop_OBJECTS) $(loop_DEPENDENCIES) + @rm -f loop$(EXEEXT) + $(LINK) $(loop_LDFLAGS) $(loop_OBJECTS) $(loop_LDADD) $(LIBS) +miscread$(EXEEXT): $(miscread_OBJECTS) $(miscread_DEPENDENCIES) + @rm -f miscread$(EXEEXT) + $(LINK) $(miscread_LDFLAGS) $(miscread_OBJECTS) $(miscread_LDADD) $(LIBS) +miscwrite$(EXEEXT): $(miscwrite_OBJECTS) $(miscwrite_DEPENDENCIES) + @rm -f miscwrite$(EXEEXT) + $(LINK) $(miscwrite_LDFLAGS) $(miscwrite_OBJECTS) $(miscwrite_LDADD) $(LIBS) +pipe$(EXEEXT): $(pipe_OBJECTS) $(pipe_DEPENDENCIES) + @rm -f pipe$(EXEEXT) + $(LINK) $(pipe_LDFLAGS) $(pipe_OBJECTS) $(pipe_LDADD) $(LIBS) +printmarkers$(EXEEXT): $(printmarkers_OBJECTS) $(printmarkers_DEPENDENCIES) + @rm -f printmarkers$(EXEEXT) + $(LINK) $(printmarkers_LDFLAGS) $(printmarkers_OBJECTS) $(printmarkers_LDADD) $(LIBS) +query2$(EXEEXT): $(query2_OBJECTS) $(query2_DEPENDENCIES) + @rm -f query2$(EXEEXT) + $(LINK) $(query2_LDFLAGS) $(query2_OBJECTS) $(query2_LDADD) $(LIBS) +seek$(EXEEXT): $(seek_OBJECTS) $(seek_DEPENDENCIES) + @rm -f seek$(EXEEXT) + $(LINK) $(seek_LDFLAGS) $(seek_OBJECTS) $(seek_LDADD) $(LIBS) +sixteen-to-eight$(EXEEXT): $(sixteen_to_eight_OBJECTS) $(sixteen_to_eight_DEPENDENCIES) + @rm -f sixteen-to-eight$(EXEEXT) + $(LINK) $(sixteen_to_eight_LDFLAGS) $(sixteen_to_eight_OBJECTS) $(sixteen_to_eight_LDADD) $(LIBS) +testaupv$(EXEEXT): $(testaupv_OBJECTS) $(testaupv_DEPENDENCIES) + @rm -f testaupv$(EXEEXT) + $(LINK) $(testaupv_LDFLAGS) $(testaupv_OBJECTS) $(testaupv_LDADD) $(LIBS) +testchannelmatrix$(EXEEXT): $(testchannelmatrix_OBJECTS) $(testchannelmatrix_DEPENDENCIES) + @rm -f testchannelmatrix$(EXEEXT) + $(LINK) $(testchannelmatrix_LDFLAGS) $(testchannelmatrix_OBJECTS) $(testchannelmatrix_LDADD) $(LIBS) +testfloat$(EXEEXT): $(testfloat_OBJECTS) $(testfloat_DEPENDENCIES) + @rm -f testfloat$(EXEEXT) + $(LINK) $(testfloat_LDFLAGS) $(testfloat_OBJECTS) $(testfloat_LDADD) $(LIBS) +testmarkers$(EXEEXT): $(testmarkers_OBJECTS) $(testmarkers_DEPENDENCIES) + @rm -f testmarkers$(EXEEXT) + $(LINK) $(testmarkers_LDFLAGS) $(testmarkers_OBJECTS) $(testmarkers_LDADD) $(LIBS) +transparency$(EXEEXT): $(transparency_OBJECTS) $(transparency_DEPENDENCIES) + @rm -f transparency$(EXEEXT) + $(LINK) $(transparency_LDFLAGS) $(transparency_OBJECTS) $(transparency_LDADD) $(LIBS) +twentyfour$(EXEEXT): $(twentyfour_OBJECTS) $(twentyfour_DEPENDENCIES) + @rm -f twentyfour$(EXEEXT) + $(LINK) $(twentyfour_LDFLAGS) $(twentyfour_OBJECTS) $(twentyfour_LDADD) $(LIBS) +twentyfour2$(EXEEXT): $(twentyfour2_OBJECTS) $(twentyfour2_DEPENDENCIES) + @rm -f twentyfour2$(EXEEXT) + $(LINK) $(twentyfour2_LDFLAGS) $(twentyfour2_OBJECTS) $(twentyfour2_LDADD) $(LIBS) +writeaiff$(EXEEXT): $(writeaiff_OBJECTS) $(writeaiff_DEPENDENCIES) + @rm -f writeaiff$(EXEEXT) + $(LINK) $(writeaiff_LDFLAGS) $(writeaiff_OBJECTS) $(writeaiff_LDADD) $(LIBS) +writealaw$(EXEEXT): $(writealaw_OBJECTS) $(writealaw_DEPENDENCIES) + @rm -f writealaw$(EXEEXT) + $(LINK) $(writealaw_LDFLAGS) $(writealaw_OBJECTS) $(writealaw_LDADD) $(LIBS) +writeavr$(EXEEXT): $(writeavr_OBJECTS) $(writeavr_DEPENDENCIES) + @rm -f writeavr$(EXEEXT) + $(LINK) $(writeavr_LDFLAGS) $(writeavr_OBJECTS) $(writeavr_LDADD) $(LIBS) +writeiff$(EXEEXT): $(writeiff_OBJECTS) $(writeiff_DEPENDENCIES) + @rm -f writeiff$(EXEEXT) + $(LINK) $(writeiff_LDFLAGS) $(writeiff_OBJECTS) $(writeiff_LDADD) $(LIBS) +writeircam$(EXEEXT): $(writeircam_OBJECTS) $(writeircam_DEPENDENCIES) + @rm -f writeircam$(EXEEXT) + $(LINK) $(writeircam_LDFLAGS) $(writeircam_OBJECTS) $(writeircam_LDADD) $(LIBS) +writenext$(EXEEXT): $(writenext_OBJECTS) $(writenext_DEPENDENCIES) + @rm -f writenext$(EXEEXT) + $(LINK) $(writenext_LDFLAGS) $(writenext_OBJECTS) $(writenext_LDADD) $(LIBS) +writenist$(EXEEXT): $(writenist_OBJECTS) $(writenist_DEPENDENCIES) + @rm -f writenist$(EXEEXT) + $(LINK) $(writenist_LDFLAGS) $(writenist_OBJECTS) $(writenist_LDADD) $(LIBS) +writeraw$(EXEEXT): $(writeraw_OBJECTS) $(writeraw_DEPENDENCIES) + @rm -f writeraw$(EXEEXT) + $(LINK) $(writeraw_LDFLAGS) $(writeraw_OBJECTS) $(writeraw_LDADD) $(LIBS) +writeulaw$(EXEEXT): $(writeulaw_OBJECTS) $(writeulaw_DEPENDENCIES) + @rm -f writeulaw$(EXEEXT) + $(LINK) $(writeulaw_LDFLAGS) $(writeulaw_OBJECTS) $(writeulaw_LDADD) $(LIBS) +writewave$(EXEEXT): $(writewave_OBJECTS) $(writewave_DEPENDENCIES) + @rm -f writewave$(EXEEXT) + $(LINK) $(writewave_LDFLAGS) $(writewave_OBJECTS) $(writewave_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/floatto24.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/instparamtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/instparamwrite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/loop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/miscread.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/miscwrite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pipe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/printmarkers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/query2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/seek.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sixteen-to-eight.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testaupv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testchannelmatrix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testfloat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testmarkers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/transparency.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/twentyfour.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/twentyfour2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeaiff.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writealaw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeavr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeiff.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeircam.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writenext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writenist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeraw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writeulaw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/writewave.Po@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-TESTS check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test/error.c b/test/error.c new file mode 100644 index 0000000..c321319 --- /dev/null +++ b/test/error.c @@ -0,0 +1,135 @@ +/* + Audio File Library + + Copyright (C) 2000-2001, Silicon Graphics, 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 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <audiofile.h> + +int expectedError; +int verbose = 0; + +void myerrorfunc (long error, const char *description) +{ + if (error != expectedError) + { + if (verbose) + { + printf("WRONG ERROR CODE:\n"); + printf("%s [error code %ld]--", description, error); + printf("expected error code %d\n", expectedError); + } + exit(EXIT_FAILURE); + } + else + { + if (verbose) + { + printf("CORRECT ERROR CODE:\n"); + printf("%s [error code %ld]\n", description, error); + } + } +} + +void testnull (void) +{ + expectedError = AF_BAD_FILEHANDLE; + + if (verbose) printf("closing null file handle\n"); + afCloseFile(AF_NULL_FILEHANDLE); + + if (verbose) printf("reading from null file handle\n"); + afReadFrames(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK, NULL, 0); + + if (verbose) printf("writing to null file handle\n"); + afWriteFrames(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK, NULL, 0); + + if (verbose) printf("setting position on null file handle\n"); + afSeekFrame(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK, 0); + + if (verbose) printf("retrieving position on null file handle\n"); + afTellFrame(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK); + + if (verbose) printf("getting data offset of null file handle\n"); + afGetDataOffset(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK); + + if (verbose) printf("getting track byte count of null file handle\n"); + afGetTrackBytes(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK); + + if (verbose) printf("getting frame count of null file handle\n"); + afGetFrameCount(AF_NULL_FILEHANDLE, AF_DEFAULT_TRACK); + + expectedError = AF_BAD_FILESETUP; + if (verbose) printf("freeing null file setup\n"); + afFreeFileSetup(AF_NULL_FILESETUP); +} + +void testbad (void) +{ + AFfilesetup setup; + setup = afNewFileSetup(); + + expectedError = AF_BAD_OPEN; + if (verbose) printf("opening nonexistent file\n"); + afOpenFile("sldkjflsdkfjalksdjflaksdjflsakfdj", "r", NULL); + + expectedError = AF_BAD_FILEFMT; + if (verbose) printf("initializing file format to invalid value\n"); + afInitFileFormat(setup, 91094); + + expectedError = AF_BAD_SAMPFMT; + if (verbose) printf("initializing sample format and sample width to invalid value\n"); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, 3992, 3932); + + afFreeFileSetup(setup); + + expectedError = AF_BAD_FILESETUP; + if (verbose) printf("initializing file format on a file setup which has been deallocated\n"); + afInitFileFormat(setup, AF_FILE_AIFFC); +} + +void testbadquery (void) +{ + expectedError = AF_BAD_QUERY; + if (verbose) printf("querying on bad selectors\n"); + afQueryLong(AF_QUERYTYPE_FILEFMT, 9999, 9999, 9999, 9999); + + expectedError = AF_BAD_QUERYTYPE; + if (verbose) printf("querying using bad query type\n"); + afQueryLong(9999, 9999, 9999, 9999, 9999); +} + +int main (int argc, char **argv) +{ + afSetErrorHandler(myerrorfunc); + + if (argc == 2 && strcmp(argv[1], "-v") == 0) + verbose = 1; + + testnull(); + testbad(); + testbadquery(); + + return 0; +} diff --git a/test/floatto24.c b/test/floatto24.c new file mode 100644 index 0000000..191daaf --- /dev/null +++ b/test/floatto24.c @@ -0,0 +1,182 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + floatto24.c + + This program creates a BICSF floating-point sound file and then + reads the sample data back as 24-bit data (i.e. 32-bit integers + with the high 8 bits equal to the sign extension of the lower + 24 bits). +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <audiofile.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define TEST_FILE "/tmp/test.sf" +#define FRAME_COUNT 10 + +/* + When converted to samples with width 24 bits, the samples + should have the following values: +*/ + +const float samples[] = +{ + 0, + 0.5, + -0.5, + 0, + 1, + -1, + -0.25, + 0.25, + 0.75, + -0.75 +}; + +const int referenceConvertedSamples[] = +{ + 0, + 4194303, /* = (2^23 - 1) / 2 */ + -4194303, + 0, + 8388607, /* = 2^23 - 1 */ + -8388607, + -2097151, + 2097151, /* = (2^23 - 1) / 4 */ + 6291455, /* = (2^23 - 1) * 3 / 4 */ + -6291455 +}; + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + AFframecount framesWritten, framesRead; + + int readsamples[FRAME_COUNT] = {-1000, -1001, -1002, -1003, + -1004, -1005, -1006, -1007}; + int i; + + if ((setup = afNewFileSetup()) == AF_NULL_FILESETUP) + { + fprintf(stderr, "Could not allocate file setup.\n"); + exit(EXIT_FAILURE); + } + + afInitFileFormat(setup, AF_FILE_IRCAM); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32); + + file = afOpenFile(TEST_FILE, "w", setup); + if (file == AF_NULL_FILEHANDLE) + { + printf("could not open file for writing\n"); + exit(EXIT_FAILURE); + } + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, (void *) samples, + FRAME_COUNT); + + if (framesWritten != FRAME_COUNT) + { + fprintf(stderr, "Wrong number of frames read.\n"); + exit(EXIT_FAILURE); + } + + if (afCloseFile(file) != 0) + { + fprintf(stderr, "Closing file returned non-zero status.\n"); + exit(EXIT_FAILURE); + } + + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "Could not open file for writing.\n"); + exit(EXIT_FAILURE); + } + + if (afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, + AF_SAMPFMT_TWOSCOMP, 24) != 0) + { + fprintf(stderr, "afSetVirtualSampleFormat returned non-zero status.\n"); + exit(EXIT_FAILURE); + } + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readsamples, + FRAME_COUNT); + + if (framesRead != FRAME_COUNT) + { + fprintf(stderr, "Wrong number of frames read.\n"); + exit(EXIT_FAILURE); + } + + for (i=0; i<framesRead; i++) + { +#ifdef DEBUG + printf("[%d] = %d\n", i, readsamples[i]); +#endif + + if (readsamples[i] == -1000 - i) + { + fprintf(stderr, "Data in destination array untouched.\n"); + exit(EXIT_FAILURE); + } + + /* + Ensure that the high-order 8 bits represent + sign extension: only 0x00 (+) or 0xff (-) is + valid. + */ + if ((readsamples[i] & 0xff000000) != 0x000000 && + (readsamples[i] & 0xff000000) != 0xff000000) + { + fprintf(stderr, "Data is not within range of " + "{-2^23, ..., 2^23-1}.\n"); + exit(EXIT_FAILURE); + } + + if (readsamples[i] != referenceConvertedSamples[i]) + { + fprintf(stderr, "Data doesn't match reference data.\n"); + exit(EXIT_FAILURE); + } + } + + if (afCloseFile(file) != 0) + { + fprintf(stderr, "Closing file returned non-zero status.\n"); + exit(EXIT_FAILURE); + } + + unlink(TEST_FILE); + + exit(EXIT_SUCCESS); +} diff --git a/test/instparamtest.c b/test/instparamtest.c new file mode 100644 index 0000000..a92b640 --- /dev/null +++ b/test/instparamtest.c @@ -0,0 +1,77 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + Copyright 2000, Silicon Graphics, 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 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 <audiofile.h> +#include <stdio.h> +#include <stdlib.h> + +main (int argc, char **argv) +{ + AFfilehandle file; + long result; + int count, instids; + + if (argc != 2) + { + fprintf(stderr, "usage: %s filename\n", argv[0]); + exit(EXIT_FAILURE); + } + + file = afOpenFile(argv[1], "r", NULL); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file '%s'\n", argv[1]); + exit(EXIT_FAILURE); + } + + count = afGetInstIDs(file, &instids); + printf("%ld instruments in file '%s'\n", count, argv[1]); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_BASENOTE); + printf("MIDI base note: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMCENTS_DETUNE); + printf("detune in cents: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LONOTE); + printf("MIDI low note: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HINOTE); + printf("MIDI high note: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LOVELOCITY); + printf("MIDI low velocity: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HIVELOCITY); + printf("MIDI high velocity: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMDBS_GAIN); + printf("gain in decibels: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_SUSLOOPID); + printf("sustain loop id: %ld\n", result); + + result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_RELLOOPID); + printf("release loop id: %ld\n", result); + + afCloseFile(file); +} diff --git a/test/instparamwrite.c b/test/instparamwrite.c new file mode 100644 index 0000000..99a5819 --- /dev/null +++ b/test/instparamwrite.c @@ -0,0 +1,55 @@ +/* + Audio File Library + + Copyright 2000, Silicon Graphics, 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 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 <stdio.h> + +#include <audiofile.h> + +main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + AUpvlist list; + + if (argc != 2) + { + fprintf(stderr, "usage: instparamwrite filename\n"); + } + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_AIFFC); + + file = afOpenFile(argv[1], "w", setup); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file %s for writing", argv[1]); + } + + afFreeFileSetup(setup); + + /* Set the base note to a 'D.' */ + afSetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_BASENOTE, 50); + + /* Detune down by 30 cents. */ + afSetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMCENTS_DETUNE, -30); + + afCloseFile(file); +} diff --git a/test/loop.c b/test/loop.c new file mode 100644 index 0000000..3778eef --- /dev/null +++ b/test/loop.c @@ -0,0 +1,37 @@ +#include <audiofile.h> + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + int markerIDs[] = {1, 2, 3, 4}; + int loopIDs[] = {1, 2}; + short frames[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_AIFF); + + afInitMarkIDs(setup, AF_DEFAULT_TRACK, markerIDs, 4); + afInitMarkName(setup, AF_DEFAULT_TRACK, 1, "sustain loop start"); + afInitMarkName(setup, AF_DEFAULT_TRACK, 2, "sustain loop end"); + afInitMarkName(setup, AF_DEFAULT_TRACK, 3, "release loop start"); + afInitMarkName(setup, AF_DEFAULT_TRACK, 4, "release loop end"); + + afInitLoopIDs(setup, AF_DEFAULT_INST, loopIDs, 2); + + file = afOpenFile(argv[1], "w", setup); + + afWriteFrames(file, AF_DEFAULT_TRACK, frames, 5); + + afSetMarkPosition(file, AF_DEFAULT_TRACK, 1, 0); + afSetMarkPosition(file, AF_DEFAULT_TRACK, 2, 2); + afSetMarkPosition(file, AF_DEFAULT_TRACK, 3, 4); + afSetMarkPosition(file, AF_DEFAULT_TRACK, 4, 5); + + afSetLoopStart(file, AF_DEFAULT_INST, 1, 1); + afSetLoopEnd(file, AF_DEFAULT_INST, 1, 2); + afSetLoopStart(file, AF_DEFAULT_INST, 2, 3); + afSetLoopEnd(file, AF_DEFAULT_INST, 2, 4); + + afCloseFile(file); +} diff --git a/test/misc.sh b/test/misc.sh new file mode 100755 index 0000000..6d8866a --- /dev/null +++ b/test/misc.sh @@ -0,0 +1,20 @@ +# +# Test miscellaneous data reading and writing for AIFF, AIFF-C, and WAVE +# file formats. +# + +for i in aiff aifc wave +do +./miscwrite $i /tmp/misc.test || (echo "failed: miscwrite $i"; exit) +./miscread /tmp/misc.test > /tmp/misc.out || (echo "failed: miscread $i"; exit) + +diff /tmp/misc.out - <<END || exit +Miscellaneous 201, 19 bytes: +1998 Michael Pruett +Miscellaneous 203, 43 bytes: +Michael Pruett's home-brew methamphetamines +END + +rm -f /tmp/misc.test /tmp/misc.out +echo "passed: miscellaneous $i" +done diff --git a/test/miscread.c b/test/miscread.c new file mode 100644 index 0000000..75084e2 --- /dev/null +++ b/test/miscread.c @@ -0,0 +1,85 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +/* Two frames of 16-bit stereo samples. */ +u_int16_t data[] = {0, 1, 2, 3}; + +int main (int argc, char **argv) +{ + AFfilehandle file; + int *miscids; + int i, misccount; + + if (argc < 2) + { + fprintf(stderr, "usage: %s <audio file>\n", argv[0]); + exit(EXIT_FAILURE); + } + + file = afOpenFile(argv[1], "r", NULL); + if (file == NULL) + { + fprintf(stderr, "could not open file %s for reading\n", argv[1]); + exit(EXIT_FAILURE); + } + misccount = afGetMiscIDs(file, NULL); + miscids = malloc(sizeof (int) * misccount); + afGetMiscIDs(file, miscids); + + for (i=0; i<misccount; i++) + { + char *data; + int datasize; + + datasize = afGetMiscSize(file, miscids[i]); + printf("Miscellaneous %d, %d bytes:\n", + afGetMiscType(file, miscids[i]), datasize); + + /* + We know that the data in this test is a string, + so make the buffer large enough for a null terminator. + */ + data = malloc(datasize+1); + afReadMisc(file, miscids[i], data, datasize); + data[datasize] = '\0'; + + puts(data); + free(data); + } + + afCloseFile(file); + + return 0; +} diff --git a/test/miscwrite.c b/test/miscwrite.c new file mode 100644 index 0000000..d299c9b --- /dev/null +++ b/test/miscwrite.c @@ -0,0 +1,106 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#ifdef DEBUG +#define DEBG printf +#else +#define DEBG +#endif + +char copyright[] = "1998 Michael Pruett"; +char name[] = "Michael Pruett's home-brew methamphetamines"; + +/* Two frames of 16-bit stereo samples. */ +u_int16_t data[] = {0, 1, 2, 3}; + +int main (int argc, char **argv) +{ + int filefmt; + AFfilehandle file; + AFfilesetup setup; + int miscids[] = {1, 2}; + int result; + + if (argc < 3) + { + fprintf(stderr, "usage: %s <file format> <audio file>\n", + argv[0]); + exit(EXIT_FAILURE); + } + + if (strcmp(argv[1], "aiff") == 0) + filefmt = AF_FILE_AIFF; + else if (strcmp(argv[1], "aifc") == 0) + filefmt = AF_FILE_AIFFC; + else if (strcmp(argv[1], "wave") == 0) + filefmt = AF_FILE_WAVE; + else + { + fprintf(stderr, "unrecognized file format '%s'\n", argv[1]); + exit(EXIT_FAILURE); + } + + setup = afNewFileSetup(); + afInitFileFormat(setup, filefmt); + afInitMiscIDs(setup, miscids, 2); + afInitMiscType(setup, 1, AF_MISC_COPY); + afInitMiscType(setup, 2, AF_MISC_NAME); + afInitMiscSize(setup, 1, strlen(copyright)); + afInitMiscSize(setup, 2, strlen(name)); + + file = afOpenFile(argv[2], "w", setup); + if (file == NULL) + { + fprintf(stderr, "could not open file '%s' for writing\n", argv[2]); + exit(EXIT_FAILURE); + } + + result = afWriteMisc(file, 1, copyright, strlen(copyright)); + DEBG("wrote miscellaneous data of type %d with length = %d\n", + afGetMiscType(file, 1), result); + result = afWriteMisc(file, 2, name, strlen(name)); + + DEBG("wrote miscellaneous data of type %d with length = %d\n", + afGetMiscType(file, 2), result); + + /* Write out two token frames of sample data. */ + afWriteFrames(file, AF_DEFAULT_TRACK, data, 2); + + afCloseFile(file); + afFreeFileSetup(setup); + + return 0; +} diff --git a/test/pipe.c b/test/pipe.c new file mode 100644 index 0000000..3cec723 --- /dev/null +++ b/test/pipe.c @@ -0,0 +1,116 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + pipe.c + + This program provides a simple test of Audio File Library + operation on non-seekable file handles. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include <audiofile.h> +#include <stdio.h> +#include <stdlib.h> + +#define SAMPLE_COUNT 12 +#define FRAME_COUNT 6 + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilesetup setup; + AFfilehandle file; + int16_t samples[SAMPLE_COUNT] = {-1,3,9,2,-5,4,8,-3,6,21,11,-2}; + int output = 0; + + setup = afNewFileSetup(); + + afInitFileFormat(setup, AF_FILE_RAWDATA); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + afInitChannels(setup, AF_DEFAULT_TRACK, 2); + afInitRate(setup, AF_DEFAULT_TRACK, 44100); +#ifdef WORDS_BIGENDIAN + afInitByteOrder(setup, AF_DEFAULT_TRACK, AF_BYTEORDER_BIGENDIAN); +#else + afInitByteOrder(setup, AF_DEFAULT_TRACK, AF_BYTEORDER_LITTLEENDIAN); +#endif + + if (argc > 1 && !strcmp(argv[1], "out")) + output = 1; + + if (output) + { + AFframecount framesWritten; + + file = afOpenFD(1, "w", setup); + + afFreeFileSetup(setup); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, + FRAME_COUNT); + + ensure(framesWritten == FRAME_COUNT, + "incorrect number of frames written"); + + fprintf(stderr, "pipe write passed\n"); + } + else + { + AFframecount framesRead; + int16_t samplesRead[SAMPLE_COUNT]; + + file = afOpenFD(0, "r", setup); + + afFreeFileSetup(setup); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, samplesRead, + FRAME_COUNT); + + ensure(framesRead == FRAME_COUNT, + "incorrect number of frames read"); + + ensure(memcmp(samplesRead, samples, + SAMPLE_COUNT * sizeof (int16_t)) == 0, + "samples read do not match samples written"); + + fprintf(stderr, "pipe read passed\n"); + } + + afCloseFile(file); + + exit(EXIT_SUCCESS); +} diff --git a/test/pipe.sh b/test/pipe.sh new file mode 100755 index 0000000..62a34bf --- /dev/null +++ b/test/pipe.sh @@ -0,0 +1,5 @@ +# pipe.sh +# This script provides a simple test of Audio File Library +# operation on non-seekable file handles. + +(./pipe out | ./pipe) && echo "passed pipe test" diff --git a/test/printmarkers.c b/test/printmarkers.c new file mode 100644 index 0000000..b3c8561 --- /dev/null +++ b/test/printmarkers.c @@ -0,0 +1,126 @@ +/* + Audio File Library + + Copyright (C) 2002, Silicon Graphics, 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 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. +*/ + +/* + printmarkers + + This program lists the markers in an audio file. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include <audiofile.h> + +void printtime (AFframecount position, double rate) +{ + double time_in_seconds; + + time_in_seconds = (double) position / rate; + + /* Handle hours. */ + if (time_in_seconds > 3600) + { + printf("%d:", (int) (time_in_seconds / 3600)); + time_in_seconds = fmod(time_in_seconds, 3600); + } + + /* Handle minutes. */ + if (time_in_seconds > 60) + { + printf("%02d:", (int) (time_in_seconds / 60)); + time_in_seconds = fmod(time_in_seconds, 60); + } + + /* Handle seconds and milliseconds. */ + printf("%02.3f", time_in_seconds); +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + double rate; + int markcount; + int *markids; + int i; + + if (argc != 2) + { + fprintf(stderr, "usage: %s filename\n", argv[0]); + fprintf(stderr, "where filename is the name of an audio file containing markers\n"); + exit(0); + } + + file = afOpenFile(argv[1], "r", NULL); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "Could not open file '%s' for reading.", argv[1]); + exit(0); + } + + markcount = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); + if (markcount <= 0) + { + fprintf(stderr, "The file '%s' does not contain any markers.", argv[1]); + exit(0); + } + + markids = calloc(markcount, sizeof (int)); + if (markids == NULL) + { + fprintf(stderr, "Could not allocate enough memory for markers."); + exit(0); + } + + afGetMarkIDs(file, AF_DEFAULT_TRACK, markids); + + rate = afGetRate(file, AF_DEFAULT_TRACK); + + for (i=0; i<markcount; i++) + { + AFframecount position; + const char *name, *comment; + + position = afGetMarkPosition(file, AF_DEFAULT_TRACK, markids[i]); + + name = afGetMarkName(file, AF_DEFAULT_TRACK, markids[i]); + comment = afGetMarkComment(file, AF_DEFAULT_TRACK, markids[i]); + + printf("marker %d, position %lld, time ", markids[i], position); + + printtime(position, rate); + + printf("\n"); + + if (name != NULL) + printf("\tname: %s\n", name); + if (comment != NULL) + printf("\tcomment: %s\n", comment); + } + + afCloseFile(file); + + return EXIT_SUCCESS; +} diff --git a/test/query2.c b/test/query2.c new file mode 100644 index 0000000..69bb93e --- /dev/null +++ b/test/query2.c @@ -0,0 +1,170 @@ +/* + Audio File Library + + Copyright 1998-2000, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#include <dmedia/audioutil.h> +#else +#include <audiofile.h> +#include <aupvlist.h> +#endif + +#include <stdio.h> +#include <stdlib.h> + +const char *paramtypename (int paramtype); +void printinstparams (int format); + +#define DEBUG + +#ifdef DEBUG +#define DEBG printf +#else +#define DEBG +#endif + +int main (int ac, char **av) +{ + AUpvlist formatlist; + int *flist; + long lvalue; + int i, formatcount; + + formatlist = afQuery(AF_QUERYTYPE_FILEFMT, AF_QUERY_IDS, 0, 0, 0); + formatcount = afQueryLong(AF_QUERYTYPE_FILEFMT, AF_QUERY_ID_COUNT, 0, 0, 0); + + DEBG("formatcount = %d\n", formatcount); + + AUpvgetval(formatlist, 0, &flist); + AUpvfree(formatlist); + + for (i=0; i<formatcount; i++) + { + int format; + char *formatstring; + + format = flist[i]; + DEBG("format = %d\n", format); + formatstring = afQueryPointer(AF_QUERYTYPE_FILEFMT, AF_QUERY_NAME, + format, 0, 0); + DEBG("format = %s\n", formatstring); + + lvalue = afQueryLong(AF_QUERYTYPE_INST, AF_QUERY_SUPPORTED, + format, 0, 0); + DEBG("instrument query: supported: %ld\n", lvalue); + + lvalue = afQueryLong(AF_QUERYTYPE_INST, AF_QUERY_MAX_NUMBER, + format, 0, 0); + DEBG("instrument query: maximum number: %ld\n", lvalue); + + lvalue = afQueryLong(AF_QUERYTYPE_INSTPARAM, AF_QUERY_SUPPORTED, + format, 0, 0); + DEBG("instrument parameter query: supported: %ld\n", lvalue); + + /* + Print instrument parameter information only if + instrument parameters are supported. + */ + if (lvalue) + printinstparams(format); + } + free(flist); + + return 0; +} + +void printinstparams (int format) +{ + int i, *iarray; + long instParamCount; + + instParamCount = afQueryLong(AF_QUERYTYPE_INSTPARAM, AF_QUERY_ID_COUNT, + format, 0, 0); + DEBG("instrument parameter query: id count: %ld\n", instParamCount); + + iarray = afQueryPointer(AF_QUERYTYPE_INSTPARAM, AF_QUERY_IDS, + format, 0, 0); + + if (iarray == NULL) + printf("AF_QUERYTYPE_INSTPARAM failed for format %d\n", format); + + for (i=0; i<instParamCount; i++) + { + int paramType; + AUpvlist defaultValue; + + DEBG("instrument parameter query: id: %d\n", iarray[i]); + paramType = afQueryLong(AF_QUERYTYPE_INSTPARAM, + AF_QUERY_TYPE, format, iarray[i], 0); + + DEBG("\ttype of parameter: %s\n", paramtypename(paramType)); + DEBG("\tname of parameter: %s\n", + (char *) afQueryPointer(AF_QUERYTYPE_INSTPARAM, + AF_QUERY_NAME, format, iarray[i], 0)); + + defaultValue = afQuery(AF_QUERYTYPE_INSTPARAM, AF_QUERY_DEFAULT, + format, iarray[i], 0); + + if (paramType == AU_PVTYPE_LONG) + { + long ldefault; + AUpvgetval(defaultValue, 0, &ldefault); + DEBG("\tdefault value: %ld\n", ldefault); + } + else if (paramType == AU_PVTYPE_DOUBLE) + { + double ddefault; + AUpvgetval(defaultValue, 0, &ddefault); + DEBG("\tdefault value: %f\n", ddefault); + } + else if (paramType == AU_PVTYPE_PTR) + { + void *vdefault; + AUpvgetval(defaultValue, 0, &vdefault); + DEBG("\tdefault value: %p\n", vdefault); + } + } + + free(iarray); +} + +const char *paramtypename (int paramtype) +{ + static const char *longname = "long"; + static const char *doublename = "double"; + static const char *pointername = "pointer"; + + switch (paramtype) + { + case AU_PVTYPE_LONG: + return longname; + case AU_PVTYPE_DOUBLE: + return doublename; + case AU_PVTYPE_PTR: + return pointername; + } + + return NULL; +} diff --git a/test/seek.c b/test/seek.c new file mode 100644 index 0000000..e4508b9 --- /dev/null +++ b/test/seek.c @@ -0,0 +1,124 @@ +/* + Audio File Library + + Copyright (C) 2003, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + seek.c + + This program tests seeking within an audio file. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <audiofile.h> + +#define TEST_FILE "/tmp/test.aiff" +#define FRAME_COUNT 2000 +#define PAD_FRAME_COUNT (FRAME_COUNT + 5) +#define DATA_LENGTH (FRAME_COUNT * sizeof (short)) + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + AFframecount framesread; + short data[FRAME_COUNT]; + short readdata[PAD_FRAME_COUNT]; + int i; + + setup = afNewFileSetup(); + ensure(setup != NULL, "could not create file setup"); + + afInitFileFormat(setup, AF_FILE_AIFF); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); + + afFreeFileSetup(setup); + + /* Initialize data to a nontrivial test pattern. */ + for (i=0; i<FRAME_COUNT; i++) + { + if ((i%2) != 0) + data[i] = i; + else + data[i] = -i; + } + + afWriteFrames(file, AF_DEFAULT_TRACK, data, FRAME_COUNT); + + afCloseFile(file); + + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); + + /* + For each position in the file, seek to that position and + read to the end of the file, checking that the data read + matches the data written. + */ + for (i=0; i<FRAME_COUNT; i++) + { + AFfileoffset currentposition; + + memset(readdata, 0, DATA_LENGTH); + + afSeekFrame(file, AF_DEFAULT_TRACK, i); + currentposition = afTellFrame(file, AF_DEFAULT_TRACK); + ensure(currentposition == i, "incorrect seek position"); + + framesread = afReadFrames(file, AF_DEFAULT_TRACK, readdata + i, + PAD_FRAME_COUNT); + ensure(framesread == FRAME_COUNT - i, + "incorrect number of frames read"); + + ensure(memcmp(data + i, readdata + i, framesread * sizeof (short)) == 0, + "error in data read"); + } + + afCloseFile(file); + + cleanup(); + return 0; +} diff --git a/test/sixteen-to-eight.c b/test/sixteen-to-eight.c new file mode 100644 index 0000000..48ace03 --- /dev/null +++ b/test/sixteen-to-eight.c @@ -0,0 +1,111 @@ +/* + Audio File Library + + Copyright 2000, Silicon Graphics, 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 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. +*/ + +/* + sixteen-to-eight.c + + This program tests the conversion from 16-bit integers to 8-bit + integers. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <audiofile.h> + +#define TEST_FILE "/tmp/test.wave" + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + int16_t frames16[] = {14298, 392, 3923, -683, 958, -1921}; + int8_t frames8[] = {55, 1, 15, -3, 3, -8}; + int i, frameCount = 6; + int8_t byte; + AFframecount result; + + setup = afNewFileSetup(); + + afInitFileFormat(setup, AF_FILE_WAVE); + + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_UNSIGNED, 8); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + + file = afOpenFile(TEST_FILE, "w", setup); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file for writing\n"); + exit(EXIT_FAILURE); + } + + afFreeFileSetup(setup); + + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + afWriteFrames(file, AF_DEFAULT_TRACK, frames16, frameCount); + + afCloseFile(file); + + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file for reading\n"); + exit(EXIT_FAILURE); + } + + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 8); + + for (i=0; i<frameCount; i++) + { + /* Read one frame. */ + result = afReadFrames(file, AF_DEFAULT_TRACK, &byte, 1); + + if (result != 1) + break; + + /* Compare the byte read with its precalculated value. */ + if (memcmp(&byte, &frames8[i], 1) != 0) + { + printf("error\n"); + printf("expected %d, got %d\n", frames8[i], byte); + exit(EXIT_FAILURE); + } + else + { +#ifdef DEBUG + printf("got what was expected: %d\n", byte); +#endif + } + } + + afCloseFile(file); + unlink(TEST_FILE); + + exit(EXIT_SUCCESS); +} diff --git a/test/testaupv.c b/test/testaupv.c new file mode 100644 index 0000000..37946bb --- /dev/null +++ b/test/testaupv.c @@ -0,0 +1,80 @@ +/* + Audio File Library + + Copyright 1998, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + testaupv.c + + This is a program to test the AUpvlist commands. +*/ + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/dm_audioutil.h> +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#include <aupvlist.h> +#endif + +#include <stdio.h> +#include <stdlib.h> + +int main (int argc, char **argv) +{ + AUpvlist list; + int size; + AFfilehandle file; + + long fuck = 99; + + if (argc != 2) + { + fprintf(stderr, "usage: testaupv filename\n"); + exit(EXIT_FAILURE); + } + + file = afOpenFile(argv[1], "r", NULL); + + list = AUpvnew(4); + size = AUpvgetmaxitems(list); + + printf("AUpvsetparam: %d\n", AUpvsetparam(list, 0, AF_INST_MIDI_BASENOTE)); + printf("AUpvsetparam: %d\n", AUpvsetparam(list, 1, AF_INST_MIDI_LONOTE)); + printf("AUpvsetparam: %d\n", AUpvsetparam(list, 2, AF_INST_SUSLOOPID)); + printf("AUpvsetparam: %d\n", AUpvsetparam(list, 3, AF_INST_RELLOOPID)); + + afGetInstParams(file, AF_DEFAULT_INST, list, 4); + + AUpvgetval(list, 0, &fuck); + printf("AUpvgetval: %ld\n", fuck); + + AUpvgetval(list, 1, &fuck); + printf("AUpvgetval: %ld\n", fuck); + + AUpvgetval(list, 2, &fuck); + printf("AUpvgetval: %ld\n", fuck); + + AUpvgetval(list, 3, &fuck); + printf("AUpvgetval: %ld\n", fuck); + + afCloseFile(file); + + return 0; +} diff --git a/test/testchannelmatrix.c b/test/testchannelmatrix.c new file mode 100644 index 0000000..e2c016a --- /dev/null +++ b/test/testchannelmatrix.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright (C) 2003, Silicon Graphics, 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 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. +*/ + +/* + testchannelmatrix.c + + This program tests the channel matrix functionality of virtual + sample format conversion in the Audio File Library. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <audiofile.h> + +#define TEST_FILE "/tmp/test.aiff" + +const short samples[] = {300, -300, 515, -515, 2315, -2315, 9154, -9154}; +#define SAMPLE_COUNT (sizeof (samples) / sizeof (short)) +#define CHANNEL_COUNT 2 + +void cleanup (void) +{ + unlink(TEST_FILE); +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (void) +{ + AFfilesetup setup; + AFfilehandle file; + int framesWritten, framesRead; + const int frameCount = SAMPLE_COUNT / CHANNEL_COUNT; + short readsamples[SAMPLE_COUNT]; + int i; + int sampleFormat, sampleWidth; + + setup = afNewFileSetup(); + + afInitChannels(setup, AF_DEFAULT_TRACK, CHANNEL_COUNT); + afInitFileFormat(setup, AF_FILE_AIFFC); + + /* Write stereo data to test file. */ + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); + + afFreeFileSetup(setup); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, + frameCount); + ensure(framesWritten == frameCount, + "number of frames written doesn't match " + "number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + + /* + Open the test file and read stereo data mixed down to a + single channel. The default channel matrix for one + file channel and two virtual channels is {0.5, 0.5}, + and since each odd sample is the inverse of the + corresponding even sample, the data read should be all + zeros. + */ + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 2, + "file doesn't have exactly two channels"); + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP && sampleWidth == 16, + "file doesn't contain 16-bit two's complement data"); + ensure(afGetFileFormat(file, NULL) == AF_FILE_AIFFC, + "file format doesn't match format requested"); + + afSetVirtualChannels(file, AF_DEFAULT_TRACK, 1); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readsamples, + frameCount); + ensure(framesRead == frameCount, "number of frames read does not match number of frames requested"); + + for (i=0; i<SAMPLE_COUNT/CHANNEL_COUNT; i++) + { + ensure(readsamples[i] == 0, + "data written to file is not as expected"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + exit(EXIT_SUCCESS); +} diff --git a/test/testfloat.c b/test/testfloat.c new file mode 100644 index 0000000..daf29a6 --- /dev/null +++ b/test/testfloat.c @@ -0,0 +1,132 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + testfloat.c + + This program tests floating-point reading and writing for + the AIFF-C, WAVE, NeXT .snd, and IRCAM file formats. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <audiofile.h> + +#define TEST_FILE "/tmp/test.float" + +const float samples[] = + {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4}; +#define SAMPLE_COUNT (sizeof (samples) / sizeof (float)) + +void testfloat (int fileFormat); + +void cleanup (void) +{ + unlink(TEST_FILE); +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + /* These file formats support floating-point audio data. */ + int fileFormatCount = 4; + int fileFormats[] = + {AF_FILE_AIFFC, AF_FILE_WAVE, AF_FILE_NEXTSND, AF_FILE_IRCAM}; + char *formatNames[] = {"AIFF-C", "WAVE", "NeXT .snd", "IRCAM"}; + int i; + + for (i=0; i<fileFormatCount; i++) + { + printf("testfloat: testing %s\n", formatNames[i]); + testfloat(fileFormats[i]); + } + + printf("testfloat passed\n"); + exit(EXIT_SUCCESS); +} + +void testfloat (int fileFormat) +{ + AFfilesetup setup; + AFfilehandle file; + int framesWritten, framesRead; + const int frameCount = SAMPLE_COUNT/2; + float readsamples[SAMPLE_COUNT]; + int i; + int sampleFormat, sampleWidth; + + setup = afNewFileSetup(); + + afInitFileFormat(setup, fileFormat); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32); + afInitChannels(setup, AF_DEFAULT_TRACK, 2); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); + + afFreeFileSetup(setup); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, + frameCount); + ensure(framesWritten == frameCount, "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 2, + "file doesn't have exactly two channels"); + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_FLOAT && sampleWidth == 32, + "file doesn't contain 32-bit floating-point data"); + ensure(afGetFileFormat(file, NULL) == fileFormat, + "file format doesn't match format requested"); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readsamples, + frameCount); + ensure(framesRead == frameCount, "number of frames read does not match number of frames requested"); + + for (i=0; i<SAMPLE_COUNT; i++) + { + ensure(readsamples[i] == samples[i], + "data written to file doesn't match data read"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); +} diff --git a/test/testmarkers.c b/test/testmarkers.c new file mode 100644 index 0000000..5dd5b1d --- /dev/null +++ b/test/testmarkers.c @@ -0,0 +1,134 @@ +/* + Audio File Library + + Copyright (C) 2002, Silicon Graphics, 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 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include <audiofile.h> + +#define TEST_FILE "/tmp/markers.test" + +#define FRAME_COUNT 200 + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int testmarkers (int fileformat) +{ + AFfilehandle file; + AFfilesetup setup; + int markids[] = {1, 2, 3, 4}; + AFframecount markpositions[] = {14, 54, 23, 101}; + const char *marknames[] = {"one", "two", "three", "four"}; + short frames[FRAME_COUNT * 2]; + int readmarkcount; + int readmarkids[4]; + AFframecount frameswritten; + int i; + + setup = afNewFileSetup(); + ensure(setup != AF_NULL_FILESETUP, "Could not create file setup"); + + afInitFileFormat(setup, fileformat); + afInitChannels(setup, AF_DEFAULT_TRACK, 2); + + afInitMarkIDs(setup, AF_DEFAULT_TRACK, markids, 4); + + afInitMarkName(setup, AF_DEFAULT_TRACK, markids[0], marknames[0]); + afInitMarkName(setup, AF_DEFAULT_TRACK, markids[1], marknames[1]); + afInitMarkName(setup, AF_DEFAULT_TRACK, markids[2], marknames[2]); + afInitMarkName(setup, AF_DEFAULT_TRACK, markids[3], marknames[3]); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "Could not open file for writing"); + + afFreeFileSetup(setup); + + frameswritten = afWriteFrames(file, AF_DEFAULT_TRACK, frames, FRAME_COUNT); + ensure(frameswritten == FRAME_COUNT, "Error writing audio data"); + + afSetMarkPosition(file, AF_DEFAULT_TRACK, markids[0], markpositions[0]); + afSetMarkPosition(file, AF_DEFAULT_TRACK, markids[1], markpositions[1]); + afSetMarkPosition(file, AF_DEFAULT_TRACK, markids[2], markpositions[2]); + afSetMarkPosition(file, AF_DEFAULT_TRACK, markids[3], markpositions[3]); + + afCloseFile(file); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "Could not open file for reading"); + + readmarkcount = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); + ensure(readmarkcount == 4, "Number of markers is not correct"); + + afGetMarkIDs(file, AF_DEFAULT_TRACK, readmarkids); + + for (i=0; i<readmarkcount; i++) + ensure(readmarkids[i] = markids[i], + "Marker identification numbers do not match"); + + for (i=0; i<readmarkcount; i++) + { + AFframecount readmarkposition; + const char *readmarkname; + + readmarkposition = afGetMarkPosition(file, AF_DEFAULT_TRACK, readmarkids[i]); + + readmarkname = afGetMarkName(file, AF_DEFAULT_TRACK, readmarkids[i]); + + ensure(readmarkposition == markpositions[i], + "Marker positions do not match"); + ensure(strcmp(readmarkname, marknames[i]) == 0, + "Marker names do not match"); + } + + afCloseFile(file); + + return EXIT_SUCCESS; +} + +int main (void) +{ + testmarkers(AF_FILE_AIFF); + testmarkers(AF_FILE_AIFFC); + testmarkers(AF_FILE_WAVE); + + cleanup(); + + return EXIT_SUCCESS; +} diff --git a/test/transparency.c b/test/transparency.c new file mode 100644 index 0000000..36620b9 --- /dev/null +++ b/test/transparency.c @@ -0,0 +1,129 @@ +/* + Audio File Library + + Copyright 1998-2000, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + transparency.c + + This program does a small sanity check on file writing + operations. + + If this program fails, something in the Audio File Library is broken. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +void usage (void) +{ + fprintf(stderr, "usage: transparency file1 file2 [format]\n"); + fprintf(stderr, "where format is one of aiff, aifc, next, or wave\n"); + fprintf(stderr, "(format defaults to aiff.)\n"); + exit(0); +} + +int main (int argc, char **argv) +{ + AFfilehandle outfile; + AFfilesetup outfilesetup; + unsigned short buffer[] = {0x1122, 0x3344, 0x5566, 0x7788, + 0x99aa, 0xbbcc, 0xddee, 0xff00}; + int format = AF_FILE_AIFF; + AFframecount result; + + if (argc < 3) + usage(); + + if (argc > 3) + { + if (!strcmp(argv[3], "aiff")) + format = AF_FILE_AIFF; + else if (!strcmp(argv[3], "aifc")) + format = AF_FILE_AIFFC; + else if (!strcmp(argv[3], "next")) + format = AF_FILE_NEXTSND; + else if (!strcmp(argv[3], "wave")) + format = AF_FILE_WAVE; + else + { + fprintf(stderr, "%s: invalid format.\n", argv[3]); + usage(); + } + } + + outfilesetup = afNewFileSetup(); + afInitFileFormat(outfilesetup, format); + + outfile = afOpenFile(argv[1], "w", outfilesetup); + if (outfile == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file %s for writing\n", argv[1]); + exit(EXIT_FAILURE); + } + + result = afWriteFrames(outfile, AF_DEFAULT_TRACK, buffer, 2); + if (result != 2) + { + fprintf(stderr, "afWriteFrames did not return expected result\n"); + fprintf(stderr, "got %ld, expected 2\n", result); + exit(EXIT_FAILURE); + } + afWriteFrames(outfile, AF_DEFAULT_TRACK, buffer + 4, 2); + if (result != 2) + { + fprintf(stderr, "afWriteFrames did not return expected result\n"); + fprintf(stderr, "got %ld, expected 2\n", result); + exit(EXIT_FAILURE); + } + + afCloseFile(outfile); + + outfile = afOpenFile(argv[2], "w", outfilesetup); + if (outfile == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file %s for writing\n", argv[1]); + exit(EXIT_FAILURE); + } + + result = afWriteFrames(outfile, AF_DEFAULT_TRACK, buffer, 4); + if (result != 4) + { + fprintf(stderr, "afWriteFrames did not return expected result\n"); + fprintf(stderr, "got %ld, expected 4\n", result); + exit(EXIT_FAILURE); + } + + afCloseFile(outfile); + + afFreeFileSetup(outfilesetup); + + return 0; +} diff --git a/test/transparency.sh b/test/transparency.sh new file mode 100755 index 0000000..365e16f --- /dev/null +++ b/test/transparency.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +for i in aiff aifc next wave +do + ./transparency /tmp/dicko1 /tmp/dicko2 $i || + (echo "did not complete test $i." ; exit) + diff /tmp/dicko1 /tmp/dicko2 || + (echo "failed $i format transparency test." ; exit) +done + +echo "passed all transparency tests." + +rm /tmp/dicko1 /tmp/dicko2 diff --git a/test/twentyfour.c b/test/twentyfour.c new file mode 100644 index 0000000..c5bcaf6 --- /dev/null +++ b/test/twentyfour.c @@ -0,0 +1,236 @@ +/* + Audio File Library + + Copyright (C) 2001, Silicon Graphics, Inc. + Michael Pruett <mpruett@sgi.com> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + twentyfour.c + + This program tests the conversion between 24-bit signed integer + data in a file and 32-bit signed integer data in memory. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <audiofile.h> +#include <assert.h> + +#define TEST_FILE "/tmp/test.aiff" +#define FRAME_COUNT 6 + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + /* All elements in frames32 must be in the range -2^23 to 2^23 - 1. */ + const int32_t frames32[FRAME_COUNT] = + {4314298, -49392, 3923, -143683, 43, -992129}; + const u_int8_t frames24[FRAME_COUNT*3] = + { + 0x41, 0xd4, 0xba, /* 4314298 */ + 0xff, 0x3f, 0x10, /* -49392 */ + 0x00, 0x0f, 0x53, /* 3923 */ + 0xfd, 0xce, 0xbd, /* -143683 */ + 0x00, 0x00, 0x2b, /* 43 */ + 0xf0, 0xdc, 0x7f /* -992129 */ + }; + int32_t readframes32[FRAME_COUNT]; + int i; + + setup = afNewFileSetup(); + assert(setup); + + afInitFileFormat(setup, AF_FILE_AIFF); + + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + + file = afOpenFile(TEST_FILE, "w", setup); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file for writing\n"); + exit(EXIT_FAILURE); + } + + afFreeFileSetup(setup); + + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); + afWriteFrames(file, AF_DEFAULT_TRACK, frames32, FRAME_COUNT); + + afCloseFile(file); + + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + if (file == AF_NULL_FILEHANDLE) + { + fprintf(stderr, "could not open file for reading\n"); + exit(EXIT_FAILURE); + } + + /* Test virtual sample width of 24 bits. */ +#ifdef DEBUG + fprintf(stderr, "Testing virtual sample width of 24 bits.\n"); +#endif + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); + + for (i=0; i<FRAME_COUNT; i++) + { + u_int8_t x[4]; + u_int8_t y[4]; + u_int8_t z[4]; + + if ((frames32[i] & 0x800000) != 0) + x[0] = 0xff; + else + x[0] = 0; + x[1] = (frames32[i] >> 16) & 0xff; + x[2] = (frames32[i] >> 8) & 0xff; + x[3] = (frames32[i]) & 0xff; + + /* + Check to see that the precomputed values match + what we've just computed. + */ + if (x[1] != frames24[3*i] || + x[2] != frames24[3*i + 1] || + x[3] != frames24[3*i + 2]) + { + fprintf(stderr, "Data doesn't match pre-computed values.\n"); + exit(EXIT_FAILURE); + } + + if (afReadFrames(file, AF_DEFAULT_TRACK, y, 1) != 1) + { + fprintf(stderr, "Could not read from test file.\n"); + exit(EXIT_FAILURE); + } + + /* + x is in big-endian byte order; make z a + native-endian copy of x. + */ +#ifdef WORDS_BIGENDIAN + memcpy(z, x, 4); +#else + z[0] = x[3]; + z[1] = x[2]; + z[2] = x[1]; + z[3] = x[0]; +#endif + +#ifdef DEBUG + printf("x = %02x %02x %02x %02x\n", x[0], x[1], x[2], x[3]); + printf("y = %02x %02x %02x %02x\n", y[0], y[1], y[2], y[3]); + printf("z = %02x %02x %02x %02x\n", z[0], z[1], z[2], z[3]); +#endif + + /* + Check to see that the data read from the file + matches computed value. + */ + if (memcmp(y, z, 4) != 0) + { + fprintf(stderr, "Data read from file is incorrect.\n"); + exit(EXIT_FAILURE); + } + } + + /* Test virtual sample width of 32 bits. */ +#ifdef DEBUG + fprintf(stderr, "Testing virtual sample width of 32 bits.\n"); +#endif + afSeekFrame(file, AF_DEFAULT_TRACK, 0); + afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 32); + + for (i=0; i<FRAME_COUNT; i++) + { + u_int8_t x[4]; + u_int8_t y[4]; + u_int8_t z[4]; + + x[0] = (frames32[i] >> 16) & 0xff; + x[1] = (frames32[i] >> 8) & 0xff; + x[2] = (frames32[i]) & 0xff; + x[3] = 0; + + /* + Check to see that the precomputed values match + what we've just computed. + */ + if (x[0] != frames24[3*i] || + x[1] != frames24[3*i + 1] || + x[2] != frames24[3*i + 2]) + { + fprintf(stderr, "Data doesn't match pre-computed values.\n"); + exit(EXIT_FAILURE); + } + + if (afReadFrames(file, AF_DEFAULT_TRACK, y, 1) != 1) + { + fprintf(stderr, "Could not read from test file.\n"); + exit(EXIT_FAILURE); + } + + /* + x is in big-endian byte order; make z a + native-endian copy of x. + */ +#ifdef WORDS_BIGENDIAN + memcpy(z, x, 4); +#else + z[0] = x[3]; + z[1] = x[2]; + z[2] = x[1]; + z[3] = x[0]; +#endif + +#ifdef DEBUG + printf("x = %02x %02x %02x %02x\n", x[0], x[1], x[2], x[3]); + printf("y = %02x %02x %02x %02x\n", y[0], y[1], y[2], y[3]); + printf("z = %02x %02x %02x %02x\n", z[0], z[1], z[2], z[3]); +#endif + + /* + Check to see that the data read from the file + matches computed value. + */ + if (memcmp(y, z, 4) != 0) + { + fprintf(stderr, "Data read from file is incorrect.\n"); + exit(EXIT_FAILURE); + } + } + + if (afCloseFile(file) != 0) + { + fprintf(stderr, "Error closing file.\n"); + exit(EXIT_FAILURE); + } + unlink(TEST_FILE); + + exit(EXIT_SUCCESS); +} diff --git a/test/twentyfour2.c b/test/twentyfour2.c new file mode 100644 index 0000000..6a83ce7 --- /dev/null +++ b/test/twentyfour2.c @@ -0,0 +1,127 @@ +/* + Audio File Library + + Copyright (C) 2003, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + twentyfour2.c + + This program checks reading and writing a large amount of 24-bit + audio data to an AIFF file. + + This program serves as a regression test for a bug in the Audio + File Library in which requesting more than _AF_ATOMIC_NVFRAMES + (1024 frames) from afReadFrames when reading a 24-bit audio file + would result in corrupted audio data. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#include <audiofile.h> + +#define TEST_FILE "/tmp/test.aiff" +#define FRAME_COUNT 10000 + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (void) +{ + AFfilehandle file; + AFfilesetup setup; + int32_t *buffer, *readbuffer; + int i; + AFframecount frameswritten, framesread; + + setup = afNewFileSetup(); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != NULL, "could not open test file for writing"); + + buffer = malloc(sizeof (int32_t) * FRAME_COUNT); + ensure(buffer != NULL, "could not allocate buffer for audio data"); + + readbuffer = malloc(sizeof (int32_t) * FRAME_COUNT); + ensure(readbuffer != NULL, "could not allocate buffer for audio data"); + + for (i=0; i<FRAME_COUNT; i++) + { + if ((i%3) == 0) + buffer[i] = -i; + else + buffer[i] = i; + } + + frameswritten = afWriteFrames(file, AF_DEFAULT_TRACK, buffer, FRAME_COUNT); + ensure(frameswritten == FRAME_COUNT, "incorrect number of frames written"); + + afCloseFile(file); + + /* + Now open file for reading and ensure that the data read + is equal to the data written. + */ + file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + ensure(file != NULL, "could not open test file for reading"); + + framesread = afReadFrames(file, AF_DEFAULT_TRACK, readbuffer, FRAME_COUNT); + ensure(framesread == FRAME_COUNT, "incorrect number of frames read"); + +#ifdef DEBUG + for (i=0; i<FRAME_COUNT; i++) + { + if (buffer[i] != readbuffer[i]) + { + printf("buffer[%d] = %d, readbuffer[%d] = %d\n", + i, buffer[i], i, readbuffer[i]); + } + } +#endif + + ensure(!memcmp(buffer, readbuffer, sizeof (int32_t) * FRAME_COUNT), + "data read does not match data written"); + + cleanup(); + return 0; +} diff --git a/test/writeaiff.c b/test/writeaiff.c new file mode 100644 index 0000000..6907c1b --- /dev/null +++ b/test/writeaiff.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writeaiff.c + + This program tests the validity of the AIFF file reading and writing + code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.aiff" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_AIFF); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_AIFF, + "test file not created as AIFF"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); + + for (i=0; i<8; i++) + { + u_int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writeaiff test passed.\n"); + + exit(0); +} diff --git a/test/writealaw.c b/test/writealaw.c new file mode 100644 index 0000000..c746831 --- /dev/null +++ b/test/writealaw.c @@ -0,0 +1,166 @@ +/* + Audio File Library + + Copyright (C) 2000, Michael Pruett <michael@68k.org> + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + writealaw.c + + The writealaw program performs sanity testing on the Audio File + Library's G.711 A-law compression by writing and then reading + back known data to a file to make sure the two sets of data agree. + + This program writes a set of data which is invariant under G.711 + A-law compression to a file and then reads that set of data back. + + The data read from that file should match the data written + exactly. + + If this test fails, something in the Audio File Library is broken. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define TEST_FILE "/tmp/test.alaw" + +#define FRAME_COUNT 16 +#define SAMPLE_COUNT FRAME_COUNT + +void testalaw (int fileFormat); + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + printf("writealaw: testing NeXT .snd.\n"); + testalaw(AF_FILE_NEXTSND); + printf("writealaw: testing AIFF-C.\n"); + testalaw(AF_FILE_AIFFC); + printf("writealaw: testing WAVE.\n"); + testalaw(AF_FILE_WAVE); + + printf("writealaw test passed.\n"); + + exit(0); +} + +void testalaw (int fileFormat) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {8, 24, 88, 120, 184, 784, 912, 976, + 1120, 1440, 1888, 8960, 9984, 16128, 19968, 32256}; + u_int16_t readsamples[SAMPLE_COUNT]; + AFframecount framesWritten, framesRead; + int i; + + setup = afNewFileSetup(); + + afInitCompression(setup, AF_DEFAULT_TRACK, AF_COMPRESSION_G711_ALAW); + afInitFileFormat(setup, fileFormat); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + + file = afOpenFile(TEST_FILE, "w", setup); + afFreeFileSetup(setup); + + ensure(afGetCompression(file, AF_DEFAULT_TRACK) == + AF_COMPRESSION_G711_ALAW, + "test file not created with G.711 A-law compression"); + + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, + FRAME_COUNT); + + ensure(framesWritten == FRAME_COUNT, + "number of frames requested does not match number of frames written"); + afCloseFile(file); + + /* Open the file for reading and verify the data. */ + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == fileFormat, + "test file format incorrect"); + + ensure(afGetCompression(file, AF_DEFAULT_TRACK) == + AF_COMPRESSION_G711_ALAW, + "test file not opened with G.711 A-law compression"); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readsamples, + FRAME_COUNT); + + ensure(framesRead == FRAME_COUNT, + "number of frames read does not match number of frames requested"); + +#ifdef DEBUG + for (i=0; i<SAMPLE_COUNT; i++) + printf("readsamples[%d]: %d\n", i, readsamples[i]); + for (i=0; i<SAMPLE_COUNT; i++) + printf("samples[%d]: %d\n", i, samples[i]); +#endif + + for (i=0; i<SAMPLE_COUNT; i++) + { + ensure(samples[i] == readsamples[i], + "data written does not match data read"); + } + + /* G.711 compression uses one byte per sample. */ + ensure(afGetTrackBytes(file, AF_DEFAULT_TRACK) == SAMPLE_COUNT, + "track byte count is incorrect"); + + ensure(afGetFrameCount(file, AF_DEFAULT_TRACK) == FRAME_COUNT, + "frame count is incorrect"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "channel count is incorrect"); + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); +} diff --git a/test/writeavr.c b/test/writeavr.c new file mode 100644 index 0000000..10c1c94 --- /dev/null +++ b/test/writeavr.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writeavr.c + + This program tests the validity of the AVR file reading and + writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.avr" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_AVR); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_AVR, + "test file not created as AVR"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); + + for (i=0; i<8; i++) + { + int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writeavr test passed.\n"); + + exit(0); +} diff --git a/test/writeiff.c b/test/writeiff.c new file mode 100644 index 0000000..63d714b --- /dev/null +++ b/test/writeiff.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writeiff.c + + This program tests the validity of the IFF/8SVX file reading + and writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.iff" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + int8_t samples[] = {11, 51, 101, -101, -54, 120, -15, 99}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_IFF_8SVX); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 8); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 7); + ensure(framesWritten == 7, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_IFF_8SVX, + "test file not created as IFF/8SVX"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 8, + "test file sample format is not 8-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); + + for (i=0; i<7; i++) + { + int8_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writeiff test passed.\n"); + + exit(0); +} diff --git a/test/writeircam.c b/test/writeircam.c new file mode 100644 index 0000000..b46dc16 --- /dev/null +++ b/test/writeircam.c @@ -0,0 +1,128 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writeircam.c + + This program tests the validity of the IRCAM/BICSF format + reading and writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.au" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_IRCAM); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_IRCAM, + "test file not created as IRCAM/BICSF"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + +#ifdef WORDS_BIGENDIAN + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); +#else + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_LITTLEENDIAN, + "test file not little-endian"); +#endif + + for (i=0; i<8; i++) + { + u_int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writeircam test passed.\n"); + + exit(0); +} diff --git a/test/writenext.c b/test/writenext.c new file mode 100644 index 0000000..7d1c16b --- /dev/null +++ b/test/writenext.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writenext.c + + This program tests the validity of the NeXT/Sun .snd/.au format + reading and writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.au" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_NEXTSND); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_NEXTSND, + "test file not created as NeXT/Sun .snd/.au"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); + + for (i=0; i<8; i++) + { + u_int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writenext test passed.\n"); + + exit(0); +} diff --git a/test/writenist.c b/test/writenist.c new file mode 100644 index 0000000..454a92a --- /dev/null +++ b/test/writenist.c @@ -0,0 +1,128 @@ +/* + Audio File Library + + Copyright (C) 2004, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writenist.c + + This program tests the validity of the NIST SPHERE format + reading and writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.sph" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + int16_t samples[] = {11, 51, -101, 501, 1001, -5001, -10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_NIST_SPHERE); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_NIST_SPHERE, + "test file not created as NIST SPHERE"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + +#if WORDS_BIGENDIAN + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN, + "test file not big-endian"); +#else + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_LITTLEENDIAN, + "test file not little-endian"); +#endif + + for (i=0; i<8; i++) + { + int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writenist test passed.\n"); + + exit(0); +} diff --git a/test/writeraw.c b/test/writeraw.c new file mode 100644 index 0000000..5729a48 --- /dev/null +++ b/test/writeraw.c @@ -0,0 +1,130 @@ +/* + Audio File Library + + Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> + Copyright (C) 2002, Silicon Graphics, 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 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. +*/ + +/* + writeraw.c + + This program tests the validity of the AIFF file reading and writing + code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#define TEST_FILE "/tmp/test.raw" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + int nativeByteOrder; + +#ifdef WORDS_BIGENDIAN + nativeByteOrder = AF_BYTEORDER_BIGENDIAN; +#else + nativeByteOrder = AF_BYTEORDER_LITTLEENDIAN; +#endif + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_RAWDATA); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + + file = afOpenFile(TEST_FILE, "r", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_RAWDATA, + "test file not created as raw audio data file"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == nativeByteOrder, + "test file not in native byte order"); + + for (i=0; i<8; i++) + { + u_int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writeraw test passed.\n"); + + exit(EXIT_SUCCESS); +} diff --git a/test/writeulaw.c b/test/writeulaw.c new file mode 100644 index 0000000..45d76b2 --- /dev/null +++ b/test/writeulaw.c @@ -0,0 +1,166 @@ +/* + Audio File Library + + Copyright (C) 2000, Michael Pruett <michael@68k.org> + Copyright (C) 2001, Silicon Graphics, 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 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. +*/ + +/* + writeulaw.c + + The writeulaw program performs sanity testing on the Audio File + Library's G.711 u-law compression by writing and then reading + back known data to a file to make sure the two sets of data agree. + + This program writes a set of data which is invariant under G.711 + u-law compression to a file and then reads that set of data back. + + The data read from that file should match the data written + exactly. + + If this test fails, something in the Audio File Library is broken. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define TEST_FILE "/tmp/test.ulaw" + +#define FRAME_COUNT 16 +#define SAMPLE_COUNT FRAME_COUNT + +void testulaw (int fileFormat); + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + printf("writeulaw: testing NeXT .snd.\n"); + testulaw(AF_FILE_NEXTSND); + printf("writeulaw: testing AIFF-C.\n"); + testulaw(AF_FILE_AIFFC); + printf("writeulaw: testing WAVE.\n"); + testulaw(AF_FILE_WAVE); + + printf("writeulaw test passed.\n"); + + exit(0); +} + +void testulaw (int fileFormat) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {8, 16, 80, 120, 180, 780, 924, 988, + 1116, 1436, 1884, 8828, 9852, 15996, 19836, 32124}; + u_int16_t readsamples[SAMPLE_COUNT]; + AFframecount framesWritten, framesRead; + int i; + + setup = afNewFileSetup(); + + afInitCompression(setup, AF_DEFAULT_TRACK, AF_COMPRESSION_G711_ULAW); + afInitFileFormat(setup, fileFormat); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + + file = afOpenFile(TEST_FILE, "w", setup); + afFreeFileSetup(setup); + + ensure(afGetCompression(file, AF_DEFAULT_TRACK) == + AF_COMPRESSION_G711_ULAW, + "test file not created with G.711 u-law compression"); + + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, + FRAME_COUNT); + + ensure(framesWritten == FRAME_COUNT, + "number of frames requested does not match number of frames written"); + afCloseFile(file); + + /* Open the file for reading and verify the data. */ + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == fileFormat, + "test file format incorrect"); + + ensure(afGetCompression(file, AF_DEFAULT_TRACK) == + AF_COMPRESSION_G711_ULAW, + "test file not opened with G.711 u-law compression"); + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readsamples, + FRAME_COUNT); + + ensure(framesRead == FRAME_COUNT, + "number of frames read does not match number of frames requested"); + +#ifdef DEBUG + for (i=0; i<SAMPLE_COUNT; i++) + printf("readsamples[%d]: %d\n", i, readsamples[i]); + for (i=0; i<SAMPLE_COUNT; i++) + printf("samples[%d]: %d\n", i, samples[i]); +#endif + + for (i=0; i<SAMPLE_COUNT; i++) + { + ensure(samples[i] == readsamples[i], + "data written does not match data read"); + } + + /* G.711 compression uses one byte per sample. */ + ensure(afGetTrackBytes(file, AF_DEFAULT_TRACK) == SAMPLE_COUNT, + "track byte count is incorrect"); + + ensure(afGetFrameCount(file, AF_DEFAULT_TRACK) == FRAME_COUNT, + "frame count is incorrect"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "channel count is incorrect"); + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); +} diff --git a/test/writewave.c b/test/writewave.c new file mode 100644 index 0000000..65afede --- /dev/null +++ b/test/writewave.c @@ -0,0 +1,123 @@ +/* + Audio File Library + + Copyright 1998-1999, Michael Pruett <michael@68k.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. +*/ + +/* + writewave.c + + This program tests the validity of the MS RIFF Wave format reading + and writing code. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + +#ifdef __USE_SGI_HEADERS__ +#include <dmedia/audiofile.h> +#else +#include <audiofile.h> +#endif + +#define TEST_FILE "/tmp/test.wave" + +void cleanup (void) +{ +#ifndef DEBUG + unlink(TEST_FILE); +#endif +} + +void ensure (int condition, const char *message) +{ + if (!condition) + { + printf("%s.\n", message); + cleanup(); + exit(EXIT_FAILURE); + } +} + +int main (int argc, char **argv) +{ + AFfilehandle file; + AFfilesetup setup; + u_int16_t samples[] = {11, 51, 101, 501, 1001, 5001, 10001, 50001}; + int i; + int sampleFormat, sampleWidth; + int framesRead, framesWritten; + + setup = afNewFileSetup(); + afInitFileFormat(setup, AF_FILE_WAVE); + afInitChannels(setup, AF_DEFAULT_TRACK, 1); + afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + + file = afOpenFile(TEST_FILE, "w", setup); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); + + framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); + ensure(framesWritten == 8, + "number of frames written does not match number of frames requested"); + + ensure(afCloseFile(file) == 0, "error closing file"); + afFreeFileSetup(setup); + + file = afOpenFile(TEST_FILE, "r", NULL); + ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); + + ensure(afGetFileFormat(file, NULL) == AF_FILE_WAVE, + "test file not created as Wave"); + + afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); + ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, + "test file not two's complement"); + ensure(sampleWidth == 16, + "test file sample format is not 16-bit"); + + ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, + "test file doesn't have exactly one channel"); + + ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_LITTLEENDIAN, + "test file not little-endian"); + + for (i=0; i<8; i++) + { + u_int16_t temporary; + + framesRead = afReadFrames(file, AF_DEFAULT_TRACK, &temporary, 1); + ensure(framesRead == 1, + "number of frames read does not match number of frames requested"); + + ensure(temporary == samples[i], + "data written to file doesn't match data read from file"); + } + + ensure(afCloseFile(file) == 0, "error closing file"); + + cleanup(); + + printf("writewave test passed.\n"); + + exit(0); +} diff --git a/win32/Makefile.am b/win32/Makefile.am new file mode 100644 index 0000000..0f8de3c --- /dev/null +++ b/win32/Makefile.am @@ -0,0 +1,30 @@ +EXTRA_DIST = \ + all.dsp \ + all.dsw \ + audiofile.def \ + build_all.bat \ + clean_all.bat \ + clean_dist.bat \ + config.h \ + dynamiclib.dep \ + dynamiclib.dsp \ + dynamiclib.mak \ + dynmodules.dep \ + dynmodules.dsp \ + dynmodules.mak \ + lib.dsw \ + modules.dep \ + modules.dsp \ + modules.mak \ + prebuild.bat \ + README.win32 \ + sfcommands.dsp \ + sfconvert.dep \ + sfconvert.dsp \ + sfconvert.mak \ + sfinfo.dep \ + sfinfo.dsp \ + sfinfo.mak \ + staticlib.dep \ + staticlib.dsp \ + staticlib.mak diff --git a/win32/Makefile.in b/win32/Makefile.in new file mode 100644 index 0000000..5586fdc --- /dev/null +++ b/win32/Makefile.in @@ -0,0 +1,246 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AS = @AS@ +AUDIOFILE_MAJOR_VERSION = @AUDIOFILE_MAJOR_VERSION@ +AUDIOFILE_MICRO_VERSION = @AUDIOFILE_MICRO_VERSION@ +AUDIOFILE_MINOR_VERSION = @AUDIOFILE_MINOR_VERSION@ +AUDIOFILE_VERSION = @AUDIOFILE_VERSION@ +AUDIOFILE_VERSION_INFO = @AUDIOFILE_VERSION_INFO@ +AUDIO_LIB = @AUDIO_LIB@ +AWK = @AWK@ +CC = @CC@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TEST_BIN = @TEST_BIN@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +EXTRA_DIST = \ + all.dsp \ + all.dsw \ + audiofile.def \ + build_all.bat \ + clean_all.bat \ + clean_dist.bat \ + config.h \ + dynamiclib.dep \ + dynamiclib.dsp \ + dynamiclib.mak \ + dynmodules.dep \ + dynmodules.dsp \ + dynmodules.mak \ + lib.dsw \ + modules.dep \ + modules.dsp \ + modules.mak \ + prebuild.bat \ + README.win32 \ + sfcommands.dsp \ + sfconvert.dep \ + sfconvert.dsp \ + sfconvert.mak \ + sfinfo.dep \ + sfinfo.dsp \ + sfinfo.mak \ + staticlib.dep \ + staticlib.dsp \ + staticlib.mak + +subdir = win32 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu win32/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: +tags: TAGS +TAGS: + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || 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 + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/win32/README.win32 b/win32/README.win32 new file mode 100644 index 0000000..92ca0c2 --- /dev/null +++ b/win32/README.win32 @@ -0,0 +1,66 @@ +$Id: s.README.win32 1.1 01/08/27 21:29:48-00:00 mpruett@cvs.68k.org $ +$Name: <Not implemented> $ + +Win32 port of audiofile, August 2001, Chris Wolf <cwolf@starclass.com> +=========================================================================== +This is the win32 port of the audiofile library and utilities. +It has only been tested using MSVC v6 on Windows 2000 server, but +should build on other win32 platforms as long as MCVC v6 is used. + +BUILDING + + Before running either the command-line build, or IDE build, run the + script "prebuild.bat". This will create the required working directories. + + Command line build: + The libraries and executables may be built by invoking "build_all.bat". + + Note that the makefiles are generated from the IDE, and are thus a + reflection of the workspace and project file states. It is strongly + recommended to make changes via the IDE and export the makefiles, + rather than tweaking the makefiles directly. + + IDE build: + Load the "all.dsw" workspace. This workspace loads and manages the + the dependent project files. To perform a build, from the "build" + menu, select the "build" menu item. + + +DIRECTORIES + + Debug and release versions of both the static and dynamic (DLL) libraries + will be created in the win32/lib directory. + + The debug and release versions of the statically and dynamically linked + versions of the executables will be created in the following directories: + + Debug/bin/static + Debug/bin/dynamic + Relase/bin/static + Relase/bin/dynamic + + N.B. In order to execute the dynamically linked executables, the + corresponding DLL's must be in the PATH. There are two options: + + 1.) put the fully qualified path of "win32/lib" in the PATH. + + 2.) copy "audiofile.dll" and/or "audiofileD.dll" to a directory + which is already in the PATH. + + +LIBRARY NAMING CONVENTIONS + + There is an ambiguity with Microsoft's naming convention; a file with + a "*.lib" extension could either be a static library, or a DLL export + library, therefore the following naming convention is adopted to resolve + the ambiguity: + + Static Library: libBASENAME.lib e.g. libaudiofile.lib + DLL export Library: BASENAME.lib e.g. audiofile.lib + + In addition, appending "D" to the basename denotes a debug version of + the library. e.g. libaudiofileD.lib, audiofileD.dll + + The module definition file (audiofile.def) does not explicitly name + the library, in order for the linker to set the name based on the + type of build. diff --git a/win32/all.dsp b/win32/all.dsp new file mode 100644 index 0000000..eb5cc75 --- /dev/null +++ b/win32/all.dsp @@ -0,0 +1,93 @@ +# Microsoft Developer Studio Project File - Name="all" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Generic Project" 0x010a + +CFG=all - Win32 Debug using DLL +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "all.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "all.mak" CFG="all - Win32 Debug using DLL" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "all - Win32 Release" (based on "Win32 (x86) Generic Project") +!MESSAGE "all - Win32 Debug" (based on "Win32 (x86) Generic Project") +!MESSAGE "all - Win32 Release using DLL" (based on "Win32 (x86) Generic Project") +!MESSAGE "all - Win32 Debug using DLL" (based on "Win32 (x86) Generic Project") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +MTL=midl.exe + +!IF "$(CFG)" == "all - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "all - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "all - Win32 Release using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "all___Win32_Release_using_DLL" +# PROP BASE Intermediate_Dir "all___Win32_Release_using_DLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "all - Win32 Debug using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "all___Win32_Debug_using_DLL" +# PROP BASE Intermediate_Dir "all___Win32_Debug_using_DLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "all - Win32 Release" +# Name "all - Win32 Debug" +# Name "all - Win32 Release using DLL" +# Name "all - Win32 Debug using DLL" +# End Target +# End Project diff --git a/win32/all.dsw b/win32/all.dsw new file mode 100644 index 0000000..bdb379c --- /dev/null +++ b/win32/all.dsw @@ -0,0 +1,125 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "all"=.\all.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name sfconvert + End Project Dependency + Begin Project Dependency + Project_Dep_Name sfinfo + End Project Dependency +}}} + +############################################################################### + +Project: "dynamiclib"=.\dynamiclib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name dynmodules + End Project Dependency +}}} + +############################################################################### + +Project: "dynmodules"=.\dynmodules.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "modules"=.\modules.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "sfconvert"=.\sfconvert.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name dynamiclib + End Project Dependency + Begin Project Dependency + Project_Dep_Name staticlib + End Project Dependency +}}} + +############################################################################### + +Project: "sfinfo"=.\sfinfo.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name dynamiclib + End Project Dependency + Begin Project Dependency + Project_Dep_Name staticlib + End Project Dependency +}}} + +############################################################################### + +Project: "staticlib"=.\staticlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name modules + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/audiofile.def b/win32/audiofile.def new file mode 100644 index 0000000..13b100d --- /dev/null +++ b/win32/audiofile.def @@ -0,0 +1,114 @@ +;------------------------------------------------------------------------ +; $Id: s.audiofile.def 1.1 01/08/27 21:29:49-00:00 mpruett@cvs.68k.org $ +; $Name: <Not implemented> $ +; +; Win32 port, August 2001 Chris Wolf +;------------------------------------------------------------------------ +; +; This should be kept syncronized with the publicly exposed API +; defined by audiofile.h +; +LIBRARY +; +DESCRIPTION "Entry points for libaudiofile." +; +EXPORTS + + afCloseFile + afFreeFileSetup + afGetAESChannelData + afGetByteOrder + afGetChannels + afGetCompression + afGetDataOffset + afGetFileFormat + afGetFrameCount + afGetFrameSize + afGetInstIDs + afGetInstParamLong + afGetInstParams + afGetLoopCount + afGetLoopEnd + afGetLoopEndFrame + afGetLoopIDs + afGetLoopMode + afGetLoopStart + afGetLoopStartFrame + afGetLoopTrack + afGetMarkComment + afGetMarkIDs + afGetMarkName + afGetMarkPosition + afGetMiscIDs + afGetMiscSize + afGetMiscType + afGetPCMMapping + afGetRate + afGetSampleFormat + afGetTrackBytes + afGetTrackIDs + afGetVirtualByteOrder + afGetVirtualChannels + afGetVirtualFrameSize + afGetVirtualPCMMapping + afGetVirtualSampleFormat + afIdentifyFD + afIdentifyNamedFD + afInitAESChannelData + afInitAESChannelDataTo + afInitByteOrder + afInitChannels + afInitCompression + afInitDataOffset + afInitFileFormat + afInitFrameCount + afInitInstIDs + afInitLoopIDs + afInitMarkComment + afInitMarkIDs + afInitMarkName + afInitMiscIDs + afInitMiscSize + afInitMiscType + afInitPCMMapping + afInitRate + afInitSampleFormat + afInitTrackIDs + afNewFileSetup + afOpenFD + afOpenFile + afOpenNamedFD +; afOpenVirtualFile @65 ; not implemented + afQuery + afQueryDouble + afQueryLong + afQueryPointer + afReadFrames + afReadMisc +; afRestoreFilePosition @72 ; not implemented +; afSaveFilePosition @73 ; not implemented + afSeekFrame + afSeekMisc + afSetAESChannelData + afSetChannelMatrix + afSetErrorHandler + afSetInstParamLong + afSetInstParams + afSetLoopCount + afSetLoopEnd + afSetLoopEndFrame + afSetLoopMode + afSetLoopStart + afSetLoopStartFrame + afSetLoopTrack + afSetMarkPosition + afSetTrackPCMMapping + afSetVirtualByteOrder + afSetVirtualChannels + afSetVirtualPCMMapping + afSetVirtualSampleFormat + afSyncFile + afTellFrame + afWriteFrames + afWriteMisc + diff --git a/win32/build_all.bat b/win32/build_all.bat new file mode 100755 index 0000000..d1b3bff --- /dev/null +++ b/win32/build_all.bat @@ -0,0 +1,4 @@ +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug" +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release" +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug using DLL" +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release using DLL" diff --git a/win32/clean_all.bat b/win32/clean_all.bat new file mode 100755 index 0000000..e088cf0 --- /dev/null +++ b/win32/clean_all.bat @@ -0,0 +1,31 @@ +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug using DLL" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release using DLL" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Debug" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Release" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Debug using DLL" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Release using DLL" CLEAN +nmake -f staticlib.mak CFG="staticlib - Win32 Debug" CLEAN +nmake -f staticlib.mak CFG="staticlib - Win32 Release" CLEAN +nmake -f dynamiclib.mak CFG="dynamiclib - Win32 Debug" CLEAN +nmake -f dynamiclib.mak CFG="dynamiclib - Win32 Release" CLEAN +del .\lib\*.lib +cd .\Debug +del /q /s *.obj +del /q /s *.sbr +del /q /s *.dep +del /q /s *.lib +del /q /s *.idb +del /q /s *.pdb +del /q /s *.bsc +del /q /s *.pch +cd ..\Release +del /q /s *.obj +del /q /s *.sbr +del /q /s *.dep +del /q /s *.lib +del /q /s *.idb +del /q /s *.pdb +del /q /s *.bsc +del /q /s *.pch diff --git a/win32/clean_dist.bat b/win32/clean_dist.bat new file mode 100755 index 0000000..f0c1c6e --- /dev/null +++ b/win32/clean_dist.bat @@ -0,0 +1,18 @@ +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Debug using DLL" CLEAN +nmake -f sfinfo.mak CFG="sfinfo - Win32 Release using DLL" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Debug" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Release" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Debug using DLL" CLEAN +nmake -f sfconvert.mak CFG="sfconvert - Win32 Release using DLL" CLEAN +nmake -f staticlib.mak CFG="staticlib - Win32 Debug" CLEAN +nmake -f staticlib.mak CFG="staticlib - Win32 Release" CLEAN +nmake -f dynamiclib.mak CFG="dynamiclib - Win32 Debug" CLEAN +nmake -f dynamiclib.mak CFG="dynamiclib - Win32 Release" CLEAN +rmdir /s /q .\lib +del *.ncb +del *.opt +del *.plg +rmdir /s /q .\Debug +rmdir /s /q .\Release diff --git a/win32/config.h b/win32/config.h new file mode 100644 index 0000000..015f85d --- /dev/null +++ b/win32/config.h @@ -0,0 +1,72 @@ +/* + | $Id: s.config.h 1.2 04/02/10 02:16:55-05:00 michael@andromeda.68k.org $ + | config.h for Win32, Copyright (c) 2001, Chris Wolf <af@starclass.com> + | This file is specifically for the MSVC environment, it has not + | been tested using Cygwin GCC, yet. + */ + +#if !defined(__HAVE_AF_CONFIG_H__) && defined(_MSC_VER) +#define __HAVE_AF_CONFIG_H__ + +#include <float.h> + +#define isnan _isnan +#define vsnprintf _vsnprintf +#define snprintf _snprintf + +typedef long ssize_t; +typedef char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef long int32_t; +typedef unsigned long u_int32_t; + + + + + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +/* #undef off_t */ + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a off_t. */ +#define SIZEOF_OFF_T 4 + +/* The number of bytes in a size_t. */ +#define SIZEOF_SIZE_T 4 + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <unistd.h> header file. */ +/* #define HAVE_UNISTD_H 1 */ + +/* Define if you have the m library (-lm). */ +#define HAVE_LIBM 1 + +/* Name of package */ +#define PACKAGE "audiofile" + +/* Version number of package */ +#define VERSION "0.2.6" + +#endif /* __HAVE_AF_CONFIG_H__ */ diff --git a/win32/dynamiclib.dep b/win32/dynamiclib.dep new file mode 100644 index 0000000..159b1ca --- /dev/null +++ b/win32/dynamiclib.dep @@ -0,0 +1,387 @@ +# Microsoft Developer Studio Generated Dependency File, included by dynamiclib.mak + +..\libaudiofile\aes.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\af_vfs.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\aiff.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\extended.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\aiffwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\extended.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\aupv.c : \ + "..\libaudiofile\aupvinternal.h"\ + "..\libaudiofile\aupvlist.h"\ + + +..\libaudiofile\avr.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\avrwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\byteorder.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + ".\config.h"\ + + +..\libaudiofile\compression.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\data.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + ".\config.h"\ + + +..\libaudiofile\error.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\extended.c : \ + "..\libaudiofile\extended.h"\ + + +..\libaudiofile\format.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\iff.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\iffwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\instrument.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\ircam.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\ircamwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\loop.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\marker.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\misc.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\modules.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\debug.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\rebuffer.h"\ + "..\libaudiofile\pcm.h"\ + "..\libaudiofile\print.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\next.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\nextwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\nist.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\nistwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\openclose.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\pcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\pcm.h"\ + ".\config.h"\ + + +..\libaudiofile\query.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\raw.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\raw.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\setup.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\pcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\track.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\units.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\g711.h"\ + "..\libaudiofile\modules\ima.h"\ + "..\libaudiofile\modules\msadpcm.h"\ + "..\libaudiofile\modules\pcm.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\raw.h"\ + "..\libaudiofile\units.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + + +..\libaudiofile\util.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvinternal.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\wave.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + + +..\libaudiofile\wavewrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + diff --git a/win32/dynamiclib.dsp b/win32/dynamiclib.dsp new file mode 100644 index 0000000..8af94c8 --- /dev/null +++ b/win32/dynamiclib.dsp @@ -0,0 +1,383 @@ +# Microsoft Developer Studio Project File - Name="dynamiclib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=dynamiclib - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "dynamiclib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dynamiclib.mak" CFG="dynamiclib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dynamiclib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "dynamiclib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dynamiclib___Win32_Release" +# PROP BASE Intermediate_Dir "dynamiclib___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\dynamiclib" +# PROP Intermediate_Dir "Release\dynamiclib" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dynmodules.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt" /out:"lib\audiofile.dll" /libpath:"Release\dynmodules" +# SUBTRACT LINK32 /nodefaultlib +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=get export library +PostBuild_Cmds=echo on copy Release\dynamiclib\audiofile.lib .\lib +# End Special Build Tool + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dynamiclib___Win32_Debug" +# PROP BASE Intermediate_Dir "dynamiclib___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug/dynamiclib" +# PROP Intermediate_Dir "Debug/dynamiclib" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\libaudiofile" /I "..\..\vorbis\vorbis\include" /I "..\..\vorbis\ogg\include" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dynmodules.lib /nologo /dll /incremental:no /debug /machine:I386 /out:"lib/audiofileD.dll" /pdbtype:sept /libpath:"Debug\dynmodules" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=get export library +PostBuild_Cmds=echo off copy Debug\dynamiclib\audiofileD.lib .\lib +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "dynamiclib - Win32 Release" +# Name "dynamiclib - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\libaudiofile\aes.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\af_vfs.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiff.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiffwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupv.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\avr.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\avrwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\byteorder.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\compression.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\data.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\error.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\extended.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\format.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\g711.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\iff.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\iffwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\instrument.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircam.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircamwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\loop.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\marker.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\misc.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\next.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nextwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nist.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nistwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\openclose.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\pcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\query.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\raw.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\setup.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\track.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\units.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\util.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wave.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wavewrite.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\libaudiofile\af_vfs.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\afinternal.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiff.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\audiofile.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupvinternal.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupvlist.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\avr.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\byteorder.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\compression.h +# End Source File +# Begin Source File + +SOURCE=.\config.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\error.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\extended.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\g711.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\iff.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\instrument.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircam.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\marker.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\next.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nist.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\pcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\print.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\raw.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\setup.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\track.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\units.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\util.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wave.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Group "module definition" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\audiofile.def +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/dynamiclib.mak b/win32/dynamiclib.mak new file mode 100644 index 0000000..08723e8 --- /dev/null +++ b/win32/dynamiclib.mak @@ -0,0 +1,1154 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on dynamiclib.dsp +!IF "$(CFG)" == "" +CFG=dynamiclib - Win32 Debug +!MESSAGE No configuration specified. Defaulting to dynamiclib - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "dynamiclib - Win32 Release" && "$(CFG)" != "dynamiclib - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dynamiclib.mak" CFG="dynamiclib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dynamiclib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "dynamiclib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + +OUTDIR=.\Release\dynamiclib +INTDIR=.\Release\dynamiclib + +!IF "$(RECURSE)" == "0" + +ALL : ".\lib\audiofile.dll" + +!ELSE + +ALL : "dynmodules - Win32 Release" ".\lib\audiofile.dll" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynmodules - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\aes.obj" + -@erase "$(INTDIR)\af_vfs.obj" + -@erase "$(INTDIR)\aiff.obj" + -@erase "$(INTDIR)\aiffwrite.obj" + -@erase "$(INTDIR)\aupv.obj" + -@erase "$(INTDIR)\avr.obj" + -@erase "$(INTDIR)\avrwrite.obj" + -@erase "$(INTDIR)\byteorder.obj" + -@erase "$(INTDIR)\compression.obj" + -@erase "$(INTDIR)\data.obj" + -@erase "$(INTDIR)\error.obj" + -@erase "$(INTDIR)\extended.obj" + -@erase "$(INTDIR)\format.obj" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\iff.obj" + -@erase "$(INTDIR)\iffwrite.obj" + -@erase "$(INTDIR)\instrument.obj" + -@erase "$(INTDIR)\ircam.obj" + -@erase "$(INTDIR)\ircamwrite.obj" + -@erase "$(INTDIR)\loop.obj" + -@erase "$(INTDIR)\marker.obj" + -@erase "$(INTDIR)\misc.obj" + -@erase "$(INTDIR)\modules.obj" + -@erase "$(INTDIR)\next.obj" + -@erase "$(INTDIR)\nextwrite.obj" + -@erase "$(INTDIR)\nist.obj" + -@erase "$(INTDIR)\nistwrite.obj" + -@erase "$(INTDIR)\openclose.obj" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\query.obj" + -@erase "$(INTDIR)\raw.obj" + -@erase "$(INTDIR)\setup.obj" + -@erase "$(INTDIR)\track.obj" + -@erase "$(INTDIR)\units.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\wave.obj" + -@erase "$(INTDIR)\wavewrite.obj" + -@erase "$(OUTDIR)\audiofile.exp" + -@erase "$(OUTDIR)\audiofile.lib" + -@erase ".\lib\audiofile.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\dynamiclib.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\dynamiclib.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dynmodules.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\audiofile.pdb" /machine:I386 /nodefaultlib:"msvcrt" /def:".\audiofile.def" /out:"lib\audiofile.dll" /implib:"$(OUTDIR)\audiofile.lib" /libpath:"Release\dynmodules" +DEF_FILE= \ + ".\audiofile.def" +LINK32_OBJS= \ + "$(INTDIR)\aes.obj" \ + "$(INTDIR)\af_vfs.obj" \ + "$(INTDIR)\aiff.obj" \ + "$(INTDIR)\aiffwrite.obj" \ + "$(INTDIR)\aupv.obj" \ + "$(INTDIR)\avr.obj" \ + "$(INTDIR)\avrwrite.obj" \ + "$(INTDIR)\byteorder.obj" \ + "$(INTDIR)\compression.obj" \ + "$(INTDIR)\data.obj" \ + "$(INTDIR)\error.obj" \ + "$(INTDIR)\extended.obj" \ + "$(INTDIR)\format.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\iff.obj" \ + "$(INTDIR)\iffwrite.obj" \ + "$(INTDIR)\instrument.obj" \ + "$(INTDIR)\ircam.obj" \ + "$(INTDIR)\ircamwrite.obj" \ + "$(INTDIR)\loop.obj" \ + "$(INTDIR)\marker.obj" \ + "$(INTDIR)\misc.obj" \ + "$(INTDIR)\modules.obj" \ + "$(INTDIR)\next.obj" \ + "$(INTDIR)\nextwrite.obj" \ + "$(INTDIR)\nist.obj" \ + "$(INTDIR)\nistwrite.obj" \ + "$(INTDIR)\openclose.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\query.obj" \ + "$(INTDIR)\raw.obj" \ + "$(INTDIR)\setup.obj" \ + "$(INTDIR)\track.obj" \ + "$(INTDIR)\units.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wave.obj" \ + "$(INTDIR)\wavewrite.obj" \ + ".\Release\dynmodules\dynmodules.lib" + +".\lib\audiofile.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=get export library +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +$(DS_POSTBUILD_DEP) : "dynmodules - Win32 Release" ".\lib\audiofile.dll" + echo on + copy Release\dynamiclib\audiofile.lib .\lib + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + +OUTDIR=.\Debug/dynamiclib +INTDIR=.\Debug/dynamiclib +# Begin Custom Macros +OutDir=.\Debug/dynamiclib +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : ".\lib\audiofileD.dll" "$(OUTDIR)\dynamiclib.bsc" + +!ELSE + +ALL : "dynmodules - Win32 Debug" ".\lib\audiofileD.dll" "$(OUTDIR)\dynamiclib.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynmodules - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\aes.obj" + -@erase "$(INTDIR)\aes.sbr" + -@erase "$(INTDIR)\af_vfs.obj" + -@erase "$(INTDIR)\af_vfs.sbr" + -@erase "$(INTDIR)\aiff.obj" + -@erase "$(INTDIR)\aiff.sbr" + -@erase "$(INTDIR)\aiffwrite.obj" + -@erase "$(INTDIR)\aiffwrite.sbr" + -@erase "$(INTDIR)\aupv.obj" + -@erase "$(INTDIR)\aupv.sbr" + -@erase "$(INTDIR)\avr.obj" + -@erase "$(INTDIR)\avr.sbr" + -@erase "$(INTDIR)\avrwrite.obj" + -@erase "$(INTDIR)\avrwrite.sbr" + -@erase "$(INTDIR)\byteorder.obj" + -@erase "$(INTDIR)\byteorder.sbr" + -@erase "$(INTDIR)\compression.obj" + -@erase "$(INTDIR)\compression.sbr" + -@erase "$(INTDIR)\data.obj" + -@erase "$(INTDIR)\data.sbr" + -@erase "$(INTDIR)\error.obj" + -@erase "$(INTDIR)\error.sbr" + -@erase "$(INTDIR)\extended.obj" + -@erase "$(INTDIR)\extended.sbr" + -@erase "$(INTDIR)\format.obj" + -@erase "$(INTDIR)\format.sbr" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\g711.sbr" + -@erase "$(INTDIR)\iff.obj" + -@erase "$(INTDIR)\iff.sbr" + -@erase "$(INTDIR)\iffwrite.obj" + -@erase "$(INTDIR)\iffwrite.sbr" + -@erase "$(INTDIR)\instrument.obj" + -@erase "$(INTDIR)\instrument.sbr" + -@erase "$(INTDIR)\ircam.obj" + -@erase "$(INTDIR)\ircam.sbr" + -@erase "$(INTDIR)\ircamwrite.obj" + -@erase "$(INTDIR)\ircamwrite.sbr" + -@erase "$(INTDIR)\loop.obj" + -@erase "$(INTDIR)\loop.sbr" + -@erase "$(INTDIR)\marker.obj" + -@erase "$(INTDIR)\marker.sbr" + -@erase "$(INTDIR)\misc.obj" + -@erase "$(INTDIR)\misc.sbr" + -@erase "$(INTDIR)\modules.obj" + -@erase "$(INTDIR)\modules.sbr" + -@erase "$(INTDIR)\next.obj" + -@erase "$(INTDIR)\next.sbr" + -@erase "$(INTDIR)\nextwrite.obj" + -@erase "$(INTDIR)\nextwrite.sbr" + -@erase "$(INTDIR)\nist.obj" + -@erase "$(INTDIR)\nist.sbr" + -@erase "$(INTDIR)\nistwrite.obj" + -@erase "$(INTDIR)\nistwrite.sbr" + -@erase "$(INTDIR)\openclose.obj" + -@erase "$(INTDIR)\openclose.sbr" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\pcm.sbr" + -@erase "$(INTDIR)\query.obj" + -@erase "$(INTDIR)\query.sbr" + -@erase "$(INTDIR)\raw.obj" + -@erase "$(INTDIR)\raw.sbr" + -@erase "$(INTDIR)\setup.obj" + -@erase "$(INTDIR)\setup.sbr" + -@erase "$(INTDIR)\track.obj" + -@erase "$(INTDIR)\track.sbr" + -@erase "$(INTDIR)\units.obj" + -@erase "$(INTDIR)\units.sbr" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\util.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(INTDIR)\wave.obj" + -@erase "$(INTDIR)\wave.sbr" + -@erase "$(INTDIR)\wavewrite.obj" + -@erase "$(INTDIR)\wavewrite.sbr" + -@erase "$(OUTDIR)\audiofileD.exp" + -@erase "$(OUTDIR)\audiofileD.lib" + -@erase "$(OUTDIR)\audiofileD.pdb" + -@erase "$(OUTDIR)\dynamiclib.bsc" + -@erase ".\lib\audiofileD.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /GX /ZI /Od /I "..\libaudiofile" /I "..\..\vorbis\vorbis\include" /I "..\..\vorbis\ogg\include" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\dynamiclib.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aes.sbr" \ + "$(INTDIR)\af_vfs.sbr" \ + "$(INTDIR)\aiff.sbr" \ + "$(INTDIR)\aiffwrite.sbr" \ + "$(INTDIR)\aupv.sbr" \ + "$(INTDIR)\avr.sbr" \ + "$(INTDIR)\avrwrite.sbr" \ + "$(INTDIR)\byteorder.sbr" \ + "$(INTDIR)\compression.sbr" \ + "$(INTDIR)\data.sbr" \ + "$(INTDIR)\error.sbr" \ + "$(INTDIR)\extended.sbr" \ + "$(INTDIR)\format.sbr" \ + "$(INTDIR)\g711.sbr" \ + "$(INTDIR)\iff.sbr" \ + "$(INTDIR)\iffwrite.sbr" \ + "$(INTDIR)\instrument.sbr" \ + "$(INTDIR)\ircam.sbr" \ + "$(INTDIR)\ircamwrite.sbr" \ + "$(INTDIR)\loop.sbr" \ + "$(INTDIR)\marker.sbr" \ + "$(INTDIR)\misc.sbr" \ + "$(INTDIR)\modules.sbr" \ + "$(INTDIR)\next.sbr" \ + "$(INTDIR)\nextwrite.sbr" \ + "$(INTDIR)\nist.sbr" \ + "$(INTDIR)\nistwrite.sbr" \ + "$(INTDIR)\openclose.sbr" \ + "$(INTDIR)\pcm.sbr" \ + "$(INTDIR)\query.sbr" \ + "$(INTDIR)\raw.sbr" \ + "$(INTDIR)\setup.sbr" \ + "$(INTDIR)\track.sbr" \ + "$(INTDIR)\units.sbr" \ + "$(INTDIR)\util.sbr" \ + "$(INTDIR)\wave.sbr" \ + "$(INTDIR)\wavewrite.sbr" + +"$(OUTDIR)\dynamiclib.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dynmodules.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\audiofileD.pdb" /debug /machine:I386 /def:".\audiofile.def" /out:"lib/audiofileD.dll" /implib:"$(OUTDIR)\audiofileD.lib" /pdbtype:sept /libpath:"Debug\dynmodules" +DEF_FILE= \ + ".\audiofile.def" +LINK32_OBJS= \ + "$(INTDIR)\aes.obj" \ + "$(INTDIR)\af_vfs.obj" \ + "$(INTDIR)\aiff.obj" \ + "$(INTDIR)\aiffwrite.obj" \ + "$(INTDIR)\aupv.obj" \ + "$(INTDIR)\avr.obj" \ + "$(INTDIR)\avrwrite.obj" \ + "$(INTDIR)\byteorder.obj" \ + "$(INTDIR)\compression.obj" \ + "$(INTDIR)\data.obj" \ + "$(INTDIR)\error.obj" \ + "$(INTDIR)\extended.obj" \ + "$(INTDIR)\format.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\iff.obj" \ + "$(INTDIR)\iffwrite.obj" \ + "$(INTDIR)\instrument.obj" \ + "$(INTDIR)\ircam.obj" \ + "$(INTDIR)\ircamwrite.obj" \ + "$(INTDIR)\loop.obj" \ + "$(INTDIR)\marker.obj" \ + "$(INTDIR)\misc.obj" \ + "$(INTDIR)\modules.obj" \ + "$(INTDIR)\next.obj" \ + "$(INTDIR)\nextwrite.obj" \ + "$(INTDIR)\nist.obj" \ + "$(INTDIR)\nistwrite.obj" \ + "$(INTDIR)\openclose.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\query.obj" \ + "$(INTDIR)\raw.obj" \ + "$(INTDIR)\setup.obj" \ + "$(INTDIR)\track.obj" \ + "$(INTDIR)\units.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wave.obj" \ + "$(INTDIR)\wavewrite.obj" \ + ".\Debug\dynmodules\dynmodules.lib" + +".\lib\audiofileD.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=get export library +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug/dynamiclib +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "dynmodules - Win32 Debug" ".\lib\audiofileD.dll" "$(OUTDIR)\dynamiclib.bsc" + echo off + copy Debug\dynamiclib\audiofileD.lib .\lib + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("dynamiclib.dep") +!INCLUDE "dynamiclib.dep" +!ELSE +!MESSAGE Warning: cannot find "dynamiclib.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "dynamiclib - Win32 Release" || "$(CFG)" == "dynamiclib - Win32 Debug" +SOURCE=..\libaudiofile\aes.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\aes.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\aes.obj" "$(INTDIR)\aes.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\af_vfs.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\af_vfs.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\af_vfs.obj" "$(INTDIR)\af_vfs.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aiff.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\aiff.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\aiff.obj" "$(INTDIR)\aiff.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aiffwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\aiffwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\aiffwrite.obj" "$(INTDIR)\aiffwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aupv.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\aupv.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\aupv.obj" "$(INTDIR)\aupv.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\avr.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\avr.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\avr.obj" "$(INTDIR)\avr.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\avrwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\avrwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\avrwrite.obj" "$(INTDIR)\avrwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\byteorder.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\byteorder.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\byteorder.obj" "$(INTDIR)\byteorder.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\compression.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\compression.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\compression.obj" "$(INTDIR)\compression.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\data.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\data.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\data.obj" "$(INTDIR)\data.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\error.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\error.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\error.obj" "$(INTDIR)\error.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\extended.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\extended.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\extended.obj" "$(INTDIR)\extended.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\format.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\format.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\format.obj" "$(INTDIR)\format.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\g711.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\g711.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\g711.obj" "$(INTDIR)\g711.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\iff.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\iff.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\iff.obj" "$(INTDIR)\iff.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\iffwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\iffwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\iffwrite.obj" "$(INTDIR)\iffwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\instrument.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\instrument.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\instrument.obj" "$(INTDIR)\instrument.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\ircam.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\ircam.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\ircam.obj" "$(INTDIR)\ircam.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\ircamwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\ircamwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\ircamwrite.obj" "$(INTDIR)\ircamwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\loop.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\loop.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\loop.obj" "$(INTDIR)\loop.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\marker.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\marker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\marker.obj" "$(INTDIR)\marker.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\misc.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\misc.obj" "$(INTDIR)\misc.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\modules.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\modules.obj" "$(INTDIR)\modules.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\next.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\next.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\next.obj" "$(INTDIR)\next.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nextwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\nextwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\nextwrite.obj" "$(INTDIR)\nextwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nist.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\nist.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\nist.obj" "$(INTDIR)\nist.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nistwrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\nistwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\nistwrite.obj" "$(INTDIR)\nistwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\openclose.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\openclose.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\openclose.obj" "$(INTDIR)\openclose.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\pcm.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\pcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\pcm.obj" "$(INTDIR)\pcm.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\query.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\query.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\query.obj" "$(INTDIR)\query.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\raw.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\raw.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\raw.obj" "$(INTDIR)\raw.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\setup.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\setup.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\setup.obj" "$(INTDIR)\setup.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\track.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\track.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\track.obj" "$(INTDIR)\track.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\units.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\units.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\units.obj" "$(INTDIR)\units.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\util.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\util.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\util.obj" "$(INTDIR)\util.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\wave.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\wave.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\wave.obj" "$(INTDIR)\wave.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\wavewrite.c + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + + +"$(INTDIR)\wavewrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + + +"$(INTDIR)\wavewrite.obj" "$(INTDIR)\wavewrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +!IF "$(CFG)" == "dynamiclib - Win32 Release" + +"dynmodules - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynmodules.mak" CFG="dynmodules - Win32 Release" + cd "." + +"dynmodules - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynmodules.mak" CFG="dynmodules - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "dynamiclib - Win32 Debug" + +"dynmodules - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynmodules.mak" CFG="dynmodules - Win32 Debug" + cd "." + +"dynmodules - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynmodules.mak" CFG="dynmodules - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ENDIF + + +!ENDIF + diff --git a/win32/dynmodules.dep b/win32/dynmodules.dep new file mode 100644 index 0000000..6e1c114 --- /dev/null +++ b/win32/dynmodules.dep @@ -0,0 +1,70 @@ +# Microsoft Developer Studio Generated Dependency File, included by dynmodules.mak + +..\libaudiofile\modules\adpcm.c : \ + "..\libaudiofile\modules\adpcm.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\g711.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\g711.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\g711.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\ima.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\adpcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\msadpcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\msadpcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\pcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\print.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\rebuffer.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\pcm.h"\ + "..\libaudiofile\modules\rebuffer.template"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + diff --git a/win32/dynmodules.dsp b/win32/dynmodules.dsp new file mode 100644 index 0000000..53a49bd --- /dev/null +++ b/win32/dynmodules.dsp @@ -0,0 +1,142 @@ +# Microsoft Developer Studio Project File - Name="dynmodules" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=dynmodules - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "dynmodules.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dynmodules.mak" CFG="dynmodules - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dynmodules - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "dynmodules - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dynmodules - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dynmodules___Win32_Release" +# PROP BASE Intermediate_Dir "dynmodules___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\dynmodules" +# PROP Intermediate_Dir "Release\dynmodules" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /FD /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "dynmodules - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dynmodules___Win32_Debug" +# PROP BASE Intermediate_Dir "dynmodules___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\dynmodules" +# PROP Intermediate_Dir "Debug\dynmodules" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "dynmodules - Win32 Release" +# Name "dynmodules - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\libaudiofile\modules\adpcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\g711.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\ima.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\msadpcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\pcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\rebuffer.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\libaudiofile\modules\adpcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\g711.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\ima.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\msadpcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\pcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\rebuffer.h +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/dynmodules.mak b/win32/dynmodules.mak new file mode 100644 index 0000000..c599dec --- /dev/null +++ b/win32/dynmodules.mak @@ -0,0 +1,234 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on dynmodules.dsp +!IF "$(CFG)" == "" +CFG=dynmodules - Win32 Debug +!MESSAGE No configuration specified. Defaulting to dynmodules - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "dynmodules - Win32 Release" && "$(CFG)" != "dynmodules - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dynmodules.mak" CFG="dynmodules - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dynmodules - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "dynmodules - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "dynmodules - Win32 Release" + +OUTDIR=.\Release\dynmodules +INTDIR=.\Release\dynmodules +# Begin Custom Macros +OutDir=.\Release\dynmodules +# End Custom Macros + +ALL : "$(OUTDIR)\dynmodules.lib" + + +CLEAN : + -@erase "$(INTDIR)\adpcm.obj" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\ima.obj" + -@erase "$(INTDIR)\msadpcm.obj" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\rebuffer.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\dynmodules.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\dynmodules.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\dynmodules.lib" +LIB32_OBJS= \ + "$(INTDIR)\adpcm.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\ima.obj" \ + "$(INTDIR)\msadpcm.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\rebuffer.obj" + +"$(OUTDIR)\dynmodules.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "dynmodules - Win32 Debug" + +OUTDIR=.\Debug\dynmodules +INTDIR=.\Debug\dynmodules +# Begin Custom Macros +OutDir=.\Debug\dynmodules +# End Custom Macros + +ALL : "$(OUTDIR)\dynmodules.lib" + + +CLEAN : + -@erase "$(INTDIR)\adpcm.obj" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\ima.obj" + -@erase "$(INTDIR)\msadpcm.obj" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\rebuffer.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\dynmodules.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_USRDLL" /D "DYNAMICLIB_EXPORTS" /D "HAVE_CONFIG_H" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\dynmodules.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\dynmodules.lib" +LIB32_OBJS= \ + "$(INTDIR)\adpcm.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\ima.obj" \ + "$(INTDIR)\msadpcm.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\rebuffer.obj" + +"$(OUTDIR)\dynmodules.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("dynmodules.dep") +!INCLUDE "dynmodules.dep" +!ELSE +!MESSAGE Warning: cannot find "dynmodules.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "dynmodules - Win32 Release" || "$(CFG)" == "dynmodules - Win32 Debug" +SOURCE=..\libaudiofile\modules\adpcm.c + +"$(INTDIR)\adpcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\libaudiofile\modules\g711.c + +"$(INTDIR)\g711.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\libaudiofile\modules\ima.c + +"$(INTDIR)\ima.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\libaudiofile\modules\msadpcm.c + +"$(INTDIR)\msadpcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\libaudiofile\modules\pcm.c + +"$(INTDIR)\pcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\libaudiofile\modules\rebuffer.c + +"$(INTDIR)\rebuffer.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + + +!ENDIF + diff --git a/win32/lib.dsw b/win32/lib.dsw new file mode 100644 index 0000000..1b4b009 --- /dev/null +++ b/win32/lib.dsw @@ -0,0 +1,95 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "dynamiclib"=.\dynamiclib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name dynmodules + End Project Dependency +}}} + +############################################################################### + +Project: "dynmodules"=.\dynmodules.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "modules"=.\modules.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "sfconvert"=.\sfconvert.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "sfinfo"=.\sfinfo.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "staticlib"=.\staticlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name modules + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/modules.dep b/win32/modules.dep new file mode 100644 index 0000000..8e83e34 --- /dev/null +++ b/win32/modules.dep @@ -0,0 +1,70 @@ +# Microsoft Developer Studio Generated Dependency File, included by modules.mak + +..\libaudiofile\modules\adpcm.c : \ + "..\libaudiofile\modules\adpcm.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\g711.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\g711.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\g711.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\ima.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\adpcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\msadpcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\msadpcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\pcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\print.h"\ + ".\config.h"\ + + +..\libaudiofile\modules\rebuffer.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\pcm.h"\ + "..\libaudiofile\modules\rebuffer.template"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + diff --git a/win32/modules.dsp b/win32/modules.dsp new file mode 100644 index 0000000..e0989e9 --- /dev/null +++ b/win32/modules.dsp @@ -0,0 +1,141 @@ +# Microsoft Developer Studio Project File - Name="modules" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=modules - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "modules.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "modules.mak" CFG="modules - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "modules - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "modules - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "modules - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "modules___Win32_Release" +# PROP BASE Intermediate_Dir "modules___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\staticmod" +# PROP Intermediate_Dir "Release\staticmod" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "modules___Win32_Debug" +# PROP BASE Intermediate_Dir "modules___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\staticmod" +# PROP Intermediate_Dir "Debug\staticmod" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"Debug\staticmod\modulesD.lib" + +!ENDIF + +# Begin Target + +# Name "modules - Win32 Release" +# Name "modules - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\libaudiofile\modules\adpcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\g711.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\ima.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\msadpcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\pcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\rebuffer.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\libaudiofile\modules\adpcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\g711.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\ima.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\msadpcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\pcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules\rebuffer.h +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/modules.mak b/win32/modules.mak new file mode 100644 index 0000000..5be5ea7 --- /dev/null +++ b/win32/modules.mak @@ -0,0 +1,324 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on modules.dsp +!IF "$(CFG)" == "" +CFG=modules - Win32 Debug +!MESSAGE No configuration specified. Defaulting to modules - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "modules - Win32 Release" && "$(CFG)" != "modules - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "modules.mak" CFG="modules - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "modules - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "modules - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "modules - Win32 Release" + +OUTDIR=.\Release\staticmod +INTDIR=.\Release\staticmod +# Begin Custom Macros +OutDir=.\Release\staticmod +# End Custom Macros + +ALL : "$(OUTDIR)\modules.lib" + + +CLEAN : + -@erase "$(INTDIR)\adpcm.obj" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\ima.obj" + -@erase "$(INTDIR)\msadpcm.obj" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\rebuffer.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\modules.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\modules.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\modules.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\modules.lib" +LIB32_OBJS= \ + "$(INTDIR)\adpcm.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\ima.obj" \ + "$(INTDIR)\msadpcm.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\rebuffer.obj" + +"$(OUTDIR)\modules.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +OUTDIR=.\Debug\staticmod +INTDIR=.\Debug\staticmod +# Begin Custom Macros +OutDir=.\Debug\staticmod +# End Custom Macros + +ALL : "$(OUTDIR)\modulesD.lib" "$(OUTDIR)\modules.bsc" + + +CLEAN : + -@erase "$(INTDIR)\adpcm.obj" + -@erase "$(INTDIR)\adpcm.sbr" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\g711.sbr" + -@erase "$(INTDIR)\ima.obj" + -@erase "$(INTDIR)\ima.sbr" + -@erase "$(INTDIR)\msadpcm.obj" + -@erase "$(INTDIR)\msadpcm.sbr" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\pcm.sbr" + -@erase "$(INTDIR)\rebuffer.obj" + -@erase "$(INTDIR)\rebuffer.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\modules.bsc" + -@erase "$(OUTDIR)\modulesD.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\modules.bsc" +BSC32_SBRS= \ + "$(INTDIR)\adpcm.sbr" \ + "$(INTDIR)\g711.sbr" \ + "$(INTDIR)\ima.sbr" \ + "$(INTDIR)\msadpcm.sbr" \ + "$(INTDIR)\pcm.sbr" \ + "$(INTDIR)\rebuffer.sbr" + +"$(OUTDIR)\modules.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\modulesD.lib" +LIB32_OBJS= \ + "$(INTDIR)\adpcm.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\ima.obj" \ + "$(INTDIR)\msadpcm.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\rebuffer.obj" + +"$(OUTDIR)\modulesD.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("modules.dep") +!INCLUDE "modules.dep" +!ELSE +!MESSAGE Warning: cannot find "modules.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "modules - Win32 Release" || "$(CFG)" == "modules - Win32 Debug" +SOURCE=..\libaudiofile\modules\adpcm.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\adpcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\adpcm.obj" "$(INTDIR)\adpcm.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules\g711.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\g711.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\g711.obj" "$(INTDIR)\g711.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules\ima.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\ima.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\ima.obj" "$(INTDIR)\ima.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules\msadpcm.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\msadpcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\msadpcm.obj" "$(INTDIR)\msadpcm.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules\pcm.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\pcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\pcm.obj" "$(INTDIR)\pcm.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules\rebuffer.c + +!IF "$(CFG)" == "modules - Win32 Release" + + +"$(INTDIR)\rebuffer.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + + +"$(INTDIR)\rebuffer.obj" "$(INTDIR)\rebuffer.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + + +!ENDIF + diff --git a/win32/prebuild.bat b/win32/prebuild.bat new file mode 100755 index 0000000..cb83c63 --- /dev/null +++ b/win32/prebuild.bat @@ -0,0 +1,25 @@ +echo off +rem $Id: s.prebuild.bat 1.1 01/08/27 21:29:49-00:00 mpruett@cvs.68k.org $ +rem +mkdir .\lib +mkdir .\Debug\bin\dynamic +mkdir .\Debug\bin\static +mkdir .\Debug\dynamiclib +mkdir .\Debug\dynmodules +mkdir .\Debug\sfconvert +mkdir .\Debug\sfconvert_using_DLL +mkdir .\Debug\sfinfo +mkdir .\Debug\sfinfo_using_DLL +mkdir .\Debug\staticlib +mkdir .\Debug\staticmod +mkdir .\Release\bin +mkdir .\Release\bin\dynamic +mkdir .\Release\bin\static +mkdir .\Release\dynamiclib +mkdir .\Release\dynmodules +mkdir .\Release\sfconvert +mkdir .\Release\sfconvert_using_DLL +mkdir .\Release\sfinfo\static +mkdir .\Release\sfinfo_using_DLL +mkdir .\Release\staticlib +mkdir .\Release\staticmod diff --git a/win32/sfcommands.dsp b/win32/sfcommands.dsp new file mode 100644 index 0000000..56fbcff --- /dev/null +++ b/win32/sfcommands.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="sfcommands" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sfcommands - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sfcommands.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sfcommands.mak" CFG="sfcommands - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sfcommands - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sfcommands - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sfcommands - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "sfcommands___Win32_Release" +# PROP BASE Intermediate_Dir "sfcommands___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "sfcommands___Win32_Release" +# PROP Intermediate_Dir "sfcommands___Win32_Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "sfcommands - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfcommands___Win32_Debug" +# PROP BASE Intermediate_Dir "sfcommands___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\sfconvert" +# PROP Intermediate_Dir "Debug\sfconvert" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib modulesD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /out:"Debug/sfcommands.exe" /pdbtype:sept /libpath:"lib" + +!ENDIF + +# Begin Target + +# Name "sfcommands - Win32 Release" +# Name "sfcommands - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\sfcommands\printinfo.c +# End Source File +# Begin Source File + +SOURCE=..\sfcommands\sfinfo.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/win32/sfconvert.dep b/win32/sfconvert.dep new file mode 100644 index 0000000..2faa18b --- /dev/null +++ b/win32/sfconvert.dep @@ -0,0 +1,12 @@ +# Microsoft Developer Studio Generated Dependency File, included by sfconvert.mak + +..\sfcommands\printinfo.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\sfcommands\sfconvert.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + diff --git a/win32/sfconvert.dsp b/win32/sfconvert.dsp new file mode 100644 index 0000000..6ecfa1a --- /dev/null +++ b/win32/sfconvert.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="sfconvert" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sfconvert - Win32 Debug using DLL +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sfconvert.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sfconvert.mak" CFG="sfconvert - Win32 Debug using DLL" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sfconvert - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Debug using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Release using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sfconvert - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "sfconvert___Win32_Release" +# PROP BASE Intermediate_Dir "sfconvert___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\sfconvert" +# PROP Intermediate_Dir "Release\sfconvert" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofile.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Release\bin\static\sfconvert.exe" /libpath:"lib" + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfconvert___Win32_Debug" +# PROP BASE Intermediate_Dir "sfconvert___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\sfconvert" +# PROP Intermediate_Dir "Debug\sfconvert" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmtd" /out:"Debug\bin\static\sfconvert.exe" /pdbtype:sept /libpath:"lib" + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfconvert___Win32_Debug_using_DLL" +# PROP BASE Intermediate_Dir "sfconvert___Win32_Debug_using_DLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\sfconvert_using_DLL" +# PROP Intermediate_Dir "Debug\sfconvert_using_DLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib modulesD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmtd" /pdbtype:sept /libpath:"lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmtd" /pdbtype:sept /libpath:"lib" + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "sfconvert___Win32_Release_using_DLL" +# PROP BASE Intermediate_Dir "sfconvert___Win32_Release_using_DLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\sfconvert_using_DLL" +# PROP Intermediate_Dir "Release\sfconvert_using_DLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofile.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libcd" /out:"Release\bin\dynamic\sfconvert.exe" /libpath:"lib" + +!ENDIF + +# Begin Target + +# Name "sfconvert - Win32 Release" +# Name "sfconvert - Win32 Debug" +# Name "sfconvert - Win32 Debug using DLL" +# Name "sfconvert - Win32 Release using DLL" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\sfcommands\printinfo.c +# End Source File +# Begin Source File + +SOURCE=..\sfcommands\sfconvert.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/win32/sfconvert.mak b/win32/sfconvert.mak new file mode 100644 index 0000000..d2fe61e --- /dev/null +++ b/win32/sfconvert.mak @@ -0,0 +1,503 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on sfconvert.dsp +!IF "$(CFG)" == "" +CFG=sfconvert - Win32 Debug using DLL +!MESSAGE No configuration specified. Defaulting to sfconvert - Win32 Debug using DLL. +!ENDIF + +!IF "$(CFG)" != "sfconvert - Win32 Release" && "$(CFG)" != "sfconvert - Win32 Debug" && "$(CFG)" != "sfconvert - Win32 Debug using DLL" && "$(CFG)" != "sfconvert - Win32 Release using DLL" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sfconvert.mak" CFG="sfconvert - Win32 Debug using DLL" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sfconvert - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Debug using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE "sfconvert - Win32 Release using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "sfconvert - Win32 Release" + +OUTDIR=.\Release\sfconvert +INTDIR=.\Release\sfconvert + +!IF "$(RECURSE)" == "0" + +ALL : ".\Release\bin\static\sfconvert.exe" + +!ELSE + +ALL : "staticlib - Win32 Release" "dynamiclib - Win32 Release" ".\Release\bin\static\sfconvert.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynamiclib - Win32 ReleaseCLEAN" "staticlib - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfconvert.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase ".\Release\bin\static\sfconvert.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\sfconvert.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfconvert.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofile.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\sfconvert.pdb" /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Release\bin\static\sfconvert.exe" /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfconvert.obj" \ + ".\Release\dynamiclib\audiofile.lib" \ + ".\lib\libaudiofile.lib" + +".\Release\bin\static\sfconvert.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + +OUTDIR=.\Debug\sfconvert +INTDIR=.\Debug\sfconvert +# Begin Custom Macros +OutDir=.\Debug\sfconvert +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : ".\Debug\bin\static\sfconvert.exe" "$(OUTDIR)\sfconvert.bsc" + +!ELSE + +ALL : "staticlib - Win32 Debug" "dynamiclib - Win32 Debug" ".\Debug\bin\static\sfconvert.exe" "$(OUTDIR)\sfconvert.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynamiclib - Win32 DebugCLEAN" "staticlib - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\printinfo.sbr" + -@erase "$(INTDIR)\sfconvert.obj" + -@erase "$(INTDIR)\sfconvert.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\sfconvert.bsc" + -@erase "$(OUTDIR)\sfconvert.pdb" + -@erase ".\Debug\bin\static\sfconvert.exe" + -@erase ".\Debug\bin\static\sfconvert.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MT /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfconvert.bsc" +BSC32_SBRS= \ + "$(INTDIR)\printinfo.sbr" \ + "$(INTDIR)\sfconvert.sbr" + +"$(OUTDIR)\sfconvert.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\sfconvert.pdb" /debug /machine:I386 /nodefaultlib:"libcmtd" /out:"Debug\bin\static\sfconvert.exe" /pdbtype:sept /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfconvert.obj" \ + ".\Debug\dynamiclib\audiofileD.lib" \ + ".\lib\libaudiofileD.lib" + +".\Debug\bin\static\sfconvert.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + +OUTDIR=.\Debug\sfconvert_using_DLL +INTDIR=.\Debug\sfconvert_using_DLL +# Begin Custom Macros +OutDir=.\Debug\sfconvert_using_DLL +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "$(OUTDIR)\sfconvert.exe" + +!ELSE + +ALL : "$(OUTDIR)\sfconvert.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN : +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfconvert.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\sfconvert.exe" + -@erase "$(OUTDIR)\sfconvert.ilk" + -@erase "$(OUTDIR)\sfconvert.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MT /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfconvert.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\sfconvert.pdb" /debug /machine:I386 /nodefaultlib:"libcmtd" /out:"$(OUTDIR)\sfconvert.exe" /pdbtype:sept /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfconvert.obj" + +"$(OUTDIR)\sfconvert.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + +OUTDIR=.\Release\sfconvert_using_DLL +INTDIR=.\Release\sfconvert_using_DLL + +!IF "$(RECURSE)" == "0" + +ALL : ".\Release\bin\dynamic\sfconvert.exe" + +!ELSE + +ALL : ".\Release\bin\dynamic\sfconvert.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN : +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfconvert.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase ".\Release\bin\dynamic\sfconvert.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\sfconvert.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfconvert.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofile.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\sfconvert.pdb" /machine:I386 /nodefaultlib:"libcd" /out:"Release\bin\dynamic\sfconvert.exe" /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfconvert.obj" + +".\Release\bin\dynamic\sfconvert.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("sfconvert.dep") +!INCLUDE "sfconvert.dep" +!ELSE +!MESSAGE Warning: cannot find "sfconvert.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "sfconvert - Win32 Release" || "$(CFG)" == "sfconvert - Win32 Debug" || "$(CFG)" == "sfconvert - Win32 Debug using DLL" || "$(CFG)" == "sfconvert - Win32 Release using DLL" +SOURCE=..\sfcommands\printinfo.c + +!IF "$(CFG)" == "sfconvert - Win32 Release" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + + +"$(INTDIR)\printinfo.obj" "$(INTDIR)\printinfo.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\sfcommands\sfconvert.c + +!IF "$(CFG)" == "sfconvert - Win32 Release" + + +"$(INTDIR)\sfconvert.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + + +"$(INTDIR)\sfconvert.obj" "$(INTDIR)\sfconvert.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + + +"$(INTDIR)\sfconvert.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + + +"$(INTDIR)\sfconvert.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +!IF "$(CFG)" == "sfconvert - Win32 Release" + +"dynamiclib - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Release" + cd "." + +"dynamiclib - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + +"dynamiclib - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Debug" + cd "." + +"dynamiclib - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + +!ENDIF + +!IF "$(CFG)" == "sfconvert - Win32 Release" + +"staticlib - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Release" + cd "." + +"staticlib - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug" + +"staticlib - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Debug" + cd "." + +"staticlib - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Debug using DLL" + +!ELSEIF "$(CFG)" == "sfconvert - Win32 Release using DLL" + +!ENDIF + + +!ENDIF + diff --git a/win32/sfinfo.dep b/win32/sfinfo.dep new file mode 100644 index 0000000..095716d --- /dev/null +++ b/win32/sfinfo.dep @@ -0,0 +1,12 @@ +# Microsoft Developer Studio Generated Dependency File, included by sfinfo.mak + +..\sfcommands\printinfo.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\sfcommands\sfinfo.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + diff --git a/win32/sfinfo.dsp b/win32/sfinfo.dsp new file mode 100644 index 0000000..e14b178 --- /dev/null +++ b/win32/sfinfo.dsp @@ -0,0 +1,166 @@ +# Microsoft Developer Studio Project File - Name="sfinfo" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sfinfo - Win32 Release using DLL +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sfinfo.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sfinfo.mak" CFG="sfinfo - Win32 Release using DLL" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sfinfo - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Debug using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Release using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sfinfo - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "sfinfo___Win32_Release" +# PROP BASE Intermediate_Dir "sfinfo___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\sfinfo\static" +# PROP Intermediate_Dir "Release\sfinfo\static" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofile.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Release\bin\static\sfinfo.exe" /libpath:"lib" + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfinfo___Win32_Debug" +# PROP BASE Intermediate_Dir "sfinfo___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\sfinfo" +# PROP Intermediate_Dir "Debug\sfinfo" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\bin\static\sfinfo.exe" /pdbtype:sept /libpath:"lib" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfinfo___Win32_Debug_using_DLL" +# PROP BASE Intermediate_Dir "sfinfo___Win32_Debug_using_DLL" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\sfinfo_using_DLL" +# PROP Intermediate_Dir "Debug\sfinfo_using_DLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib modulesD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\sfinfo.exe" /pdbtype:sept /libpath:"lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofileD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\bin\dynamic\sfinfo.exe" /pdbtype:sept /libpath:"lib" + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sfinfo___Win32_Release_using_DLL" +# PROP BASE Intermediate_Dir "sfinfo___Win32_Release_using_DLL" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Release\sfinfo_using_DLL" +# PROP Intermediate_Dir "Release\sfinfo_using_DLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /GZ /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /D "USE_DLL" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofileD.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\sfinfo.exe" /pdbtype:sept /libpath:"lib" /libpath:"Debug\dynamiclib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofile.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Release\bin\dynamic\sfinfo.exe" /pdbtype:sept /libpath:"lib" + +!ENDIF + +# Begin Target + +# Name "sfinfo - Win32 Release" +# Name "sfinfo - Win32 Debug" +# Name "sfinfo - Win32 Debug using DLL" +# Name "sfinfo - Win32 Release using DLL" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\sfcommands\printinfo.c +# End Source File +# Begin Source File + +SOURCE=..\sfcommands\sfinfo.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/win32/sfinfo.mak b/win32/sfinfo.mak new file mode 100644 index 0000000..f99066f --- /dev/null +++ b/win32/sfinfo.mak @@ -0,0 +1,503 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on sfinfo.dsp +!IF "$(CFG)" == "" +CFG=sfinfo - Win32 Release using DLL +!MESSAGE No configuration specified. Defaulting to sfinfo - Win32 Release using DLL. +!ENDIF + +!IF "$(CFG)" != "sfinfo - Win32 Release" && "$(CFG)" != "sfinfo - Win32 Debug" && "$(CFG)" != "sfinfo - Win32 Debug using DLL" && "$(CFG)" != "sfinfo - Win32 Release using DLL" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sfinfo.mak" CFG="sfinfo - Win32 Release using DLL" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sfinfo - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Debug using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE "sfinfo - Win32 Release using DLL" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "sfinfo - Win32 Release" + +OUTDIR=.\Release\sfinfo\static +INTDIR=.\Release\sfinfo\static + +!IF "$(RECURSE)" == "0" + +ALL : ".\Release\bin\static\sfinfo.exe" + +!ELSE + +ALL : "staticlib - Win32 Release" "dynamiclib - Win32 Release" ".\Release\bin\static\sfinfo.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynamiclib - Win32 ReleaseCLEAN" "staticlib - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfinfo.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase ".\Release\bin\static\sfinfo.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\sfinfo.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfinfo.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofile.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\sfinfo.pdb" /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Release\bin\static\sfinfo.exe" /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfinfo.obj" \ + ".\Release\dynamiclib\audiofile.lib" \ + ".\lib\libaudiofile.lib" + +".\Release\bin\static\sfinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + +OUTDIR=.\Debug\sfinfo +INTDIR=.\Debug\sfinfo + +!IF "$(RECURSE)" == "0" + +ALL : ".\Debug\bin\static\sfinfo.exe" + +!ELSE + +ALL : "staticlib - Win32 Debug" "dynamiclib - Win32 Debug" ".\Debug\bin\static\sfinfo.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"dynamiclib - Win32 DebugCLEAN" "staticlib - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfinfo.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\sfinfo.pdb" + -@erase ".\Debug\bin\static\sfinfo.exe" + -@erase ".\Debug\bin\static\sfinfo.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfinfo.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libaudiofileD.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\sfinfo.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\bin\static\sfinfo.exe" /pdbtype:sept /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfinfo.obj" \ + ".\Debug\dynamiclib\audiofileD.lib" \ + ".\lib\libaudiofileD.lib" + +".\Debug\bin\static\sfinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + +OUTDIR=.\Debug\sfinfo_using_DLL +INTDIR=.\Debug\sfinfo_using_DLL +# Begin Custom Macros +OutDir=.\Debug\sfinfo_using_DLL +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : ".\Debug\bin\dynamic\sfinfo.exe" "$(OUTDIR)\sfinfo.bsc" + +!ELSE + +ALL : ".\Debug\bin\dynamic\sfinfo.exe" "$(OUTDIR)\sfinfo.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN : +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\printinfo.sbr" + -@erase "$(INTDIR)\sfinfo.obj" + -@erase "$(INTDIR)\sfinfo.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\sfinfo.bsc" + -@erase "$(OUTDIR)\sfinfo.pdb" + -@erase ".\Debug\bin\dynamic\sfinfo.exe" + -@erase ".\Debug\bin\dynamic\sfinfo.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfinfo.bsc" +BSC32_SBRS= \ + "$(INTDIR)\printinfo.sbr" \ + "$(INTDIR)\sfinfo.sbr" + +"$(OUTDIR)\sfinfo.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofileD.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\sfinfo.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Debug\bin\dynamic\sfinfo.exe" /pdbtype:sept /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfinfo.obj" + +".\Debug\bin\dynamic\sfinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + +OUTDIR=.\Release\sfinfo_using_DLL +INTDIR=.\Release\sfinfo_using_DLL + +!IF "$(RECURSE)" == "0" + +ALL : ".\Release\bin\dynamic\sfinfo.exe" + +!ELSE + +ALL : ".\Release\bin\dynamic\sfinfo.exe" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN : +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\printinfo.obj" + -@erase "$(INTDIR)\sfinfo.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\sfinfo.pdb" + -@erase ".\Release\bin\dynamic\sfinfo.exe" + -@erase ".\Release\bin\dynamic\sfinfo.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /D "USE_DLL" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\sfinfo.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib audiofile.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\sfinfo.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"Release\bin\dynamic\sfinfo.exe" /pdbtype:sept /libpath:"lib" +LINK32_OBJS= \ + "$(INTDIR)\printinfo.obj" \ + "$(INTDIR)\sfinfo.obj" + +".\Release\bin\dynamic\sfinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("sfinfo.dep") +!INCLUDE "sfinfo.dep" +!ELSE +!MESSAGE Warning: cannot find "sfinfo.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "sfinfo - Win32 Release" || "$(CFG)" == "sfinfo - Win32 Debug" || "$(CFG)" == "sfinfo - Win32 Debug using DLL" || "$(CFG)" == "sfinfo - Win32 Release using DLL" +SOURCE=..\sfcommands\printinfo.c + +!IF "$(CFG)" == "sfinfo - Win32 Release" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + + +"$(INTDIR)\printinfo.obj" "$(INTDIR)\printinfo.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + + +"$(INTDIR)\printinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\sfcommands\sfinfo.c + +!IF "$(CFG)" == "sfinfo - Win32 Release" + + +"$(INTDIR)\sfinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + + +"$(INTDIR)\sfinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + + +"$(INTDIR)\sfinfo.obj" "$(INTDIR)\sfinfo.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + + +"$(INTDIR)\sfinfo.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +!IF "$(CFG)" == "sfinfo - Win32 Release" + +"dynamiclib - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Release" + cd "." + +"dynamiclib - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + +"dynamiclib - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Debug" + cd "." + +"dynamiclib - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\dynamiclib.mak" CFG="dynamiclib - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + +!ENDIF + +!IF "$(CFG)" == "sfinfo - Win32 Release" + +"staticlib - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Release" + cd "." + +"staticlib - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug" + +"staticlib - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Debug" + cd "." + +"staticlib - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\staticlib.mak" CFG="staticlib - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Debug using DLL" + +!ELSEIF "$(CFG)" == "sfinfo - Win32 Release using DLL" + +!ENDIF + + +!ENDIF + diff --git a/win32/staticlib.dep b/win32/staticlib.dep new file mode 100644 index 0000000..c67aed6 --- /dev/null +++ b/win32/staticlib.dep @@ -0,0 +1,387 @@ +# Microsoft Developer Studio Generated Dependency File, included by staticlib.mak + +..\libaudiofile\aes.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\af_vfs.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\aiff.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\extended.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\aiffwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\extended.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\aupv.c : \ + "..\libaudiofile\aupvinternal.h"\ + "..\libaudiofile\aupvlist.h"\ + + +..\libaudiofile\avr.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\avrwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\byteorder.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + ".\config.h"\ + + +..\libaudiofile\compression.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\data.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + ".\config.h"\ + + +..\libaudiofile\error.c : \ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\extended.c : \ + "..\libaudiofile\extended.h"\ + + +..\libaudiofile\format.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\iff.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\iffwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\instrument.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\ircam.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\ircamwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\loop.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\marker.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\misc.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\modules.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\debug.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\rebuffer.h"\ + "..\libaudiofile\pcm.h"\ + "..\libaudiofile\print.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\next.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\nextwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\nist.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\nistwrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + ".\config.h"\ + + +..\libaudiofile\openclose.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\pcm.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\pcm.h"\ + ".\config.h"\ + + +..\libaudiofile\query.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\instrument.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\raw.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\raw.h"\ + "..\libaudiofile\setup.h"\ + ".\config.h"\ + + +..\libaudiofile\setup.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\pcm.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\track.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + ".\config.h"\ + + +..\libaudiofile\units.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\aiff.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\avr.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\iff.h"\ + "..\libaudiofile\ircam.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\modules\g711.h"\ + "..\libaudiofile\modules\ima.h"\ + "..\libaudiofile\modules\msadpcm.h"\ + "..\libaudiofile\modules\pcm.h"\ + "..\libaudiofile\next.h"\ + "..\libaudiofile\nist.h"\ + "..\libaudiofile\raw.h"\ + "..\libaudiofile\units.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + + +..\libaudiofile\util.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvinternal.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\compression.h"\ + "..\libaudiofile\modules.h"\ + "..\libaudiofile\units.h"\ + ".\config.h"\ + + +..\libaudiofile\wave.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\marker.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\track.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + + +..\libaudiofile\wavewrite.c : \ + "..\libaudiofile\af_vfs.h"\ + "..\libaudiofile\afinternal.h"\ + "..\libaudiofile\audiofile.h"\ + "..\libaudiofile\aupvlist.h"\ + "..\libaudiofile\byteorder.h"\ + "..\libaudiofile\setup.h"\ + "..\libaudiofile\wave.h"\ + ".\config.h"\ + diff --git a/win32/staticlib.dsp b/win32/staticlib.dsp new file mode 100644 index 0000000..c8688e3 --- /dev/null +++ b/win32/staticlib.dsp @@ -0,0 +1,346 @@ +# Microsoft Developer Studio Project File - Name="staticlib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=staticlib - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "staticlib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "staticlib.mak" CFG="staticlib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "staticlib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "staticlib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "staticlib - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release\staticlib" +# PROP Intermediate_Dir "Release\staticlib" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FD /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"lib\libaudiofile.lib" + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug\staticlib" +# PROP Intermediate_Dir "Debug\staticlib" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"lib\libaudiofileD.lib" + +!ENDIF + +# Begin Target + +# Name "staticlib - Win32 Release" +# Name "staticlib - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\libaudiofile\aes.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\af_vfs.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiff.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiffwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupv.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\avr.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\avrwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\byteorder.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\compression.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\data.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\error.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\extended.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\format.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\g711.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\iff.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\iffwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\instrument.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircam.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircamwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\loop.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\marker.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\misc.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\next.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nextwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nist.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nistwrite.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\openclose.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\pcm.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\query.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\raw.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\setup.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\track.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\units.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\util.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wave.c +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wavewrite.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\libaudiofile\af_vfs.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\afinternal.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aiff.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\audiofile.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupvinternal.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\aupvlist.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\byteorder.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\compression.h +# End Source File +# Begin Source File + +SOURCE=.\config.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\error.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\extended.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\g711.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\instrument.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\ircam.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\marker.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\modules.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\next.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\nist.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\pcm.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\print.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\raw.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\setup.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\track.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\units.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\util.h +# End Source File +# Begin Source File + +SOURCE=..\libaudiofile\wave.h +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/staticlib.mak b/win32/staticlib.mak new file mode 100644 index 0000000..ad89f7f --- /dev/null +++ b/win32/staticlib.mak @@ -0,0 +1,1115 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on staticlib.dsp +!IF "$(CFG)" == "" +CFG=staticlib - Win32 Debug +!MESSAGE No configuration specified. Defaulting to staticlib - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "staticlib - Win32 Release" && "$(CFG)" != "staticlib - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "staticlib.mak" CFG="staticlib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "staticlib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "staticlib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "staticlib - Win32 Release" + +OUTDIR=.\Release\staticlib +INTDIR=.\Release\staticlib + +!IF "$(RECURSE)" == "0" + +ALL : ".\lib\libaudiofile.lib" + +!ELSE + +ALL : "modules - Win32 Release" ".\lib\libaudiofile.lib" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"modules - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\aes.obj" + -@erase "$(INTDIR)\af_vfs.obj" + -@erase "$(INTDIR)\aiff.obj" + -@erase "$(INTDIR)\aiffwrite.obj" + -@erase "$(INTDIR)\aupv.obj" + -@erase "$(INTDIR)\avr.obj" + -@erase "$(INTDIR)\avrwrite.obj" + -@erase "$(INTDIR)\byteorder.obj" + -@erase "$(INTDIR)\compression.obj" + -@erase "$(INTDIR)\data.obj" + -@erase "$(INTDIR)\error.obj" + -@erase "$(INTDIR)\extended.obj" + -@erase "$(INTDIR)\format.obj" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\iff.obj" + -@erase "$(INTDIR)\iffwrite.obj" + -@erase "$(INTDIR)\instrument.obj" + -@erase "$(INTDIR)\ircam.obj" + -@erase "$(INTDIR)\ircamwrite.obj" + -@erase "$(INTDIR)\loop.obj" + -@erase "$(INTDIR)\marker.obj" + -@erase "$(INTDIR)\misc.obj" + -@erase "$(INTDIR)\modules.obj" + -@erase "$(INTDIR)\next.obj" + -@erase "$(INTDIR)\nextwrite.obj" + -@erase "$(INTDIR)\nist.obj" + -@erase "$(INTDIR)\nistwrite.obj" + -@erase "$(INTDIR)\openclose.obj" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\query.obj" + -@erase "$(INTDIR)\raw.obj" + -@erase "$(INTDIR)\setup.obj" + -@erase "$(INTDIR)\track.obj" + -@erase "$(INTDIR)\units.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\wave.obj" + -@erase "$(INTDIR)\wavewrite.obj" + -@erase ".\lib\libaudiofile.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\libaudiofile" /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\staticlib.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"lib\libaudiofile.lib" +LIB32_OBJS= \ + "$(INTDIR)\aes.obj" \ + "$(INTDIR)\af_vfs.obj" \ + "$(INTDIR)\aiff.obj" \ + "$(INTDIR)\aiffwrite.obj" \ + "$(INTDIR)\aupv.obj" \ + "$(INTDIR)\byteorder.obj" \ + "$(INTDIR)\compression.obj" \ + "$(INTDIR)\data.obj" \ + "$(INTDIR)\error.obj" \ + "$(INTDIR)\extended.obj" \ + "$(INTDIR)\format.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\instrument.obj" \ + "$(INTDIR)\ircam.obj" \ + "$(INTDIR)\ircamwrite.obj" \ + "$(INTDIR)\loop.obj" \ + "$(INTDIR)\marker.obj" \ + "$(INTDIR)\misc.obj" \ + "$(INTDIR)\modules.obj" \ + "$(INTDIR)\next.obj" \ + "$(INTDIR)\nextwrite.obj" \ + "$(INTDIR)\nist.obj" \ + "$(INTDIR)\openclose.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\query.obj" \ + "$(INTDIR)\raw.obj" \ + "$(INTDIR)\setup.obj" \ + "$(INTDIR)\track.obj" \ + "$(INTDIR)\units.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wave.obj" \ + "$(INTDIR)\wavewrite.obj" \ + "$(INTDIR)\nistwrite.obj" \ + "$(INTDIR)\iffwrite.obj" \ + "$(INTDIR)\iff.obj" \ + "$(INTDIR)\avrwrite.obj" \ + "$(INTDIR)\avr.obj" \ + ".\Release\staticmod\modules.lib" + +".\lib\libaudiofile.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + +OUTDIR=.\Debug\staticlib +INTDIR=.\Debug\staticlib +# Begin Custom Macros +OutDir=.\Debug\staticlib +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : ".\lib\libaudiofileD.lib" "$(OUTDIR)\staticlib.bsc" + +!ELSE + +ALL : "modules - Win32 Debug" ".\lib\libaudiofileD.lib" "$(OUTDIR)\staticlib.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"modules - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\aes.obj" + -@erase "$(INTDIR)\aes.sbr" + -@erase "$(INTDIR)\af_vfs.obj" + -@erase "$(INTDIR)\af_vfs.sbr" + -@erase "$(INTDIR)\aiff.obj" + -@erase "$(INTDIR)\aiff.sbr" + -@erase "$(INTDIR)\aiffwrite.obj" + -@erase "$(INTDIR)\aiffwrite.sbr" + -@erase "$(INTDIR)\aupv.obj" + -@erase "$(INTDIR)\aupv.sbr" + -@erase "$(INTDIR)\avr.obj" + -@erase "$(INTDIR)\avr.sbr" + -@erase "$(INTDIR)\avrwrite.obj" + -@erase "$(INTDIR)\avrwrite.sbr" + -@erase "$(INTDIR)\byteorder.obj" + -@erase "$(INTDIR)\byteorder.sbr" + -@erase "$(INTDIR)\compression.obj" + -@erase "$(INTDIR)\compression.sbr" + -@erase "$(INTDIR)\data.obj" + -@erase "$(INTDIR)\data.sbr" + -@erase "$(INTDIR)\error.obj" + -@erase "$(INTDIR)\error.sbr" + -@erase "$(INTDIR)\extended.obj" + -@erase "$(INTDIR)\extended.sbr" + -@erase "$(INTDIR)\format.obj" + -@erase "$(INTDIR)\format.sbr" + -@erase "$(INTDIR)\g711.obj" + -@erase "$(INTDIR)\g711.sbr" + -@erase "$(INTDIR)\iff.obj" + -@erase "$(INTDIR)\iff.sbr" + -@erase "$(INTDIR)\iffwrite.obj" + -@erase "$(INTDIR)\iffwrite.sbr" + -@erase "$(INTDIR)\instrument.obj" + -@erase "$(INTDIR)\instrument.sbr" + -@erase "$(INTDIR)\ircam.obj" + -@erase "$(INTDIR)\ircam.sbr" + -@erase "$(INTDIR)\ircamwrite.obj" + -@erase "$(INTDIR)\ircamwrite.sbr" + -@erase "$(INTDIR)\loop.obj" + -@erase "$(INTDIR)\loop.sbr" + -@erase "$(INTDIR)\marker.obj" + -@erase "$(INTDIR)\marker.sbr" + -@erase "$(INTDIR)\misc.obj" + -@erase "$(INTDIR)\misc.sbr" + -@erase "$(INTDIR)\modules.obj" + -@erase "$(INTDIR)\modules.sbr" + -@erase "$(INTDIR)\next.obj" + -@erase "$(INTDIR)\next.sbr" + -@erase "$(INTDIR)\nextwrite.obj" + -@erase "$(INTDIR)\nextwrite.sbr" + -@erase "$(INTDIR)\nist.obj" + -@erase "$(INTDIR)\nist.sbr" + -@erase "$(INTDIR)\nistwrite.obj" + -@erase "$(INTDIR)\nistwrite.sbr" + -@erase "$(INTDIR)\openclose.obj" + -@erase "$(INTDIR)\openclose.sbr" + -@erase "$(INTDIR)\pcm.obj" + -@erase "$(INTDIR)\pcm.sbr" + -@erase "$(INTDIR)\query.obj" + -@erase "$(INTDIR)\query.sbr" + -@erase "$(INTDIR)\raw.obj" + -@erase "$(INTDIR)\raw.sbr" + -@erase "$(INTDIR)\setup.obj" + -@erase "$(INTDIR)\setup.sbr" + -@erase "$(INTDIR)\track.obj" + -@erase "$(INTDIR)\track.sbr" + -@erase "$(INTDIR)\units.obj" + -@erase "$(INTDIR)\units.sbr" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\util.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(INTDIR)\wave.obj" + -@erase "$(INTDIR)\wave.sbr" + -@erase "$(INTDIR)\wavewrite.obj" + -@erase "$(INTDIR)\wavewrite.sbr" + -@erase "$(OUTDIR)\staticlib.bsc" + -@erase ".\lib\libaudiofileD.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MTd /W3 /GX /ZI /Od /I "..\libaudiofile" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CONFIG_H" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +RSC=rc.exe +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\staticlib.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aes.sbr" \ + "$(INTDIR)\af_vfs.sbr" \ + "$(INTDIR)\aiff.sbr" \ + "$(INTDIR)\aiffwrite.sbr" \ + "$(INTDIR)\aupv.sbr" \ + "$(INTDIR)\byteorder.sbr" \ + "$(INTDIR)\compression.sbr" \ + "$(INTDIR)\data.sbr" \ + "$(INTDIR)\error.sbr" \ + "$(INTDIR)\extended.sbr" \ + "$(INTDIR)\format.sbr" \ + "$(INTDIR)\g711.sbr" \ + "$(INTDIR)\instrument.sbr" \ + "$(INTDIR)\ircam.sbr" \ + "$(INTDIR)\ircamwrite.sbr" \ + "$(INTDIR)\loop.sbr" \ + "$(INTDIR)\marker.sbr" \ + "$(INTDIR)\misc.sbr" \ + "$(INTDIR)\modules.sbr" \ + "$(INTDIR)\next.sbr" \ + "$(INTDIR)\nextwrite.sbr" \ + "$(INTDIR)\nist.sbr" \ + "$(INTDIR)\openclose.sbr" \ + "$(INTDIR)\pcm.sbr" \ + "$(INTDIR)\query.sbr" \ + "$(INTDIR)\raw.sbr" \ + "$(INTDIR)\setup.sbr" \ + "$(INTDIR)\track.sbr" \ + "$(INTDIR)\units.sbr" \ + "$(INTDIR)\util.sbr" \ + "$(INTDIR)\wave.sbr" \ + "$(INTDIR)\wavewrite.sbr" \ + "$(INTDIR)\nistwrite.sbr" \ + "$(INTDIR)\iffwrite.sbr" \ + "$(INTDIR)\iff.sbr" \ + "$(INTDIR)\avrwrite.sbr" \ + "$(INTDIR)\avr.sbr" + +"$(OUTDIR)\staticlib.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"lib\libaudiofileD.lib" +LIB32_OBJS= \ + "$(INTDIR)\aes.obj" \ + "$(INTDIR)\af_vfs.obj" \ + "$(INTDIR)\aiff.obj" \ + "$(INTDIR)\aiffwrite.obj" \ + "$(INTDIR)\aupv.obj" \ + "$(INTDIR)\byteorder.obj" \ + "$(INTDIR)\compression.obj" \ + "$(INTDIR)\data.obj" \ + "$(INTDIR)\error.obj" \ + "$(INTDIR)\extended.obj" \ + "$(INTDIR)\format.obj" \ + "$(INTDIR)\g711.obj" \ + "$(INTDIR)\instrument.obj" \ + "$(INTDIR)\ircam.obj" \ + "$(INTDIR)\ircamwrite.obj" \ + "$(INTDIR)\loop.obj" \ + "$(INTDIR)\marker.obj" \ + "$(INTDIR)\misc.obj" \ + "$(INTDIR)\modules.obj" \ + "$(INTDIR)\next.obj" \ + "$(INTDIR)\nextwrite.obj" \ + "$(INTDIR)\nist.obj" \ + "$(INTDIR)\openclose.obj" \ + "$(INTDIR)\pcm.obj" \ + "$(INTDIR)\query.obj" \ + "$(INTDIR)\raw.obj" \ + "$(INTDIR)\setup.obj" \ + "$(INTDIR)\track.obj" \ + "$(INTDIR)\units.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wave.obj" \ + "$(INTDIR)\wavewrite.obj" \ + "$(INTDIR)\nistwrite.obj" \ + "$(INTDIR)\iffwrite.obj" \ + "$(INTDIR)\iff.obj" \ + "$(INTDIR)\avrwrite.obj" \ + "$(INTDIR)\avr.obj" \ + ".\Debug\staticmod\modulesD.lib" + +".\lib\libaudiofileD.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("staticlib.dep") +!INCLUDE "staticlib.dep" +!ELSE +!MESSAGE Warning: cannot find "staticlib.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "staticlib - Win32 Release" || "$(CFG)" == "staticlib - Win32 Debug" +SOURCE=..\libaudiofile\aes.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\aes.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\aes.obj" "$(INTDIR)\aes.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\af_vfs.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\af_vfs.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\af_vfs.obj" "$(INTDIR)\af_vfs.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aiff.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\aiff.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\aiff.obj" "$(INTDIR)\aiff.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aiffwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\aiffwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\aiffwrite.obj" "$(INTDIR)\aiffwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\aupv.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\aupv.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\aupv.obj" "$(INTDIR)\aupv.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\avr.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\avr.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\avr.obj" "$(INTDIR)\avr.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\avrwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\avrwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\avrwrite.obj" "$(INTDIR)\avrwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\byteorder.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\byteorder.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\byteorder.obj" "$(INTDIR)\byteorder.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\compression.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\compression.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\compression.obj" "$(INTDIR)\compression.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\data.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\data.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\data.obj" "$(INTDIR)\data.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\error.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\error.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\error.obj" "$(INTDIR)\error.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\extended.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\extended.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\extended.obj" "$(INTDIR)\extended.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\format.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\format.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\format.obj" "$(INTDIR)\format.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\g711.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\g711.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\g711.obj" "$(INTDIR)\g711.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\iff.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\iff.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\iff.obj" "$(INTDIR)\iff.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\iffwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\iffwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\iffwrite.obj" "$(INTDIR)\iffwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\instrument.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\instrument.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\instrument.obj" "$(INTDIR)\instrument.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\ircam.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\ircam.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\ircam.obj" "$(INTDIR)\ircam.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\ircamwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\ircamwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\ircamwrite.obj" "$(INTDIR)\ircamwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\loop.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\loop.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\loop.obj" "$(INTDIR)\loop.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\marker.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\marker.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\marker.obj" "$(INTDIR)\marker.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\misc.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\misc.obj" "$(INTDIR)\misc.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\modules.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\modules.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\modules.obj" "$(INTDIR)\modules.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\next.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\next.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\next.obj" "$(INTDIR)\next.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nextwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\nextwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\nextwrite.obj" "$(INTDIR)\nextwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nist.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\nist.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\nist.obj" "$(INTDIR)\nist.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\nistwrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\nistwrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\nistwrite.obj" "$(INTDIR)\nistwrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\openclose.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\openclose.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\openclose.obj" "$(INTDIR)\openclose.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\pcm.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\pcm.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\pcm.obj" "$(INTDIR)\pcm.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\query.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\query.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\query.obj" "$(INTDIR)\query.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\raw.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\raw.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\raw.obj" "$(INTDIR)\raw.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\setup.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\setup.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\setup.obj" "$(INTDIR)\setup.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\track.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\track.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\track.obj" "$(INTDIR)\track.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\units.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\units.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\units.obj" "$(INTDIR)\units.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\util.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\util.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\util.obj" "$(INTDIR)\util.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\wave.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\wave.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\wave.obj" "$(INTDIR)\wave.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\libaudiofile\wavewrite.c + +!IF "$(CFG)" == "staticlib - Win32 Release" + + +"$(INTDIR)\wavewrite.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + + +"$(INTDIR)\wavewrite.obj" "$(INTDIR)\wavewrite.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +!IF "$(CFG)" == "staticlib - Win32 Release" + +"modules - Win32 Release" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\modules.mak" CFG="modules - Win32 Release" + cd "." + +"modules - Win32 ReleaseCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\modules.mak" CFG="modules - Win32 Release" RECURSE=1 CLEAN + cd "." + +!ELSEIF "$(CFG)" == "staticlib - Win32 Debug" + +"modules - Win32 Debug" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\modules.mak" CFG="modules - Win32 Debug" + cd "." + +"modules - Win32 DebugCLEAN" : + cd "." + $(MAKE) /$(MAKEFLAGS) /F ".\modules.mak" CFG="modules - Win32 Debug" RECURSE=1 CLEAN + cd "." + +!ENDIF + + +!ENDIF + |