commit 50b48aec6ddd451a6d1709c0942477b503457663 Author: tpearson Date: Wed Feb 3 02:15:56 2010 +0000 Added abandoned KDE3 version of K3B git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8363f0c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Sebastian Trueg +Christian Kvasny diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..034359f --- /dev/null +++ b/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301 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 diff --git a/COPYING-DOCS b/COPYING-DOCS new file mode 100644 index 0000000..4a0fe1c --- /dev/null +++ b/COPYING-DOCS @@ -0,0 +1,397 @@ + GNU Free Documentation License + Version 1.2, November 2002 + + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (Thus, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document 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. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation 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. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c4477a1 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,743 @@ +1.0.5 +===== + * Fix CD Copy device selection (Bug 151924) + * Fixed HAL mounting (thanks to Ken Milmore) + * Always wait for the drive to become ready before starting verification. + +1.0.4 +===== + * Never use growisofs parameter -dvd-compat with DVD-RW media in restricted overwrite mode + * Unmount medium before DVD formatting + * Silently (without introducing new strings for translation) allow the burning of files + bigger than 4 GB with appropriate versions of genisoimage or mkisofs. + * Do only reload the medium before verification if necessary, i.e. if the newly written + track cannot be read otherwise (many old drives depend on this). Hopefully this will + at least work around the aweful "DMA disabled" bug for many users. + +1.0.3 +===== + * Reverted to old behaviour of reloading medium before verification. Not enough + testing had been done before introducing this and some systems fail to read the + medium before reload (Bugs 147297, 147328, 147420, 147698). + * Do not crash when the currently playing audio project item is removed (Bug 147548). + * Added desktop actions to handle empty media with K3b. + * Fixed read retry when reading data tracks (Bug 147778) + * K3b's dialogs now honor the global button layout setting (Bug 147799) + * Do not crash on mp3 files without tags if compiled with taglib support (Bug 142651) + * Do not allow to copy a rewritable media to itself. + * Fixed crash on startup with devices that return bogus GET PERFORMANCE data (Bug 147676) + +1.0.2 +===== + * Properly determine the capacity of complete CD-R(W) media. + * Mark a data project as modified if files are renamed. + * Allow adding of all actions to the welcome window (Bug 145866) + * Added "NoDisplay=true" property to k3b-cue.desktop and k3b-iso.desktop + * Fixed supported write speed detection on some devices + * No reload before verification and between writing sessions (CD copy + Mixed Mode CD) anymore + +1.0.1 +===== + * Fixed crash when using the Device menu without a selected device. + * Fixed DVD copy when reading from a DVD+RW. + * Fixed --without-alsa configure check + * Fixed a crash in Video DVD ripping when the title does not contain an audio stream + * Only use the mkisofs parameters -biblio, -copyright, and -abstract if they have been set. Using them + with invalid values (empty) seems to result in broken iso images sometimes. + * Better compatibility with recent transcode development branch + * Fixed Multisession import size handling. + * Fixed Lame quality preset handling. + * Made libk3bdevice really thread-safe. This fixes the disabled DMA bug! + * New configure check --without-cdrecord-suid-root to disable K3b's check for cdrecord permissions. + Although not recommended it is requested by many distributors. + * Changed the order of the buttons in the tool dialogs to match the KDE order. + * Added handling of the newly introduced genisoimage parameter -allow-limited-size + * Make the K3b Sox audio encoder plugin work with newer sox versions (Thanks, Stephan.) + +1.0 +=== + * K3b now includes a VideoDVD kio slave. It can be used in Konqueror through the protocol videodvd:/ + to copy the files from a VideoDVD with on-the-fly decryption if libdvdcss is installed. + (Be aware that in some countries it is not permitted to use libdvdcss.) + * New Device menu containing all the actions possible for a device (like eject, unmount, ...). + This includes the possibility of assigning shortcuts to these kind of actions. + * K3b now warns if user parameters for external programs have been specified. This has been introduced + because there were some bug report that were caused by faulty user parameters. + * Cleaned up all the job classes: No job creates a widget anymore. This allows for non-GUI usage of libk3b. + For example in a kioslave. + * New option in the data project to not cache the inodes. That means it is possible to have multiple + actual copies of the same file on one CD/DVD. + * K3b now tries to disable stuff that might influence the burning process. This includes the KDED module + mediamanager, SuSEPlugger, and automounting (currently supported: subfs, supermount). + * New Audio Track source editor dialog to cut audio track sources at the beginning and the end. + * Splitted "read retries" and "ignore read errors" for data and audio sectors in cd copy and set new + defaults for audio sectors which make more sense: 5 retires and skip unreadable sectors. + * New Mediamanager which makes K3b always know which device contains which medium. This makes medium handling + more smooth and the user now selects a medium instead of a device. + Other advantages: + - No waiting time anymore when asking for information on media (including for example Audio CD ripping). + - Nice default image filenames. + - CD Copy: Enable/disable options based on the source medium + - Automatically select newly inserted media as burning medium + * DCOP call directBurn() now returns a boolean value stating if the process could be started. + * New DCOP calls cddaRip(), videocdrip(), and videodvdrip() with media:/ url support. + * K3b can now handle media:/ urls from the command line to specify devices + * Better Lame settings dialog. Easier to use for the novice user and better defaults. + * Nicer Ogg Vorbis encoder settings dialog. + * K3b now shows the DVD Medium ID in the disk information view. + * K3b now displays a rough estimate on the remaining time for the current job. + * New automatic media size mode for the projects. This means K3b uses the size from an inserted medium + for the project maximum size. + * Make a suggestion for the filename when saving a project based on the Volume ID (data projects) or the + CD-Text title (Audio CD) + * The Audio encoder plugins are now able to provide (very simplistic) user feedback in case of an error. + * New settings "Swap byte order" and "Write Wave header" in the audio encoding plugin using external apps. + This makes way for the usage of such programs as mppenc to encode Musepack files. In fact, mppenc is set up + as a default along with flac if installed. + * New DCOP interface: K3bJobInterface which provides DCOP signals for the currently running job. It may, + for example, be used to provide information to a Karamba module. + * New KFile plugin for K3b projects. For now it only shows the type of the project (Data DVD or Audio CD or ...) + but may be extended to show arbitrary information. + * K3b now chooses default image names based on the project name or the volumeid/cdtext title in case of + CD/DVD copy. + * The K3b Project DCOP Interface now uses the QString type for url parameters instead of KURL. + * Save/load audio cd track sources in audio projects + * Display a beautified volume id. For example: THE_TRANSPORTER -> The Transporter + * Check if the image directory exists before starting to create a project image + * Possibility to hide the OSD temporarily for one process. + * Completely rewritten Video DVD ripping and transcoding support: + - Simple on-the-fly transcoding of Video DVD titles + - Interface similar to Audio CD ripping + - Preview images in the ripping window + - Automatic clipping + - Simple resizing with automatic aspect ratio handling + * File System presets for all data projects including all the advanced options. + * Completely rewritten data project verification + - K3b now compares the written image instead of the single files + - Verification of Video DVD projects + * Little GUI changes: + - Changed the dialog layout in the action dialogs. + - Simplified the layout of the burn dialogs for data projects (more advanced settings hidden) + - Improved theme support (transparent themes) + * Device buffer status display for DVD burning with growisofs >= 7.0 + * Support for Audio CD ripping with libcdio instead of libcdparanoia + * Support for Cdrkit, the Debian fork of cdrtools + +0.12.17 +======= + * Fixed saving/loading of the file view configuration. + * Improved ffmpeg autoconf check. + * More FreeBSD Compile fixes (thanks to Heiner Eichmann). + * Fixed symbolic link handling in data projects (a bug introduced in 0.12.16) + * Use UTF-8 encoding to store and load local CDDB entries. + * Never use growisofs parameter -dvd-compat with DVD+RW media. + * Fixed flac audio encoding for the audio project conversion feature. + +0.12.16 +======= + * FreeBSD Compile fixes (thanks to Heiner Eichmann). + * Always force 44.1khz in the Lame MP3 encoder plugin. + * Fixed VideoDVD creation on rewritable media. + * NetBSD support (thanks to Mark Davies). + * Fixed Copy of Enhanced Audio CDs with CD-Text + * Changed default boot cataloge name from "boot.cataloge" to "boot.catalog" + * Fixed a crash when reusing the same DVD Iso Image writing dialog. + * Ignore case when comparing MD5 sums entered by the user. + * Make sure that filenames in a data project's folder are unique. + * Allow index statements bigger than 99 minutes in cue files. + * Properly set the length of SCSI commands (this fixes some device detection problems). + +0.12.15 +======= + * Write more metadata tags in the default setup of the external encoder plugin. + * Fixed on-the-fly Video DVD creation + * Fixed data project verification in case filenames had to be shortened due to Joliet limitations. + * Use -dvd-compat parameter to close DVDs in on-the-fly mode. + * Fixed libdvdcss handling (again), no crashes anymore. + * Fixed the "invalid url" bug. + * Use SG IO for scsi commands with newer linux kernels. This should fix problems with scsi device + detection. + * Warn about shortened filenames due to Joliet restrictions before starting the burning process. + +0.12.14 +======= + * Make sure new projects are not already marked as modified. + * Fixed (hopefully) the last bug related to Data project verification. + +0.12.13 +======= + * Honor umask when creating directories for Audio CD ripping. + * Only update the buffer state for DVD burning if it really changes. + * Fixed a crash in verification if the CD/DVD does not contain RR extensions. + * Lowered default DVD writing buffer size to 32 MB to avoid "memorylock limit" problems + as described on http://fy.chalmers.se/~appro/linux/DVD+RW/tools/ + * Fixed loading of libdvdcss. + +0.12.12 +======= + * Fixed another bug in the iso options code which sometimes resulted in a failed verification. + * Properly close the reading device when copying VideoDVDs. This bug resulted in a blocked device. + * Fixed handling of filenames in libdvdcss backend (this fixes VideoDVD copy). + +0.12.11 +======= + * Fixed selection in the audio CD ripping window. + * Fixed info block handling in WAVE audio file decoder: no more clicks at the end. + * Introduced a hack which fixes the "Wav detected as Mpeg file" bug. + * Fixed Auto multisession mode for DVD+RW and DVD-RW in restricted overwrite mode in case + a previous session was imported. + * Fixed a crash with HAL >= 0.5 when exiting K3b. + * Allow copying of double layer DVDs with a size below 4.3 GB to single layer media. + * Support for the ring buffer in growisofs 6.0. + * Use .iso extension for images instead of .img + * Properly remove the image file in case verification failed. + * Ignore mounting state of a medium when showing its contents. + * Fixed a bug in the iso options code which sometimes resulted in a failed verification. + * Properly handle cue files withan image file name like image.bin.cue + image.bin + * Write a proper Xing header when encoding VBR mp3 files. + +0.12.10 +======= + * Fixed Auto multisession mode in DVD projects + * Fixed crash in dcop call directBurn in case no valid burner device was set. + * Fixed verification of datacd projects when using the MaxIso9660 option without the OmitVersionNumber option + +0.12.9 +====== + * New project dcop calls: + directBurn() - directly starts the burn process without user interaction + setBurnDevice(QString) - set the burn device to be used + * Disable the cd-text fields if cd-text writing is disabled. + * New Alsa audio output plugin. + * If a DVD project does not fill up the DVD completely do not close the DVD in automatic + multisession mode. + * Fixed problems with filenames ending in backslashes. + * Fixed verification problems with localized characters. + * Added error handling for incorrectly encoded filenames. + * Automatically use a newly installed version of an external application at the next K3b start. + * Complete new set of K3b action icons for project types and tools. Many thanks to Marcel Dierkes. + * Show text on the burn button to make it catch the eye. + * Support for media:// urls in the Image writing dialogs. + * Fixed problems with files bigger than 2 GB on some systems. + +0.12.8 +====== + * Load index0 value in audio project. + * Ignore case in cue files. + * The "eject media" setting was not used properly in some situations (thanks to simon@munton.demon.co.uk for the patch) + * Fixed a bug in the mp3 decoder which caused it to miss some perfectly valid mp3 files. + +0.12.7 +====== + * Fixed crash when refreshing the device list. + * Fixed cancellation of adding files to a data project. + * Fixed on-the-fly data project burning. + * Backported a warning about following links to folders (K3b cannot do that after the link has + been added to the project). + +0.12.6 +====== + * Copy XA Form1 tracks always in TAO writing mode. + * Support for media:/ urls. + * No extra whitespace when renaming audio files in a data project anymore. + * Fixed verification of multisession CDs (thanks to simon@munton.demon.co.uk) + * Preserve directory access time in data projects when using the "backup" option. + * Disable the "audio normalization" option in case the normalize program is not installed. + +0.12.5 +====== + * Fixed the progressbar in the file view + * It is possible to add the "New Data DVD Project" button to the welcome window again. + * Fixed problems with unreadable items when using a non-standard color scheme + * Properly set the permissions on cdrecord versions >= 2.01.01a02 + * Fixed the "Disabled start button in Copy dialog" bug. + * Little window layout fix in K3bSetup2. + * Always use sector size 2048 when only creating an image in CD Copy. This means extracted + iso images from CDs with non-Mode1 tracks are useable again. + * Preserve directory permissions and user/group id in data projects when using the "backup" option. + +0.12.4 +====== + * Fixed --cdimage and --dvdimage parameters. + * Fixed the file browser menu. Now it contains the bookmarks and "add to project" actions again. + * Fixed Index 0 (Pregap) handling in audio cue files. + * Improved handling of broken cue files: K3b now searches the directory for image files that could fit + the cue file in case the FILE entry is bogus. + * Always try to create a new session in case the old one has been imported regardless of the inserted + medium's free space. + * Fixed DVD-RW Restricted Overwrite media handling + * Use RAW writing mode for audio CDs in case the writer does not support DAO but RAW. + * Fixed compile problems with latest ffmpeg builds. + +0.12.3 +====== + * Ignore dock config from K3b versions older than 0.12 + * Do not delete DVD project iso image if "remove image" is unchecked. + * Properly load multisession default settings. + * Update device selection boxes when devices are added or removed via HAL. + * Properly cancel DVD project writing. + * Fixed DVD+RW session import + +0.12.2 +====== + * After for example copying a CD when the dialog comes up again keep the last settings. + * Default to incremental sequential writing mode when copying a DVD to a DVD-R. + * Fixed a crash when the DVD copy dialog is reused. + * Fixed inline editing in the audio CD view (without bigger changes this only works with a + rather strange selection mode.) + * Show the configured splash screen image instead of the default. + * Fixed eMovix 0.9 default settings handling. + * Import session: disable RockRidge if the previous session does not contain RR extensions. + This fixes the problem with strange filenames if the new session is mounted via RR. + * Fixed the --cdimage parameter. + * Changed max copies from 99 to 999. + * Improved session import dialog. + * Properly default to DVD size in Video DVD project. + * Fixed automatic multisession handling for DVD+RW media. + * Fixed handbook installation. + * Fixed HAL backend: devices are properly removed now. + * Ignore K3b Themes that do not follow the new filename scheme. + +0.12.1 +Fixed compilation problems with older musepack library version. +Fixed compile problem with older gcc versions. +Enable verification checkbox for ISO9660 images in the CD writing dialog. +Do not report success even if audio project conversion failed. + +0.12 +Added "Mpeg Still" support to Video-CD Project +FreeBSD support (thanks to Adriaan De Groot) +Support for all global CD-Text fields with cdrecord. +Some GUI changes: cleaned up the action dialogs, moved the burnfree option to the global settings dialog + since turning it off should be a very seldomly used task. +Added support for multiple copies to the projects. +Added missed VCD 3.0 track interpretation option for SVCD's +New Lame encoding plugin providing a proper configuration dialog. +Added Bookmarks to the file browser. +Fixed window layering problem with windowmanagers != kwm +Added KPart plugin which converts a list of audio files into one of the supported encoder formats. +Allow disabling of CD-Text reading in cd-copy to overcome problems with CD-Text on some drives. +Check CD-Text crc when copying +Fixed incorrect PBC order, PBC now should work on all "standalone" DVD Players +Fixed waittime bug for PBC infinite timeout. +Import Audio Cue files into an audio project. +It is now possible to open an iso image or an audio cue file just like a project file. +Create cue files for an audio CD ripped into one single file +Show writer buffer state in addition to fifo buffer when writing CDs. +Show device buffer state for DVD writing (does not work always yet) +Fixed read and save setting in VideoCD project. +Big parts of the audio project have been rewritten to have a way better design: + - K3b now does not create additional silence between the tracks by default + the pregap is treated as part of the previous track like in all other + writing applications. + - Instead it's possible to add additional silence manually to a track. + - Allow multible sources for one track. + - Split tracks, merge tracks. + - Improved track dialog. +K3b now always writes a logfile in $(KDEHOME)/share/apps/k3b/lastlog.log +New device configuration format which solves all issues with removable devices like USB. +Copy CSS encrypted DVDs if libdvdcss is installed. +Libsndfile decoder plugin. This includes support for AIFF audio files. +ffmpeg decoder plugin. This includes support for wma audio files. +Musepack audio decoder plugin. +Use DAO writing mode for data CDs when overwrite is enabled. +Added option to load the last used settings in addition to the default user settings in every + action dialog. +Show system device name in case the string representing two devices are equal. +Fixed the docking issues. No floating dock windows anymore. :) I have no idea why I wasn't able to do this + before... it was so easy after all. +Plugin based Audio Output system for Audio project "preview". +Dropped id3lib in favor of TagLib (great work Scott :) +When the speed for an on-the-fly audio project is set to "Auto" K3b now determines the max writing speed. +Do not close dialogs after the action is done (for example cd copy) +Directly copy Audio tracks from an Audio CD to an Audio project. +Session management +Made K3b a unique application only allowing one instance. +Improved dcop interface for data projects which allows to add and remove items + to and from specific folders in the project. +Conditional audio ripping pattern. Now what does that mean? It means that you can do stuff like: + "if the track has a genre encoded use it, otherwise use 'misc'" and stuff like that. +New project plugin interface. Example: the audio project cddb plugin is now a project plugin +MusicBrainz support (Query audio file tags over the internet) +K3b now has a "smart" automatic multisession handling in Data projects. +Replaced the system tray by an OSD inspired by the one in amaroK +Better symlink handling with proper size information if "follow symlinks" is activated. +HAL support (turn on your USB writer while K3b is running and see it getting detected automatically) +eMovix 0.9.0 support + +0.11.10 +Support Mp3 files starting with multiple ID3 tags. +Improved ~ handling in the QuickDirSelector. +Save/Load composer fields in audio projects +Save/Load default DVD Copy reading device + +0.11.9 +Fixed data project size calculation (for good this time). + +0.11.8 +K3b now searches for the Debian cdrecord wrapper script and properly selects the cdrecord version to use + (cdrecord.mmap or cdrecord.shm) based on the kernel version. This should fix all problems with + K3bSetup on Debian. +Fixed writing speed parsing with patched cdrecord +Add leading zero to tracknumber meta data field when encoding audio tracks. +Fixed data project size calculation if files from different devices have the same inode number. +It is now possible to enter hexadecimal values in the boot image load segment fields. +Fixed external program encoder plugin (this includes lame and flac encoding) + +0.11.7 +Check size of returned CD-TEXT data to be a multiple of the pack length. This should fix problems + with CD copy. +Audio Project: Do not overwrite CD-Text values loaded from the project file with the ones detected. +Added --copydvd command line parameter +Do only read MCN and ISRCs when copying an audio cd since scanning them takes a very long time. +Fixed cdrdao 1.1.8 version handling (no ATAPI warning) +Fixed crash when using the Audiometadatarenamer on Movix Projects +Automatically enable UDF extensions in case the project contains files bigger then 2 gb. + +0.11.6 +Fixed length calculation for long FLAC files. +Allow Audio CDs that violate the Red Book standard (Tracks shorter than 4 seconds) +Some improvements in disk-info retrieval + +0.11.5 +Do not ask for overwriting directories in cloning dialog +Again fixed some disk detection problems which were introduced with the previous fixes :-( +Fixed a crash which occured if the last boot image was displayed in the fileview while removing it. +Support for ID3 Tags in FLAC files. +Support for cdrdao 1.1.8. + +0.11.4 +Fixed adding of hidden files (wrong naming of config entries) +Use a default imagefile name for cloning if none was specified. +Use the Joliet names if no Rockridge is available in session import + +0.11.3 +fixed features detection with some devices. +fixed multisession writing on some systems (K3b used to open the device instead of leaving it to mkisofs to + prevent permission problems. Sadly this does not work with all systems since it seems that K3b does + not close the device early enough so cdrecord cannot open it.) + +0.11.2 +K3bProcess now has a clean API and a non-stupid implementation which fixes the kde 3.2 issue +way better than the hotfix from 0.11.1. +Fixed a crash at K3b start which happened with ROM drives that return zero length modepage 0x05 data. +fixed onthefly DVD copy issues +K3b now uses the internal reader for DVD copy instead of readcd +added read retries and "ignore read error" options to the dvd copy dialog +fixed handling of empty raw toc data +fixed the bug that made K3b try to use cdrdao for DVD iso image writing. +add files to a project by dropping them on the corresponding tab +removed the "query cddb" option from the copy dialog since this is configured globally anyway. +fixed loading of VideoDVD projects +Fixed VideoDVD project with a HACK. mkisofs is not able to create a VideoDVD using graft-points which + is the default in K3b. So now K3b links all VIDEO_TS files in a temp directory. + +0.11.1 +fixed an issue introduced with KDE 3.2rc1 which caused on-the-fly data writing to fail all the time. + (If you need to know: For some reason KProcess makes the Stdin fd O_NONBLOCK. This way mkisofs is + not able to write properly to cdrecord's stdin anymore.) + +0.11 +fixed libcdparanoia-loading on Debian (and maybe some other systems) +fixed crash at end of image creation in DVD project +fixed filesize display for very large files and projects (integer overflow) +fixed CD-TEXT reading. On some systems some senseless characters where appended. +fixed Id3lib detection in configure.in.in +added primitive supermount support +kernel 2.5 compile fixes (thanks to ismail (cartman) d�mez ) +K3b now defaults to the generic-mmc cdrdao driver if the used burner is not listed in + cdrdao's driver table. As all modern drives use the generic-mmc driver anyway this + is valid and prevents from a lot of newbie problems. +Added a thememanager and the new crystal look by Everaldo +K3b does not mount the disk for session import or data verification anymore. This way supermount + users will have no problems. +merged cue/bin and isoimage burning in one dialog which provides image-type-detection + supported so far: iso, cue, cdrdao toc, cdrecord clone images +better systemconfigcheck messages when cdrecord is not running with root privs +proper automatic writing mode and writing app selection for non-DAO-capable writers +overwriting of files in a new session +default CD size is now 80 min +generic resampling for all audio plugins +support for mono files +support for 8Bit wave files +FLAC decoding plugin (thanks to John Steele Scott) +check if a DVD-R(W) writer supports incremental streaming before trying multisession +check if a DVD-R(W) writer supports testwriting before trying a simulation +fixed DVD-Copy. We needed to determine the size of the data to copy for ourselves instead of relying + on the kernel +Automatic CD-writing speed selection (chooses always the max for now) +Technical info about audiofiles in the audio project are displayed in the track properties dialog +One may now add complete dirs to an audio project +Detection of Justlink support +Finally the device handling is completely independant. No calls to cdrecord anymore. That's why we +now have a libk3bdevice. +Improved writing speed estimation for audio tracks. +Added a button which determines the supported writing speeds with the mounted media. this way it is possible + to also select dvd writing speeds other than 1x +fixed directory sorting in iso filesystems +fixed boot image file sorting +Joliet long support (103 chars joliet filenames) +improved meta tag handling for audio encoding, support for album title and stuff +fixed crash when only creating images without an installed cd writer +writing speed is loaded correctly again +Completely rewritten CD copy: + - Copy Audio, multisession and Mixed mode CDs. + - Copy CD-TEXT + - Create CD-TEXT from Cddb entries + - Audio reading with cdparanoia for high quality ripping + - no cdrdao anymore +Support for new growisofs option to specify the size of a written image in DAO mode +Added check for free space in temp dir to dvd copy +Added a script to simplify the start of K3bSetup2. + +0.10 +DVD writing support with the DVD+RW-tools by Andy Polyakov +DVD formatting +DVD Copy (pure data dvd copy without any video transcoding) +CD Cloning with cdrtools >= 2.01a17 +device capabilities detection without cdrecord. This solves the long startup problem with ATAPI devices. +moved audio ripping pattern configuration from options dialog to audio ripping dialog +option to automatically erase CD-RWs and DVD-RWs without asking before writing +dragging files from a data project to the audio player (basically it's just a KURLDrag so it may be dragged + everywhere) +K3b is now divided in three libs and the main application: libk3bcore, libk3btools, and libk3bproject + this makes creating KParts-plugins easy. Two examples can be found in the tests/kpartplugins dir + one of them is a former K3b option which allowed to use audio meta data to rename files while + adding them to a data project. Now this is done by a plugin and a much higher degree of user + interaction. +Iso9660 file sorting (mkisofs -sort) +libid3 support for better mp3 tag access (we had that in some very old version but back then + K3b depended on it. Now it defaults to using KFileMetaInfo if it's not available) +Pluggable audio decoding +Pluggable audio encoding and completely rewritten audio ripping + much faster now due to a much better threading +Check for read permission when adding files to a project +file filter in binimagewritingdialog and isoimagewritingdialog (thanx to David Maciejak) +Verification of written data (compares md5 sums of all written files). +K3bSetup is not longer compiled unless explicit activated (K3bSetup is outdated and K3bSetup2 is still not ready) +K3b now also compiles without aRts. In this case the audioplayer will be useless (but still there) +no need for special mkisofs permissons anymore. K3b now openes the device itself when importing + an old session. +added a little color animation when dropping files onto a directory in data projects + it is always hard to tell if one dropped on the correct dir. If some one has a better animation + I would be interested in replacing this simple one. +Added CD-TEXT reading (used for Audio CD ripping) +sox encoder plugin to encode to all audio formats supported by sox (will anyone ever use this??) +encoder plugin that let's you specify a commandline to encode the data. Typical example would be calling lame to + encode to mp3. +much better TOC reading. K3b now displays multisession info. +m3u Playlist creation for ripped audio files +replaced the old K3bSetup with a quite simple KControl Module which is only able to change the + needed permission for devices and external programs. Everything else is nowadays done + by the distros. + + +0.9 +support for eMovix 0.8.0rc2 +better data project size calculation + +0.9pre2 +support for writing CD-Text with cdrecord +support for writing audio and mixed-mode CDs on-the-fly with cdrecord >= 2.01a13 +no gui blocking when reloading the media while writing a two-session mixed-mode cd +nodma option in eMovix project +fixed problems with audio decoding (the process sometimes stalled) + +0.9pre1 +added system notification +added eMovix project +added bootable cd support (multible images) +K3b now allows automatic writing mode selection to be sure to always use the best writing mode (DAO, TAO) +the environment PATH is searched for external bins +more error handling +dropped KDE/QT 3.0.x compatibility, now K3b requires at least 3.1 +internals: + devices rewrite, use generic packet ioctl's + cdinfo rewrite, use generic packet ioctl's + merged cdrdaoparser and cdrdaowriter +added multisession cd copy +fixed onlyCreateImage (this time for real!) +added option to hide main window while writing +fixed temp-dir problems with nfs-mounted home directories + K3b now uses the default kde tempdir +Resmgr support +added user datamode selection (mode1, mode2(form1)) +support for relative paths in playlists (thanx to Nick Bloke) +new progressdialog +faster cddb access (older versions just queried all entries, now only the selected one gets queried) +K3b is now threaded. +Gui beautifying. +videocd: + add playback control (PBC) + add customizing of Gaps and Margins + add HQ-VIDEOCD support + add relaxed APS support (this controls whether APS constraints are strict or relaxed) + add category restriction support + add an option to create always an empty `/SEGMENT' directory (some Players need this) + fixed load and saveUserDefaults + fixed autodetection VCD Typ (now the user can turn off this feature) +added audio volume normalization +added udf support to data project +user commands for external programs are separated by space now since the comma just + made problems for options like "--driver generic-mmc" which had to be specified + as "--driver, generic-mmc" +support for newer versions of cdrecord which have a slighly changed user interface +support for cuefile writing with cdrecord > 2.01a14 + +0.8.1 +fixed compiling problems with kernel < 2.4.3 +fixed onlyCreateImage in data project +fixed handling of cdrecord burnfree/burnproof driveroption in versions < 1.10 +fixed error with localized docking config that caused empty windows when changing the language +introduced workaround for serious cdrdao bug that caused tocfiles to be deleted +disabled the delete shortcut in the fileview (way too many users deleted files by accident when they + wanted to remove project items) + +0.8 +advanced options: manually selection of writing app (cdrecord or cdrdao) + +changed the option dialog layout -> smaller window + +fixed problems with first pregap in audio project: + no need to set the first pregap to 0 on some writers anymore + no 4 second pregap before first tracks anymore + +fixed problems with detecting some audio tracks that had flags like preemp set + +removed cdparanoia dependancy (dynamic linking) +big internal changes +split bin/cue writing from iso-image-writing +better cdcopy (mainly more options) +customizeable audio ripping + +mixed mode cd creation +video cd creation +video cd on cd-i support +better error handling + +indivdual selection of final size for encoded movie +clean vob dir before start and restore it (i.e playing wiht PowerDVD stores +config files in the directory) + +AC3-passthrough mode for DIVX Encoding +DND for AudioCD-Ripping to harddisc. + + +0.7.5 +Added session import +little reordering of menus +fixed the "cdrecord error 255" bug +fixed some i18n issues +improved mp3 file detection +added K3b project mimetype +added konqueror servicemenu entries +now KoStore is used for saving documents +K3bSetup is started with the correct language now +MD5 sum is only calculated on demand (but still asynchronous) +fixed K3bSetup linking problems + +0.7.4 +fixed bug that caused stupid mountpoints to be assigned to the devices +Mounting dvd with UDF filesystem (uppercase words) should now work (copy ifo-files). +beautified cddb setup +internal cddb change (rewrite) +fixed problems when writing mp3 and ogg vorbis files together +burnproof support for cdrecord <= 1.11a02 works again (and also for the new cdrecord ;) +Fix audiolanguange parsing for transcode 0.6.2 (wrong entries in k3bDVDRip.xml) +Bugfix Selecting ripping dir with file dialog and new directory now shows the available space properly. +Bugfix Cancel one pass in encoding now works +If select "Add to project" in the context menu of the file/dir tree a dialog (audio/data) asks +for creating a new data or audio project. + +0.7.3 +fixed compile problems with gcc 3.x + +0.7.2 +added md5sum to iso-image dialog +fixed compile problem when ogg-vorbis is not installed +fixed iso-image volume descriptor problem that caused all descriptors to be enclosed in quotation marks +added raw-copy option +better external program handling + +0.7.1 +audio: + fixed mp3 resampling problems + better handling of newly added tracks +data: + proper symlink handling + better support of the mkisofs options + option for adding hidden files + backup permissions +device: + support for symlinks in fstab +misc: + progress display in the K3b titlebar + better progress display in systray + +0.7 +DivX/XviD encoding +enhanced cddb support +new artwork from Ayo +fixed some device detection problems +fixed problems with long filenames and Joliet +some gui enhancements +added libmad to the sources +removed id3lib + +0.6pre2 +added ogg-vorbis support +added iso ids to diskInfo +fixed iso project input fields + +0.6pre1 +well... I don't know.. everything? + +0.5.1 +fixed bug that caused a compile error on some systems +fixed problems with audio cd writing +disabled projects while writing (needed for writing in the background) + +0.5.0 +-fixed mkisofs 1.14 problems +-audio on-the-fly burning (even corrupted mp3-files) +-saving/loading of projects +-atip and toc info +-cd-ripping (wav) with extended pattern support +-cddb support +-play audio cds +-extended option-dialog +-hide first track on audio-cds +-detection of ide-devices as cd-rom +-blanking of cdrws +-writing of existing iso-images +-optional setting of cdrdao driver for every scsi-device +-burn in the background (it's even possible to write on two writers simultaneous or write a cd and create an image (if your system is fast enough ;-)) +-K3b checks for an empty disk before writing! +-and like every time some other stuff i cannot remember ;-) + +0.4.3 +Fixed bug that caused K3b to crash while detecting devices +highly improved adding of files and directories to a data project +adding empty directories to data project via context menu +disabled audio on-the-fly burning due to a problem that caused faulty cds + +0.4.2 +added new DirTree (code from Konqueror) +added new device-management (the scsi-bus is checked directly) +detection of Burn-Proof-capable drives +some bugfixes + +0.4.1 +added whitespace-treatment +dock-positions are saved + +0.4.0 +Added ISO-cd support +file-tree creation via drag'n'drop +renaming of files +support of most of the mkisofs-features +improved audiotrack dialog +use of ID3Lib + +... and other things i really cannot remember... ;-) + diff --git a/FAQ b/FAQ new file mode 100644 index 0000000..3802d3b --- /dev/null +++ b/FAQ @@ -0,0 +1,82 @@ +Q: Compiling K3b fails with errors like this: + base_k3badvanceddataimagesettings.cpp:185: invalid use of undefined type + `struct KComboBox' + base_k3badvanceddataimagesettings.h:17: forward declaration of `struct + KComboBox' +A: The QTDesigner tool 'uic' is not able to find the kde widget plugins. + To solve this run 'qtconfig' and add '$KDEDIR/lib/kde3/plugins' to the plugin search path + (replace $KDEDIR with your kde base dir). + + +Q: K3b thinks my SCSI device is IDE. +A: If you are using the rpm from SuSE your version of K3bSetup is not able to set the + permissions that K3b needs the devices to have. The SuSE guys seem to think messing with + permissions is too dangerous. It is recommended to always compile from source to have all + K3b features. + + +Q: Where has all the fancy graphic gone? +A: Most likely you installed K3b in the wrong directory. All KDE programs are installed in the + KDE dirtree (SuSE: /opt/kde3, RedHat: /usr). If you compile K3b from source it defaults + to either $KDEDIR or /usr/local. To install in the correct directory you need to specify the prefix + to configure like this: + ./configure --prefix=`kde-config --prefix` + That will install K3b relative to the correct path. + + +Q: The linking always breaks with the missing -laudio. +A: You need to install NAS. + + +Q: Where can I find K3bSetup2? +A: K3bSetup2 is a KControlCenter Module. You can find it in the System Administration section or start + it manually with "kdesu kcmshell k3bsetup2". + There also is a script since K3b 0.11 called k3bsetup. + + +Q: My writer supports writing at speed X but K3b shows Y as a max. +A: K3b determined the maximum writing speed the first time you start it. Since the speed reported by the + writer always depends on the mounted medium this may not be the real max. + To manually change it open the K3b settings in the device section and click on the value. You will + be presented with a spinbox which allows to change the speed. + + +Q: Writing fails with the following cdrecord message: + "Cannot allocate memory. Cannot get SCSI I/O buffer." +A: Since kernel 2.6.9 suid root programs are not allowed to use the SCSI subsystem. + To solve this issue either configure cdrecord to run without root privileges: chmod 755 /usr/bin/cdrecord + or run K3b as root (which is not recommended but works also). + + +Q: Writing fails with the following cdrecord message over and over again: + "Error trying to open /dev/hdc exclusively (Device or resource busy)..." +A: You are using a patched cdrecord version which tries to open the device exclusively which fails because + your are probably also using automounting. The solutions are to disable automounting altogether (and this is + the recommended solution as automounting can cause other more serious problems with CD/DVD writing) or to + install a non-patched cdrecord version. + +Q: My DVD drive supports 16X but K3B keeps burning at 1X! What's happening? + +A: Your kernel most likely didn't apply optimal settings for your drive when it detected it. You can find out + what are the current settings of your drive with the command "hdparm -v /dev/dvd": + + /dev/dvd: + IO_support = 0 (default 16-bit) + unmaskirq = 0 (off) + using_dma = 0 (off) + keepsettings = 0 (off) + readonly = 0 (off) + readahead = 256 (on) + + The following options are known to maximize burning and playback performance: + + hdparm -d1 -c1 -a8 -u1 /dev/dvd + + To make these options permanent, a quick and dirty solution is to include the command in /etc/rc.local. + Consult your distribution documentation for a tailored solution. + + Some drives have buggy DMA support. If you experience instability, leave these options disabled. + + Some useful references: + http://www.togaware.com/linux/survivor/CD_DVD_Drives.shtml + http://www.linuxjournal.com/article/6921 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..4ce45cb --- /dev/null +++ b/INSTALL @@ -0,0 +1,51 @@ +Installing K3b 1.0 +------------------ + + +What you need to run K3b: + mandatory: + - since K3b is a CD writing program a cd writer would be a good thing to have ;-) + - the QT3 library (at least version 3.2) + - the KDE3 libraries (at least version 3.2) + - the cdparanoia library for cd ripping from Monty + - the cdrtools (cdrecord, mkisofs) from Joerg Schilling + - the dvd+rw-tools by Andy Polyakov for DVD writing + + optional: + - cdrdao, the other linux cd writing program from Andreas Mueller + - the transcode tools for DVD ripping and DivX/XviD encoding from Thomas Oestreich + - vcdimager >= 0.7 for creating video cds + - libmad for mp3 decoding + - ogg-vorbis libraries for encoding and decoding + - the FLAC++ libraries for flac-decoding + - the eMovix package + - TagLib by Scott Wheeler for reading Meta data tags + - the musepack (or now mpcdec) library for decoding Musepack audio files + - the ffmpeg library to decode other audio file formats such as wma + - the sndfile library to decode audio file formats such as AIFF or VOC + - the lame library to encode audio files in the mp3 format + - sox to encode audio files in formats such as AIFF or VOC + - a dynamically compiled libffmpeg for wma decoding + - the musicbrainz library for metadata queries for single audio titles + +After that it's all the same: + + ./configure + +or try ./configure --help to learn about the options. + +If configure was successful you are presented with a list of configure results that shows +which optional features are enabled. Now just compile K3b: + + make + +Now you are ready to install: + + make install (as root) + + +See PERMISSIONS on hints how to properly setup the permissions to use K3b without problems. + + +Have fun +Sebastian Trueg (trueg@k3b.org) diff --git a/KNOWNBUGS b/KNOWNBUGS new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6d2b67a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,11 @@ +if with_k3bsetup1 + K3BSETUPDIR=k3bsetup +endif + +EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL README TODO k3b.lsm admin configure.in.in + +AUTOMAKE_OPTIONS = foreign 1.5 + +#include admin/deps.am + +SUBDIRS = doc libk3bdevice libk3b src kioslaves plugins kfile-plugins $(K3BSETUPDIR) diff --git a/PERMISSIONS b/PERMISSIONS new file mode 100644 index 0000000..1fe56bf --- /dev/null +++ b/PERMISSIONS @@ -0,0 +1,32 @@ +K3b needs some special permissions to work properly. Most distrobutions come with permissions that I don't like +very much and make problems when adding new CD/DVD devices to your system. +If you set up your system as follows you can be sure to never have K3b permission problems again. + +1. Disable pam authentication for cdrom and burner devices in /etc/security/console.perm. Otherwise your permissions + will be overwritten when loggin in and it's not possible for two users to use K3b at the same time. + In my opinion one should disable this completely and create a proper configuration instead. The most annoying + issue with this pam stuff is that you cannot have two sessions with two different users running because the first + one owns all the sound and cd devices. + +2. Create a cdrom or cdrw or whatever group (if it not already exists) and add all users that should be able to + use K3b to that group. You may also skip this step and let everybody use K3b. In that case simply use root as + the group and permissions 4711 and 666 instead of 4710 and 660 in the following steps. + +3. Change the permissions of cdrecord and cdrdao to 4710 root.cdrom (substitute cdrom with the group from 2). + This way both will run suid root which allows them to increase their scheduling priority resulting in a more + stable burning process. + +4. Change the permissions of all your cdrom device to 660 root.cdrom (substitute cdrom with the group from 2). + With devfs you may do this with lines like this (the first changes all ide cd devices while the second takes + care of the scsi cd devices): + REGISTER ^ide/host.*/bus.*/target.*/lun.*/cd PERMISSIONS root.cdrom 660 + REGISTER ^scsi/host.*/bus.*/target.*/lun.*/cd PERMISSIONS root.cdrom 660 + In case you are not using devfs you may determine the devices by running K3b once as root and looking in the + device settings. The corresponding devices are listed there. + +5. Change the permissions of the generic SCSI devices to 660 root.cdrom (substitute cdrom with the group from 2). + Both cdrecord and cdrdao use the generic devices to access the scsi drives. So you don't need to perform this step + if you only have IDE devices. + Use a line like the following for devfs: + REGISTER ^scsi/host.*/bus.*/target.*/lun.*/generic PERMISSIONS root.cdrom 660 + In case you are not using devfs the devices are /dev/sg*. diff --git a/README b/README new file mode 100644 index 0000000..6bb3640 --- /dev/null +++ b/README @@ -0,0 +1,92 @@ +K3b Version 1.0 + +Thanx for downloading K3b - The CD Kreator + +These are the features so far: + - the most userfriendly interface ever ;-) + - themable + + - Media-centric user interface: + - Select the medium to use for burning instead of the device + - K3b always knows about all optical devices and inserted media and adjusts the UI accordingly + + - writing audio-cds + - On-the-fly decoding of many audio formats through plugin struxture + (decoding plugins for mp3, ogg vorbis, flac, wave, musepack, wma, aiff, and others) + - CD-Text support + - Metadata support, fill CD-Text from metadata or via Internet queries (CDDB + Musicbrainz) + - little gimmick: hide the first track (so that you have to search back from the + beginning of the cd to find it) + - volume level normalization (only when writing with an image) + - multiple sources for one track possible (merging of tracks, splitting of tracks, + adding silence of arbitrary length) + - integrated "preview" player + - Directly add audio tracks from other CDs and let K3b take care of the rest. + + - writing ISO9660-CDs and DVDs + - Joliet/Rockridge support + - Udf filestructures (no pure Udf so far) + - create image/write image + - writing on-the-fly + - creating of file-tree via drag'n'drop (as easy as it could be) + - removing files and directories from data tree + - moving files within the project + - adding new empty directories to data tree + - renaming of files (manually or automatically for mp3-files) (for joliet and rockrigde) + - support for most of the mkisofs-options (I don't think anyone will ever use them! ;-)) + - multisession support (including importing old sessions and overwriting files from old sessions) + Automagically multisession handling: start, continue, or finish multisession CDs and DVDs based on + the size of the project and the remaining capacity on the media. + - El Torito bootable CD/DVD support + + - writing Video CDs + - VCD 1.1, 2.0, SVCD + - CD-i support (Version 4) + + - writing mixed-mode CDs + - CD-Extra (CD-Plus, Enhanced Audio CD) support + + - writing eMovix CDs and DVDs + + - writing data DVDs + - Support for DVD-R(W) and DVD+R(W) + - Support for DVD+R Double Layer media + + - formatting DVD-RWs and DVD+RWs + + - writing existing iso-images and cue/bin images to CD + - Writing of Audio cue file images on-the-fly (All audio formats supported) + + - CD copy (data, audio, mixed mode) + + - DVD copy + + - CD cloning with cdrecord >=2.01a17 + + - blanking of CD-RWs + - Also automagically before writing a CD. + + - CD ripping to wav, mp3, ogg-vorbis, flac, or whatever format needed + - encoding plugin system + - Cddb support + - sophisticated pattern system to automatically organize the ripped tracks + - m3u playlist creation + - CD-TEXT support + + - DVD ripping with the transcode tools + - Support for automatic clipping + - DivX/XviD encoding + + - Retrieving CD/DVD info and toc + + - Powerful default and automatic settings + + +See INSTALL for further information + + +Please report bugs (with k3b output!) and tell me what you like/dislike +about the user-interface! + +Have fun +Sebastian Trueg (trueg@k3b.org) diff --git a/RELEASE_HOWTO b/RELEASE_HOWTO new file mode 100644 index 0000000..7346b6a --- /dev/null +++ b/RELEASE_HOWTO @@ -0,0 +1,27 @@ +Howto create a K3b release (stable branch) + +1. create a package from the stable branch using the createPackage.sh script: + createPackage.sh -a k3b -av 0.12 -ab branches/stable/extragear/multimedia --notoplevel -ib branches/stable/l10n + -is extragear-multimedia --pofiles "k3b libk3b libk3bdevice k3bsetup" --postprocess postprocessk3b.sh --split + --admin /branches/KDE/3.4/kde-common/admin + +2. Make sure the version in src/main.cpp, k3b.lsm, README, INSTALL is valid. + Check the version in libk3b. + +3. Create the tarball. + +4. Test the tarball. That includes removing any trace of K3b from the test system before and in the ideal + case compile on a minimal system meaning minimal KDE/QT versions. + +5. Upload the tarball to upload.sf.net/incoming and create a release on www.sourceforge.net (or use releaseforge, + a nice little application which automates the whole sourceforge release thing). + +6. Create a news entry on www.k3b.org and update the download page. + +7. Promote the release on www.kde-apps.org and freshmeat.net (the latter may also be done with releaseforge) + +8. Send an announcement email to: + k3b-user@lists.sourceforge.net + k3b-announce@lists.sourceforge.net + kde-extra-gear@kde.org + kde-announce@kde.org diff --git a/TODO b/TODO new file mode 100644 index 0000000..02bd01e --- /dev/null +++ b/TODO @@ -0,0 +1,22 @@ ++ integrated Audio CD player (as part of the audio project preview) + +- video cd photoalbum, portfolio +- video cd Interactive Menues (automenues) +- video cd split long mpegs (volume set) +- video dvd creation with menu support +- Support for other playlist formats + ++ video cd ripping ++ video cd mpeg-still support ++ video cd Navigation + ++ Alsa output plugin ++ Rewrite of the DVD ripping/encoding stuff + + Encoding on-the-fly (no extra encoding dialog) + + Do not rip in a special format but save the Video DVD as + a normal VideoDVD structure (or encoded) + +legend: +- planned +* work in progress ++ done diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..6b26319 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,11945 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +dnl Boston, MA 02110-1301, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN([KDE_PATH_X_DIRECT], +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK([#include ], [${x_direct_test_function}(1)], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_FIND_FILE], +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs, +dnl if-not-found, test-parameter, prepend-path) +dnl +dnl Look for program-name in list-of-dirs+$PATH. +dnl If prepend-path is set, look in $PATH+list-of-dirs instead. +dnl If found, $variable-name is set. If not, if-not-found is evaluated. +dnl test-parameter: if set, the program is executed with this arg, +dnl and only a successful exit code is required. +AC_DEFUN([KDE_FIND_PATH], +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + dirs="" + for dir in $PATH; do + dirs="$dirs $dir" + done + if test -z "$6"; then dnl Append dirs in PATH (default) + dirs="$3 $dirs" + else dnl Prepend dirs in PATH (if 6th arg is set) + dirs="$dirs $3" + fi + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN([KDE_MOC_ERROR_MESSAGE], +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN([KDE_UIC_ERROR_MESSAGE], +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN([KDE_CHECK_UIC_FLAG], +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui < +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_MOC_UIC], +[ + AC_REQUIRE([KDE_CHECK_PERL]) + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + else + UIC=$UIC_PATH + + if test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN([KDE_1_CHECK_PATHS], +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN([KDE_SET_PATHS], +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_kcfgdir=\"$kde_kcfgdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_menudir=\"$xdg_menudir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN([KDE_SET_DEFAULT_PATHS], +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${datadir}/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${datadir}/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${datadir}/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${datadir}/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${datadir}/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${datadir}/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${datadir}/config' + fi + if test -z "$kde_kcfgdir"; then + kde_kcfgdir='\${datadir}/config.kcfg' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${datadir}/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${datadir}/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${datadir}/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${datadir}/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${datadir}/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${datadir}/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications/kde' + fi + if test -z "$xdg_menudir"; then + xdg_menudir='\${sysconfdir}/xdg/menus' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS], +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_kcfgdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" || + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN([KDE_MISSING_PROG_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN([KDE_MISSING_ARTS_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly or use +--without-arts to compile without aRts support (this will remove functionality). +]) +]) + +AC_DEFUN([KDE_SET_DEFAULT_BINDIRS], +[ + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi +]) + +AC_DEFUN([KDE_SUBST_PROGRAMS], +[ + AC_ARG_WITH(arts, + AC_HELP_STRING([--without-arts],[build without aRts [default=no]]), + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no") + if test "$build_arts" = "no"; then + AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts]) + fi + + KDE_SET_DEFAULT_BINDIRS + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" '!=' "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + kde32ornewer=1 + kde33ornewer=1 + if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then + kde32ornewer= + kde33ornewer= + else + if test "$kde_qtver" = "3"; then + if test "$kde_qtsubver" -le 1; then + kde32ornewer= + fi + if test "$kde_qtsubver" -le 2; then + kde33ornewer= + fi + if test "$KDECONFIG" != "compiled"; then + if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then + kde33ornewer= + fi + fi + fi + fi + + if test -n "$kde32ornewer"; then + KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)]) + KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)]) + fi + if test -n "$kde33ornewer"; then + KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)]) + AC_SUBST(MAKEKDEWIDGETS) + fi + KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""]) + + if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + if test -n "$kde32ornewer"; then + KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)' + DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)' + AC_SUBST(KCONFIG_COMPILER) + AC_SUBST(KCFG_DEPENDENCIES) + AC_SUBST(DCOPIDLNG) + fi + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + AC_SUBST(XMLLINT) +])dnl + +AC_DEFUN([AC_CREATE_KFSSTND], +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_menudir= xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN([AC_SUBST_KFSSTND], +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_kcfgdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_menudir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kdeinitdir, '$(kde_moduledir)') +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN([KDE_MISC_TESTS], +[ + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # sys/bitypes.h is needed for uint32_t and friends on Tru64 + AC_CHECK_HEADERS(sys/bitypes.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # for some image handling on Mac OS X + AC_CHECK_HEADERS(Carbon/Carbon.h) + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-Wl,-framework,CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + KDE_CHECK_PIE_SUPPORT + +# darwin needs this to initialize the environment +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + +AH_VERBATIM(_DARWIN_ENVIRON, +[ +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif +]) + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([K_PATH_X], +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]), + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]), + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +AC_ARG_ENABLE( + mac, + AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]), + kde_use_qt_mac=$enableval, + kde_use_qt_mac=no +) + +# used to disable x11-specific stuff on special platforms +AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no") + +if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then + +AC_MSG_CHECKING(for X) + +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE || test "$kde_x_libraries" = "/usr/lib"; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS" + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +LDFLAGS="$ac_save_LDFLAGS" + +LIB_X11='-lX11 $(LIBSOCKET)' + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include +#ifdef STDC_HEADERS +# include +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no +) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe +]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +elif test "$kde_use_qt_emb" = "yes"; then + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +elif test "$kde_use_qt_mac" = "yes"; then + dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to + dnl be included to get the information) --Sam + CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" + CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +fi +AC_SUBST(X_PRE_LIBS) +AC_SUBST(LIB_X11) +AC_SUBST(LIB_XRENDER) +AC_SUBST(LIBSM) +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_includes) +AC_SUBST(x_libraries) +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + +]) + +AC_DEFUN([KDE_PRINT_QT_PROGRAM], +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext < +#include +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext < +#include +#include +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <> conftest.$ac_ext < +#include +#include +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_1_3], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]), + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ +if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" +else + qtlib="qt" +fi + +kde_int_qt="-l$qtlib" + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]), + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]), + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]), + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +fi +if test "$PKG_CONFIG" != "no" ; then + if $PKG_CONFIG --exists qt-mt ; then + qt_incdirs="$qt_incdirs `$PKG_CONFIG --variable=includedir qt-mt`" + fi +fi +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir/lib $dir" +done +if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +fi +if test "$PKG_CONFIG" != "no" ; then + if $PKG_CONFIG --exists qt-mt ; then + qt_libdirs="$qt_incdirs `$PKG_CONFIG --variable=libdir qt-mt`" + fi +fi +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIBQT="$LIBQT ${kde_int_qt}_incremental" + break + fi +done + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then + KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$QT_LDFLAGS $all_libraries" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIB_QT="$LIB_QT ${kde_int_qt}_incremental" + break + fi +done + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN([AC_PATH_QT], +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN([KDE_CHECK_UIC_PLUGINS], +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF + +NewConnectionDialog + + + + testInput + + + + +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + # if you're trying to debug this check and think it's incorrect, + # better check your installation. The check _is_ correct - your + # installation is not. + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +AC_MSG_RESULT([$kde_cv_uic_plugins]) +if test "$kde_cv_uic_plugins" != yes; then + AC_MSG_ERROR([ +you need to install kdelibs first. + +If you did install kdelibs, then the Qt version that is picked up by +this configure is not the same version you used to compile kdelibs. +The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the +_same Qt version_, compiled with the _same compiler_ and the same Qt +configuration settings. +]) +fi +fi +]) + +AC_DEFUN([KDE_CHECK_FINAL], +[ + AC_ARG_ENABLE(final, + AC_HELP_STRING([--enable-final], + [build size optimized apps (experimental - needs lots of memory)]), + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN([KDE_CHECK_CLOSURE], +[ + AC_ARG_ENABLE(closure, + AC_HELP_STRING([--enable-closure],[delay template instantiation]), + kde_use_closure=$enableval, kde_use_closure=no) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_NO_UNDEFINED="" + case $host in + *-*-linux-gnu) + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + ;; + esac + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +dnl Check if the linker supports --enable-new-dtags and --as-needed +AC_DEFUN([KDE_CHECK_NEW_LDFLAGS], +[ + AC_ARG_ENABLE(new_ldflags, + AC_HELP_STRING([--enable-new-ldflags], + [enable the new linker flags]), + kde_use_new_ldflags=$enableval, + kde_use_new_ldflags=no) + + LDFLAGS_AS_NEEDED="" + LDFLAGS_NEW_DTAGS="" + if test "x$kde_use_new_ldflags" = "xyes"; then + LDFLAGS_NEW_DTAGS="" + KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags], + [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],) + + KDE_CHECK_COMPILER_FLAG([Wl,--as-needed], + [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],) + fi + AC_SUBST(LDFLAGS_AS_NEEDED) + AC_SUBST(LDFLAGS_NEW_DTAGS) +]) + +AC_DEFUN([KDE_CHECK_NMCHECK], +[ + AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]), + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + +AC_DEFUN([KDE_EXPAND_MAKEVAR], [ +savex=$exec_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +tmp=$$2 +while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done +exec_prefix=$savex +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_BASE_PATH_KDE], +[ +AC_REQUIRE([KDE_CHECK_STL]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${includedir} + KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir) + + kde_libraries=${libdir} + KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir) + +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1, e.g. from kdelibs + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes="${includedir}" + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION" + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$KDE_LDFLAGS $all_libraries" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN([KDE_CHECK_EXTRA_LIBS], +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]), + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]), + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN([KDE_1_CHECK_PATH_HEADERS], +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#endif +#include +#include "confdefs.h" +#include + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_menudir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + printf("kde_kcfgdir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$all_includes $CPPFLAGS" + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_CHECK_KDEQTADDON], +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN([KDE_CREATE_LIBS_ALIASES], +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + case $host in + *cygwin*) lib_kded="-lkdeinit_kded" ;; + *) lib_kded="" ;; + esac + AC_SUBST(LIB_KDED, $lib_kded) + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KJS, "-lkjs") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") + AC_SUBST(LIB_KUTILS, "-lkutils") + AC_SUBST(LIB_KDEPIM, "-lkdepim") + AC_SUBST(LIB_KIMPROXY, "-lkimproxy") + AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff") + AC_SUBST(LIB_KDNSSD, "-lkdnssd") + AC_SUBST(LIB_KUNITTEST, "-lkunittest") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN([AC_PATH_KDE], +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]), + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN([KDE_CHECK_FUNC_EXT], +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +$4; +#ifdef __cplusplus +} +#endif +#endif +]) +]) + +AC_DEFUN([AC_CHECK_SETENV], +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN([AC_CHECK_UNSETENV], +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN([AC_CHECK_GETDOMAINNAME], +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include +#include +#include +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [#include + int getdomainname (char *, size_t)], + [GETDOMAINNAME]) +]) + +AC_DEFUN([AC_CHECK_GETHOSTNAME], +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include +#include +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN([AC_CHECK_USLEEP], +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN([AC_CHECK_RANDOM], +[ + KDE_CHECK_FUNC_EXT(random, [ +#include +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN([AC_CHECK_INITGROUPS], +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include +#include +#include +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMPS], +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include +#include +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMP], +[ + KDE_CHECK_FUNC_EXT(mkstemp, [ +#include +#include +], + [ +mkstemp("/tmp/aaaXXXXXX"); +], + [int mkstemp(char *)], + [MKSTEMP]) +]) + +AC_DEFUN([AC_CHECK_MKDTEMP], +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include +#include +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN([AC_CHECK_RES_INIT], +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include +#include +#include +#include + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + KDE_CHECK_FUNC_EXT(res_init, + [ +#include +#include +#include +#include + ], + [res_init()], + [int res_init(void)], + [RES_INIT]) +]) + +AC_DEFUN([AC_CHECK_STRLCPY], +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN([AC_CHECK_STRLCAT], +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN([AC_CHECK_RES_QUERY], +[ + KDE_CHECK_FUNC_EXT(res_query, [ +#include +#include +#include +#include +#include +], +[ +res_query(NULL, 0, 0, NULL, 0); +], + [int res_query(const char *, int, int, unsigned char *, int)], + [RES_QUERY]) +]) + +AC_DEFUN([AC_CHECK_DN_SKIPNAME], +[ + KDE_CHECK_FUNC_EXT(dn_skipname, [ +#include +#include +#include +#include +], +[ +dn_skipname (NULL, NULL); +], + [int dn_skipname (unsigned char *, unsigned char *)], + [DN_SKIPNAME]) +]) + + +AC_DEFUN([AC_FIND_GIF], + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN([KDE_FIND_JPEG_HELPER], +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[ +#ifdef __cplusplus +extern "C" { +#endif +void jpeg_CreateDecompress(); +#ifdef __cplusplus +} +#endif +], +[jpeg_CreateDecompress();], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN([AC_FIND_JPEG], +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN([KDE_CHECK_QT_JPEG], +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include ], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN([AC_FIND_ZLIB], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include +#include +], +[ + char buf[42]; + gzFile f = (gzFile) 0; + /* this would segfault.. but we only link, don't run */ + (void) gzgets(f, buf, sizeof(buf)); + + return (strcmp(zlibVersion(), ZLIB_VERSION) == 0); +], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. + Possibly configure picks up an outdated version + installed by XFree86. Remove it from your system. + + Check your installation and look into config.log) + LIBZ="" +fi +AC_SUBST(LIBZ) +]) + +AC_DEFUN([KDE_TRY_TIFFLIB], +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN([AC_FIND_TIFF], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + +AC_DEFUN([KDE_FIND_LIBEXR], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_CACHE_VAL(ac_cv_libexr, +[ + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + AC_MSG_CHECKING([for OpenEXR libraries]) + + if test "$PKG_CONFIG" = "no" ; then + AC_MSG_RESULT(no) + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + if ! $PKG_CONFIG --exists OpenEXR ; then + AC_MSG_RESULT(no) + EXRSTATUS=no + else + if ! $PKG_CONFIG --atleast-version="1.1.1" OpenEXR ; then + AC_MSG_RESULT(no) + EXRSTATUS=old + else + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $USER_LDFLAGS `pkg-config --libs OpenEXR` $LIBZ" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_CXXFLAGS="$CXXFLAGS" + EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR` + CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS" + + AC_TRY_LINK(dnl + [ + #include + ], + [ + using namespace Imf; + RgbaInputFile file ("dummy"); + return 0; + ], + eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'", + eval "ac_cv_libexr=no" + ) + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR]) + LIB_EXR="$ac_cv_libexr" + AC_MSG_RESULT($ac_cv_libexr) + else + AC_MSG_RESULT(no) + LIB_EXR="" + fi + fi + fi + fi + AC_SUBST(LIB_EXR) + AC_SUBST(EXR_FLAGS) +]) + + + +AC_DEFUN([AC_FIND_PNG], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN([AC_FIND_JASPER], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + return( jas_init() ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN([AC_CHECK_BOOL], +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN([AC_CHECK_GNU_EXTENSIONS], +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN([KDE_CHECK_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CC supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_C + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], []) + CFLAGS="$save_CFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN([AC_REMOVE_FORBIDDEN], +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + + +AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER], +[ + AC_MSG_CHECKING([whether $CC is blacklisted]) + + dnl In theory we have tu run this test against $CC and $CXX + dnl in C and in C++ mode, because its perfectly legal for + dnl the user to mix compiler versions, since C has a defined + dnl ABI. + dnl + dnl For now, we assume the user is not on crack. + + AC_TRY_COMPILE([ +#ifdef __GNUC__ +#if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0 +choke me +#endif +#endif +], , + kde_bad_compiler=no, + kde_bad_compiler=yes +) + + AC_MSG_RESULT($kde_bad_compiler) + +if test "$kde_bad_compiler" = "yes"; then + AC_MSG_ERROR([ + +This particular compiler version is blacklisted because it +is known to miscompile KDE. Please use a newer version, or +if that is not yet available, choose an older version. + +Please do not report a bug or bother us reporting this +configure error. We know about it, and we introduced +it by intention to avoid untraceable bugs or crashes in KDE. + +]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH], +[ + AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline], + kde_cv_opt_noinline_match, + [ + kde_cv_opt_noinline_match=irrelevant + dnl if we don't use both -O2 and -fno-inline, this check is moot + if echo "$CFLAGS" | grep -e -O2 >/dev/null 2>/dev/null \ + && echo "$CFLAGS" | grep -e -fno-inline >/dev/null 2>/dev/null ; then + + ac_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS -D_USE_GNU" + + AC_TRY_LINK([ + #include +], [ const char *pt, *et; + et = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p ( ";," ) && ((size_t)(const void *)(( ";," )+ 1) - (size_t)(const void *)( ";," ) == 1) ? ((__a0 =((__const char *) ( ";," ))[0], __a0 == '\0') ? ((void) ( pt ),((void *)0) ) : ((__a1 = ((__const char *) ( ";," ))[1], __a1== '\0') ? (__extension__ (__builtin_constant_p ( __a0 ) && ( __a0 ) == '\0' ? (char *) __rawmemchr ( pt , __a0) : strchr( pt , __a0 ))) : ((__a2 = ((__const char *) ( ";," ))[2], __a2 == '\0') ? __strpbrk_c2 ( pt , __a0, __a1) :(((__const char *) ( ";," ))[3] == '\0' ? __strpbrk_c3 ( pt ,__a0, __a1, __a2): strpbrk ( pt , ";," ))))) : strpbrk ( pt , ";," )); }) ; +], + kde_cv_opt_noinline_match=yes, + kde_cv_opt_noinline_match=no + ) + + CFLAGS="$ac_cflags_save" + fi + ]) +]) + + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN([AC_VALIDIFY_CXXFLAGS], +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN([AC_CHECK_COMPILERS], +[ + AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]), + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption, + AC_HELP_STRING([--disable-debug], + [disables debug output and debug symbols [default=no]]), + [],[]) + + AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], + [compiles with strict compiler options (may not work!)]), + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]), + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]), + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 -fno-inline $CFLAGS" + else + CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + KDE_CHECK_FOR_BAD_COMPILER + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 -fno-inline $CXXFLAGS" + else + CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS" + case $host in + *-*-linux-gnu) + CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"]) + KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + dnl ### FIXME: revert for KDE 4 + KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + AC_ARG_ENABLE(pch, + AC_HELP_STRING([--enable-pch], + [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]), + [ kde_use_pch=$enableval ],[ kde_use_pch=no ]) + + HAVE_GCC_VISIBILITY=0 + AC_SUBST([HAVE_GCC_VISIBILITY]) + + if test "$GXX" = "yes"; then + gcc_no_reorder_blocks=NO + KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES]) + if test $kde_use_debug_code != "no" && \ + test $kde_use_debug_code != "full" && \ + test "YES" = "$gcc_no_reorder_blocks" ; then + CXXFLAGS="$CXXFLAGS -fno-reorder-blocks" + CFLAGS="$CFLAGS -fno-reorder-blocks" + fi + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + ENABLE_PERMISSIVE_FLAG="-fpermissive" + + if test "$kde_use_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c header files) + echo >conftest.h + if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + if test "$kde_gcc_supports_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c++ header files) + if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + fi + rm -f conftest.h conftest.h.gch + fi + + KDE_CHECK_FOR_OPT_NOINLINE_MATCH + if test "x$kde_cv_opt_noinline_match" = "xno" ; then + CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`" + fi + fi + AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes") + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CFLAGS=-O0 + fi + KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0]) + + AC_ARG_ENABLE(coverage, + AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [ + if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="-lgcc" + elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="" + else + AC_MSG_ERROR([coverage with your compiler is not supported]) + fi + CFLAGS="$CFLAGS $ac_coverage_compiler" + CXXFLAGS="$CXXFLAGS $ac_coverage_compiler" + LDFLAGS="$LDFLAGS $ac_coverage_linker" + ]) + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + AC_SUBST(ENABLE_PERMISSIVE_FLAG) + + KDE_CHECK_NEW_LDFLAGS + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG], + [ + AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + safe_CXXFLAGS=$CXXFLAGS + safe_LDFLAGS=$LDFLAGS + CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0" + LDFLAGS="$LDFLAGS -shared -fPIC" + + AC_TRY_LINK( + [ + /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */ + #include + int some_function( void ) __attribute__ ((visibility("default"))); + int some_function( void ) + { + std::string s("blafasel"); + return 0; + } + ], [/* elvis is alive */], + kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes) + + CXXFLAGS=$safe_CXXFLAGS + LDFLAGS=$safe_LDFLAGS + AC_LANG_RESTORE + ] + ) + + if test x$kde_cv_val_gcc_visibility_bug = xno; then + CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" + fi + ] +) + +AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY], +[ + AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY]) + + AC_MSG_CHECKING([grepping for visibility push/pop in headers]) + + if test "x$GXX" = "xyes"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_EGREP_CPP( + [GCC visibility push], + [ #include + ], + [ + AC_MSG_RESULT(yes) + kde_stdc_visibility_patched=yes ], + [ + AC_MSG_RESULT(no) + AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for + visibility support. Disabling -fvisibility=hidden]) + + kde_stdc_visibility_patched=no ]) + + AC_LANG_RESTORE + + kde_have_gcc_visibility=no + KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, + [ + kde_have_gcc_visibility=yes + dnl the whole toolchain is just a mess, gcc is just too buggy + dnl to handle STL with visibility enabled. Lets reconsider + dnl when gcc 4.2 is out or when things get fixed in the compiler. + dnl Contact mueller@kde.org for details. + AC_ARG_ENABLE(gcc-hidden-visibility, + AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]), + [kde_have_gcc_visibility=$enableval], + [kde_have_gcc_visibility=no]) + + AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + safe_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $all_includes" + + AC_TRY_COMPILE( + [ +#include +#if Q_EXPORT - 0 != 0 +/* if this compiles, then Q_EXPORT is undefined */ +/* if Q_EXPORT is nonempty, this will break compilation */ +#endif + ], [/* elvis is alive */], + kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes) + + CXXFLAGS=$safe_CXXFLAGS + AC_LANG_RESTORE + ] + ) + + if test x$kde_have_gcc_visibility = "xyes" && test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then + CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + KDE_CHECK_VISIBILITY_GCC_BUG + HAVE_GCC_VISIBILITY=1 + AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported]) + fi + ]) + fi +]) + +AC_DEFUN([KDE_ADD_DEPENDENCIES], +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN([KDE_PROG_LIBTOOL], +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_OBJEXT +AC_EXEEXT + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +# This hack ensures that libtool creates shared libs for kunittest plugins. By default check_LTLIBRARIES makes static libs. +KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)" +AC_SUBST(KDE_CHECK_PLUGIN) + +# we patch configure quite some so we better keep that consistent for incremental runs +AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure') +]) + +AC_DEFUN([KDE_CHECK_LIB64], +[ + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none,auto[=default])]), + kdelibsuff=$enableval, kdelibsuff="auto") + + if test "$kdelibsuff" = "auto"; then + +cat > conftest.c << EOF +#include +int main() { + return 0; +} +EOF + kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out |sed -ne '/libc.so/{ + s,.*/lib\([[^\/]]*\)/.*,\1, + p +}'` + rm -rf conftest.* + fi + + if test "$kdelibsuff" = "no" || test "$kdelibsuff" = "none"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN([KDE_CHECK_TYPES], +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(short)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +dnl Not used - kept for compat only? +AC_DEFUN([KDE_DO_IT_ALL], +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN([AC_CHECK_RPATH], +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]), + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(libdir)" + + if test "$kde_libraries" != "$libdir"; then + KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)" + fi + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + X_RPATH="-R \$(x_libraries)" + KDE_RPATH="$KDE_RPATH $X_RPATH" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_SUBST(X_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN([AC_CHECK_SOCKLEN_T], +[ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(kde_cv_socklen_t, + [ + AC_LANG_PUSH(C++) + kde_cv_socklen_t=no + AC_TRY_COMPILE([ + #include + #include + ], + [ + socklen_t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t=yes + kde_cv_socklen_t_equiv=socklen_t + ]) + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t) + if test $kde_cv_socklen_t = no; then + AC_MSG_CHECKING([for socklen_t equivalent for socket functions]) + AC_CACHE_VAL(kde_cv_socklen_t_equiv, + [ + kde_cv_socklen_t_equiv=int + AC_LANG_PUSH(C++) + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #include + #include + ], + [ + $t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t_equiv="$t" + break + ]) + done + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t_equiv) + fi + AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined]) + AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)]) +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN([AM_KDE_WITH_NLS], + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN([AM_KDE_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN([AC_HAVE_XPM], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]), + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include ],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN([AC_HAVE_DPMS], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]), + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries" + LIBS="-lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LIBS="-lXdpms $LIBS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + ac_save_cflags="$CFLAGS" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO, + [Define if you have the DPMSCapable prototype in ]) + AC_CHECK_DECL(DPMSCapable, + AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),, + [#include + #include ]) + AH_TEMPLATE(HAVE_DPMSINFO_PROTO, + [Define if you have the DPMSInfo prototype in ]) + AC_CHECK_DECL(DPMSInfo, + AC_DEFINE(HAVE_DPMSINFO_PROTO),, + [#include + #include ]) + CFLAGS="$ac_save_cflags" + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN([AC_HAVE_GL], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]), + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags=$LDFLAGS + ac_save_cxxflags=$CXXFLAGS + ac_save_libs=$LIBS + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries" + LIBS="$LIBS -lGL -lGLU" + test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11" + LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + AC_LANG_RESTORE + LDFLAGS=$ac_save_ldflags + CXXFLAGS=$ac_save_cxxflags + LIBS=$ac_save_libs + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + GLLIB='-lGLU -lGL $(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN([KDE_PAM], [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + want_pam= + AC_ARG_WITH(pam, + AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]), + [ if test "x$withval" = "xyes"; then + want_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + want_pam=no + else + want_pam=yes + pam_service=$withval + fi + ], [ pam_service=kde ]) + + use_pam= + PAMLIBS= + if test "x$want_pam" != xno; then + AC_CHECK_LIB(pam, pam_start, [ + AC_CHECK_HEADER(security/pam_appl.h, + [ pam_header=security/pam_appl.h ], + [ AC_CHECK_HEADER(pam/pam_appl.h, + [ pam_header=pam/pam_appl.h ], + [ + AC_MSG_WARN([PAM detected, but no headers found! +Make sure you have the necessary development packages installed.]) + ] + ) + ] + ) + ], , $LIBDL) + if test -z "$pam_header"; then + if test "x$want_pam" = xyes; then + AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!]) + fi + else + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + use_pam=yes + + dnl darwin claims to be something special + if test "$pam_header" = "pam/pam_appl.h"; then + AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/]) + fi + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], $pam_header, + [ AC_EGREP_HEADER([const struct pam_message], $pam_header, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN([DEF_PAM_SERVICE], [ + AC_ARG_WITH($1-pam, + AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]), + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE=$withval + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN([KDE_SHADOWPASSWD], [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + AC_HELP_STRING([--with-shadow],[If you want shadow password support]), + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN([KDE_PASSWDLIBS], [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN([KDE_CHECK_LIBDL], +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN([KDE_CHECK_DLOPEN], +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]), +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING], +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN([KDE_ADD_INCLUDES], +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + +AC_DEFUN([KDE_CHECK_LIBPTHREAD], +[ + dnl This code is here specifically to handle the + dnl various flavors of threading library on FreeBSD + dnl 4-, 5-, and 6-, and the (weird) rules around it. + dnl There may be an environment PTHREAD_LIBS that + dnl specifies what to use; otherwise, search for it. + dnl -pthread is special cased and unsets LIBPTHREAD + dnl below if found. + LIBPTHREAD="" + + if test -n "$PTHREAD_LIBS"; then + if test "x$PTHREAD_LIBS" = "x-pthread" ; then + LIBPTHREAD="PTHREAD" + else + PTHREAD_LIBS_save="$PTHREAD_LIBS" + PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'` + AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS]) + KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [ + LIBPTHREAD="$PTHREAD_LIBS_save"]) + PTHREAD_LIBS="$PTHREAD_LIBS_save" + fi + fi + + dnl Is this test really needed, in the face of the Tru64 test below? + if test -z "$LIBPTHREAD"; then + AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"]) + fi + + dnl This is a special Tru64 check, see BR 76171 issue #18. + if test -z "$LIBPTHREAD" ; then + AC_MSG_CHECKING([for pthread_create in -lpthread]) + kde_safe_libs=$LIBS + LIBS="$LIBS -lpthread" + AC_TRY_LINK([#include ],[(void)pthread_create(0,0,0,0);],[ + AC_MSG_RESULT(yes) + LIBPTHREAD="-lpthread"],[ + AC_MSG_RESULT(no)]) + LIBS=$kde_safe_libs + fi + + dnl Un-special-case for FreeBSD. + if test "x$LIBPTHREAD" = "xPTHREAD" ; then + LIBPTHREAD="" + fi + + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_PTHREAD_OPTION], +[ + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"]) + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_THREADING], +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]), + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN([KDE_TRY_LINK_PYTHON], +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi + +fi + +]) + +AC_DEFUN([KDE_CHECK_PYTHON_DIR], +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]), +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN([KDE_CHECK_PYTHON_INTERN], +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs" +AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.so; then + AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) + if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_PYTHON], +[ + KDE_CHECK_PYTHON_INTERN("2.5", + [KDE_CHECK_PYTHON_INTERN("2.4", + [KDE_CHECK_PYTHON_INTERN("2.3", + [KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", + [KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) + ]) + ]) + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_STL], +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + + AC_MSG_CHECKING([if C++ programs can be compiled]) + AC_CACHE_VAL(kde_cv_stl_works, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_works=yes, + kde_cv_stl_works=no) +]) + + AC_MSG_RESULT($kde_cv_stl_works) + + if test "$kde_cv_stl_works" = "yes"; then + # back compatible + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + else + AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs. +Check config.log for details - if you're using a Linux distribution you might miss +a package named similar to libstdc++-dev.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN([AC_FIND_QIMGIO], + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include +#include +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN([AM_DISABLE_LIBRARIES], +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN([AC_CHECK_UTMP_FILE], +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN([KDE_CREATE_SUBDIRSLIST], +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" +TOPSUBDIRS="" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +ac_topsubdirs= +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +elif test -s $srcdir/subdirs; then + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.@]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN([KDE_CHECK_NAMESPACES], +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_S_ISSOCK], +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_TRY_LINK( +[ +#include +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_KDEMAXPATHLEN], +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +cat > conftest.$ac_ext < +#endif +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN([KDE_CHECK_HEADER], +[ + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER([$1], [$2], [$3], [$4]) + AC_LANG_RESTORE + CPPFLAGS=$kde_safe_cppflags +]) + +AC_DEFUN([KDE_CHECK_HEADERS], +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_FAST_CONFIGURE], +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]), + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN([KDE_CONF_FILES], +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +dnl This sets the prefix, for arts and kdelibs +dnl Do NOT use in any other module. +dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde +AC_DEFUN([KDE_SET_PREFIX_CORE], +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + + +AC_DEFUN([KDE_SET_PREFIX], +[ + unset CDPATH + dnl We can't give real code to that macro, only a value. + dnl It only matters for --help, since we set the prefix in this function anyway. + AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix}) + + KDE_SET_DEFAULT_BINDIRS + if test "x$prefix" = "xNONE"; then + dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + else + dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH + kde_save_PATH="$PATH" + PATH="$exec_prefix/bin:$prefix/bin:$PATH" + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + PATH="$kde_save_PATH" + fi + + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + + AC_MSG_CHECKING([where to install]) + if test "x$prefix" = "xNONE"; then + prefix=$kde_libs_prefix + AC_MSG_RESULT([$prefix (as returned by kde-config)]) + else + dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different + given_prefix=$prefix + AC_MSG_RESULT([$prefix (as requested)]) + fi + + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + AC_SUBST(KDECONFIG) + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN([KDE_LANG_CPLUSPLUS], +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN([KDE_CHECK_LONG_LONG], +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN([KDE_CHECK_LIB], +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN([KDE_JAVA_PREFIX], +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN([KDE_CHECK_JAVA_DIR], +[ + +AC_ARG_WITH(java, +AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]), +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libgcjdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> collect list of candidate paths + if test -n "$JAVA_HOME"; then + KDE_JAVA_PREFIX($JAVA_HOME) + fi + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/lib/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + if test -d "$dir"; then + javadirs="$javadirs $dir" + fi + done + IFS=$kde_save_IFS + jredirs= + + dnl Now javadirs contains a list of paths that exist, all ending with bin/ + for dir in $javadirs; do + dnl Check for the java executable + if test -x "$dir/java"; then + sane_path=$(cd $dir; /bin/pwd) + dnl And also check for a libjvm.so somewhere under there + dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big. + if test "$sane_path" != "/usr/bin"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + fi + done + + dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libgcj.so + kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + + dnl not needed for gcj + + if test "x$kde_java_libgcjdir" = "x"; then + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + fi + + else + JAVAC= + jni_includes= + fi + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + else + if test ! -r "$kde_java_libgcjdir/libgcj.so"; then + AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.]) + fi + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + dnl not needed for gcj compile + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + if test "x$kde_java_libgcjdir" = "x"; then + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + else + JVMLIBS="-L$kde_java_libgcjdir -lgcj" + fi + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +elif test -d "/Library/Java/Home"; then + kde_java_bindir="/Library/Java/Home/bin" + jni_includes="-I/Library/Java/Home/include" + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + JVMLIBS="-Wl,-framework,JavaVM" + + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([Apple Java Framework]) +else + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. (matz@kde.org) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN([KDE_NEED_FLEX], +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN([AC_PATH_QTOPIA], +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]), + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext < +#include + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN([KDE_INIT_DOXYGEN], +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN([AC_FIND_BZIP2], +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([KDE_CHECK_SSL], +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]), + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + AC_HELP_STRING([--without-ssl],[disable SSL checks]), + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + + cat >conftest.$ac_ext < +#include + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + if test "$ac_ssl_includes" != "/usr/include"; then + CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes" + fi + + if AC_TRY_EVAL(ac_link); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +SSL_INCLUDES= + +if test "$ssl_includes" = "/usr/include"; then + if test -f /usr/kerberos/include/krb5.h; then + SSL_INCLUDES="-I/usr/kerberos/include" + fi +elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN([KDE_CHECK_STRLCPY], +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail kde-devel@kde.org with a description of your system! + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_BINUTILS], +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ +#ifdef __INTEL_COMPILER +icc apparently does not support libtools version-info and version-script +at the same time. Dunno where the bug is, but until somebody figured out, +better disable the optional version scripts. +#endif + + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) + +AC_DEFUN([KDE_CHECK_PERL], +[ + KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [ + AC_MSG_ERROR([No Perl found in your $PATH. +We need perl to generate some code.]) + ]) + AC_SUBST(PERL) +]) + +AC_DEFUN([KDE_CHECK_LARGEFILE], +[ +AC_SYS_LARGEFILE +if test "$ac_cv_sys_file_offset_bits" != no; then + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" +fi + +if test "x$ac_cv_sys_large_files" != "xno"; then + CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1" +fi + +]) + +dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in) +dnl which allows to search for libs that get installed into the KDE prefix. +dnl +dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not) +dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page +dnl also defines KSTUFF_PKG_ERRORS on error +AC_DEFUN([KDE_PKG_CHECK_MODULES], [ + + PKG_CONFIG_PATH="$prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH" + if test "$prefix" != "$kde_libs_prefix"; then + PKG_CONFIG_PATH="$kde_libs_prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH" + fi + export PKG_CONFIG_PATH + PKG_CHECK_MODULES([$1],[$2],[$3],[$4]) +]) + + +dnl Check for PIE support in the compiler and linker +AC_DEFUN([KDE_CHECK_PIE_SUPPORT], +[ + AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + safe_CXXFLAGS=$CXXFLAGS + safe_LDFLAGS=$LDFLAGS + CXXFLAGS="$CXXFLAGS -fPIE" + LDFLAGS="$LDFLAGS -pie" + + AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no]) + + CXXFLAGS=$safe_CXXFLAGS + LDFLAGS=$safe_LDFLAGS + AC_LANG_RESTORE + ]) + + AC_MSG_CHECKING(if enabling -pie/fPIE support) + + AC_ARG_ENABLE(pie, + AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]), + [kde_has_pie_support=$enableval], + [kde_has_pie_support=detect]) + + if test "$kde_has_pie_support" = "detect"; then + kde_has_pie_support=$kde_cv_val_pie_support + fi + + AC_MSG_RESULT([$kde_has_pie_support]) + + KDE_USE_FPIE="" + KDE_USE_PIE="" + + AC_SUBST([KDE_USE_FPIE]) + AC_SUBST([KDE_USE_PIE]) + + if test "$kde_has_pie_support" = "yes"; then + KDE_USE_FPIE="-fPIE" + KDE_USE_PIE="-pie" + fi +]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])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 --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)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 +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +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 + +# 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' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_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" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +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 "$LTCC" && LTCC=$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 "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# 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 + +# 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_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--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 + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _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], +[_LT_AC_SHELL_INIT([ +# 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 </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. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + 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="$lt_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) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--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 +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LINUX_64_MODE="32" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + LINUX_64_MODE="64" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; 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 + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; 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 + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _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], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#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], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +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 + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + 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" + 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_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # 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 . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && 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_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = 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 +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = 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 +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[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 +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +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" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + 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.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + 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}${shared_ext}$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}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$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" + # 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 + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $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 + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +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}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + 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}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$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. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # 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 ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + 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}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64 -a ! -h /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # 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}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + 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 + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + 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}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$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}${shared_ext}$versuffix ${libname}${shared_ext}$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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=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 + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +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*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + # the debian people say, arm and glibc 2.3.1 works for them with pass_all + arm* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + 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]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + 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 + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +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 + ;; + +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 + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# 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 +# DIRECTORY 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_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# 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 +# DIRECTORY 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, lt_dlinit, + [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" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +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 + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=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]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + 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 + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + 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. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=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 + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + 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. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | 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, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# 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 + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# 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=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# 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 + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# 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_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# 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_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# 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_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +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_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# 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_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# 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_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_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=$_LT_AC_TAGVAR(hardcode_action, $1) + +# 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_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# 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=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# 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="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# 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_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# 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 + + # 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" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +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 +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# 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 from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# 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_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_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 + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_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]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_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. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# 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 < $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 grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + 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 +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$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 + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp 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'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_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 + + _LT_AC_TAGVAR(ld_shlibs, $1)=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/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&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 + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$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)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II 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't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&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 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=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 + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + 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. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=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 + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + 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. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$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)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + 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. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $compiler_flags $libobjs `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=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*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $libobjs $deplibs~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$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' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $libobjs $deplibs' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$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 $compiler_flags $libobjs $deplibs$output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$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 + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${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' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$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' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$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 + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=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. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -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 + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +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 + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) 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]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #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 +# 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 */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# 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]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..c033748 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,903 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# Figure out how to run the assembler. -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_PROG_AS +# ---------- +AC_DEFUN([AM_PROG_AS], +[# By default we simply use the C compiler to build assembly code. +AC_REQUIRE([AC_PROG_CC]) +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS +AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) +AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..9602074 --- /dev/null +++ b/config.h.in @@ -0,0 +1,362 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* defined if K3b should check cdrecord for suid root */ +#undef CDRECORD_SUID_ROOT_CHECK + +/* Define to 1 if your flac library's version is newer than or equal to 1.1.2 + */ +#undef FLAC_NEWER_THAN_1_1_1 + +/* HAL API version 0.4 */ +#undef HAL_0_4 + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARTSC_ARTSC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CARBON_CARBON_H + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DVDREAD_DVD_READER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLAC___DECODER_H + +/* compile in HAL support */ +#undef HAVE_HAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_ICONV_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* defined if K3bSetup is compiled */ +#undef HAVE_K3BSETUP + +/* defined if you have the lame header and lib */ +#undef HAVE_LAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_LAME_LAME_H + +/* Defined if you have libdvdread headers and libs installed. */ +#undef HAVE_LIBDVDREAD + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* defined if you have libmad headers and libraries */ +#undef HAVE_LIBMAD + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* defined if you have libsamplerate library and header */ +#undef HAVE_LIBSAMPLERATE + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define if lrint is not supported */ +#undef HAVE_LRINT + +/* Define if lrintf is not supported */ +#undef HAVE_LRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MPCDEC_MPCDEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MUSEPACK_MUSEPACK_H + +/* have MusicBrainz */ +#undef HAVE_MUSICBRAINZ + +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Define to 1 if the assembler supports AltiVec instructions. */ +#undef HAVE_PPC_ALTIVEC + +/* defined if you have resmgr libraries and headers */ +#undef HAVE_RESMGR + +/* Define to 1 if you have the header file. */ +#undef HAVE_RESMGR_H + +/* Define if you have res_init */ +#undef HAVE_RES_INIT + +/* Define if you have the res_init prototype */ +#undef HAVE_RES_INIT_PROTO + +/* Define to 1 if you have the header file. */ +#undef HAVE_SAMPLERATE_H + +/* Define if you have a STL implementation by SGI */ +#undef HAVE_SGI_STL + +/* Set to 1 if you have libsndfile. */ +#undef HAVE_SNDFILE + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `stat64' function. */ +#undef HAVE_STAT64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VFS_H + +/* have TagLib */ +#undef HAVE_TAGLIB + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if the assembler supports 3DNOW instructions. */ +#undef HAVE_X86_3DNOW + +/* Define to 1 if the assembler supports MMX instructions. */ +#undef HAVE_X86_MMX + +/* Define to 1 if the assembler supports SSE instructions. */ +#undef HAVE_X86_SSE + +/* Define to 1 if the assembler supports SSE2 instructions. */ +#undef HAVE_X86_SSE2 + +/* K3b additional debugging support */ +#undef K3B_DEBUG + +/* Defined if all ffmpeg codecs should be allowed */ +#undef K3B_FFMPEG_ALL_CODECS + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* The header to include for MPC decoding. */ +#undef MPC_HEADER_FILE + +/* Define if you have ogg/vorbis installed */ +#undef OGG_VORBIS + +/* 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 `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Defined if compiling without arts */ +#undef WITHOUT_ARTS + +/* defined if arts support is compiled in */ +#undef WITH_ARTS + +/* 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 + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include +#endif + + + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif + + + +#if !defined(HAVE_RES_INIT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +int res_init(void); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + +/* define to 1 if -fvisibility is supported */ +#undef __KDE_HAVE_GCC_VISIBILITY + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* type to use in place of socklen_t if not defined */ +#undef kde_socklen_t + +/* type to use in place of socklen_t if not defined (deprecated, use + kde_socklen_t) */ +#undef ksize_t + +/* backwards compatibility stuff */ +#undef mpc_bool_t diff --git a/configure.files b/configure.files new file mode 100644 index 0000000..1225922 --- /dev/null +++ b/configure.files @@ -0,0 +1,26 @@ +./admin/configure.in.min +configure.in.in +./libk3b/configure.in.in +./libk3b/plugin/libsamplerate/configure.in.in +./libk3b/videodvd/configure.in.bot +./libk3b/videodvd/configure.in.in +./libk3bdevice/configure.in.bot +./libk3bdevice/configure.in.in +./plugins/audiooutput/alsa/configure.in.bot +./plugins/audiooutput/alsa/configure.in.in +./plugins/decoder/ffmpeg/configure.in.bot +./plugins/decoder/ffmpeg/configure.in.in +./plugins/decoder/flac/configure.in.bot +./plugins/decoder/flac/configure.in.in +./plugins/decoder/libsndfile/configure.in.bot +./plugins/decoder/libsndfile/configure.in.in +./plugins/decoder/mp3/configure.in.bot +./plugins/decoder/mp3/configure.in.in +./plugins/decoder/musepack/configure.in.bot +./plugins/decoder/musepack/configure.in.in +./plugins/decoder/ogg/configure.in.bot +./plugins/decoder/ogg/configure.in.in +./plugins/encoder/lame/configure.in.bot +./plugins/encoder/lame/configure.in.in +./src/fastscale/configure.in.in +configure.in.bot diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..4bcf6eb --- /dev/null +++ b/configure.in @@ -0,0 +1,1244 @@ +dnl ======================================================= +dnl FILE: ./admin/configure.in.min +dnl ======================================================= + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +dnl Boston, MA 02110-1301, USA. + +# Original Author was Kalle@kde.org +# I lifted it in some mater. (Stephan Kulow) +# I used much code from Janos Farkas + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(acinclude.m4) dnl a source file from your sub dir + +dnl This is so we can use kde-common +AC_CONFIG_AUX_DIR(admin) + +dnl This ksh/zsh feature conflicts with `cd blah ; pwd` +unset CDPATH + +dnl Checking host/target/build systems, for make, install etc. +AC_CANONICAL_SYSTEM +dnl Perform program name transformation +AC_ARG_PROGRAM + +dnl Automake doc recommends to do this only here. (Janos) +AM_INIT_AUTOMAKE(k3b-1.0.5, "3.5.9") dnl searches for some needed programs + +KDE_SET_PREFIX + +dnl generate the config header +AM_CONFIG_HEADER(config.h) dnl at the distribution this done + +dnl Checks for programs. +AC_CHECK_COMPILERS +AC_ENABLE_SHARED(yes) +AC_ENABLE_STATIC(no) +KDE_PROG_LIBTOOL + +dnl for NLS support. Call them in this order! +dnl WITH_NLS is for the po files +AM_KDE_WITH_NLS + +KDE_USE_QT(3.2) +AC_PATH_KDE +dnl ======================================================= +dnl FILE: configure.in.in +dnl ======================================================= + +#MIN_CONFIG(3.2) +#AM_KDE_MIN_VERSION(3.4) + +AC_CHECK_HEADERS(byteswap.h) + +dnl - check the byte order - +dnl this will define WORDS_BIGENDIAN or do nothing +AC_C_BIGENDIAN() + +AC_ARG_WITH( + external-libsamplerate, + [ --with-external-libsamplerate use the libsamplerate provided by the system (default=yes)], + [external_sampletrate=$withval], + [external_sampletrate=yes] +) + +LIBSAMPLERATE="" + +if test x$external_sampletrate != xno; then + +dnl === check for libsamplerate ========== +KDE_CHECK_HEADERS(samplerate.h, [ + KDE_CHECK_LIB(samplerate, src_new, [ + LIBSAMPLERATE="-lsamplerate" + AC_DEFINE(HAVE_LIBSAMPLERATE,1,[defined if you have libsamplerate library and header]) + ]) +]) + +fi + +AC_SUBST(LIBSAMPLERATE) +AM_CONDITIONAL(compile_libsamplerate, [test -z "$LIBSAMPLERATE"]) + + +ARTS_LIBS="" +if test "x$build_arts" = "xyes"; then + dnl Find aRts + KDE_CHECK_HEADERS(artsc/artsc.h, + [arts_available=yes + ARTS_LIBS="-lartsc"], + [arts_available=no] + ) +fi +AC_SUBST(ARTS_LIBS) +AM_CONDITIONAL(include_arts, [test -n "$ARTS_LIBS"]) +if test "x$build_arts" = "xyes" -a "x$arts_available" = "xyes"; then + AC_DEFINE(WITH_ARTS,1,[defined if arts support is compiled in]) +fi + +KDE_CHECK_THREADING + +compile_k3bsetup=yes +AC_ARG_WITH( + k3bsetup, + [ --with-k3bsetup[=ARG] do compile K3bSetup2 KControl Module (default=yes)], + [compile_k3bsetup=$withval] +) + +if test x$compile_k3bsetup = xyes; then + AC_DEFINE(HAVE_K3BSETUP,1,[defined if K3bSetup is compiled]) +fi + +AM_CONDITIONAL(with_k3bsetup1, [test x$compile_k3bsetup = xyes]) + + +cdrecord_suid_root=yes +AC_ARG_WITH( + cdrecord-suid-root, + AS_HELP_STRING( + [--without-cdrecord-suid-root], + [enable or disable K3b's suid root check for cdrecord/cdrdao/wodim (default=enabled)]), + [cdrecord_suid_root=$withval], + [cdrecord_suid_root=yes] +) +if test x$cdrecord_suid_root = xyes; then + AC_DEFINE(CDRECORD_SUID_ROOT_CHECK,1,[defined if K3b should check cdrecord for suid root]) +fi + + +# Extra SCSI support libs can go in CAM_LIB, and are linked into +# libk3bdevice. For Linux, nothing is needed. FreeBSD requires -lcam +# (which is in base, so no test is needed). +case "$host_os" in +freebsd* | dragonfly*) + CAM_LIB="-lcam" + ;; +*) + CAM_LIB="" + ;; +esac +AC_SUBST(CAM_LIB) + + + +dnl ---------- TAGLIB CHECK ---------- + +AC_DEFUN([AC_HAVE_TAGLIB], +[ + AC_DEFINE(HAVE_TAGLIB, 1, [have TagLib]) + taglib_includes=[`$TAGLIB_CONFIG --cflags`] + taglib_libs=[`$TAGLIB_CONFIG --libs`] + have_taglib=true +]) + +AC_DEFUN([AC_NO_TAGLIB], +[ + taglib_includes="" + taglib_libs="" + have_taglib=false +]) + +AC_PATH_PROG(TAGLIB_CONFIG, taglib-config, [no], [$PATH:$prefix/bin]) +if test "x$TAGLIB_CONFIG" = "xno" ; then + AC_NO_TAGLIB +else + AC_HAVE_TAGLIB +fi + +AC_SUBST(taglib_includes) +AC_SUBST(taglib_libs) + +dnl ---------- END TAGLIB CHECK ---------- + + + +dnl ----------- TUNEPIMP/MUSICBRAINZ CHECK ----------- + +AC_ARG_WITH( + musicbrainz, + AS_HELP_STRING( + [--without-musicbrainz], + [build K3b without Musicbrainz support (default=no)]), + [ac_cv_use_musicbrainz=$withval], + [ac_cv_use_musicbrainz=yes] +) + +have_mb=false +MUSICBRAINZ_LIBS="" +if test "$ac_cv_use_musicbrainz" = "yes"; then + KDE_CHECK_HEADER(musicbrainz/mb_c.h, + [ + KDE_CHECK_LIB(musicbrainz,mb_New,[ + AC_DEFINE(HAVE_MUSICBRAINZ, 1, [have MusicBrainz]) + MUSICBRAINZ_LIBS="-lmusicbrainz" + have_mb=true + ]) + ], []) +fi +AC_SUBST(MUSICBRAINZ_LIBS) + +dnl --------- TUNEPIMP/MUSICBRAINZ CHECK END ----------- + + +dnl --------- K3b debugging stuff (only for developers) ---- + +AC_ARG_WITH( + k3b-debug, + AS_HELP_STRING( + [--with-k3b-debug], + [Enable additional K3b debugging output and functionality (default=no)]), + [use_k3b_debug=$withval], + [use_k3b_debug=no] +) +if test "$use_k3b_debug" = "yes"; then + AC_DEFINE(K3B_DEBUG, "1", [K3b additional debugging support]) +fi + +dnl -------------------------------------------------------- + + + + +dnl --------------- libiconv check ------------------------- + +AC_CHECK_HEADERS(iconv.h) + +dnl -------------------------------------------------------- + + +#AC_DEFINE(LIBK3B_VERSION, "0.11.98", [k3b library version]) +#AC_SUBST(LIBK3B_VERSION, 0.11.98) +#AC_CONFIG_FILES([k3b/libk3b/libk3b.pc]) + +KDE_ENABLE_HIDDEN_VISIBILITY +dnl ======================================================= +dnl FILE: ./libk3b/configure.in.in +dnl ======================================================= + +AC_CHECK_FUNCS(stat64) +AC_CHECK_HEADERS(sys/vfs.h) +AC_CHECK_HEADERS(sys/statvfs.h) +dnl ======================================================= +dnl FILE: ./libk3b/plugin/libsamplerate/configure.in.in +dnl ======================================================= + +LIBS="-lm $all_libraries" + +AC_CHECK_DECL(lrint, + AC_DEFINE(HAVE_LRINT,1,[Define if lrint is supported]), + AC_DEFINE(HAVE_LRINT,0,[Define if lrint is not supported]), + [#include ] +) + +AC_CHECK_DECL(lrintf, + AC_DEFINE(HAVE_LRINTF,1,[Define if lrintf is supported]), + AC_DEFINE(HAVE_LRINTF,0,[Define if lrintf is not supported]), + [#include ] +) +dnl ======================================================= +dnl FILE: ./libk3b/videodvd/configure.in.in +dnl ======================================================= + +AC_ARG_WITH( + libdvdread, + AS_HELP_STRING( + [--without-libdvdread], + [build K3b without libdvdread (Video DVD ripping) support (default=no)]), + [ac_cv_use_libdvdread=$withval], + [ac_cv_use_libdvdread=yes] +) + +have_libdvdread=no +if test "$ac_cv_use_libdvdread" = "yes"; then + KDE_CHECK_HEADERS(dvdread/dvd_reader.h, + [ + AC_CHECK_LIB(dvdread, + DVDOpen, + [ + AC_DEFINE(HAVE_LIBDVDREAD,1,[Defined if you have libdvdread headers and libs installed.]) + have_libdvdread=yes + ] + ) + ]) +fi +AM_CONDITIONAL(include_videodvdrip, [test x$have_libdvdread = xyes]) + +#if test "$have_libdvdread" = "no"; then +# AC_MSG_ERROR([Could not find libdvdread. Please install.]) +# DO_NOT_COMPILE="$DO_NOT_COMPILE k3b" +#fi +dnl ======================================================= +dnl FILE: ./libk3bdevice/configure.in.in +dnl ======================================================= + +dnl FIXME: only make the linux header check on linux systems. + +linux_scsi=no +AC_MSG_CHECKING(for linux scsi headers) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ + #include + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,50) + typedef unsigned char u8; + #endif + #include + #include /* cope with silly includes */ + ], + [], + [linux_scsi=yes]) +AC_MSG_RESULT($linux_scsi) + +case "$host_os" in +freebsd*|dragonfly*) + # I'll be damned if lousy coding prevents us from running + # this application. + linux_scsi=yes + ;; +esac + +if test "x$linux_scsi" = "xno" ; then + DO_NOT_COMPILE="$DO_NOT_COMPILE k3b" +fi +AC_LANG_RESTORE + +dnl - find the cam_* functions +AC_CHECK_FUNC(cam_close_device, + [CAM_LIB=""], + [AC_CHECK_LIB(cam, cam_close_device, [CAM_LIB=-lcam], [CAM_LIB=""])] + ) +AC_SUBST(CAM_LIB) + + + +dnl === check for resmgr - begin ============ +AC_ARG_WITH( + resmgr, + AS_HELP_STRING([--without-resmgr], [build K3b without ResMgr support (default=no)]), + [ac_cv_use_resmgr=$withval], + [ac_cv_use_resmgr=yes] +) + +if test "$ac_cv_use_resmgr" = "yes"; then + RESMGR_LIB="" + KDE_CHECK_HEADERS(resmgr.h, [ + KDE_CHECK_LIB(resmgr,rsm_open_device,[ + RESMGR_LIB="-lresmgr" + AC_DEFINE(HAVE_RESMGR,1,[defined if you have resmgr libraries and headers]) + ]) + ]) + AC_SUBST(RESMGR_LIB) +fi +dnl === check for resmgr - end ============ + + + + + +# HAL check from kdebase/kioslave/media + +AC_ARG_WITH( + hal, + AS_HELP_STRING( + [--without-hal], + [build K3b without HAL support (default=no)]), + [ac_cv_use_hal=$withval], + [ac_cv_use_hal=yes] +) + +if test "x$ac_cv_use_hal" = "xyes" ; then + +########### Check for the HAL + + AC_MSG_CHECKING(for the HAL) + + hal_inc=NOTFOUND + hal_lib=NOTFOUND + hal=NOTFOUND + + search_incs="$kde_includes /usr/include /usr/include/hal /usr/local/include /usr/local/include/hal" + AC_FIND_FILE(libhal.h libhal-storage.h, $search_incs, hal_incdir) + + if [test -r $hal_incdir/libhal.h] ; then + HAL_INCS="-I$hal_incdir" + hal_inc=FOUND + fi + + if test -r $hal_incdir/libhal-storage.h ; then + hal_storage_version=4 + grep LibHalVolume $hal_incdir/libhal-storage.h \ + > /dev/null 2>&1 && hal_storage_version=5 + if test $hal_storage_version = 4 ; then + AC_DEFINE(HAL_0_4, , [HAL API version 0.4]) + fi + fi + + search_libs="$kde_libraries /usr/lib64 /usr/lib /usr/local/lib /lib /lib64" + AC_FIND_FILE(libhal.so, $search_libs, hal_libdir) + + if [test -r $hal_libdir/libhal.so] ; then + HAL_LIBS="-L$hal_libdir -lhal" + hal_lib=FOUND + fi + + + if [test $hal_inc = FOUND] && [test $hal_lib = FOUND] ; then + AC_MSG_RESULT(headers $hal_incdir libraries $hal_libdir) + hal=FOUND + else + AC_MSG_RESULT(searched but not found) + fi + + AC_SUBST(HAL_INCS) + AC_SUBST(HAL_LIBS) + + +########### Check for DBus + + AC_MSG_CHECKING(for DBus) + + dbus_inc=NOTFOUND + dbus_lib=NOTFOUND + dbus=NOTFOUND + + search_incs="$kde_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0" + AC_FIND_FILE(dbus/dbus.h, $search_incs, dbus_incdir) + + search_incs_arch_deps="$kde_includes /usr/lib64/dbus-1.0/include /usr/lib/dbus-1.0/include /usr/local/lib/dbus-1.0/include" + AC_FIND_FILE(dbus/dbus-arch-deps.h, $search_incs_arch_deps, dbus_incdir_arch_deps) + + if [test -r $dbus_incdir/dbus/dbus.h] && [test -r $dbus_incdir_arch_deps/dbus/dbus-arch-deps.h] ; then + DBUS_INCS="-I$dbus_incdir -I$dbus_incdir_arch_deps" + dbus_inc=FOUND + fi + + search_libs="$kde_libraries /usr/lib64 /usr/lib /usr/local/lib /lib /lib64" + AC_FIND_FILE(libdbus-1.so, $search_libs, dbus_libdir) + + if test -r $dbus_libdir/libdbus-1.so ; then + DBUS_LIBS="-L$dbus_libdir -ldbus-1" + dbus_lib=FOUND + fi + + if [test $dbus_inc = FOUND] && [test $dbus_lib = FOUND] ; then + AC_MSG_RESULT(headers $dbus_incdir $dbus_incdir_arch_deps libraries $dbus_libdir) + dbus=FOUND + else + AC_MSG_RESULT(searched but not found) + fi + + AC_SUBST(DBUS_INCS) + AC_SUBST(DBUS_LIBS) + +########### Check for DBus-Qt bindings + + AC_MSG_CHECKING(for DBus-Qt bindings) + + dbusqt_inc=NOTFOUND + dbusqt_lib=NOTFOUND + dbusqt=NOTFOUND + + search_incs="$kde_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0" + AC_FIND_FILE(dbus/connection.h, $search_incs, dbusqt_incdir) + + if test -r $dbusqt_incdir/dbus/connection.h ; then + have_qt_patch=0 + grep dbus_connection_setup_with_qt_main $dbusqt_incdir/dbus/connection.h \ + > /dev/null 2>&1 && have_qt_patch=1 + if test $have_qt_patch = 1 ; then + DBUSQT_INCS="-I$dbusqt_incdir" + dbusqt_inc=FOUND + fi + fi + + search_libs="$kde_libraries /usr/lib /usr/lib64 /usr/local/lib" + AC_FIND_FILE(libdbus-qt-1.so, $search_libs, dbusqt_libdir) + + if test -r $dbusqt_libdir/libdbus-qt-1.so ; then + DBUSQT_LIBS="-L$dbusqt_libdir -ldbus-qt-1" + dbusqt_lib=FOUND + fi + + if [test $dbusqt_inc = FOUND] && [test $dbusqt_lib = FOUND] ; then + AC_MSG_RESULT(headers $dbusqt_incdir libraries $dbusqt_libdir) + dbusqt=FOUND + else + AC_MSG_RESULT(searched but not found) + fi + + AC_SUBST(DBUSQT_INCS) + AC_SUBST(DBUSQT_LIBS) +fi + +########### Check if media HAL backend sould be compiled + +have_hal=no +HAL_DBUS_LIBS="" +if [test "x$hal" = "xFOUND"] && [test "x$dbus" = "xFOUND"] && [test "x$dbusqt" = "xFOUND"] && [ test $hal_storage_version = 5 ] ; then + AC_DEFINE(HAVE_HAL, , [compile in HAL support]) + have_hal=yes + HAL_DBUS_LIBS="$HAL_LIBS $DBUS_LIBS $DBUSQT_LIBS" +fi + +AM_CONDITIONAL(include_HAL, [test x$have_hal = xyes]) +AC_SUBST(HAL_DBUS_LIBS) + +dnl ======================================================= +dnl FILE: ./plugins/audiooutput/alsa/configure.in.in +dnl ======================================================= + +dnl --------- ALSA CHECK BEGIN ------------- + +AC_DEFUN([KDE_CHECK_ALSA], +[ + PKG_CHECK_MODULES([ALSA], [alsa >= 0.9], [have_alsa=yes], [have_alsa=no]) + AC_SUBST([ALSA_CFLAGS]) + AC_SUBST([ALSA_LIBS]) +]) + +AC_ARG_WITH(alsa, + [AS_HELP_STRING(--with-alsa, + [enable support for ALSA output @<:@default=check@:>@])], + [], with_alsa=check) + +have_alsa=no +if test "x$with_alsa" != xno; then + KDE_CHECK_ALSA + + if test "x$with_alsa" != xcheck && test "x$have_alsa" != xyes; then + AC_MSG_FAILURE([--with-alsa was given, but test for ALSA failed]) + fi +fi + +AM_CONDITIONAL(include_ALSA, [test "x$have_alsa" = "xyes"]) + +dnl --------- ALSA CHECK END --------------- +dnl ======================================================= +dnl FILE: ./plugins/decoder/ffmpeg/configure.in.in +dnl ======================================================= + +dnl --------------- FFMPEG CHECK --------------------------------- + +AC_ARG_WITH( + ffmpeg, + AS_HELP_STRING( + [--without-ffmpeg], + [build K3b without ffmpeg audio decoder support (default=no)]), + [ac_cv_use_ffmpeg=$withval], + [ac_cv_use_ffmpeg=yes] +) + +# +# The ffmpeg decoder plugin needs ffmpeg 0.4.9 or higher +# +have_ffmpeg=no +if test "$ac_cv_use_ffmpeg" = "yes"; then + k3b_cxxflags_save="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS" + AC_MSG_CHECKING(for ffmpeg >= 0.4.9) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_COMPILE_IFELSE( + extern "C" { + #include + #include + } + + int main() { + AVFormatContext* fc = 0; + AVPacket* p = 0; + av_register_all(); + return av_read_frame( fc, p ); + }, + [ffmpeg_compiles=yes], [ffmpeg_compiles=no] ) + OLD_LIBS=$LIBS + LIBS="-lavformat -lavcodec $LIBS" + AC_LINK_IFELSE( + extern "C" { + #include + #include + } + + int main() { + AVFormatContext* fc = 0; + AVPacket* p = 0; + av_register_all(); + return av_read_frame( fc, p ); + }, + [ffmpeg_links=yes], [ffmpeg_links=no] ) + AC_LANG_RESTORE + LIBS=$OLD_LIBS + have_ffmpeg=$ffmpeg_links + AC_MSG_RESULT($have_ffmpeg) + CXXFLAGS=$k3b_cxxflags_save +fi +AM_CONDITIONAL(include_FFMPEG, [test x$have_ffmpeg = xyes]) + +dnl --------------- FFMPEG CHECK END ------------------------------ + +AC_ARG_ENABLE( + ffmpeg-all-codecs, + AS_HELP_STRING( + [--enable-ffmpeg-all-codecs], + [Build K3b's ffmeg decoder plugin with all audio codecs enabled (default=disabled)]), + [AC_DEFINE(K3B_FFMPEG_ALL_CODECS, 1, [Defined if all ffmpeg codecs should be allowed]) + enable_ffmpeg_all_codecs=yes], + [enable_ffmpeg_all_codecs=no] +) +dnl ======================================================= +dnl FILE: ./plugins/decoder/flac/configure.in.in +dnl ======================================================= + +dnl === test for FLAC++ and FLAC - begin ==== +AC_ARG_WITH( + flac, + AS_HELP_STRING([--without-flac], [build K3b without FLAC support (default=no)]), + [ac_cv_use_flac=$withval], + [ac_cv_use_flac=yes] +) + +have_flac=no +if test "$ac_cv_use_flac" = "yes"; then + KDE_CHECK_HEADERS(FLAC++/decoder.h, [ + AC_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single, + have_flac=yes,[],$all_libraries)]) + + AC_MSG_CHECKING(for libFLAC newer than 1.1.1) + AC_CACHE_VAL(k3b_flac_new, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE( + [ + #include + ], [ + FLAC::Metadata::VorbisComment* vc; + vc->get_vendor_string().get_field(); + ], k3b_flac_new=no, k3b_flac_new=yes ) + AC_LANG_RESTORE + ]) + AC_MSG_RESULT($k3b_flac_new) + if test $k3b_flac_new = yes; then + AC_DEFINE(FLAC_NEWER_THAN_1_1_1, + 1, + [Define to 1 if your flac library's version is newer than or equal to 1.1.2] + ) + fi +else + have_flac=no +fi + +AM_CONDITIONAL(include_FLAC, [test x$have_flac = xyes]) +dnl === test for FLAC++ and FLAC - end ==== +dnl ======================================================= +dnl FILE: ./plugins/decoder/libsndfile/configure.in.in +dnl ======================================================= + +dnl === test for libsndfile - begin === +dnl +dnl Don't use PKG_CHECK, since if there is no pkg-config installed, +dnl then there is no auto* magic for it either. +dnl +dnl Tests copied from kdebase/kioslave/thumbnail/ +dnl +if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +fi + +AC_ARG_WITH( + sndfile, + AS_HELP_STRING([--without-sndfile], + [build K3b without libsndfile support (default=no)]), + [ac_cv_use_sndfile=$withval], + [ac_cv_use_sndfile=yes] +) + +if test "$ac_cv_use_sndfile" = "yes"; then + SNDFILE_CFLAGS="" + SNDFILE_LIBS="" + if test "$PKG_CONFIG" = "no" ; then + ac_cv_sndfile=0 + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + if !(`$PKG_CONFIG --exists sndfile`) ; then + echo "*** sndfile is not installed." + ac_cv_sndfile=0 + else + if !(`$PKG_CONFIG --atleast-version="1.0.2" sndfile`) ; then + echo "*** You need at least version 1.0.2 of sndfile." + ac_cv_sndfile=0 + else + ac_cv_sndfile=1 + SNDFILE_CFLAGS=`$PKG_CONFIG --cflags sndfile` + SNDFILE_LIBS=`$PKG_CONFIG --libs sndfile` + fi + fi + fi + + AC_DEFINE_UNQUOTED([HAVE_SNDFILE],${ac_cv_sndfile}, + [Set to 1 if you have libsndfile.]) + AC_SUBST(SNDFILE_CFLAGS) + AC_SUBST(SNDFILE_LIBS) +fi + +AM_CONDITIONAL(include_AIFF, [test x$ac_cv_sndfile = x1]) +dnl === test for libsndfile - end === +dnl ======================================================= +dnl FILE: ./plugins/decoder/mp3/configure.in.in +dnl ======================================================= + +dnl === libmad MPEG decoder check - begin === +AC_ARG_WITH( + libmad, + AS_HELP_STRING([--without-libmad], [build K3b without libmad support (default=no)]), + [ac_cv_use_libmad=$withval], + [ac_cv_use_libmad=yes] +) + +if test "$ac_cv_use_libmad" = "yes"; then + MAD_LIB="" + KDE_CHECK_HEADER(mad.h, [ + AC_CHECK_LIB(mad, mad_synth_frame, [ + MAD_LIB="-lmad" + AC_DEFINE(HAVE_LIBMAD,1,[defined if you have libmad headers and libraries])], + [], + $all_libraries + ) + ]) + AC_SUBST(MAD_LIB) + +fi + +AM_CONDITIONAL(include_MP3, [test -n "$MAD_LIB"]) +dnl === libmad MPeg decoder check - end === +dnl ======================================================= +dnl FILE: ./plugins/decoder/musepack/configure.in.in +dnl ======================================================= + +dnl --------- MUSEPACK CHECK --------------- + +AC_ARG_WITH( + musepack, + AS_HELP_STRING( + [--without-musepack], + [build K3b without Musepack audio support (default=no)]), + [ac_cv_use_mpc=$withval], + [ac_cv_use_mpc=yes] +) + +have_mpc=no +if test "$ac_cv_use_mpc" = "yes"; then + + dnl - search for both the new and the old naming - + + KDE_CHECK_HEADERS(mpcdec/mpcdec.h, [ + AC_CHECK_LIB(mpcdec, mpc_decoder_setup, [ + have_mpc=yes + MPC_LIBS="-lmpcdec" + AC_DEFINE( + MPC_HEADER_FILE, + , + [The header to include for MPC decoding.]) + ], + [], [], []) + ]) + + if test "$have_mpc" = "no"; then + KDE_CHECK_HEADERS(musepack/musepack.h, [ + AC_CHECK_LIB(musepack, mpc_decoder_setup, [ + have_mpc=yes + MPC_LIBS="-lmusepack" + AC_DEFINE( + MPC_HEADER_FILE, + , + [The header to include for MPC decoding.] + ) + AC_DEFINE( + mpc_bool_t, + BOOL, + [backwards compatibility stuff] + ) + ], [], []) + ]) + fi +fi +AC_SUBST(MPC_LIBS) + +AM_CONDITIONAL(include_MPC, [test x$have_mpc = xyes]) + +dnl --------- MUSEPACK CHECK END ----------- +dnl ======================================================= +dnl FILE: ./plugins/decoder/ogg/configure.in.in +dnl ======================================================= + +dnl === Ogg Vorbis Test - Begin === +AC_ARG_WITH( + oggvorbis, + AS_HELP_STRING([--without-oggvorbis], [build K3b without OggVorbis support (default=no)]), + [ac_cv_use_oggvorbis=$withval], + [ac_cv_use_oggvorbis=yes] +) + +if test "$ac_cv_use_oggvorbis" = "yes"; then + + AC_MSG_CHECKING(for ogg/vorbis headers) + ogg_vorbis=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + ogg_vorbis=yes + ]) + AC_MSG_RESULT($ogg_vorbis) + if test x$ogg_vorbis = xyes; then + dnl we need the ogg_vorbis_lib because otherwise we override LIBS ! + AC_CHECK_LIB(vorbisfile,ov_open,ogg_vorbis_lib=yes, + ogg_vorbis=no,[$all_libraries -lvorbisfile -lvorbis -logg]) + fi + if test x$ogg_vorbis = xyes; then + AC_DEFINE(OGG_VORBIS,1,[Define if you have ogg/vorbis installed]) + fi +fi + +AM_CONDITIONAL(include_OGG, [test x$ogg_vorbis = xyes]) +dnl === Ogg Vorbis Test - End === +dnl ======================================================= +dnl FILE: ./plugins/encoder/lame/configure.in.in +dnl ======================================================= + +dnl === test for LAME - begin ==== +AC_ARG_WITH( + lame, + AS_HELP_STRING([--without-lame], [build K3b without LAME support (default=no)]), + [ac_cv_use_lame=$withval], + [ac_cv_use_lame=yes] +) + +have_lame=no +if test "$ac_cv_use_lame" = "yes"; then + KDE_CHECK_HEADERS(lame/lame.h, [ + AC_CHECK_LIB(mp3lame, lame_init, [ + have_lame=yes + AC_DEFINE(HAVE_LAME,1,[defined if you have the lame header and lib]) + ], [], $all_libraries -lm) + ]) +fi + +AM_CONDITIONAL(include_LAME, [test x$have_lame = xyes]) +dnl === test for LAME - end ==== +dnl ======================================================= +dnl FILE: ./src/fastscale/configure.in.in +dnl ======================================================= + +# +# Imlib/Mosfet scaling +# +AM_PROG_AS + +# MMX test duped from kdelibs/kdefx - it should be probably moved to admin/ +dnl ----------------------------------------------------- +dnl IA32 checks +dnl ----------------------------------------------------- + +gv_asm_defs= +case $host_cpu in + i*86 ) + AC_MSG_CHECKING(for assembler support for IA32 extensions) + + dnl MMX check + AC_TRY_COMPILE(, [ __asm__("pxor %mm0, %mm0") ], + [ + echo $ECHO_N "MMX yes$ECHO_C" + AC_DEFINE_UNQUOTED(HAVE_X86_MMX, 1, [Define to 1 if the assembler supports MMX instructions.]) + gv_asm_defs="$gv_asm_defs -DHAVE_X86_MMX" + ], [ echo $ECHO_N "MMX no$ECHO_C" ]) + + dnl SSE check + AC_TRY_COMPILE(,[ __asm__("xorps %xmm0, %xmm0") ], + [ + echo $ECHO_N ", SSE yes$ECHO_C" + AC_DEFINE_UNQUOTED(HAVE_X86_SSE, 1, [Define to 1 if the assembler supports SSE instructions.]) + gv_asm_defs="$gv_asm_defs -DHAVE_X86_SSE" + ], [ echo $ECHO_N ", SSE no$ECHO_C" ]) + + dnl SSE2 check + AC_TRY_COMPILE(, [ __asm__("xorpd %xmm0, %xmm0") ], + [ + echo $ECHO_N ", SSE2 yes$ECHO_C" + AC_DEFINE_UNQUOTED(HAVE_X86_SSE2, 1, [Define to 1 if the assembler supports SSE2 instructions.]) + gv_asm_defs="$gv_asm_defs -DHAVE_X86_SSE2" + ], [ echo $ECHO_N ", SSE2 no$ECHO_C" ]) + + dnl 3DNOW check + AC_TRY_COMPILE(, [ __asm__("femms") ], + [ + echo $ECHO_N ", 3DNOW yes$ECHO_C" + AC_DEFINE_UNQUOTED(HAVE_X86_3DNOW, 1, [Define to 1 if the assembler supports 3DNOW instructions.]) + gv_asm_defs="$gv_asm_defs -DHAVE_X86_3DNOW" + ], [ echo $ECHO_N ", 3DNOW no$ECHO_C" ]) + echo + ;; + powerpc ) + AC_MSG_CHECKING(for assembler support for AltiVec instructions) + dnl AltiVec check + AC_TRY_COMPILE(, [ __asm__("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0" : : "r"(-1) ) ], + [ + echo $ECHO_N " yes$ECHO_C" + AC_DEFINE_UNQUOTED(HAVE_PPC_ALTIVEC, 1, [Define to 1 if the assembler supports AltiVec instructions.]) + gv_asm_defs="$gv_asm_defs -DHAVE_PPC_ALTIVEC" + ], [ echo $ECHO_N ", AltiVec no$ECHO_C" ]) + echo + ;; +esac + +GV_ASM_DEFS="$gv_asm_defs" +AC_SUBST(GV_ASM_DEFS) +KDE_CREATE_SUBDIRSLIST +AC_CONFIG_FILES([ Makefile ]) +AC_CONFIG_FILES([ doc/Makefile ]) +AC_CONFIG_FILES([ k3bsetup/Makefile ]) +AC_CONFIG_FILES([ kfile-plugins/Makefile ]) +AC_CONFIG_FILES([ kfile-plugins/k3bproject/Makefile ]) +AC_CONFIG_FILES([ kioslaves/Makefile ]) +AC_CONFIG_FILES([ kioslaves/videodvd/Makefile ]) +AC_CONFIG_FILES([ libk3b/Makefile ]) +AC_CONFIG_FILES([ libk3b/cddb/Makefile ]) +AC_CONFIG_FILES([ libk3b/core/Makefile ]) +AC_CONFIG_FILES([ libk3b/jobs/Makefile ]) +AC_CONFIG_FILES([ libk3b/plugin/Makefile ]) +AC_CONFIG_FILES([ libk3b/plugin/libsamplerate/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/audiocd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/datacd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/datadvd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/mixedcd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/movixcd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/movixdvd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/videocd/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/videocd/cdi/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/videocd/extra/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/videocd/mpeginfo/Makefile ]) +AC_CONFIG_FILES([ libk3b/projects/videodvd/Makefile ]) +AC_CONFIG_FILES([ libk3b/scripts/Makefile ]) +AC_CONFIG_FILES([ libk3b/tools/Makefile ]) +AC_CONFIG_FILES([ libk3b/tools/libisofs/Makefile ]) +AC_CONFIG_FILES([ libk3b/videodvd/Makefile ]) +AC_CONFIG_FILES([ libk3bdevice/Makefile ]) +AC_CONFIG_FILES([ plugins/Makefile ]) +AC_CONFIG_FILES([ plugins/audiooutput/Makefile ]) +AC_CONFIG_FILES([ plugins/audiooutput/alsa/Makefile ]) +AC_CONFIG_FILES([ plugins/audiooutput/arts/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/ffmpeg/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/flac/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/libsndfile/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/mp3/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/musepack/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/ogg/Makefile ]) +AC_CONFIG_FILES([ plugins/decoder/wave/Makefile ]) +AC_CONFIG_FILES([ plugins/encoder/Makefile ]) +AC_CONFIG_FILES([ plugins/encoder/external/Makefile ]) +AC_CONFIG_FILES([ plugins/encoder/lame/Makefile ]) +AC_CONFIG_FILES([ plugins/encoder/ogg/Makefile ]) +AC_CONFIG_FILES([ plugins/encoder/sox/Makefile ]) +AC_CONFIG_FILES([ plugins/project/Makefile ]) +AC_CONFIG_FILES([ plugins/project/audiometainforenamer/Makefile ]) +AC_CONFIG_FILES([ plugins/project/audioprojectcddb/Makefile ]) +AC_CONFIG_FILES([ src/Makefile ]) +AC_CONFIG_FILES([ src/fastscale/Makefile ]) +AC_CONFIG_FILES([ src/icons/Makefile ]) +AC_CONFIG_FILES([ src/icons/actions/Makefile ]) +AC_CONFIG_FILES([ src/konqi/Makefile ]) +AC_CONFIG_FILES([ src/mimetypes/Makefile ]) +AC_CONFIG_FILES([ src/misc/Makefile ]) +AC_CONFIG_FILES([ src/option/Makefile ]) +AC_CONFIG_FILES([ src/pics/Makefile ]) +AC_CONFIG_FILES([ src/pics/73lab/Makefile ]) +AC_CONFIG_FILES([ src/pics/RobsTheme/Makefile ]) +AC_CONFIG_FILES([ src/pics/crystal/Makefile ]) +AC_CONFIG_FILES([ src/pics/quant/Makefile ]) +AC_CONFIG_FILES([ src/projects/Makefile ]) +AC_CONFIG_FILES([ src/projects/kostore/Makefile ]) +AC_CONFIG_FILES([ src/rip/Makefile ]) +AC_CONFIG_FILES([ src/rip/videodvd/Makefile ]) +AC_CONFIG_FILES([ src/sounds/Makefile ]) +AC_OUTPUT +echo "" + +echo "K3b - Include libdvdread (Video DVD ripping) support:" +if test "$have_libdvdread" = "yes"; then + echo "K3b - yes" +else + echo "K3b - no" + if test "$ac_cv_use_libdvdread" = "yes"; then + echo "K3b - You are missing the libdvdread library." + fi +fi +echo "" + +if test -n "$RESMGR_LIB"; then + echo "K3b - Resmgr support: yes" +else + echo "K3b - Resmgr support: no" +fi + +echo "" + + +if test x$have_hal = xyes; then + echo "K3b - Compile HAL support yes" +else + echo "K3b - Compile HAL support no" +if test "x$ac_cv_use_hal" = "xyes" ; then + echo "K3b - You are missing the HAL >= 0.5 headers and libraries" + echo "K3b - or the DBus Qt bindings." +fi +fi +echo "" + +if test "x$have_alsa" = xyes; then + echo "K3b - Audioplayer available (alsa) yes" +else + echo "K3b - Audioplayer available (alsa) no" +fi +echo "" + +echo "K3b - FFMpeg decoder plugin (decodes wma and others):" +if test x$have_ffmpeg = xyes; then + echo "K3b - yes" + if test x$enable_ffmpeg_all_codecs = xyes; then + echo "K3b - WARNING: You enabled all codecs in the ffmpeg decoder plugin." + echo "K3b - Be aware that most are not tested and track lengths" + echo "K3b - will be wrong in many cases." + fi +else + echo "K3b - no" +if test "$ac_cv_use_ffmpeg" = "yes"; then + if test "$ffmpeg_compiles" = "yes"; then + echo "K3b - You are missing the ffmpeg libraries." + echo "K3b - Make sure ffmpeg has been configured as a" + echo "K3b - shared library (which is not the default)." + else + echo "K3b - You are missing the ffmpeg headers and libraries" + echo "K3b - version 0.4.9 or higher." + fi + echo "K3b - The ffmpeg audio decoding plugin (decodes wma and" + echo "K3b - others) won't be compiled." +fi +fi +echo "" + +if test x$have_flac = xyes; then + echo "K3b - FLAC support: yes" +else + echo "K3b - FLAC support: no" +if test "$ac_cv_use_flac" = "yes"; then + if test "$have_flac" = "no"; then + echo "K3b - You are missing the FLAC++ headers and libraries." + echo "K3b - The FLAC decoding plugin won't be compiled." + fi +fi +fi +echo "" + +if $av_cv_sndfile; then + echo "K3b - libsndfile audio decoding support: yes" +else + echo "K3b - libsndfile audio decoding support: no" +if test "$ac_cv_use_sndfile" = "yes"; then + echo "K3b - You are missing the libsndfile headers and libraries." + echo "K3b - The libsndfile audio decoding plugin won't be compiled." +fi +fi +echo "" + +if test -n "$MAD_LIB"; then + echo "K3b - Mp3 decoding support (libmad): yes" +else + echo "K3b - Mp3 decoding support (libmad): no" +if test "$ac_cv_use_libmad" = "yes"; then + echo "K3b - You are missing the libmad headers and libraries." + echo "K3b - The Mp3 decoding plugin won't be compiled." +fi +fi +echo "" + +if test x$have_mpc = xyes; then + echo "K3b - Musepack support: yes" +else + echo "K3b - Musepack support: no" +if test "$ac_cv_use_mpc" = "yes"; then + echo "K3b - You are missing the Musepack headers and libraries >= 1.1." + echo "K3b - The Musepack audio decoding plugin won't be compiled." +fi +fi + +echo "" + +if test x$ogg_vorbis = xyes; then + echo "K3b - Ogg Vorbis support: yes" +else + echo "K3b - Ogg Vorbis support: no" +if test "$ac_cv_use_oggvorbis" = "yes"; then + echo "K3b - You are missing the Ogg-Vorbis headers and libraries." + echo "K3b - The Ogg Vorbis decoding and encoding plugins won't be compiled." +fi +fi +echo "" + +if test x$have_lame = xyes; then + echo "K3b - Lame Mp3 encoder plugin: yes" +else + echo "K3b - Lame Mp3 encoder plugin no" +if test "$ac_cv_use_lame" = "yes"; then + echo "K3b - You are missing the Lame headers and libraries." + echo "K3b - The Lame Mp3 encoding plugin won't be compiled." +fi +fi +echo "" + +if test "$use_k3b_debug" = "yes"; then + echo "" + echo "K3b - K3B DEBUGGING ENABLED! THIS ENABLES ADDITIONAL DEBUGGING OUTPUT" + echo "K3b - AND FUNCTIONALITY WHICH IS ONLY INTENDED FOR K3B DEVELOPERS!" + echo "K3b - THIS MAY EVEN SLOW DOWN K3B IN SOME PLACES!" + echo "" +fi + +if test "$cdrecord_suid_root" != "yes"; then + echo "" + echo "K3b - Suid root test for cdrecord, cdrdao, and wodim deactivated" + echo "K3b - This is NOT recommended although it might work out fine ;)" + echo "" +fi + +if $have_taglib; then + echo "K3b - Audio meta data reading with Taglib: yes" +else + echo "K3b - Audio meta data reading with Taglib: no" + echo "K3b - You are missing the Taglib headers and libraries." + echo "K3b - The mp3 and flac decoder plugins will fall back to" + echo "K3b - using KMetaFileInfo." +fi + +echo "" + +echo "K3b - Audio resampling:" +if test -n "$LIBSAMPLERATE"; then + echo "K3b - using installed version" +else + echo "K3b - using version bundled with K3b" +fi + +echo "" + +if test x$arts_available = xyes; then + echo "K3b - Audioplayer available (aRts) yes" +else + echo "K3b - Audioplayer available (aRts) no" +fi + +echo "" + +if test x$compile_k3bsetup = xyes; then + echo "K3b - Compile K3bSetup 2: yes" +else + echo "K3b - Compile K3bSetup 2: no" +fi + +echo "" + +if $have_mb; then + echo "K3b - Tag guessing using MusicBrainz yes" +else + echo "K3b - Tag guessing using MusicBrainz no" +if test "$ac_cv_use_musicbrainz" = "yes"; then + echo "K3b - You are missing the musicbrainz headers and libraries." + echo "K3b - K3b will be compiled without support for tag guessing." +fi +fi +# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure +if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then + # And if so, warn when they don't match + if test "$kde_libs_prefix" != "$given_prefix"; then + # And if kde doesn't know about the prefix yet + echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null + if test $? -ne 0; then + echo "" + echo "Warning: you chose to install this package in $given_prefix," + echo "but KDE was found in $kde_libs_prefix." + echo "For this to work, you will need to tell KDE about the new prefix, by ensuring" + echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix" + echo "Then restart KDE." + echo "" + fi + fi +fi + +if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then + echo "" + echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility" + echo "was not included. Therefore, GCC symbol visibility support remains disabled." + echo "" + echo "For better performance, consider including the Qt visibility supporting patch" + echo "located at:" + echo "" + echo "http://bugs.kde.org/show_bug.cgi?id=109386" + echo "" + echo "and recompile all of Qt and KDE. Note, this is entirely optional and" + echo "everything will continue to work just fine without it." + echo "" +fi + +if test "$all_tests" = "bad"; then + if test ! "$cache_file" = "/dev/null"; then + echo "" + echo "Please remove the file $cache_file after changing your setup" + echo "so that configure will find the changes next time." + echo "" + fi +else + echo "" + echo "Good - your configure finished. Start make now" + echo "" +fi diff --git a/configure.in.bot b/configure.in.bot new file mode 100644 index 0000000..718d6ba --- /dev/null +++ b/configure.in.bot @@ -0,0 +1,62 @@ +echo "" + +if test "$use_k3b_debug" = "yes"; then + echo "" + echo "K3b - K3B DEBUGGING ENABLED! THIS ENABLES ADDITIONAL DEBUGGING OUTPUT" + echo "K3b - AND FUNCTIONALITY WHICH IS ONLY INTENDED FOR K3B DEVELOPERS!" + echo "K3b - THIS MAY EVEN SLOW DOWN K3B IN SOME PLACES!" + echo "" +fi + +if test "$cdrecord_suid_root" != "yes"; then + echo "" + echo "K3b - Suid root test for cdrecord, cdrdao, and wodim deactivated" + echo "K3b - This is NOT recommended although it might work out fine ;)" + echo "" +fi + +if $have_taglib; then + echo "K3b - Audio meta data reading with Taglib: yes" +else + echo "K3b - Audio meta data reading with Taglib: no" + echo "K3b - You are missing the Taglib headers and libraries." + echo "K3b - The mp3 and flac decoder plugins will fall back to" + echo "K3b - using KMetaFileInfo." +fi + +echo "" + +echo "K3b - Audio resampling:" +if test -n "$LIBSAMPLERATE"; then + echo "K3b - using installed version" +else + echo "K3b - using version bundled with K3b" +fi + +echo "" + +if test x$arts_available = xyes; then + echo "K3b - Audioplayer available (aRts) yes" +else + echo "K3b - Audioplayer available (aRts) no" +fi + +echo "" + +if test x$compile_k3bsetup = xyes; then + echo "K3b - Compile K3bSetup 2: yes" +else + echo "K3b - Compile K3bSetup 2: no" +fi + +echo "" + +if $have_mb; then + echo "K3b - Tag guessing using MusicBrainz yes" +else + echo "K3b - Tag guessing using MusicBrainz no" +if test "$ac_cv_use_musicbrainz" = "yes"; then + echo "K3b - You are missing the musicbrainz headers and libraries." + echo "K3b - K3b will be compiled without support for tag guessing." +fi +fi diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..27cec92 --- /dev/null +++ b/configure.in.in @@ -0,0 +1,184 @@ +#MIN_CONFIG(3.2) +#AM_KDE_MIN_VERSION(3.4) + +AC_CHECK_HEADERS(byteswap.h) + +dnl - check the byte order - +dnl this will define WORDS_BIGENDIAN or do nothing +AC_C_BIGENDIAN() + +AC_ARG_WITH( + external-libsamplerate, + [ --with-external-libsamplerate use the libsamplerate provided by the system (default=yes)], + [external_sampletrate=$withval], + [external_sampletrate=yes] +) + +LIBSAMPLERATE="" + +if test x$external_sampletrate != xno; then + +dnl === check for libsamplerate ========== +KDE_CHECK_HEADERS(samplerate.h, [ + KDE_CHECK_LIB(samplerate, src_new, [ + LIBSAMPLERATE="-lsamplerate" + AC_DEFINE(HAVE_LIBSAMPLERATE,1,[defined if you have libsamplerate library and header]) + ]) +]) + +fi + +AC_SUBST(LIBSAMPLERATE) +AM_CONDITIONAL(compile_libsamplerate, [test -z "$LIBSAMPLERATE"]) + + +ARTS_LIBS="" +if test "x$build_arts" = "xyes"; then + dnl Find aRts + KDE_CHECK_HEADERS(artsc/artsc.h, + [arts_available=yes + ARTS_LIBS="-lartsc"], + [arts_available=no] + ) +fi +AC_SUBST(ARTS_LIBS) +AM_CONDITIONAL(include_arts, [test -n "$ARTS_LIBS"]) +if test "x$build_arts" = "xyes" -a "x$arts_available" = "xyes"; then + AC_DEFINE(WITH_ARTS,1,[defined if arts support is compiled in]) +fi + +KDE_CHECK_THREADING + +compile_k3bsetup=yes +AC_ARG_WITH( + k3bsetup, + [ --with-k3bsetup[=ARG] do compile K3bSetup2 KControl Module (default=yes)], + [compile_k3bsetup=$withval] +) + +if test x$compile_k3bsetup = xyes; then + AC_DEFINE(HAVE_K3BSETUP,1,[defined if K3bSetup is compiled]) +fi + +AM_CONDITIONAL(with_k3bsetup1, [test x$compile_k3bsetup = xyes]) + + +cdrecord_suid_root=yes +AC_ARG_WITH( + cdrecord-suid-root, + AS_HELP_STRING( + [--without-cdrecord-suid-root], + [enable or disable K3b's suid root check for cdrecord/cdrdao/wodim (default=enabled)]), + [cdrecord_suid_root=$withval], + [cdrecord_suid_root=yes] +) +if test x$cdrecord_suid_root = xyes; then + AC_DEFINE(CDRECORD_SUID_ROOT_CHECK,1,[defined if K3b should check cdrecord for suid root]) +fi + + +# Extra SCSI support libs can go in CAM_LIB, and are linked into +# libk3bdevice. For Linux, nothing is needed. FreeBSD requires -lcam +# (which is in base, so no test is needed). +case "$host_os" in +freebsd* | dragonfly*) + CAM_LIB="-lcam" + ;; +*) + CAM_LIB="" + ;; +esac +AC_SUBST(CAM_LIB) + + + +dnl ---------- TAGLIB CHECK ---------- + +AC_DEFUN([AC_HAVE_TAGLIB], +[ + AC_DEFINE(HAVE_TAGLIB, 1, [have TagLib]) + taglib_includes=[`$TAGLIB_CONFIG --cflags`] + taglib_libs=[`$TAGLIB_CONFIG --libs`] + have_taglib=true +]) + +AC_DEFUN([AC_NO_TAGLIB], +[ + taglib_includes="" + taglib_libs="" + have_taglib=false +]) + +AC_PATH_PROG(TAGLIB_CONFIG, taglib-config, [no], [$PATH:$prefix/bin]) +if test "x$TAGLIB_CONFIG" = "xno" ; then + AC_NO_TAGLIB +else + AC_HAVE_TAGLIB +fi + +AC_SUBST(taglib_includes) +AC_SUBST(taglib_libs) + +dnl ---------- END TAGLIB CHECK ---------- + + + +dnl ----------- TUNEPIMP/MUSICBRAINZ CHECK ----------- + +AC_ARG_WITH( + musicbrainz, + AS_HELP_STRING( + [--without-musicbrainz], + [build K3b without Musicbrainz support (default=no)]), + [ac_cv_use_musicbrainz=$withval], + [ac_cv_use_musicbrainz=yes] +) + +have_mb=false +MUSICBRAINZ_LIBS="" +if test "$ac_cv_use_musicbrainz" = "yes"; then + KDE_CHECK_HEADER(musicbrainz/mb_c.h, + [ + KDE_CHECK_LIB(musicbrainz,mb_New,[ + AC_DEFINE(HAVE_MUSICBRAINZ, 1, [have MusicBrainz]) + MUSICBRAINZ_LIBS="-lmusicbrainz" + have_mb=true + ]) + ], []) +fi +AC_SUBST(MUSICBRAINZ_LIBS) + +dnl --------- TUNEPIMP/MUSICBRAINZ CHECK END ----------- + + +dnl --------- K3b debugging stuff (only for developers) ---- + +AC_ARG_WITH( + k3b-debug, + AS_HELP_STRING( + [--with-k3b-debug], + [Enable additional K3b debugging output and functionality (default=no)]), + [use_k3b_debug=$withval], + [use_k3b_debug=no] +) +if test "$use_k3b_debug" = "yes"; then + AC_DEFINE(K3B_DEBUG, "1", [K3b additional debugging support]) +fi + +dnl -------------------------------------------------------- + + + + +dnl --------------- libiconv check ------------------------- + +AC_CHECK_HEADERS(iconv.h) + +dnl -------------------------------------------------------- + + +#AC_DEFINE(LIBK3B_VERSION, "0.11.98", [k3b library version]) +#AC_SUBST(LIBK3B_VERSION, 0.11.98) +#AC_CONFIG_FILES([k3b/libk3b/libk3b.pc]) + +KDE_ENABLE_HIDDEN_VISIBILITY diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..6385fe8 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ + +KDE_LANG = en +KDE_DOCS = k3b + diff --git a/doc/audiocd-howto.docbook b/doc/audiocd-howto.docbook new file mode 100644 index 0000000..b993db5 --- /dev/null +++ b/doc/audiocd-howto.docbook @@ -0,0 +1,96 @@ + + + Quickguide: Burning an Audio-CD in 4 Steps + + + This Quickguide shows you how to create a AudioCD with &k3b;. To reproduce + these steps you need a working &k3b; and a directory in which you have + audiofiles. + + + Step 1 + + When you start &k3b; you should see something like this. + + Here you can select one of four projects &k3b; offers + + + + + + Screenshot + + + + + + + Step 2 + + Now you click on "New Audio CD Project" + + This is a dialog where you can select which files you want to burn on a CD + + + + + + Screenshot + + + + + + The files you see on the top-part of &k3b; can be dropped with the mouse to the bottom-widget. + Another way is to right-click on a file an select Add to Project. In order to rearrange + the order of the audio-tracks you can simply move the tracks with the left mouse-button. The properties + of the tracks can be changed by clicking with the &RMB; and choosing Properties. + As soon as you like the arrangement of the tracks click on Burn... in the right-bottom + corner. + + + + When you burn AudioCD from MP3s or other lossy compressed music, remember that if you encode this CD back to MP3, you'll get poorer quality regardless the bitrate you use. To check whether AudioCD was burnt from lossy format, try auCDtect. + + + + + Step 3 + + This is a dialog where you can decide the settings for the CD. + + + + + + Screenshot + + + + + In this dialog you can control the settings of the burning itself. The default-settings of &k3b; + are probably correct for you. In the top-right corner you can control the speed. One last + step before the actual burning you can give the CD a title by choosing CD-Text and + selecting Write CD-Text. The two which are probably most important for you + are Title and Performer. As soon as you are content with + the settings click on Burn. + + + + Step 4 + + + In this dialog you can see the progress of you burning + + + + + + Screenshot + + + + In this dialog is nothing you can do. Just wait for you computer to finish the session. + + + diff --git a/doc/burndialog_audio.png b/doc/burndialog_audio.png new file mode 100644 index 0000000..936ea3b Binary files /dev/null and b/doc/burndialog_audio.png differ diff --git a/doc/burndialog_progress.png b/doc/burndialog_progress.png new file mode 100644 index 0000000..8a0ac30 Binary files /dev/null and b/doc/burndialog_progress.png differ diff --git a/doc/cdcloning_dialog.png b/doc/cdcloning_dialog.png new file mode 100644 index 0000000..cb93f6e Binary files /dev/null and b/doc/cdcloning_dialog.png differ diff --git a/doc/cdcloning_reading.png b/doc/cdcloning_reading.png new file mode 100644 index 0000000..d7c0b4c Binary files /dev/null and b/doc/cdcloning_reading.png differ diff --git a/doc/cdcopy-howto.docbook b/doc/cdcopy-howto.docbook new file mode 100644 index 0000000..ded1ae0 --- /dev/null +++ b/doc/cdcopy-howto.docbook @@ -0,0 +1,86 @@ + + + Quickguide: Copying a Data-CD in 4 Steps + + + This Quickguide shows you how to create a Data-CD with &k3b;. To reproduce + these steps you need a working &k3b; and the CD you wish to copy inserted in your + CD-ROM. + + + Step 1 + + To copy a Data-CD you select Tools,CDCopy CD... + You will see a dialog where you can set up the burning. + + In this dialog you can select the settings you want to use for the burning. + + + + + + Screenshot + + + + + + + Step 2 + + After you have set up &k3b; click on Start CD Copy. You will get a dialog similar to this: + + In this dialog you can watch to progress of the copying. As soon as the writing of the + image-file is done you will be asked for a emtpy CD on which the data will be burned. + + + + + + Screenshot + + + + + + In this dialog you can watch to progress of the copying. As soon as the writing of the + image-file is done you will be asked for a emtpy CD on which the data will be burned. + + + + Step 3 + + &k3b; is burning the Image file. You have to wait until the Overall process + is at 100% + + + + + + Screenshot + + + + + &k3b; is burning the Image file. You have to wait until the Overall process + is at 100%. + + + + Step 4 + + + In this dialog you can see the result of your burning + + + + + + Screenshot + + + + &k3b; has finished the burning. Click on Close to close the dialog. + + + diff --git a/doc/cdcopy_done.png b/doc/cdcopy_done.png new file mode 100644 index 0000000..20cd3d4 Binary files /dev/null and b/doc/cdcopy_done.png differ diff --git a/doc/cdcopy_reading.png b/doc/cdcopy_reading.png new file mode 100644 index 0000000..d2611ed Binary files /dev/null and b/doc/cdcopy_reading.png differ diff --git a/doc/cdcopy_settings.png b/doc/cdcopy_settings.png new file mode 100644 index 0000000..bb8a1aa Binary files /dev/null and b/doc/cdcopy_settings.png differ diff --git a/doc/cdcopy_writing.png b/doc/cdcopy_writing.png new file mode 100644 index 0000000..6761ea1 Binary files /dev/null and b/doc/cdcopy_writing.png differ diff --git a/doc/commands.docbook b/doc/commands.docbook new file mode 100644 index 0000000..a6f69ae --- /dev/null +++ b/doc/commands.docbook @@ -0,0 +1,700 @@ + + + + The Menu Entries + + + The <guimenu>File</guimenu> Menu + + + + + + + &Ctrl;N + + + File + New Project + + + + + Creates a new project. + You have to choose the project type (Audio CD, Data DVD, ...). + + + + + + + + &Ctrl;O + + + File + Open... + + + + + Opens an existing project which + can be selected with KDE's Open File dialog. + + + + + + + + &Ctrl;R + + + File + Open Recent + + + + + This is a shortcut to re-open recently opened + projects. The sub-menu belonging to this item + contains a list of these projects, clicking on a specific file + will open it again. + + + + + + + + &Ctrl;S + + + File + Save + + + + + Saves the current project. + If there has already been a save of the document then this + will overwrite the previously saved file without asking + for the user's consent. If it is the first save of a new + document the Save As dialog will be invoked. + + + + + + + File + Save As... + + + + + Saves the current project with a new + file name. KDE's Save As dialog appears to specify + name and directory of the new project file. + + + + + + + File + Save All + + + + + Saves all open projects. + This is the same as selecting + + File + Save + for each of them. + + + + + + + + &Ctrl;C + + + File + Close + + + + + Closes the current project. + If a project has been modified but not yet saved + then &k3b; will ask what to do. + You can choose to save or discard the changes, + and you also have the opportunity to cancel closing + and keep the project open. + + + + + + + File + Close All + + + + + Closes all open projects. For each unsaved + project &k3b; will ask what to do, just like it does when + + File + Close + is selected. + + + + + + + + &Ctrl;Q + + + File + Quit + + + + + Quits &k3b; after closing all of its open + projects. For every unsaved project &k3b; will ask what to do, + just like it does when + + File + Close + is selected. + + + + + + + + + + The <guimenu>Project</guimenu> Menu + + + + + + Project + Add Files... + + + + + When this item is selected, the appearing dialog + lets you choose one or more files to be added + to the project. This has the same effect as dragging + files directly from the Contents View into the Project View. + If the current project is a data disc project, + the added files will appear in the disc's root directory. + + + + + + + Project + Clear Project + + + + + Removes all files and directories + from the current project. + The project itself remains open. + + + + + + + + &Ctrl;B + + + Project + Burn... + + + + + Opens the Burn dialog for the current project. + This is in fact the same as the Properties dialog - the only + difference is that there is an additional Burn button which + causes &k3b; to burn a disc from project data. The Burn dialog + won't open if the project does not contain any files. + + + + + + + + &Ctrl;P + + + Project + Properties... + + + + + Opens the Properties dialog for the current project. + Here you can specify a lot of options concerning + the project. Every project type has got a different set of + options, most of them can be explained by using What's This + (accessible by right-mouse-clicking). + + + + + + + Project + Import Session + + + + + This Item only appears if a Data CD/DVD or Video DVD project + is active. It causes K3b to import the file entries + from the previous session to the current project. + You can use this when compiling files for multi-session discs. + Hence that data from the previous session is always included, + even if you don't choose to make use of this command. + It just helps to know what's on the disc already. + + + + + + + Project + Clear Imported Session + + + + + This Item only appears if a Data CD/DVD or Video DVD project + is active. It causes K3b to remove the file entries + from the current project that were imported by + + Project + Import Session + while keeping all of the other data + in the project. Hence that making use of this command doesn't + actually remove anything from the disc that will be burned, + it just hides these files again. + + + + + + + Project + Edit Boot Images + + + + + This Item only appears if a Data CD/DVD or Video DVD project + is active. Here you can specify boot images + in order to create bootable CDs or DVDs. A boot image can be + a direct copy of a floppy or hard disk (for example, created + by the dd shell command) as well as another disc's boot image. + In any case it's a single file containing a complete, bootable + system that is burned as a normal file. In order to let the + computer know that the disc contains a boot image, the burning + application creates a boot catalog file whose name can be + determined in the dialog window. + + + + + + + + + + + + + The <guimenu>Tools</guimenu> Menu + + + + + + Tools + Copy CD... + + + + + Opens the CD Copy dialog. + Without the need of a project file, it provides + the ability to copy a CD's content to another disc. + Alternatively, you can choose only to create an image + of the source CD which can be burned anytime. There is + also an option to clone the CD instead of normal + copying, which should be preferred when copying CDs + with defective sectors or Video CDs. + + + + + + + Tools + Copy DVD... + + + + + Opens the DVD Copy dialog. + Without the need of a project file, it provides + the ability to copy a DVD's content to another disc. + Alternatively, you can choose only to create an image + of the source DVD which can be burned anytime. + Video transcoding within the DVD Copy dialog + is not yet supported, so the destination disc + has to be large enough to contain all of the + source disc's (video) data in its original form. + + + + + + + Tools + Erase CD-RW... + + + + + Opens the Erase CD-RW dialog. + With its help you can clear the contents of a CD-RW, + or part of it. + + + + + + + Tools + Format DVD±RW... + + + + + Opens the DVD Formatting dialog. + With its help you can format a DVD-R(W) or DVD+R(W), + which causes the disc's contents to be deleted. + &k3b; gives the choice between the "Overwrite" and + "Incremental" writing modes. + + + + + + + Tools + Burn CD Image... + + + + + Burns a previously created CD image. + The Burn CD Image dialog asks to select an + *.iso, + *.cue or + *.toc file + as data source that you can instantly burn by pressing + the Start button. + (Nero *.nrg files + are currently not supported, so you have to make use + of other tools like + Nrg2Iso.) + + + + + + + Tools + Burn DVD ISO Image... + + + + + Burns a previously created DVD image. + The Burn Iso9660 Image dialog asks to select an + *.iso file as data + source that you can instantly burn by pressing + the Start button. + + + + + + + Tools + Encode Video... + + + + + A DVD video that has already been ripped can be + encoded with a little help from the Encoding Video + dialog. This dialog box normally opens after ripping the DVD + from within the Contents View, but can also be used standalone. + It contains information about the ripped DVD video, encoding + options and even video resizing and cropping abilities. + + + + + + + Tools + Diskinfo + + + + + Shows information about the inserted disk. + This information will be displayed in the Contents View and + covers disk properties like type, size and track length + of the CD or DVD in your drive. + + + + + + + + + + The <guimenu>Settings</guimenu> Menu + + + + + + Settings + Toolbars + + + + + Pops up a list of &k3b;'s toolbars. + If a toolbar entry is checked, it means that + the toolbar is currently visible. + + + + + + + Settings + Show/Hide Statusbar + + + + + This enables you to show or hide the small bar + at the bottom of the main window containing + various information about &k3b;'s status and activities. + + + + + + + Settings + Show Directories + + + + + Toggles the visibility of the Directory View. + This view enables you to select directories and disc drives. + When selected, their contents will appear in the Contents View. + Disc drives have also got a context menu providing functions + like Disk Info, (un)mounting the drive or ejecting the medium. + + + + + + + Settings + Show Contents + + + + + Toggles the visibility of the Contents View. + This view enables you to select files that can be dragged + into the Project View in order to add them to the project. + The Contents View also acts as an interface to rip + audio CDs and video discs when a disc drive containing + an appropriate CD/DVD is selected in the Directory View. + + + + + + + Settings + Show Document Header + + + + + Toggles the visibility of the document header + belonging to the Project View. This is a small bar that is + only visible if the Project View contains any open projects. + The document header has no functionality, yet it's nice + eye candy and improves clarity by separating + the Project View from the other views. + + + + + + + Settings + Configure Shortcuts... + + + + + This command opens a dialog box where the key bindings + for &k3b;'s menu commands may be changed. + After selecting one of the available commands + from the upper part of the dialog, the shortcut + for this action can be changed in the lower part. + + + + + + + Settings + Configure Toolbars... + + + + + This command opens a dialog box where the toolbars + can be customized. The drop down box on top + of the dialog determines which toolbar can be edited + at the moment. The Available Actions list on the left contains + all commands that can be added to the toolbar, + the Current Actions list on the right shows the ones + that are already there. Items can be added by selecting + the appropriate command out of the Available Actions list and + pressing the right button to move it to the Current Actions + list. Removing an item works the other way round. + The up and down buttons change the commands's position + within the toolbar. + + + + + + + Settings + &k3b; Setup + + + + + This opens &k3bsetup; which helps setting the + right permissions needed by &k3b; in order to burn + CDs and DVDs. Linux' user rights management permits program + execution and access to disc drives if no permissions have + been granted by the administrator. &k3bsetup; cannot set + permissions without administrator privileges, so you have + to enter the root password when starting up. + + + + + + + Settings + Configure &k3b;... + + + + + Opens the Options dialog + where general program settings can be configured. + Although most of &k3b;'s functionality should work out + of the box, this dialog allows to customize and fine-tune + the program. + + + + + + + + + + The <guimenu>Help</guimenu> Menu +&help.menu.documentation; + + + + \ No newline at end of file diff --git a/doc/dcop.docbook b/doc/dcop.docbook new file mode 100644 index 0000000..82b05a6 --- /dev/null +++ b/doc/dcop.docbook @@ -0,0 +1,104 @@ + + The &k3b; &DCOP; Interface + &k3b; features, like many other &kde; applications as well, a + &DCOP; interface which makes it possible to control a part of it's + functionality from ⪚ a shellscript. + To use these &DCOP; functions you can either use the + dcop commandline program or the more convenient + Kdcop application. Both provide the same + functionality so it's mostly a matter of taste and context of usage when + deciding which way to choose. + This chapter assumes that you're using the dcop + commandline program. To access &k3b;'s &DCOP; functions, make sure that + &k3b; is started and then enter something like this at a console: + +# dcop [function] + + + +Besides the generic &DCOP; functions available to all &kde; +applications, &k3b;'s DCOP interface mainly consists of two parts as described below. + + +The default K3bInterface + +The default K3b DCOP interface provides functionality like copyCD, formatDVD, and methods for creating new projects. + + +DCOPRef createDataCDProject() +DCOPRef createAudioCDProject() +DCOPRef createMixedCDProject() +DCOPRef createVideoCDProject() +DCOPRef createMovixCDProject() +DCOPRef createDataDVDProject() +DCOPRef createVideoDVDProject() +DCOPRef createMovixDVDProject() +DCOPRef openProject(KURL url) +QValueList<DCOPRef> projects() +DCOPRef currentProject() +void copyCd() +void copyDvd() +void eraseCdrw() +void formatDvd() +void burnCdImage(KURL url) +void burnDvdImage(KURL url) + + +As result from one of the createXXXProject methods one gets a DCOP reference to the newly created project: + +DCOPRef(k3b,K3bProject-0) + +Alternatively you may create a project using the command line: + + +# k3b --audiocd + + +and then retrieve a reference to this project with + + +# dcop currentProject + + +Using this reference it is possible to manipulate the project using the K3bProjectInterface. + + + + +K3bProjectInterface + + +void addUrls(KURL::List urls) +void addUrl(KURL url) +void burn() + + +K3b offers the K3bProjectInterface as listed above or the more powerful K3bDataProjectInterface which only applies to data projects (CD and DVD): + + +void createFolder(QString name) +void createFolder(QString name,QString parent) +void addUrl(KURL url,QString parent) +void addUrls(KURL::List urls,QString parent) +void removeItem(QString path) +void renameItem(QString path,QString newName) +void setVolumeID(QString id) + + + +Using this it is possible to fill a data project with files and folders from a script. +The following script for example creates a new data project, adds several folders to the project, and adds files to the newly created folders: + + +#!/bin/bash +PROJECT=$(dcop k3b K3bInterface createDataCDProject) +dcop $PROJECT createFolder test +dcop $PROJECT createFolder foo +dcop $PROJECT createFolder bar /foo +dcop $PROJECT addUrl /home/trueg/somefile.txt /foo/bar + + + + + + diff --git a/doc/index.docbook b/doc/index.docbook new file mode 100644 index 0000000..fcb6f96 --- /dev/null +++ b/doc/index.docbook @@ -0,0 +1,340 @@ + +K3b"> +cdrdao"> +DVD+RW-Tools"> +mkisofs"> +cdrecord"> +K3bSetup"> + + + + + + + + +]> + + + + +The &k3b; Handbook + + + + Carsten + Niehaus + + + Jakob + Petsovits + + + + + + + + + 2003-2004 +Carsten Niehaus + + +&FDLNotice; + +2005-06-21 +0.03.00 + + + + + + &k3b; is a CD and DVD burning application for &kde; with a comfortable user interface. + + + + +KDE +kdeextragear +cdrecord +DVD +CD +burning +ripping +iso +K3b + + + + + +Introduction + + + &k3b; is a CD and DVD burning application for Linux systems + optimized for &kde;. It provides a comfortable user interface + to perform most CD/DVD burning tasks like creating an Audio CD + from a set of audio files or copying a CD. + While the experienced user can take influence in all steps + of the burning process, the beginner may find comfort + in the automatic settings and the reasonable &k3b; defaults + which allow a quick start. The actual burning in K3b is done + by the command line utilities + cdrecord, + cdrdao, and + growisofs. + + + + +&k3b-commands; + + + HOWTOs for a quickstart to &k3b; + + &k3b-audiocd-howto; + &k3b-cdcopy-howto; + + + + +&k3b-dcop; + + + +Questions and Answers + + + +&reporting.bugs; +&updating.documentation; + + + + + + Compiling &k3b; fails with undefined type "struct KComboBox". + + + + + The QTDesigner tool uic is not able to find the kde widget plugins. + To solve this run qtconfig and add + $KDEDIR/lib/kde3/plugins to the + plugin search path (replace $KDEDIR with your kde base dir). + + + + + + + + + + + +Credits and License + + +&k3b; + + + Program copyright 1999-2005 Sebastian Trueg trueg@k3b.org + and the K3b team + + +Contributors: + + Thomas Froescher tfroescher@k3b.org + +Christian Kvasny chris@k3b.org + +Klaus-Dieter Krannich kd@k3b.org + + + + + + Documentation Copyright © 2003-2004 Carsten Niehaus cniehaus@kde.org + + + + +&underFDL; + + + +&underGPL; + + + +Installation + + +How to obtain &k3b; + + + + + + The main information site for &k3b; is + www.k3b.org. + For the most current version of &k3b;, feedback and + community help as well as &k3b; news and other information, + this is the place to go. + + + + + +Requirements + + + In order to successfully use &k3b;, you need &kde; >= 3.1 and &Qt; >= 3.1. + + + &cdrdao;: Records audio or data CD-Rs in disk-at-once (DAO) + mode based on a textual description of the CD contents (toc-file). + + + &cdrecord;/&mkisofs;: Records any kind of CD-Rs. &cdrecord; contains all of &cdrdao;'s features and extended functionality and therefore is &k3b;'s standard choice for CD burning. In some cases, &cdrdao; reaches better audio CD burning quality though. + + + &dvdtools;: The &dvdtools; are used to burn and format DVD+R(W) and DVD-R(W) media. + + + + Optionally &k3b; can make use of all these libraries: + + + +cdparanoia: A Compact Disc Digital Audio (CDDA) extraction tool, +commonly known on the net as a 'ripper'. + + + +Ogg Vorbis library: Ogg Vorbis is a completely open, patent-free, +professional audio encoding and streaming technology with all the benefits +of Open Source, and in direct competition with the MP3 format. +Used by the Ogg Vorbis Decoder and Encoder plugins. + + + +MAD (MPEG Audio Decoder) Library: A high-quality MPEG audio decoder, +supporting the MPEG-1, MPEG-2 and MPEG 2.5 formats. All three audio +layers Layer I, Layer II, and Layer III (i.e. MP3) are fully implemented. +Used by the MP3 Decoder plugin. + + + +LAME: A highly evolved MP3 encoder, with quality and speed able to rival +state of the art commercial encoders. Used by the MP3 Encoder plugin. + + + +FLAC: A free, open source codec for lossless audio compression and +decompression. Used by the FLAC Decoder plugin and the +External Audio Encoder plugin, so you can read and write FLAC files. + + + +Libsndfile, FFmpeg, FLAC, Musepack decoders: Other libraries for processing a +broad range of audio file formats. For example, with FFmpeg it is possible to +decode WMA files in order to burn them onto audio CDs. +Used by the respective plugins. + + + +SoX: A utility that can convert between various audio file formats. +Used by the SoX Audio Encoder plugin. + + + +transcode: A Linux text-console utility for video stream processing. +You need this if you want to rip DVD video. + + + +VCDImager: A full-featured mastering suite for authoring, +disassembling and analyzing Video CDs and Super Video CDs. + + + +Normalize: A tool for adjusting the volume of audio files to a standard level. +This is useful for things like creating mixed CDs and MP3 collections, where +different recording levels on different albums can cause the volume to vary +greatly from song to song. + + + +eMovix: A tiny Linux distribution that is burned on CD together with video +files. eMovix contains all the software to boot from a CD and automatically +play every video file localized in the CD root. + + + + +You can find a list of changes to &k3b; at http://www.k3b.org. + + + + +Compilation and Installation + + + + + +&install.compile.documentation; + + + + + +&documentation.index; + + + diff --git a/doc/select_audiofiles.png b/doc/select_audiofiles.png new file mode 100644 index 0000000..b50a8a9 Binary files /dev/null and b/doc/select_audiofiles.png differ diff --git a/doc/select_project.png b/doc/select_project.png new file mode 100644 index 0000000..9cedf35 Binary files /dev/null and b/doc/select_project.png differ diff --git a/k3b.lsm b/k3b.lsm new file mode 100644 index 0000000..ad825b8 --- /dev/null +++ b/k3b.lsm @@ -0,0 +1,14 @@ +Begin3 +Title: K3b +Version: 1.0 +Entered-date: +Description: CD writing software for KDE 3.2 and above +Keywords: CD-Writing, Ripping, CD-Audio, CDDA +Author: Sebastian Trueg +Maintained-by: Sebastian Trueg +Primary-site: +Home-page: http://www.k3b.org +Original-site: +Platforms: Linux +Copying-policy: GNU Public License +End diff --git a/k3bsetup/Makefile.am b/k3bsetup/Makefile.am new file mode 100644 index 0000000..42d3bee --- /dev/null +++ b/k3bsetup/Makefile.am @@ -0,0 +1,18 @@ +AM_CPPFLAGS = -I$(srcdir)/../src -I$(srcdir)/../libk3b/core -I$(srcdir)/../libk3b/tools -I$(srcdir)/../libk3bdevice $(all_includes) + +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kcm_k3bsetup2.la + +kcm_k3bsetup2_la_SOURCES = base_k3bsetup2.ui k3bsetup2.cpp +kcm_k3bsetup2_la_LIBADD = $(LIB_KDEUI) ../libk3b/libk3b.la +kcm_k3bsetup2_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined + +k3bsetup2_DATA = k3bsetup2.desktop +k3bsetup2dir = $(kde_appsdir)/Settings/System + +bin_SCRIPTS = k3bsetup + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/k3bsetup.pot diff --git a/k3bsetup/base_k3bsetup2.ui b/k3bsetup/base_k3bsetup2.ui new file mode 100644 index 0000000..05af5fd --- /dev/null +++ b/k3bsetup/base_k3bsetup2.ui @@ -0,0 +1,380 @@ + +base_K3bSetup2 + + + Form1 + + + + 0 + 0 + 500 + 450 + + + + + unnamed + + + 0 + + + + layout6 + + + + unnamed + + + + groupBox3 + + + Settings + + + + unnamed + + + + layout1 + + + + unnamed + + + + m_checkUseBurningGroup + + + Use burning group: + + + <p>If this option is checked, only the users in the specified group will be able to burn CDs and DVDs, since only they will have access to the devices and the CD recording programs used by K3b.</p> +<p>Otherwise all users on the system have access to the devices and to all K3b functionality. + + + + + m_editBurningGroup + + + false + + + burning + + + + + + + layout2 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Fixed + + + + 20 + 10 + + + + + + textLabel2 + + + Users allowed to burn (separated by space): + + + + + m_editUsers + + + false + + + + + + + + + groupBox1 + + + Devices + + + + unnamed + + + + textLabel1_2 + + + Check the devices whose permissions you want to be changed + + + + + + Device + + + true + + + true + + + + + Devicenode + + + true + + + true + + + + + Permissions + + + true + + + true + + + + + New Permissions + + + true + + + true + + + + m_viewDevices + + + + + layout3 + + + + unnamed + + + + spacer2 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + m_buttonAddDevice + + + Add Device... + + + + + + + + + groupBox2 + + + External Programs + + + + unnamed + + + + tabWidget2 + + + + tab + + + Found Programs + + + + unnamed + + + + textLabel1 + + + Check the programs whose permissions you want to be changed + + + + + + Program + + + true + + + true + + + + + Version + + + true + + + true + + + + + Path + + + true + + + true + + + + + Permissions + + + true + + + true + + + + + New Permissions + + + true + + + true + + + + m_viewPrograms + + + + + + + tab + + + Search Path + + + + unnamed + + + + m_editSearchPath + + + Search Path + + + false + + + + + textLabel1_3 + + + <qt><b>Hint:</b> to force K3b to use another than the default name for the executable specify it in the search path.</qt> + + + + + + + + + + + + + + m_checkUseBurningGroup + toggled(bool) + m_editBurningGroup + setEnabled(bool) + + + m_checkUseBurningGroup + toggled(bool) + m_editUsers + setEnabled(bool) + + + + + klistview.h + klistview.h + keditlistbox.h + klineedit.h + + diff --git a/k3bsetup/k3bsetup b/k3bsetup/k3bsetup new file mode 100644 index 0000000..0851430 --- /dev/null +++ b/k3bsetup/k3bsetup @@ -0,0 +1,20 @@ +# +# $Id: k3bsetup 476230 2005-10-31 23:05:34Z thiago $ +# Copyright (C) 2003 Sebastian Trueg +# +# This file is part of the K3b project. +# Copyright (C) 1998-2003 Sebastian Trueg +# +# 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. +# See the file "COPYING" for the exact licensing terms. +# + + +#!/usr/bin/sh + +#TODO: if kdesu not found and not currently root use kdialog to display an error message + +kdesu kcmshell k3bsetup2 diff --git a/k3bsetup/k3bsetup2.cpp b/k3bsetup/k3bsetup2.cpp new file mode 100644 index 0000000..37c23a1 --- /dev/null +++ b/k3bsetup/k3bsetup2.cpp @@ -0,0 +1,560 @@ +/* + * + * $Id: k3bsetup2.cpp 623771 2007-01-15 13:47:39Z trueg $ + * Copyright (C) 2003-2007 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "k3bsetup2.h" +#include "base_k3bsetup2.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + + +static bool shouldRunSuidRoot( K3bExternalBin* bin ) +{ + // + // Since kernel 2.6.8 older cdrecord versions are not able to use the SCSI subsystem when running suid root anymore + // So for we ignore the suid root issue with kernel >= 2.6.8 and cdrecord < 2.01.01a02 + // + // Some kernel version 2.6.16.something again introduced a problem here. Since I do not know the exact version + // and a workaround was introduced in cdrecord 2.01.01a05 just use that version as the first for suid root. + // + // Seems as if cdrdao never had problems with suid root... + // + + if( bin->name() == "cdrecord" ) { + return ( K3b::simpleKernelVersion() < K3bVersion( 2, 6, 8 ) || + bin->version >= K3bVersion( 2, 1, 1, "a05" ) || + bin->hasFeature( "wodim" ) ); + } + else if( bin->name() == "cdrdao" ) { + return true; + } + else if( bin->name() == "growisofs" ) { + // + // starting with 6.0 growiofs raises it's priority using nice(-20) + // BUT: newer kernels have ridiculously low default memorylocked resource limit, which prevents privileged + // users from starting growisofs 6.0 with "unable to anonymously mmap 33554432: Resource temporarily unavailable" + // error message. Until Andy releases a version including a workaround we simply never configure growisofs suid root + return false; // bin->version >= K3bVersion( 6, 0 ); + } + else + return false; +} + + +class K3bSetup2::Private +{ +public: + K3bDevice::DeviceManager* deviceManager; + K3bExternalBinManager* externalBinManager; + + bool changesNeeded; + + QMap listDeviceMap; + QMap deviceListMap; + + QMap listBinMap; + QMap binListMap; + + KConfig* config; +}; + + + +K3bSetup2::K3bSetup2( QWidget *parent, const char *, const QStringList& ) + : KCModule( parent, "k3bsetup" ) +{ + d = new Private(); + d->config = new KConfig( "k3bsetup2rc" ); + + m_aboutData = new KAboutData("k3bsetup2", + "K3bSetup 2", + 0, 0, KAboutData::License_GPL, + "(C) 2003-2007 Sebastian Trueg"); + m_aboutData->addAuthor("Sebastian Trueg", 0, "trueg@k3b.org"); + + setButtons( KCModule::Apply|KCModule::Cancel|KCModule::Ok|KCModule::Default ); + + QHBoxLayout* box = new QHBoxLayout( this ); + box->setAutoAdd(true); + box->setMargin(0); + box->setSpacing( KDialog::spacingHint() ); + + KTextEdit* label = new KTextEdit( this ); + label->setText( "

K3bSetup

" + + i18n("

This simple setup assistant is able to set the permissions needed by K3b in order to " + "burn CDs and DVDs. " + "

It does not take things like devfs or resmgr into account. In most cases this is not a " + "problem but on some systems the permissions may be altered the next time you login or restart " + "your computer. In those cases it is best to consult the distribution documentation." + "

Caution: Although K3bSetup 2 should not be able " + "to mess up your system no guarantee can be given.") ); + label->setReadOnly( true ); + label->setFixedWidth( 200 ); + + w = new base_K3bSetup2( this ); + + // TODO: enable this and let root specify users + w->m_editUsers->hide(); + w->textLabel2->hide(); + + + connect( w->m_checkUseBurningGroup, SIGNAL(toggled(bool)), + this, SLOT(updateViews()) ); + connect( w->m_editBurningGroup, SIGNAL(textChanged(const QString&)), + this, SLOT(updateViews()) ); + connect( w->m_editSearchPath, SIGNAL(changed()), + this, SLOT(slotSearchPrograms()) ); + connect( w->m_buttonAddDevice, SIGNAL(clicked()), + this, SLOT(slotAddDevice()) ); + + + d->externalBinManager = new K3bExternalBinManager( this ); + d->deviceManager = new K3bDevice::DeviceManager( this ); + + // these are the only programs that need special permissions + d->externalBinManager->addProgram( new K3bCdrdaoProgram() ); + d->externalBinManager->addProgram( new K3bCdrecordProgram(false) ); + d->externalBinManager->addProgram( new K3bGrowisofsProgram() ); + + d->externalBinManager->search(); + d->deviceManager->scanBus(); + + load(); + + // + // This is a hack to work around a kcm bug which makes the faulty assumption that + // every module starts without anything to apply + // + QTimer::singleShot( 0, this, SLOT(updateViews()) ); + + if( getuid() != 0 || !d->config->checkConfigFilesWritable( true ) ) + makeReadOnly(); +} + + +K3bSetup2::~K3bSetup2() +{ + delete d->config; + delete d; + delete m_aboutData; +} + + +void K3bSetup2::updateViews() +{ + d->changesNeeded = false; + + updatePrograms(); + updateDevices(); + + emit changed( ( getuid() != 0 ) ? false : d->changesNeeded ); +} + + +void K3bSetup2::updatePrograms() +{ + // first save which were checked + QMap checkMap; + QListViewItemIterator listIt( w->m_viewPrograms ); + for( ; listIt.current(); ++listIt ) + checkMap.insert( d->listBinMap[(QCheckListItem*)*listIt], ((QCheckListItem*)*listIt)->isOn() ); + + w->m_viewPrograms->clear(); + d->binListMap.clear(); + d->listBinMap.clear(); + + // load programs + const QMap& map = d->externalBinManager->programs(); + for( QMap::const_iterator it = map.begin(); it != map.end(); ++it ) { + K3bExternalProgram* p = it.data(); + + QPtrListIterator binIt( p->bins() ); + for( ; binIt.current(); ++binIt ) { + K3bExternalBin* b = *binIt; + + QFileInfo fi( b->path ); + // we need the uid bit which is not supported by QFileInfo + struct stat s; + if( ::stat( QFile::encodeName(b->path), &s ) ) { + kdDebug() << "(K3bSetup2) unable to stat " << b->path << endl; + } + else { + // create a checkviewitem + QCheckListItem* bi = new QCheckListItem( w->m_viewPrograms, b->name(), QCheckListItem::CheckBox ); + bi->setText( 1, b->version ); + bi->setText( 2, b->path ); + + d->listBinMap.insert( bi, b ); + d->binListMap.insert( b, bi ); + + // check the item on first insertion or if it was checked before + bi->setOn( checkMap.contains(b) ? checkMap[b] : true ); + + int perm = s.st_mode & 0007777; + + QString wantedGroup("root"); + if( w->m_checkUseBurningGroup->isChecked() ) + wantedGroup = burningGroup(); + + int wantedPerm = 0; + if( shouldRunSuidRoot( b ) ) { + if( w->m_checkUseBurningGroup->isChecked() ) + wantedPerm = 0004710; + else + wantedPerm = 0004711; + } + else { + if( w->m_checkUseBurningGroup->isChecked() ) + wantedPerm = 0000750; + else + wantedPerm = 0000755; + } + + bi->setText( 3, QString::number( perm, 8 ).rightJustify( 4, '0' ) + " " + fi.owner() + "." + fi.group() ); + if( perm != wantedPerm || + fi.owner() != "root" || + fi.group() != wantedGroup ) { + bi->setText( 4, QString("%1 root.%2").arg(wantedPerm,0,8).arg(wantedGroup) ); + if( bi->isOn() ) + d->changesNeeded = true; + } + else + bi->setText( 4, i18n("no change") ); + } + } + } +} + + +void K3bSetup2::updateDevices() +{ + // first save which were checked + QMap checkMap; + QListViewItemIterator listIt( w->m_viewDevices ); + for( ; listIt.current(); ++listIt ) + checkMap.insert( d->listDeviceMap[(QCheckListItem*)*listIt], ((QCheckListItem*)*listIt)->isOn() ); + + w->m_viewDevices->clear(); + d->listDeviceMap.clear(); + d->deviceListMap.clear(); + + QPtrListIterator it( d->deviceManager->allDevices() ); + for( ; it.current(); ++it ) { + K3bDevice::Device* device = *it; + // check the item on first insertion or if it was checked before + QCheckListItem* item = createDeviceItem( device->blockDeviceName() ); + item->setOn( checkMap.contains(device->blockDeviceName()) ? checkMap[device->blockDeviceName()] : true ); + item->setText( 0, device->vendor() + " " + device->description() ); + + if( !device->genericDevice().isEmpty() ) { + QCheckListItem* item = createDeviceItem( device->genericDevice() ); + item->setOn( checkMap.contains(device->genericDevice()) ? checkMap[device->genericDevice()] : true ); + item->setText( 0, device->vendor() + " " + device->description() + " (" + i18n("Generic SCSI Device") + ")" ); + } + } +} + + +QCheckListItem* K3bSetup2::createDeviceItem( const QString& deviceNode ) +{ + QFileInfo fi( deviceNode ); + struct stat s; + if( ::stat( QFile::encodeName(deviceNode), &s ) ) { + kdDebug() << "(K3bSetup2) unable to stat " << deviceNode << endl; + return 0; + } + else { + // create a checkviewitem + QCheckListItem* bi = new QCheckListItem( w->m_viewDevices, + deviceNode, + QCheckListItem::CheckBox ); + + d->listDeviceMap.insert( bi, deviceNode ); + d->deviceListMap.insert( deviceNode, bi ); + + bi->setText( 1, deviceNode ); + + int perm = s.st_mode & 0000777; + + bi->setText( 2, QString::number( perm, 8 ).rightJustify( 3, '0' ) + " " + fi.owner() + "." + fi.group() ); + if( w->m_checkUseBurningGroup->isChecked() ) { + // we ignore the device's owner here + if( perm != 0000660 || + fi.group() != burningGroup() ) { + bi->setText( 3, "660 " + fi.owner() + "." + burningGroup() ); + if( bi->isOn() ) + d->changesNeeded = true; + } + else + bi->setText( 3, i18n("no change") ); + } + else { + // we ignore the device's owner and group here + if( perm != 0000666 ) { + bi->setText( 3, "666 " + fi.owner() + "." + fi.group() ); + if( bi->isOn() ) + d->changesNeeded = true; + } + else + bi->setText( 3, i18n("no change") ); + } + + return bi; + } +} + + +void K3bSetup2::load() +{ + if( d->config->hasGroup("External Programs") ) { + d->config->setGroup( "External Programs" ); + d->externalBinManager->readConfig( d->config ); + } + if( d->config->hasGroup("Devices") ) { + d->config->setGroup( "Devices" ); + d->deviceManager->readConfig( d->config ); + } + + d->config->setGroup( "General Settings" ); + w->m_checkUseBurningGroup->setChecked( d->config->readBoolEntry( "use burning group", false ) ); + w->m_editBurningGroup->setText( d->config->readEntry( "burning group", "burning" ) ); + + + // load search path + w->m_editSearchPath->clear(); + w->m_editSearchPath->insertStringList( d->externalBinManager->searchPath() ); + + updateViews(); +} + + +void K3bSetup2::defaults() +{ + w->m_checkUseBurningGroup->setChecked(false); + w->m_editBurningGroup->setText( "burning" ); + + // + // This is a hack to work around a kcm bug which makes the faulty assumption that + // every module defaults to a state where nothing is to be applied + // + QTimer::singleShot( 0, this, SLOT(updateViews()) ); +} + + +void K3bSetup2::save() +{ + d->config->setGroup( "General Settings" ); + d->config->writeEntry( "use burning group", w->m_checkUseBurningGroup->isChecked() ); + d->config->writeEntry( "burning group", burningGroup() ); + d->config->setGroup( "External Programs"); + d->externalBinManager->saveConfig( d->config ); + d->config->setGroup( "Devices"); + d->deviceManager->saveConfig( d->config ); + + + bool success = true; + + struct group* g = 0; + if( w->m_checkUseBurningGroup->isChecked() ) { + // TODO: create the group if it's not there + g = getgrnam( burningGroup().local8Bit() ); + if( !g ) { + KMessageBox::error( this, i18n("There is no group %1.").arg(burningGroup()) ); + return; + } + } + + + // save the device permissions + QListViewItemIterator listIt( w->m_viewDevices ); + for( ; listIt.current(); ++listIt ) { + + QCheckListItem* checkItem = (QCheckListItem*)listIt.current(); + + if( checkItem->isOn() ) { + QString dev = d->listDeviceMap[checkItem]; + + if( w->m_checkUseBurningGroup->isChecked() ) { + if( ::chmod( QFile::encodeName(dev), S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP ) ) + success = false; + + if( ::chown( QFile::encodeName(dev), (gid_t)-1, g->gr_gid ) ) + success = false; + } + else { + if( ::chmod( QFile::encodeName(dev), S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH ) ) + success = false; + } + } + } + + + // save the program permissions + listIt = QListViewItemIterator( w->m_viewPrograms ); + for( ; listIt.current(); ++listIt ) { + + QCheckListItem* checkItem = (QCheckListItem*)listIt.current(); + + if( checkItem->isOn() ) { + + K3bExternalBin* bin = d->listBinMap[checkItem]; + + if( w->m_checkUseBurningGroup->isChecked() ) { + if( ::chown( QFile::encodeName(bin->path), (gid_t)0, g->gr_gid ) ) + success = false; + + int perm = 0; + if( shouldRunSuidRoot( bin ) ) + perm = S_ISUID|S_IRWXU|S_IXGRP; + else + perm = S_IRWXU|S_IXGRP|S_IRGRP; + + if( ::chmod( QFile::encodeName(bin->path), perm ) ) + success = false; + } + else { + if( ::chown( QFile::encodeName(bin->path), 0, 0 ) ) + success = false; + + int perm = 0; + if( shouldRunSuidRoot( bin ) ) + perm = S_ISUID|S_IRWXU|S_IXGRP|S_IXOTH; + else + perm = S_IRWXU|S_IXGRP|S_IRGRP|S_IXOTH|S_IROTH; + + if( ::chmod( QFile::encodeName(bin->path), perm ) ) + success = false; + } + } + } + + + if( success ) + KMessageBox::information( this, i18n("Successfully updated all permissions.") ); + else { + if( getuid() ) + KMessageBox::error( this, i18n("Could not update all permissions. You should run K3bSetup 2 as root.") ); + else + KMessageBox::error( this, i18n("Could not update all permissions.") ); + } + + // WE MAY USE "newgrp -" to reinitialize the environment if we add users to a group + + updateViews(); +} + + +QString K3bSetup2::quickHelp() const +{ + return i18n("

K3bSetup 2

" + "

This simple setup assistant is able to set the permissions needed by K3b in order to " + "burn CDs and DVDs." + "

It does not take into account devfs or resmgr, or similar. In most cases this is not a " + "problem, but on some systems the permissions may be altered the next time you login or restart " + "your computer. In these cases it is best to consult the distribution's documentation." + "

The important task that K3bSetup 2 performs is grant write access to the CD and DVD devices." + "

Caution: Although K3bSetup 2 should not be able " + "to damage your system, no guarantee can be given."); +} + + +QString K3bSetup2::burningGroup() const +{ + QString g = w->m_editBurningGroup->text(); + return g.isEmpty() ? QString("burning") : g; +} + + +void K3bSetup2::slotSearchPrograms() +{ + d->externalBinManager->setSearchPath( w->m_editSearchPath->items() ); + d->externalBinManager->search(); + updatePrograms(); + + emit changed( d->changesNeeded ); +} + + +void K3bSetup2::slotAddDevice() +{ + bool ok; + QString newDevicename = KInputDialog::getText( i18n("Location of New Drive"), + i18n("Please enter the device name where K3b should search\n" + "for a new drive (example: /dev/mebecdrom):"), + "/dev/", &ok, this ); + + if( ok ) { + if( d->deviceManager->addDevice( newDevicename ) ) { + updateDevices(); + + emit changed( d->changesNeeded ); + } + else + KMessageBox::error( this, i18n("Could not find an additional device at\n%1").arg(newDevicename), + i18n("Error"), false ); + } +} + +void K3bSetup2::makeReadOnly() +{ + w->m_checkUseBurningGroup->setEnabled( false ); + w->m_editBurningGroup->setEnabled( false ); + w->m_editUsers->setEnabled( false ); + w->m_viewDevices->setEnabled( false ); + w->m_buttonAddDevice->setEnabled( false ); + w->m_viewPrograms->setEnabled( false ); + w->m_editSearchPath->setEnabled( false ); +} + + +typedef KGenericFactory K3bSetup2Factory; +K_EXPORT_COMPONENT_FACTORY( kcm_k3bsetup2, K3bSetup2Factory("k3bsetup") ) + + +#include "k3bsetup2.moc" diff --git a/k3bsetup/k3bsetup2.desktop b/k3bsetup/k3bsetup2.desktop new file mode 100644 index 0000000..5f73b03 --- /dev/null +++ b/k3bsetup/k3bsetup2.desktop @@ -0,0 +1,148 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=K3bSetup 2 - modify permission for CD/DVD burning with K3b +Comment[af]=K3bSetup 2 - verander regte vir CD/DVD skryf met K3b +Comment[ar]= اعداد K3B 2 - غيًر الصلاحيات (الاذون ) كي تستطيع كتابة الاقراص المدمجة (CD) او الاقراص المرئية الرقمية (DVD) بواسطة K3B +Comment[bg]=Настройване на K3b (2) - промяна на правата за запис на CD/DVD с K3b +Comment[bn]=কে-থ্রি-বি ব্যবস্থাপনা ২ - কে-থ্রি-বি দিয়ে সিডি/ডিভিডি লিখনের জন্য অনুমতি পরিবর্তন করে +Comment[bs]=K3bSetup 2 - promijenite privilegije za CD/DVD prženje sa K3b-om +Comment[ca]=K3bSetup 2 - modifica els permisos per a cremar CD i DVD amb K3b +Comment[cs]=K3bSetup 2 - změna oprávnění pro vypalování CD/DVD s K3b +Comment[da]=K3bSetup 2 - ændring af tilladelser for cd/dvd-brænding med K3b +Comment[de]=K3b Einrichtungsassistent - Zugriffsrechte zum Brennen mit K3b anpassen +Comment[el]=Ρύθμιση K3b 2 - τροποποίηση δικαιωμάτων για εγγραφή CD/DVD με το K3b +Comment[eo]=K3bAgordo 2 - ŝanĝu rajtojn por KD/DVD enskribo per K3b +Comment[es]=K3bSetup 2 - modifica los permisos para la grabación de CD o DVD con K3b +Comment[et]=K3b seadistamine - võimalus muuta õigusi CD/DVD kirjutamiseks K3b-ga +Comment[fa]=K3bSetup 2 - تغییر مجوز برای سوزاندن دیسک فشرده/دی وی دی با K3b +Comment[fi]=K3bSetup 2 - aseta K3b:n poltto-oikeudet +Comment[fr]=K3bSetup 2 - Modification des permissions pour la gravure de CD / DVD avec K3b +Comment[gl]=K3bSetup 2 - modifica os permisos para gravar CDs/DVDs con K3b +Comment[he]=K3bSetup 2 - שינוי הרשאות עבור צריבת תקליטורי CD/DVD עם K3b +Comment[hi]=के3बी-सेटअप 2 - के3बी के साथ सीडी/डीवीडी बर्निंग हेतु आज्ञाएँ परिवर्धित करें +Comment[hu]=K3bSetup 2 - jogosultságbeállítás CD/DVD-íráshoz a K3b-ben +Comment[is]=K3b uppsetning 2 - breyta aðgangsheimildum á CD/DVD skrifun með K3b +Comment[it]=Impostazioni di K3b 2 - modifica i permessi per CD/DVD per scrivere con K3b +Comment[ja]=K3bSetup 2 - K3b で CD/DVD に書き込むための権限を設定 +Comment[ka]=K3bSetup 2 - K3b-ით CD/DVD-ის ჩაწერის უფლების შეცვლა +Comment[km]=K3bSetup 2 - កែប្រែ​សិទ្ធិ​ដើម្បី​ដុត​ស៊ីឌី ឬ ឌីវីឌី​​ដោយ​ប្រើ K3b +Comment[lt]=K3bSetup 2 – pakeiskite leidimus CD/DVD kūrimui su K3b +Comment[mk]=K3bSetup 2 - менување на дозволите за снимање на CD/DVD со K3b +Comment[ms]=K3bSetup2 - mengubahsuai kebenaran untuk membakar CD/DVD dengan K3b +Comment[nb]=K3bSetup 2 – endre tillatelser for CD-/DVD-brenning med K3b +Comment[nds]=K3b-Inrichthölper - Verlöven för't Brennen vun CD/DVD mit K3b ännern +Comment[ne]=K3bSetup 2 - ले K3b सँग सीडी/डीभीडी बर्निङका लागि अनुमति परिमार्जन गर्दछ +Comment[nl]=K3bSetup 2 - stelt de toegangsrechten in voor cd/dvd-branden met K3b +Comment[nn]=K3b-oppsett 2 – endra løyve for CD- og DVD-brenning med K3b +Comment[pa]=K3bSetup 2 - K3b ਨਾਲ CD/DVD ਲਿਖਣ ਲਈ ਅਧਿਕਾਰ ਸੋਧ +Comment[pl]=K3bSetup 2 - modyfikacja uprawnień do nagrywania płyt CD/DVD za pomocą K3b +Comment[pt]=K3bSetup 2 - modificar as permissões para a gravação de CDs/DVDs com o K3b +Comment[pt_BR]=Configurações Avançadas do K3b - modificar as permissões para a queima de CD/DVD com o K3b +Comment[ru]=K3bSetup 2 - настроить права для записи при помощи K3b +Comment[sk]=K3bSetup 2 - zmena práv pre napaľovanie CD/DVD s K3b +Comment[sl]=K3bSetup - spremeni dovoljenja za pisanje CD/DVD-jev s K3b +Comment[sr]=K3bSetup 2 — мења дозволе за резање CD/DVD-а помоћу K3b-а +Comment[sr@Latn]=K3bSetup 2 — menja dozvole za rezanje CD/DVD-a pomoću K3b-a +Comment[sv]=Ställ in K3b 2: ändra rättigheter för att bränna cd/dvd med K3b +Comment[ta]= K3bஅமைவு2 - K3b ஐ CD/DVD களோடு எழுதுவதற்காக அனுமதி மாற்றுவதற்காக +Comment[tg]=K3bSetup 2 - танзим кардани иҷозат барои сабт бо ёрии K3b +Comment[tr]=K3bSetup 2 - K3b ile CD/DVD kaydetme izinlerini ayarlama +Comment[uk]=K3bSetup 2 - зміна прав доступу для запису КД/DVD за допомогою K3b +Comment[uz]=K3bSetup 2 - K3b yordamida CD/DVD'ga yozish huquqini moslash +Comment[uz@cyrillic]=K3bSetup 2 - K3b ёрдамида CD/DVD'га ёзиш ҳуқуқини мослаш +Comment[zh_CN]=K3b 设置 2 - 修改使用 K3b 烧录 CD/DVD 的权限 +Comment[zh_TW]=K3bSetup 2 - 為 K3b 燒錄 CD/DVD 修改權限 +Exec=k3bsetup +Keywords=K3bSetup2,k3bsetup2 +Keywords[ar]=اعداد K3b , K3b2 +Keywords[bg]=K3bSetup2,k3bsetup2,Настройване на K3b (2) +Keywords[de]=K3b, Einrichtungsassistent, Rechte +Keywords[el]=Ρύθμιση K3b 2,k3bsetup2 +Keywords[eo]=K3bAgordo2,k3bagordo2 +Keywords[et]=K3bSetup2,k3bsetup2,k3b seadistamine +Keywords[hi]=के3बी-सेटअप 2,के3बी-सेटअप2 +Keywords[nds]=K3bSetup2,k3bsetup2,K3b-Inrichthölper +Keywords[nl]=K3bSetup2,k3bsetup2,branden,cd branden,dvd,dvd branden +Keywords[nn]=K3b-oppsett 2,k3b-oppsett 2 +Keywords[pl]=K3bSetup2,k3bsetup2,k3b,ustawienia,uprawnienia +Keywords[pt_BR]=Configurações Avançadas do K3b,configurações avançadas do K3b +Keywords[sv]=Ställ in K3b 2,k3bsetup2 +Keywords[ta]=K3bஅமைவு2,K3bஅமைவு2 +Keywords[tg]=ТанзимиK3b2,танзимиk3b2 +Keywords[uz]=K3bSetup2,k3bsetup2,CD,kompakt-disk +Keywords[uz@cyrillic]=K3bSetup2,k3bsetup2,CD,компакт-диск +Name=K3bSetup +Name[ar]= اعداد K3b +Name[bg]=Настройване на K3b +Name[bn]=কে-থ্রি-বি ব্যবস্থাপনা +Name[de]=K3b Einrichtungsassistent +Name[eo]=K3bAgordo +Name[et]=K3b seadistamine +Name[hi]=के3बी-सेटअप +Name[is]=K3b uppsetning +Name[it]=Impostazioni di K3b +Name[nds]=K3b-Inrichthölper +Name[nn]=K3b-oppsett +Name[pa]=K3b-ਸੈੱਟਅੱਪ +Name[pt_BR]=Configurar K3b +Name[sv]=Ställ in K3b +Name[ta]=K3b அமைவு +Name[tg]=ТанзимиK3b +Name[zh_TW]=K3b 設定 +Terminal=false +Type=Application +Icon=k3b +X-KDE-FactoryName=k3bsetup2 +X-KDE-Library=k3bsetup2 +X-KDE-ModuleType=Library +X-KDE-RootOnly=true +Categories=Application;System;X-KDE-System; +GenericName=CD & DVD Burning Setup +GenericName[af]=CD & DVD Skryf Opstelling +GenericName[ar]=العام اعداد كتابة القرص المدمج (CD) و القرص المرئي الرقمي (DVD) +GenericName[bg]=Настройване записа на CD и DVD +GenericName[bn]=সিডি এবং ডিভিডি লিখন ব্যবস্থাপনা +GenericName[ca]=Programa per gravar CDs i DVDs +GenericName[cs]=Nastavení vypalování CD a DVD +GenericName[da]=Cd & dvd opsætning til brænding +GenericName[de]=CD & DVD-Brennen einrichten +GenericName[el]=Ρύθμιση εγγραφής CD & DVD +GenericName[eo]=KD & DVD Enskriba agordo +GenericName[es]=Configurar grabación de CD y DVD +GenericName[et]=CD ja DVD kirjutamise seadistamine +GenericName[fa]=برپایی سوزاندن دیسک فشرده و دی وی دی +GenericName[fi]=K3b-poltto-ohjelman asetusten määritys +GenericName[fr]=Configuration de la gravure de CD et de DVD +GenericName[gl]=Configurazón da Grabazón de CDs e DVDs +GenericName[hu]=CD- és DVD-írási beállítások +GenericName[is]=Uppsetning á CD og DVD brennslu +GenericName[it]=Impostazioni di masterizzazione CD e DVD +GenericName[ja]=CD / DVD 作成の設定 +GenericName[ka]=CD-ის და DVD-ის ჩაწერის გამართვა +GenericName[km]=រៀបចំ​ការ​ដុត​ស៊ីឌី & ឌីវីឌី +GenericName[lt]=CD & DVD kūrimo parinktys +GenericName[mk]=Поставувања за снимање на CD и DVD +GenericName[ms]=Tetapan Membakar CD & DVD +GenericName[nb]=Oppsett av CD- og DVD-brenning +GenericName[nds]=Brennen vun CD & DVD instellen +GenericName[ne]=सीडी र डीभीडी बर्निङ सेटअप +GenericName[nl]=CD- en dvd-branden instellen +GenericName[nn]=Oppsett av CD- og DVD-brenning +GenericName[pa]=CD & DVD ਲਿਖਣ ਸੈਟਅੱਪ +GenericName[pl]=Konfiguracja nagrywania płyt CD i DVD +GenericName[pt]=Configuração da Gravação de CDs e DVDs +GenericName[pt_BR]=Configuração da Queima de CD & DVD +GenericName[ru]=Настройка записи CD и DVD +GenericName[sk]=Nastavenie CD & DVD napaľovania +GenericName[sl]=Nastavitve za pisanje CD-jev in DVD-jev +GenericName[sr]=Подешавање резања CD-а и DVD-а +GenericName[sr@Latn]=Podešavanje rezanja CD-a i DVD-a +GenericName[sv]=Cd och dvd-bränninställning +GenericName[ta]=சிடி & DVD நகல் எடுக்கும் அமைப்பு +GenericName[tg]=Танзимоти сабткунии CD ва DVD +GenericName[tr]=CD ve DVD Kaydetme Kurulumu +GenericName[uk]=Налажтування запису КД та DVD +GenericName[uz]=CD va DVD diskka yozishni moslash +GenericName[uz@cyrillic]=CD ва DVD дискка ёзишни мослаш +GenericName[zh_CN]=CD & DVD 刻录程序设置 +GenericName[zh_TW]=CD & DVD 燒錄設定 diff --git a/k3bsetup/k3bsetup2.h b/k3bsetup/k3bsetup2.h new file mode 100644 index 0000000..ea86664 --- /dev/null +++ b/k3bsetup/k3bsetup2.h @@ -0,0 +1,65 @@ +/* + * + * $Id: k3bsetup2.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3BSETUP2_H_ +#define _K3BSETUP2_H_ + +#include +#include + + +class base_K3bSetup2; +class QCheckListItem; + + +class K3bSetup2: public KCModule +{ + Q_OBJECT + + public: + K3bSetup2( QWidget* parent = 0, const char* name = 0, const QStringList& args = QStringList() ); + ~K3bSetup2(); + + QString quickHelp() const; + const KAboutData* aboutData() { return m_aboutData; }; + + void load(); + void save(); + void defaults(); + + public slots: + void updateViews(); + + private slots: + void slotSearchPrograms(); + void slotAddDevice(); + + private: + void updatePrograms(); + void updateDevices(); + QString burningGroup() const; + void makeReadOnly(); + QCheckListItem* createDeviceItem( const QString& deviceNode ); + + class Private; + Private* d; + + base_K3bSetup2* w; + + KAboutData* m_aboutData; +}; + +#endif diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am new file mode 100644 index 0000000..c1ba442 --- /dev/null +++ b/kfile-plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = k3bproject \ No newline at end of file diff --git a/kfile-plugins/k3bproject/Makefile.am b/kfile-plugins/k3bproject/Makefile.am new file mode 100644 index 0000000..d229c41 --- /dev/null +++ b/kfile-plugins/k3bproject/Makefile.am @@ -0,0 +1,27 @@ +AM_CPPFLAGS = -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3b/plugin \ + -I$(srcdir)/../../libk3b/tools \ + -I$(srcdir)/../../libk3b/projects \ + -I$(srcdir)/../../libk3b/projects/datacd \ + -I$(srcdir)/../../libk3bdevice \ + -I$(srcdir)/../../src/projects \ + $(all_includes) + +# these are the headers for your project +noinst_HEADERS = kfile_k3bprojectfileplugin.h + +kde_module_LTLIBRARIES = kfile_k3b.la + +kfile_k3b_la_SOURCES = kfile_k3bprojectfileplugin.cpp +kfile_k3b_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kfile_k3b_la_LIBADD = $(LIB_KIO) ../../libk3b/libk3b.la ../../src/projects/kostore/libkostore.la + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +services_DATA = kfile_k3b.desktop +servicesdir = $(kde_servicesdir) + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kfile_k3b.pot diff --git a/kfile-plugins/k3bproject/kfile_k3b.desktop b/kfile-plugins/k3bproject/kfile_k3b.desktop new file mode 100644 index 0000000..b0156d0 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_k3b.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Name=K3b Project Info +Name[af]=K3b Projek Informasie +Name[ar]= معلومات عن مشروع K3B +Name[bg]=Информация за K3b проект +Name[bn]=কে-থ্রি-বি প্রকল্প তথ্য +Name[br]=Titouroù raktres K3b +Name[ca]=Informació sobre el projecte de K3b +Name[cs]=Info o K3b projektu +Name[da]=K3b Projektinformation +Name[de]=K3b Projektinformationen +Name[el]=Πληροφορίες έργου K3b +Name[eo]=K3b projekta informo +Name[es]=Información de proyecto K3b +Name[et]=K3b projekti info +Name[fa]= اطلاعات پروژۀ K3b +Name[fi]=K3b-projektin kuvaus +Name[fr]=Information sur le projet K3b +Name[ga]=Eolas faoin Tionscadal K3b +Name[gl]=Informazón de Proxecto K3b +Name[hu]=K3b-projektinformáció +Name[is]=K3b verkefnisupplýsingar +Name[it]=Informazioni progetto K3b +Name[ja]=K3b プロジェクト情報 +Name[km]=ព័ត៌មាន​របស់​​គម្រោង K3b +Name[lt]=K3b projekto informacija +Name[mk]=Информации за проект од K3b +Name[nb]=K3b-prosjektinformasjon +Name[nds]=K3b-Projektinformatschonen +Name[nl]=K3b-projectinformatie +Name[nn]=K3b-prosjektinfo +Name[pa]=K3b ਪ੍ਰੋਜੈੱਕਟ ਜਾਣਕਾਰੀ +Name[pl]=Informacja dla projektu K3b +Name[pt]=Informação do Projecto do K3b +Name[pt_BR]=Informações do Projeto do K3b +Name[ru]=Свдения о проекте K3b +Name[sk]=K3b informácie o projekte +Name[sr]=Инфо о K3b пројекту +Name[sr@Latn]=Info o K3b projektu +Name[sv]=K3b-projektinformation +Name[tr]=K3b Proje Bilgisi +Name[uk]=Інформація проекту K3b +Name[uz]=K3b loyihasi haqida maʼlumot +Name[uz@cyrillic]=K3b лойиҳаси ҳақида маълумот +Name[zh_CN]=K3b 方案信息 +Name[zh_TW]=K3b 專案資訊 +ServiceTypes=KFilePlugin +X-KDE-Library=kfile_k3b +MimeType=application/x-k3b +PreferredGroups=General +PreferredItems=documenttype diff --git a/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp new file mode 100644 index 0000000..b868c94 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp @@ -0,0 +1,135 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include + +#include "kfile_k3bprojectfileplugin.h" +#include "kostore/koStore.h" +#include "kostore/koStoreDevice.h" + +#include + +#include + +#include +#include +#include + + + +K_EXPORT_COMPONENT_FACTORY(kfile_k3b, KGenericFactory("kfile_k3b")) + + +K3bProjectFilePlugin::K3bProjectFilePlugin( QObject *parent, const char *name, + const QStringList &args) + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-k3b" ); + + KFileMimeTypeInfo::GroupInfo* group = addGroupInfo( info, "General", i18n("General") ); + + addItemInfo( group, "documenttype", i18n("Document Type"), QVariant::String ); +} + + +bool K3bProjectFilePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + if( !info.url().isLocalFile() ) { + kdDebug() << "(K3bProjectFilePluginInfo) no local file." << endl; + return false; + } + + // open the file + bool success = false; + QDomDocument xmlDoc; + + // try opening a store + KoStore* store = KoStore::createStore( info.url().path(), KoStore::Read ); + if( store && !store->bad() && store->open( "maindata.xml" ) ) { + QIODevice* dev = store->device(); + dev->open( IO_ReadOnly ); + if( xmlDoc.setContent( dev ) ) + success = true; + dev->close(); + store->close(); + } + else + kdDebug() << "(K3bProjectFilePluginInfo) failed to open the store." << endl; + + if( success ) { + // check the documents DOCTYPE + K3bDoc::DocType type = K3bDoc::AUDIO; + if( xmlDoc.doctype().name() == "k3b_audio_project" ) + type = K3bDoc::AUDIO; + else if( xmlDoc.doctype().name() == "k3b_data_project" ) + type = K3bDoc::DATA; + else if( xmlDoc.doctype().name() == "k3b_vcd_project" ) + type = K3bDoc::VCD; + else if( xmlDoc.doctype().name() == "k3b_mixed_project" ) + type = K3bDoc::MIXED; + else if( xmlDoc.doctype().name() == "k3b_movix_project" ) + type = K3bDoc::MOVIX; + else if( xmlDoc.doctype().name() == "k3b_movixdvd_project" ) + type = K3bDoc::MOVIX_DVD; + else if( xmlDoc.doctype().name() == "k3b_dvd_project" ) + type = K3bDoc::DVD; + else if( xmlDoc.doctype().name() == "k3b_video_dvd_project" ) + type = K3bDoc::VIDEODVD; + else { + kdDebug() << "(K3bDoc) unknown doc type: " << xmlDoc.doctype().name() << endl; + success = false; + } + + QString stringType; + switch( type ) { + case K3bDoc::AUDIO: + stringType = i18n("Audio CD"); + break; + case K3bDoc::DATA: + stringType = i18n("Data CD"); + break; + case K3bDoc::MIXED: + stringType = i18n("Mixed Mode CD"); + break; + case K3bDoc::VCD: + stringType = i18n("Video CD"); + break; + case K3bDoc::MOVIX: + stringType = i18n("eMovix CD"); + break; + case K3bDoc::MOVIX_DVD: + stringType = i18n("eMovix DVD"); + break; + case K3bDoc::DVD: + stringType = i18n("Data DVD"); + break; + case K3bDoc::VIDEODVD: + stringType = i18n("Video DVD"); + break; + } + + // and finally display it! + KFileMetaInfoGroup group = appendGroup(info, "General"); + appendItem( group, "documenttype", stringType ); + } + + delete store; + + return success; +} + +#include "kfile_k3bprojectfileplugin.moc" + diff --git a/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h new file mode 100644 index 0000000..c90b678 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h @@ -0,0 +1,37 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef __KFILE_K3BPROJECTFILEPLUGIN_H__ +#define __KFILE_K3BPROJECTFILEPLUGIN_H__ + +/** + * Note: For further information look into <$KDEDIR/include/kfilemetainfo.h> + */ +#include + +class QStringList; + +class K3bProjectFilePlugin: public KFilePlugin +{ + Q_OBJECT + + public: + K3bProjectFilePlugin( QObject *parent, const char *name, const QStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif + diff --git a/kioslaves/Makefile.am b/kioslaves/Makefile.am new file mode 100644 index 0000000..55ab08d --- /dev/null +++ b/kioslaves/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = videodvd diff --git a/kioslaves/videodvd/Makefile.am b/kioslaves/videodvd/Makefile.am new file mode 100644 index 0000000..d8dca0e --- /dev/null +++ b/kioslaves/videodvd/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(srcdir)/../../libk3b/tools \ + -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3bdevice \ + $(all_includes) + +kde_module_LTLIBRARIES = kio_videodvd.la + +kio_videodvd_la_SOURCES = videodvd.cpp +kio_videodvd_la_LIBADD = -lkio ../../libk3b/libk3b.la +kio_videodvd_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_PLUGIN) + +protocol_DATA = videodvd.protocol +protocoldir = $(kde_servicesdir) + +konq_sidebartree_init_services_data_DATA = videodvd.desktop +konq_sidebartree_init_services_datadir = $(kde_datadir)/konqsidebartng/virtual_folders/services + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kio_videodvd.pot diff --git a/kioslaves/videodvd/videodvd.cpp b/kioslaves/videodvd/videodvd.cpp new file mode 100644 index 0000000..b453037 --- /dev/null +++ b/kioslaves/videodvd/videodvd.cpp @@ -0,0 +1,407 @@ +/* + * + * $Id: sourceheader 380067 2005-01-19 13:03:46Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "videodvd.h" + +using namespace KIO; + +extern "C" +{ + LIBK3B_EXPORT int kdemain( int argc, char **argv ) + { + KInstance instance( "kio_videodvd" ); + + kdDebug(7101) << "*** Starting kio_videodvd " << endl; + + if (argc != 4) + { + kdDebug(7101) << "Usage: kio_videodvd protocol domain-socket1 domain-socket2" << endl; + exit(-1); + } + + kio_videodvdProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + kdDebug(7101) << "*** kio_videodvd Done" << endl; + return 0; + } +} + + + +// FIXME: Does it really make sense to use a static device manager? Are all instances +// of videodvd started in another process? +K3bDevice::DeviceManager* kio_videodvdProtocol::s_deviceManager = 0; +int kio_videodvdProtocol::s_instanceCnt = 0; + +kio_videodvdProtocol::kio_videodvdProtocol(const QCString &pool_socket, const QCString &app_socket) + : SlaveBase("kio_videodvd", pool_socket, app_socket) +{ + kdDebug() << "kio_videodvdProtocol::kio_videodvdProtocol()" << endl; + if( !s_deviceManager ) + { + s_deviceManager = new K3bDevice::DeviceManager(); + s_deviceManager->setCheckWritingModes( false ); + s_deviceManager->scanBus(); + } + s_instanceCnt++; +} + + +kio_videodvdProtocol::~kio_videodvdProtocol() +{ + kdDebug() << "kio_videodvdProtocol::~kio_videodvdProtocol()" << endl; + s_instanceCnt--; + if( s_instanceCnt == 0 ) + { + delete s_deviceManager; + s_deviceManager = 0; + } +} + + +KIO::UDSEntry kio_videodvdProtocol::createUDSEntry( const K3bIso9660Entry* e ) const +{ + KIO::UDSEntry uds; + KIO::UDSAtom a; + + a.m_uds = KIO::UDS_NAME; + a.m_str = e->name(); + uds.append( a ); + + a.m_uds = KIO::UDS_ACCESS; + a.m_long = e->permissions(); + uds.append( a ); + + a.m_uds = KIO::UDS_CREATION_TIME; + a.m_long = e->date(); + uds.append( a ); + + a.m_uds = KIO::UDS_MODIFICATION_TIME; + a.m_long = e->date(); + uds.append( a ); + + if( e->isDirectory() ) + { + a.m_uds = KIO::UDS_FILE_TYPE; + a.m_long = S_IFDIR; + uds.append( a ); + + a.m_uds = KIO::UDS_MIME_TYPE; + a.m_str = "inode/directory"; + uds.append( a ); + } + else + { + const K3bIso9660File* file = static_cast( e ); + + a.m_uds = KIO::UDS_SIZE; + a.m_long = file->size(); + uds.append( a ); + + a.m_uds = KIO::UDS_FILE_TYPE; + a.m_long = S_IFREG; + uds.append( a ); + + a.m_uds = KIO::UDS_MIME_TYPE; + if( e->name().endsWith( "VOB" ) ) + a.m_str = "video/mpeg"; + else + a.m_str = "unknown"; + uds.append( a ); + } + + return uds; +} + + +// FIXME: remember the iso instance for quicker something and search for the videodvd +// in the available devices. +K3bIso9660* kio_videodvdProtocol::openIso( const KURL& url, QString& plainIsoPath ) +{ + // get the volume id from the url + QString volumeId = url.path().section( '/', 1, 1 ); + + kdDebug() << "(kio_videodvdProtocol) searching for Video dvd: " << volumeId << endl; + + // now search the devices for this volume id + // FIXME: use the cache created in listVideoDVDs + for( QPtrListIterator it( s_deviceManager->dvdReader() ); *it; ++it ) { + K3bDevice::Device* dev = *it; + K3bDevice::DiskInfo di = dev->diskInfo(); + + // we search for a DVD with a single track. + // this time let K3bIso9660 decide if we need dvdcss or not + // FIXME: check for encryption and libdvdcss and report an error + if( di.isDvdMedia() && di.numTracks() == 1 ) { + K3bIso9660* iso = new K3bIso9660( dev ); + iso->setPlainIso9660( true ); + if( iso->open() && iso->primaryDescriptor().volumeId == volumeId ) { + plainIsoPath = url.path().section( "/", 2, -1 ) + "/"; + kdDebug() << "(kio_videodvdProtocol) using iso path: " << plainIsoPath << endl; + return iso; + } + delete iso; + } + } + + error( ERR_SLAVE_DEFINED, i18n("No VideoDVD found") ); + return 0; +} + + +void kio_videodvdProtocol::get(const KURL& url ) +{ + kdDebug() << "kio_videodvd::get(const KURL& url)" << endl ; + + QString isoPath; + if( K3bIso9660* iso = openIso( url, isoPath ) ) + { + const K3bIso9660Entry* e = iso->firstIsoDirEntry()->entry( isoPath ); + if( e && e->isFile() ) + { + const K3bIso9660File* file = static_cast( e ); + totalSize( file->size() ); + QByteArray buffer( 10*2048 ); + int read = 0; + int cnt = 0; + KIO::filesize_t totalRead = 0; + while( (read = file->read( totalRead, buffer.data(), buffer.size() )) > 0 ) + { + buffer.resize( read ); + data(buffer); + ++cnt; + totalRead += read; + if( cnt == 10 ) + { + cnt = 0; + processedSize( totalRead ); + } + } + + delete iso; + + data(QByteArray()); // empty array means we're done sending the data + + if( read == 0 ) + finished(); + else + error( ERR_SLAVE_DEFINED, i18n("Read error.") ); + } + else + error( ERR_DOES_NOT_EXIST, url.path() ); + } +} + + +void kio_videodvdProtocol::listDir( const KURL& url ) +{ + if( url.path() == "/" ) { + listVideoDVDs(); + } + else { + QString isoPath; + K3bIso9660* iso = openIso( url, isoPath ); + if( iso ) { + const K3bIso9660Directory* mainDir = iso->firstIsoDirEntry(); + const K3bIso9660Entry* e = mainDir->entry( isoPath ); + if( e ) { + if( e->isDirectory() ) { + const K3bIso9660Directory* dir = static_cast(e); + QStringList el = dir->entries(); + el.remove( "." ); + el.remove( ".." ); + UDSEntryList udsl; + for( QStringList::const_iterator it = el.begin(); it != el.end(); ++it ) + udsl.append( createUDSEntry( dir->entry( *it ) ) ); + listEntries( udsl ); + finished(); + } + else { + error( ERR_CANNOT_ENTER_DIRECTORY, url.path() ); + } + } + else { + error( ERR_CANNOT_ENTER_DIRECTORY, url.path() ); + } + + // for testing we always do the whole thing + delete iso; + } + } +} + + +void kio_videodvdProtocol::listVideoDVDs() +{ + int cnt = 0; + + for( QPtrListIterator it( s_deviceManager->dvdReader() ); *it; ++it ) { + K3bDevice::Device* dev = *it; + K3bDevice::DiskInfo di = dev->diskInfo(); + + // we search for a DVD with a single track. + if( di.isDvdMedia() && di.numTracks() == 1 ) { + // + // now do a quick check for VideoDVD. + // - no dvdcss for speed + // - only a check for the VIDEO_TS dir + // + K3bIso9660 iso( new K3bIso9660DeviceBackend(dev) ); + iso.setPlainIso9660( true ); + if( iso.open() && iso.firstIsoDirEntry()->entry( "VIDEO_TS" ) ) { + // FIXME: cache the entry for speedup + + UDSEntryList udsl; + KIO::UDSEntry uds; + KIO::UDSAtom a; + + a.m_uds = KIO::UDS_NAME; + a.m_str = iso.primaryDescriptor().volumeId; + uds.append( a ); + + a.m_uds = KIO::UDS_FILE_TYPE; + a.m_long = S_IFDIR; + uds.append( a ); + + a.m_uds = KIO::UDS_MIME_TYPE; + a.m_str = "inode/directory"; + uds.append( a ); + + a.m_uds = KIO::UDS_ICON_NAME; + a.m_str = "dvd_unmount"; + uds.append( a ); + + udsl.append( uds ); + + listEntries( udsl ); + + ++cnt; + } + } + } + + if( cnt ) + finished(); + else + error( ERR_SLAVE_DEFINED, i18n("No VideoDVD found") ); +} + + +void kio_videodvdProtocol::stat( const KURL& url ) +{ + if( url.path() == "/" ) { + // + // stat the root path + // + KIO::UDSEntry uds; + KIO::UDSAtom a; + + a.m_uds = KIO::UDS_NAME; + a.m_str = "/"; + uds.append( a ); + + a.m_uds = KIO::UDS_FILE_TYPE; + a.m_long = S_IFDIR; + uds.append( a ); + + a.m_uds = KIO::UDS_MIME_TYPE; + a.m_str = "inode/directory"; + uds.append( a ); + + statEntry( uds ); + finished(); + } + else { + QString isoPath; + K3bIso9660* iso = openIso( url, isoPath ); + if( iso ) { + const K3bIso9660Entry* e = iso->firstIsoDirEntry()->entry( isoPath ); + if( e ) { + statEntry( createUDSEntry( e ) ); + finished(); + } + else + error( ERR_DOES_NOT_EXIST, url.path() ); + + delete iso; + } + } +} + + +// FIXME: when does this get called? It seems not to be used for the files. +void kio_videodvdProtocol::mimetype( const KURL& url ) +{ + if( url.path() == "/" ) { + error( ERR_UNSUPPORTED_ACTION, "mimetype(/)" ); + return; + } + + QString isoPath; + K3bIso9660* iso = openIso( url, isoPath ); + if( iso ) + { + const K3bIso9660Entry* e = iso->firstIsoDirEntry()->entry( isoPath ); + if( e ) + { + if( e->isDirectory() ) + mimeType( "inode/directory" ); + else if( e->name().endsWith( ".VOB" ) ) + { + mimetype( "video/mpeg" ); + } + else + { + // send some data + const K3bIso9660File* file = static_cast( e ); + QByteArray buffer( 10*2048 ); + int read = file->read( 0, buffer.data(), buffer.size() ); + if( read > 0 ) + { + buffer.resize( read ); + data(buffer); + data(QByteArray()); + finished(); + // FIXME: do we need to emit finished() after emitting the end of data()? + } + else + error( ERR_SLAVE_DEFINED, i18n("Read error.") ); + } + } + delete iso; + } +} diff --git a/kioslaves/videodvd/videodvd.desktop b/kioslaves/videodvd/videodvd.desktop new file mode 100644 index 0000000..942e860 --- /dev/null +++ b/kioslaves/videodvd/videodvd.desktop @@ -0,0 +1,48 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Link +URL=videodvd:/ +Icon=dvd_unmount +Name=Video DVD Browser +Name[af]=Video DVD Blaaier +Name[ar]= قارىء القرص المدمج المرئي الرقمي DVD +Name[bg]=Браузър за видео DVD +Name[br]=Furcher DVD Video +Name[ca]=Navegador de DVDs de vídeo +Name[cs]=Prohlížeč Video DVD +Name[da]=Video-dvd browser +Name[de]=Video-DVD-Browser +Name[el]=Περιηγητής Video DVD +Name[eo]=Videa DVD foliumilo +Name[es]=Navegador de DVD de vídeo +Name[et]=Video DVD sirvija +Name[fa]= مرورگر دی وی دی ویدئویی +Name[fi]=Video-dvd selain +Name[fr]=Navigateur de DVD +Name[gl]=Explorador de Vídeo DVD +Name[hu]=Video DVD-böngésző +Name[is]=Vídeó DVD flakkari +Name[it]=Navigatore DVD video +Name[ja]=ビデオ DVD ブラウザ +Name[ka]=ვიდეო DVD-ის ბროუზერი +Name[km]=កម្មវិធី​រុករក​ឌីវីឌី​វីដេអូ +Name[lt]=Video DVD naršyklė +Name[nds]=Video-DVD-Kieker +Name[nn]=Film-DVD-lesar +Name[pa]=ਵੀਡਿਓ DVD ਝਲਕਾਰਾ +Name[pl]=Przeglądarka płyt DVD Video +Name[pt]=Navegador de DVD de Vídeo +Name[pt_BR]=Navegador de DVD de Vídeo +Name[sk]=Video DVD prehliadač +Name[sr]=Прегледач видео DVD-а +Name[sr@Latn]=Pregledač video DVD-a +Name[sv]=Video-dvd bläddrare +Name[tr]=Görüntü DVD'si Gezgini +Name[uk]=Навігатор відео-DVD +Name[uz]=Video-DVD brauzeri +Name[uz@cyrillic]=Видео-DVD браузери +Name[zh_CN]=视频 DVD 浏览器 +Name[zh_TW]=Video DVD 瀏覽器 +Open=false +X-KDE-TreeModule=Directory +X-KDE-KonqSidebarModule=konqsidebar_tree diff --git a/kioslaves/videodvd/videodvd.h b/kioslaves/videodvd/videodvd.h new file mode 100644 index 0000000..e27e54f --- /dev/null +++ b/kioslaves/videodvd/videodvd.h @@ -0,0 +1,55 @@ +/* + * + * $Id: sourceheader 380067 2005-01-19 13:03:46Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _videodvd_H_ +#define _videodvd_H_ + +#include +#include + +#include +#include +#include + +class QCString; +class K3bIso9660Entry; +class K3bIso9660; +namespace K3bDevice +{ + class DeviceManager; +} + +class kio_videodvdProtocol : public KIO::SlaveBase +{ +public: + kio_videodvdProtocol(const QCString &pool_socket, const QCString &app_socket); + ~kio_videodvdProtocol(); + + void mimetype( const KURL& url ); + void stat( const KURL& url ); + void get( const KURL& url ); + void listDir( const KURL& url ); + +private: + K3bIso9660* openIso( const KURL&, QString& plainIsoPath ); + KIO::UDSEntry createUDSEntry( const K3bIso9660Entry* e ) const; + void listVideoDVDs(); + + static K3bDevice::DeviceManager* s_deviceManager; + static int s_instanceCnt; +}; + +#endif diff --git a/kioslaves/videodvd/videodvd.protocol b/kioslaves/videodvd/videodvd.protocol new file mode 100644 index 0000000..6337443 --- /dev/null +++ b/kioslaves/videodvd/videodvd.protocol @@ -0,0 +1,52 @@ +[Protocol] +exec=kio_videodvd +protocol=videodvd +input=none +output=filesystem +reading=true +listing=Name,Type,Size,Date +Icon=dvd_unmount +Class=:local +Description=A kioslave that allows files to be copied from a Video DVD (including decryption) +Description[af]='n 'Kioslave' wat jou toelaat om lêers vanaf 'n Video DVD te kopiëer. Dit doen ook die nodige dekripsie. +Description[ar]= يسمح هذا ال-kioslave بنسخ الملفات من قرص مدمج مرئي رقمي DVD ( بما فيه فك التشفير ) +Description[bg]=kioslave, позволяващ ви да копирате файлове от видео DVD (включително разшифроването) +Description[bn]=একটি কে-আই-ও স্লেভ যেটি একটি ভিডিও ডিভিডি থেকে ফাইল কপি করতে অনুমতিদেয় (ডিক্রিপশন সহ) +Description[ca]=Un kioslave que permet que es copiïn fitxers des d'un DVD de vídeo (incloent el desxifrat) +Description[cs]=Kioslave umožňující kopírování video DVD (včetně dekódování) +Description[da]=En kioslave som gør det muligt at kopiere filer fra en video-dvd (inklusive afkodning) +Description[de]=Ein-/Ausgabemodul, mit dem man Dateien von einer Video-DVD kopieren kann (inkl. Entschlüsselung) +Description[el]=Ένα kioslave που επιτρέπει την αντιγραφή αρχείων από ένα DVD βίντεο (δυνατότητα αποκρυπτογράφησης) +Description[eo]=Kioslave kiu permesas kopii dosierojn el videa DVD (inklude malĉifro) +Description[es]=Un kioslave que permite copiar archivos de un DVD de vídeo (incluye descifrado) +Description[et]=KIO-moodul, mis võimaldab kopeerida faile video DVD-lt (vajadusel dekrüpteerib) +Description[fa]=یک kioslave که اجازه می‌دهد پرونده‌ها از یک دی وی دی ویدئویی )شامل سرگشایی( رونوشت شوند +Description[fi]=Kioslave-palvelu, joka mahdollistaa tiedostojen purkamisen dvd-levyltä. +Description[fr]=Un kioslave qui permet de copier des fichiers depuis un DVD Vidéo (incluant le déchiffrement) +Description[gl]=Un kioslave que permite copiar ficheiros dun Video DVD (incluindo descifrar) +Description[he]=עבד קלט/פלט של KDE המאפשר לקבצים להיות מועתקים מתקליטור וידאו של DVD (כולל פענוח) +Description[hu]=Kioslave, amellyel fájlokat lehet másolni Video DVD-ről (dekódolással együtt) +Description[is]=Kioslave sem leyfir afritun af skrám frá vídeó DVD (með afkóðun) +Description[it]=Un kioslave che permette ai file di essere copiati da un DVD video (incluso decifrazione) +Description[ja]=ビデオ DVD からファイルをコピーすることを可能にする kioslave (暗号解除も含む) +Description[ka]=Kioslave, რომელიც იძლევა Video DVD-დან ასლის ფაილების მიღების საშუელებას (გაშიფრვასთან ერთად) +Description[km]=​kioslave ដែល​អនុញ្ញាត​ឲ្យ​ចម្លង​​ឯកសារ​ពី​ឌីវីឌី​វីដេអូ(រួម​ទាំង​ការ​ឌិគ្រីប) +Description[lt]=Priedas (kioslave) leidžiantis kopijuoti bylas iš Video DVD (taip pat ir atšifruoti) +Description[ms]=kioslave yang membenarkan fail untuk disalin dari DVD Video (termasuk nyahenkripsi) +Description[nb]=En kioslave som gjør det mulig å kopiere filer fra en Video-DVD (medregnet dekryptering) +Description[nds]=En In-/Utgaavmoduul, mit dat sik Dateien vun en Video-DVD koperen laat (ok mit Opslöteln) +Description[nl]=Een kioslave waarmee u bestanden van een video-dvd kunt kopiëren (inclusief versleuteling) +Description[nn]=Ein kioslave som gjer det mogleg å kopiera filer frå ein film-DVD (inkludert kryptering) +Description[pa]=ਇੱਕ kioslave ਹੈ, ਜੋ ਕਿ ਫਾਇਲਾਂ ਨੂੰ ਇੱਕ DVD (ਡਿਸਕਰਿਪਸ਼ਨ ਸਮੇ) ਤੋਂ ਨਕਲ ਕਰਨ ਲਈ ਸਹਾਇਕ ਹੈ +Description[pl]=Wtyczka protokołu pozwalająca kopiować pliki z płyt DVD Video (łącznie z odszyfrowywaniem) +Description[pt]=Um 'kioslave' que permite copiar ficheiros de um DVD Vídeo (incluindo decifrar) +Description[pt_BR]=Um kioslave que permite que arquivos sejam copiados de um DVD de Vídeo (incluindo a quebra da proteção) +Description[ru]=Позволяет копировать файлы с Video DVD (с дешифровкой) +Description[sk]=kioslave, ktorý umožňuje kopírovať súbory z Video DVD (vrátane dešifrovania) +Description[sr]=kioslave који омогућава копирање фајлова са видео DVD-а (укључујући дешифровање) +Description[sr@Latn]=kioslave koji omogućava kopiranje fajlova sa video DVD-a (uključujući dešifrovanje) +Description[sv]=En I/O-slav som gör det möjligt att kopiera filer från en video-dvd (inklusive avkodning) +Description[tr]= Bir Görüntü DVD'sinden dosyaların kopyalanmasını (ve kodunun çözülmesini) sağlayan kioslave +Description[uk]=Підлеглий В/В, який дає змогу копіювати файли з Відео DVD (включаючи розшифрування) +Description[zh_CN]=允许从视频 DVD(包括加密影碟)中复制文件的 kioslave +Description[zh_TW]=允許直接從 Video DVD 複製檔案的 kioslave(會自動解密) diff --git a/libk3b/Makefile.am b/libk3b/Makefile.am new file mode 100644 index 0000000..4c74f7d --- /dev/null +++ b/libk3b/Makefile.am @@ -0,0 +1,28 @@ +if include_videodvdrip +VIDEODVDDIR = videodvd +VIDEODVDLIB = videodvd/libvideodvd.la +endif + + +lib_LTLIBRARIES = libk3b.la + +libk3b_la_SOURCES = dummy.cpp + +libk3b_la_LIBADD = core/libk3bcore.la \ + cddb/libcddb.la \ + projects/libk3bproject.la \ + plugin/libk3bplugin.la \ + tools/libk3btools.la \ + jobs/libjobs.la \ + $(VIDEODVDLIB) \ + ../libk3bdevice/libk3bdevice.la + +libk3b_la_LDFLAGS = $(all_libraries) -version-info 3:0:0 -no-undefined + +SUBDIRS = core plugin tools projects cddb jobs $(VIDEODVDDIR) + +#pkgconfigdir = $(libdir)/pkgconfig +#pkgconfig_DATA = libk3b.pc + +messages: + $(XGETTEXT) `find -name "*.cpp" -o -name "*.h"` -o $(podir)/libk3b.pot diff --git a/libk3b/README b/libk3b/README new file mode 100644 index 0000000..a1ba273 --- /dev/null +++ b/libk3b/README @@ -0,0 +1,29 @@ +libk3b +========================= + +This is the k3b library which provides a lot of CD/DVD writing classes. + +If you want to use it please be aware that the API is far from stable and +there will be no binary compatibility (or even source compatibility) before +K3b 1.0. + +But you are welcome to help fix the API and improve it whereever it is needed. + + +Usage +========================== + +Just a very basic scetch how to create an audio cd: + +1. create a k3bcore instance (this provides all the stuff that is needed by the lib) +1.1 K3bCore::init() to initialize the core. + +2. create a K3bAudioDoc object and add urls to it + +3. create a K3bJobHandler derived class (for example a widget which displays the progress) + +4. call K3bAudioDoc::newBurnJob or create a K3bAudioJob manually. + +5. modify the doc's settings. + +6. call K3bAudioJob::start() to start the burning process. diff --git a/libk3b/cddb/Makefile.am b/libk3b/cddb/Makefile.am new file mode 100644 index 0000000..e73c5ce --- /dev/null +++ b/libk3b/cddb/Makefile.am @@ -0,0 +1,9 @@ +AM_CPPFLAGS = -I$(srcdir)/../core -I$(srcdir)/../../libk3bdevice -I$(srcdir)/../../src $(all_includes) + +METASOURCES = AUTO + +noinst_LTLIBRARIES = libcddb.la + +libcddb_la_SOURCES = k3bcddbquery.cpp k3bcddb.cpp k3bcddbresult.cpp k3bcddbhttpquery.cpp k3bcddbpquery.cpp k3bcddblocalquery.cpp k3bcddbsubmit.cpp k3bcddblocalsubmit.cpp k3bcddbmultientriesdialog.cpp + +include_HEADERS = k3bcddb.h k3bcddbresult.h diff --git a/libk3b/cddb/k3bcddb.cpp b/libk3b/cddb/k3bcddb.cpp new file mode 100644 index 0000000..a0e4fe1 --- /dev/null +++ b/libk3b/cddb/k3bcddb.cpp @@ -0,0 +1,280 @@ +/* + * + * $Id: k3bcddb.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "k3bcddb.h" +#include "k3bcddbhttpquery.h" +#include "k3bcddbpquery.h" +#include "k3bcddblocalquery.h" +#include "k3bcddblocalsubmit.h" + +#include +#include +#include "k3bcddbmultientriesdialog.h" + + +K3bCddb::K3bCddb( QObject* parent, const char* name ) + : QObject( parent, name ) +{ + m_httpQuery = 0; + m_cddbpQuery = 0; + m_localQuery = 0; + m_localSubmit = 0; + + m_lastUsedQuery = 0; +} + + +K3bCddb::~K3bCddb() +{ +} + + +void K3bCddb::readConfig( KConfig* c ) +{ + c->setGroup( "Cddb" ); + + m_bRemoteCddbQuery = c->readBoolEntry( "use remote cddb", true ); + m_bLocalCddbQuery = c->readBoolEntry( "use local cddb query", false ); + + // old config <= 0.7.3 + QStringList cddbpServer = c->readListEntry( "cddbp server" ); + QStringList httpServer = c->readListEntry( "http server" ); + + // new config + m_cddbServer = c->readListEntry( "cddb server" ); + + m_localCddbDirs = c->readPathListEntry( "local cddb dirs" ); + + m_bUseManualCgiPath = c->readBoolEntry( "use manual cgi path", false ); + m_cgiPath = c->readEntry( "cgi path", "/~cddb/cddb.cgi" ); + + if( m_localCddbDirs.isEmpty() ) + m_localCddbDirs.append( "~/.cddb/" ); + + // old config <= 0.7.3 + if( !httpServer.isEmpty() ) { + for( QStringList::iterator it = httpServer.begin(); it != httpServer.end(); ++it ) { + m_cddbServer.append( "Http " + *it ); + } + } + if( !cddbpServer.isEmpty() ) { + for( QStringList::iterator it = cddbpServer.begin(); it != cddbpServer.end(); ++it ) { + m_cddbServer.append( "Cddbp " + *it ); + } + } + + if( m_cddbServer.isEmpty() ) + m_cddbServer.append( "Http freedb2.org:80" ); +} + + +void K3bCddb::query( const K3bDevice::Toc& toc ) +{ + m_toc = toc; + + if( m_bLocalCddbQuery ) { + m_iCurrentQueriedLocalDir = 0; + QTimer::singleShot( 0, this, SLOT(localQuery()) ); + } + else if( m_bRemoteCddbQuery ) { + m_iCurrentQueriedServer = 0; + QTimer::singleShot( 0, this, SLOT(remoteQuery()) ); + } + else { + QTimer::singleShot( 0, this, SLOT(slotNoEntry()) ); + } +} + + +void K3bCddb::slotNoEntry() +{ + emit queryFinished( K3bCddbQuery::NO_ENTRY_FOUND ); +} + + +void K3bCddb::remoteQuery() +{ + K3bCddbQuery* q = getQuery( m_cddbServer[m_iCurrentQueriedServer] ); + q->query(m_toc); +} + + +void K3bCddb::slotMultibleMatches( K3bCddbQuery* query ) +{ + K3bCddbResultHeader hdr = K3bCddbMultiEntriesDialog::selectCddbEntry( query, 0 ); + if( !hdr.discid.isEmpty() ) + query->queryMatch( hdr ); + else + emit queryFinished( K3bCddbQuery::CANCELED ); +} + + +void K3bCddb::slotQueryFinished( K3bCddbQuery* query ) +{ + m_lastUsedQuery = query; + + if( query->error() == K3bCddbQuery::SUCCESS ) { + m_lastResult = m_lastUsedQuery->result(); + + // make sure the result has the requested discid since otherwise local saving does not make much sense + m_lastResult.discid = QString::number( m_toc.discId(), 16 ).rightJustify( 8, '0' ); + + emit queryFinished( K3bCddbQuery::SUCCESS ); + } + else if( query == m_localQuery ) { + m_iCurrentQueriedLocalDir++; + if( m_iCurrentQueriedLocalDir < m_localCddbDirs.size() ) + localQuery(); + else if( m_bRemoteCddbQuery ) { + m_iCurrentQueriedServer = 0; + remoteQuery(); + } + else { + emit queryFinished( query->error() ); + } + } + else { + m_iCurrentQueriedServer++; + if( m_iCurrentQueriedServer < m_cddbServer.size() ) { + remoteQuery(); + } + else { + emit queryFinished( query->error() ); + } + } +} + + +K3bCddbQuery* K3bCddb::getQuery( const QString& s ) +{ + QStringList buf = QStringList::split( ":", s.mid( s.find(" ")+1 ) ); + QString server = buf[0]; + int port = buf[1].toInt(); + + if( s.startsWith("Http") ) { + if( !m_httpQuery ) { + m_httpQuery = new K3bCddbHttpQuery( this ); + connect( m_httpQuery, SIGNAL(infoMessage(const QString&)), + this, SIGNAL(infoMessage(const QString&)) ); + connect( m_httpQuery, SIGNAL(queryFinished(K3bCddbQuery*)), + this, SLOT(slotQueryFinished(K3bCddbQuery*)) ); + connect( m_httpQuery, SIGNAL(inexactMatches(K3bCddbQuery*)), + this, SLOT(slotMultibleMatches(K3bCddbQuery*)) ); + } + + m_httpQuery->setServer( server, port ); + m_httpQuery->setCgiPath( m_bUseManualCgiPath ? m_cgiPath : QString::fromLatin1("/~cddb/cddb.cgi") ); + + return m_httpQuery; + } + else { + if( !m_cddbpQuery ) { + m_cddbpQuery = new K3bCddbpQuery( this ); + connect( m_cddbpQuery, SIGNAL(infoMessage(const QString&)), + this, SIGNAL(infoMessage(const QString&)) ); + connect( m_cddbpQuery, SIGNAL(queryFinished(K3bCddbQuery*)), + this, SLOT(slotQueryFinished(K3bCddbQuery*)) ); + connect( m_cddbpQuery, SIGNAL(inexactMatches(K3bCddbQuery*)), + this, SLOT(slotMultibleMatches(K3bCddbQuery*)) ); + } + + m_cddbpQuery->setServer( server, port ); + + return m_cddbpQuery; + } +} + + +void K3bCddb::localQuery() +{ + if( !m_localQuery ) { + m_localQuery = new K3bCddbLocalQuery( this ); + connect( m_localQuery, SIGNAL(infoMessage(const QString&)), + this, SIGNAL(infoMessage(const QString&)) ); + connect( m_localQuery, SIGNAL(queryFinished(K3bCddbQuery*)), + this, SLOT(slotQueryFinished(K3bCddbQuery*)) ); + connect( m_localQuery, SIGNAL(inexactMatches(K3bCddbQuery*)), + this, SLOT(slotMultibleMatches(K3bCddbQuery*)) ); + } + + m_localQuery->setCddbDir( m_localCddbDirs[m_iCurrentQueriedLocalDir] ); + + m_localQuery->query( m_toc ); +} + + +QString K3bCddb::errorString() const +{ + if( !m_lastUsedQuery ) + return "no query"; + + switch( m_lastUsedQuery->error() ) { + case K3bCddbQuery::SUCCESS: + return i18n("Found freedb entry."); + case K3bCddbQuery::NO_ENTRY_FOUND: + return i18n("No entry found"); + case K3bCddbQuery::CONNECTION_ERROR: + return i18n("Error while connecting to host."); + case K3bCddbQuery::WORKING: + return i18n("Working..."); + case K3bCddbQuery::QUERY_ERROR: + case K3bCddbQuery::READ_ERROR: + case K3bCddbQuery::FAILURE: + default: + return i18n("Communication error."); + } +} + + +const K3bCddbResultEntry& K3bCddb::result() const +{ + // return m_lastUsedQuery->result(); + return m_lastResult; +} + + +void K3bCddb::saveEntry( const K3bCddbResultEntry& entry ) +{ + if( !m_localSubmit ) { + m_localSubmit = new K3bCddbLocalSubmit( this ); + connect( m_localSubmit, SIGNAL(submitFinished(K3bCddbSubmit*)), + this, SLOT(slotSubmitFinished(K3bCddbSubmit*)) ); + } + + m_localSubmit->setCddbDir( m_localCddbDirs[0] ); + + m_localSubmit->submit( entry ); +} + + +void K3bCddb::slotSubmitFinished( K3bCddbSubmit* s ) +{ + emit submitFinished( s->error() == K3bCddbSubmit::SUCCESS ); +} + +#include "k3bcddb.moc" + diff --git a/libk3b/cddb/k3bcddb.h b/libk3b/cddb/k3bcddb.h new file mode 100644 index 0000000..86b67c5 --- /dev/null +++ b/libk3b/cddb/k3bcddb.h @@ -0,0 +1,103 @@ +/* + * + * $Id: k3bcddb.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDB_H +#define K3BCDDB_H + +#include +#include +#include + +#include + +#include "k3bcddbresult.h" +#include "k3b_export.h" + +class KConfig; +class K3bCddbQuery; +class K3bCddbHttpQuery; +class K3bCddbpQuery; +class K3bCddbLocalQuery; +class K3bCddbSubmit; +class K3bCddbLocalSubmit; + + +class LIBK3B_EXPORT K3bCddb : public QObject +{ + Q_OBJECT + + public: + K3bCddb( QObject* parent = 0, const char* name = 0 ); + ~K3bCddb(); + + QString errorString() const; + + /** + * Do NOT call this before queryResult has + * been emitted + */ + const K3bCddbResultEntry& result() const; + + public slots: + /** query a cd and connect to the queryFinished signal */ + void query( const K3bDevice::Toc& ); + void readConfig( KConfig* c ); + void saveEntry( const K3bCddbResultEntry& ); + + signals: + void queryFinished( int error ); + void submitFinished( bool success ); + void infoMessage( const QString& ); + + private slots: + void localQuery(); + void remoteQuery(); + void slotQueryFinished( K3bCddbQuery* ); + void slotSubmitFinished( K3bCddbSubmit* ); + void slotMultibleMatches( K3bCddbQuery* ); + void slotNoEntry(); + + private: + K3bCddbQuery* getQuery( const QString& ); + + K3bCddbHttpQuery* m_httpQuery; + K3bCddbpQuery* m_cddbpQuery; + K3bCddbLocalQuery* m_localQuery; + K3bCddbLocalSubmit* m_localSubmit; + + K3bDevice::Toc m_toc; + unsigned int m_iCurrentQueriedServer; + unsigned int m_iCurrentQueriedLocalDir; + + const K3bCddbQuery* m_lastUsedQuery; + K3bCddbResultEntry m_lastResult; + + // config + QStringList m_cddbServer; + QString m_proxyServer; + int m_proxyPort; + QString m_cgiPath; + bool m_bUseProxyServer; + bool m_bUseKdeSettings; + QStringList m_localCddbDirs; + bool m_bSaveCddbEntriesLocally; + bool m_bUseManualCgiPath; + bool m_bRemoteCddbQuery; + bool m_bLocalCddbQuery; +}; + + +#endif diff --git a/libk3b/cddb/k3bcddbhttpquery.cpp b/libk3b/cddb/k3bcddbhttpquery.cpp new file mode 100644 index 0000000..a453c3e --- /dev/null +++ b/libk3b/cddb/k3bcddbhttpquery.cpp @@ -0,0 +1,233 @@ +/* + * + * $Id: k3bcddbhttpquery.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include "k3bcddbhttpquery.h" + +#include "k3bcddbresult.h" + +#include +#include +#include + +#include +#include +#include +#include + + +K3bCddbHttpQuery::K3bCddbHttpQuery( QObject* parent, const char* name ) + : K3bCddbQuery( parent, name ) +{ + m_server = "freedb.org"; + m_port = 80; + m_cgiPath = "/~cddb/cddb.cgi"; +} + + +K3bCddbHttpQuery::~K3bCddbHttpQuery() +{ +} + + +void K3bCddbHttpQuery::doQuery() +{ + setError( WORKING ); + m_state = QUERY; + + performCommand( queryString() ); +} + + +void K3bCddbHttpQuery::doMatchQuery() +{ + setError( WORKING ); + m_state = READ; + m_parsingBuffer.truncate(0); + + performCommand( QString( "cddb read %1 %2").arg( header().category ).arg( header().discid ) ); +} + + +void K3bCddbHttpQuery::performCommand( const QString& cmd ) +{ + KURL url; + url.setProtocol( "http" ); + url.setHost( m_server ); + url.setPort( m_port ); + url.setPath( m_cgiPath ); + + url.addQueryItem( "cmd", cmd ); + url.addQueryItem( "hello", handshakeString() ); + url.addQueryItem( "proto", "6" ); + + m_data.truncate(0); + + kdDebug() << "(K3bCddbHttpQuery) getting url: " << url.prettyURL() << endl; + + KIO::TransferJob* job = KIO::get( url, false, false ); + + if( !job ) { + setError( CONNECTION_ERROR ); + emit infoMessage( i18n("Could not connect to host %1").arg(m_server) ); + emitQueryFinished(); + return; + } + + connect( job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotData(KIO::Job*, const QByteArray&)) ); + connect( job, SIGNAL(result(KIO::Job*)), + SLOT(slotResult(KIO::Job*)) ); +} + + + +void K3bCddbHttpQuery::slotData( KIO::Job*, const QByteArray& data ) +{ + if( data.size() ) { + QDataStream stream( m_data, IO_WriteOnly | IO_Append ); + stream.writeRawBytes( data.data(), data.size() ); + } +} + + +void K3bCddbHttpQuery::slotResult( KIO::Job* job ) +{ + if( job->error() ) { + emit infoMessage( job->errorString() ); + setError( CONNECTION_ERROR ); + emitQueryFinished(); + return; + } + + QStringList lines = QStringList::split( "\n", QString::fromUtf8( m_data.data(), m_data.size() ) ); + + for( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { + QString line = *it; + + // kdDebug() << "(K3bCddbHttpQuery) line: " << line << endl; + + switch( m_state ) { + + case QUERY: + if( getCode( line ) == 200 ) { + // parse exact match and send a read command + K3bCddbResultHeader header; + parseMatchHeader( line.mid(4), header ); + + queryMatch( header ); + } + + else if( getCode( line ) == 210 ) { + // TODO: perhaps add an "exact" field to K3bCddbEntry + kdDebug() << "(K3bCddbHttpQuery) Found multiple exact matches" << endl; + + emit infoMessage( i18n("Found multiple exact matches") ); + + m_state = QUERY_DATA; + } + + else if( getCode( line ) == 211 ) { + kdDebug() << "(K3bCddbHttpQuery) Found inexact matches" << endl; + + emit infoMessage( i18n("Found inexact matches") ); + + m_state = QUERY_DATA; + } + + else if( getCode( line ) == 202 ) { + kdDebug() << "(K3bCddbHttpQuery) no match found" << endl; + emit infoMessage( i18n("No match found") ); + setError(NO_ENTRY_FOUND); + m_state = FINISHED; + emitQueryFinished(); + return; + } + + else { + kdDebug() << "(K3bCddbHttpQuery) Error while querying: " << line << endl; + emit infoMessage( i18n("Error while querying") ); + setError(QUERY_ERROR); + m_state = FINISHED; + emitQueryFinished(); + return; + } + break; + + case QUERY_DATA: + if( line.startsWith( "." ) ) { + // finished query + // go on reading + + + // here we have the inexact matches headers and should emit the + // inexactMatches signal + emit inexactMatches( this ); + } + else { + kdDebug() << "(K3bCddbHttpQuery) inexact match: " << line << endl; + + // create a new resultHeader + K3bCddbResultHeader header; + parseMatchHeader( line, header ); + m_inexactMatches.append(header); + } + break; + + case READ: + if( getCode( line ) == 210 ) { + + // we just start parsing the read data + m_state = READ_DATA; + } + + else { + emit infoMessage( i18n("Could not read match") ); + setError(READ_ERROR); + m_state = FINISHED; + emitQueryFinished(); + return; + } + break; + + + case READ_DATA: + + // kdDebug() << "parsing line: " << line << endl; + + if( line.startsWith( "." ) ) { + + kdDebug() << "(K3bCddbHttpQuery query finished." << endl; + + QTextStream strStream( m_parsingBuffer, IO_ReadOnly ); + parseEntry( strStream, result() ); + + setError(SUCCESS); + m_state = FINISHED; + emitQueryFinished(); + return; + } + + else { + m_parsingBuffer.append(line + "\n"); + } + break; + } + } +} + + +#include "k3bcddbhttpquery.moc" diff --git a/libk3b/cddb/k3bcddbhttpquery.h b/libk3b/cddb/k3bcddbhttpquery.h new file mode 100644 index 0000000..b1e544e --- /dev/null +++ b/libk3b/cddb/k3bcddbhttpquery.h @@ -0,0 +1,64 @@ +/* + * + * $Id: k3bcddbhttpquery.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDB_HTTP_QUERY_H +#define K3BCDDB_HTTP_QUERY_H + +#include "k3bcddbquery.h" +#include "k3bcddbresult.h" + +#include + +namespace KIO { + class Job; +} + +class K3bCddbHttpQuery : public K3bCddbQuery +{ + Q_OBJECT + + public: + K3bCddbHttpQuery( QObject* parent = 0, const char* name = 0 ); + ~K3bCddbHttpQuery(); + + public slots: + void setServer( const QString& s, int port = 80 ) { m_server = s; m_port = port; } + void setCgiPath( const QString& p ) { m_cgiPath = p; } + + protected slots: + void doQuery(); + void doMatchQuery(); + void slotResult( KIO::Job* ); + void slotData( KIO::Job*, const QByteArray& data ); + + private: + void performCommand( const QString& ); + + enum State { QUERY, QUERY_DATA, READ, READ_DATA, FINISHED }; + + int m_state; + QString m_server; + int m_port; + QString m_cgiPath; + + QString m_currentlyConnectingServer; + + QByteArray m_data; + QString m_parsingBuffer; +}; + +#endif + diff --git a/libk3b/cddb/k3bcddblocalquery.cpp b/libk3b/cddb/k3bcddblocalquery.cpp new file mode 100644 index 0000000..b3a1264 --- /dev/null +++ b/libk3b/cddb/k3bcddblocalquery.cpp @@ -0,0 +1,129 @@ +/* + * + * $Id: k3bcddblocalquery.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bcddblocalquery.h" + +#include +#include +#include + +#include +#include +#include + + +K3bCddbLocalQuery::K3bCddbLocalQuery( QObject* parent , const char* name ) + : K3bCddbQuery( parent, name ) +{ +} + + +K3bCddbLocalQuery::~K3bCddbLocalQuery() +{ +} + + +void K3bCddbLocalQuery::doQuery() +{ + emit infoMessage( i18n("Searching entry in %1").arg( m_cddbDir ) ); + kapp->processEvents(); //BAD! + + QString path = preparePath( m_cddbDir ); + + kdDebug() << "(K3bCddbLocalQuery) searching in dir " << path << " for " + << QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ) << endl; + + for( QStringList::const_iterator it = categories().begin(); + it != categories().end(); ++it ) { + + QString file = path + *it + "/" + QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ); + + if( QFile::exists( file ) ) { + // found file + + QFile f( file ); + if( !f.open( IO_ReadOnly ) ) { + kdDebug() << "(K3bCddbLocalQuery) Could not open file" << endl; + } + else { + QTextStream t( &f ); + + K3bCddbResultEntry entry; + parseEntry( t, entry ); + K3bCddbResultHeader header; + header.discid = QString::number( toc().discId(), 16 ).rightJustify( 8, '0' ); + header.category = *it; + header.title = entry.cdTitle; + header.artist = entry.cdArtist; + m_inexactMatches.append(header); + } + } + else { + kdDebug() << "(K3bCddbLocalQuery) Could not find local entry in category " << *it << endl; + } + } + + if( m_inexactMatches.count() > 0 ) { + setError( SUCCESS ); + if( m_inexactMatches.count() == 1 ) { + queryMatch( m_inexactMatches.first() ); + } + else { + emit inexactMatches( this ); + } + } + else { + setError( NO_ENTRY_FOUND ); + emit queryFinished( this ); + } +} + + +void K3bCddbLocalQuery::doMatchQuery() +{ + QString path = preparePath( m_cddbDir ) + header().category + "/" + header().discid; + + QFile f( path ); + if( !f.open( IO_ReadOnly ) ) { + kdDebug() << "(K3bCddbLocalQuery) Could not open file" << endl; + setError( READ_ERROR ); + } + else { + QTextStream t( &f ); + + parseEntry( t, result() ); + result().discid = header().discid; + result().category = header().category; + setError( SUCCESS ); + } + emit queryFinished( this ); +} + + +QString K3bCddbLocalQuery::preparePath( const QString& p ) +{ + QString path = p; + if( path.startsWith( "~" ) ) + path.replace( 0, 1, QDir::homeDirPath() ); + else if( !path.startsWith( "/" ) ) + path.prepend( QDir::homeDirPath() ); + if( path[path.length()-1] != '/' ) + path.append( "/" ); + + return path; +} + +#include "k3bcddblocalquery.moc" diff --git a/libk3b/cddb/k3bcddblocalquery.h b/libk3b/cddb/k3bcddblocalquery.h new file mode 100644 index 0000000..d68d379 --- /dev/null +++ b/libk3b/cddb/k3bcddblocalquery.h @@ -0,0 +1,48 @@ +/* + * + * $Id: k3bcddblocalquery.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#ifndef K3BCDDB_LOCAL_QUERY_H +#define K3BCDDB_LOCAL_QUERY_H + +#include "k3bcddbquery.h" +#include "k3bcddbresult.h" + +#include + + +class K3bCddbLocalQuery : public K3bCddbQuery +{ + Q_OBJECT + + public: + K3bCddbLocalQuery( QObject* parent = 0, const char* name = 0 ); + ~K3bCddbLocalQuery(); + + public slots: + void setCddbDir( const QString& dir ) { m_cddbDir = dir; } + + protected: + void doQuery(); + void doMatchQuery(); + + private: + QString preparePath( const QString& p ); + + QString m_cddbDir; +}; + +#endif diff --git a/libk3b/cddb/k3bcddblocalsubmit.cpp b/libk3b/cddb/k3bcddblocalsubmit.cpp new file mode 100644 index 0000000..f2d1e69 --- /dev/null +++ b/libk3b/cddb/k3bcddblocalsubmit.cpp @@ -0,0 +1,102 @@ +/* + * + * $Id: k3bcddblocalsubmit.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include "k3bcddblocalsubmit.h" + +#include +#include +#include + +#include +#include + + +K3bCddbLocalSubmit::K3bCddbLocalSubmit( QObject* parent, const char* name ) + : K3bCddbSubmit( parent, name ) +{ +} + + +K3bCddbLocalSubmit::~K3bCddbLocalSubmit() +{ +} + + +void K3bCddbLocalSubmit::doSubmit() +{ + QString path = m_cddbDir; + if( path.startsWith( "~" ) ) + path.replace( 0, 1, QDir::homeDirPath() + "/" ); + else if( !path.startsWith( "/" ) ) + path.prepend( QDir::homeDirPath() + "/" ); + if( path[path.length()-1] != '/' ) + path.append( "/" ); + + if( !QFile::exists( path ) && !QDir().mkdir( path ) ) { + kdDebug() << "(K3bCddbLocalSubmit) could not create directory: " << path << endl; + setError( IO_ERROR ); + emit submitFinished( this ); + return; + } + + if( QFile::exists( path ) ) { + // if the category dir does not exists + // create it + + path += resultEntry().category; + + if( !QFile::exists( path ) ) { + if( !QDir().mkdir( path ) ) { + kdDebug() << "(K3bCddbLocalSubmit) could not create directory: " << path << endl; + setError( IO_ERROR ); + emit submitFinished( this ); + return; + } + } + + // we always overwrite existing entries + path += "/" + resultEntry().discid; + QFile entryFile( path ); + if( entryFile.exists() ) { + kdDebug() << "(K3bCddbLocalSubmit) file already exists: " << path << endl; + } + + if( !entryFile.open( IO_WriteOnly ) ) { + kdDebug() << "(K3bCddbLocalSubmit) could not create file: " << path << endl; + setError( IO_ERROR ); + emit submitFinished( this ); + } + else { + kdDebug() << "(K3bCddbLocalSubmit) creating file: " << path << endl; + QTextStream entryStream( &entryFile ); + entryStream.setEncoding( QTextStream::UnicodeUTF8 ); + entryStream << resultEntry().rawData; + entryFile.close(); + + setError( SUCCESS ); + emit submitFinished( this ); + } + } + else { + kdDebug() << "(K3bCddbLocalSubmit) could not find directory: " << path << endl; + setError( IO_ERROR ); + emit infoMessage( i18n("Could not find directory: %1").arg(path) ); + emit submitFinished( this ); + } +} + +#include "k3bcddblocalsubmit.moc" diff --git a/libk3b/cddb/k3bcddblocalsubmit.h b/libk3b/cddb/k3bcddblocalsubmit.h new file mode 100644 index 0000000..8b7ea91 --- /dev/null +++ b/libk3b/cddb/k3bcddblocalsubmit.h @@ -0,0 +1,43 @@ +/* + * + * $Id: k3bcddblocalsubmit.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDB_LOCAL_SUBMIT_H +#define K3BCDDB_LOCAL_SUBMIT_H + +#include "k3bcddbsubmit.h" + +#include + + +class K3bCddbLocalSubmit : public K3bCddbSubmit +{ + Q_OBJECT + + public: + K3bCddbLocalSubmit( QObject* parent = 0, const char* name = 0 ); + ~K3bCddbLocalSubmit(); + + public slots: + void setCddbDir( const QString& dir ) { m_cddbDir = dir; } + + protected slots: + void doSubmit(); + + private: + QString m_cddbDir; +}; + +#endif diff --git a/libk3b/cddb/k3bcddbmultientriesdialog.cpp b/libk3b/cddb/k3bcddbmultientriesdialog.cpp new file mode 100644 index 0000000..094176a --- /dev/null +++ b/libk3b/cddb/k3bcddbmultientriesdialog.cpp @@ -0,0 +1,74 @@ +/* + * + * $Id: k3bcddbmultientriesdialog.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bcddbmultientriesdialog.h" + +#include +#include +#include + +#include +#include + + + +K3bCddbMultiEntriesDialog::K3bCddbMultiEntriesDialog( QWidget* parent, const char* name ) + : KDialogBase( Plain, i18n("CDDB Database Entry"), Ok|Cancel, Ok, parent, name ) +{ + QFrame* frame = plainPage(); + QVBoxLayout* layout = new QVBoxLayout( frame ); + layout->setAutoAdd( true ); + layout->setSpacing( spacingHint() ); + layout->setMargin( 0 ); + + QLabel* infoLabel = new QLabel( i18n("K3b found multiple inexact CDDB entries. Please select one."), frame ); + infoLabel->setAlignment( WordBreak ); + + m_listBox = new KListBox( frame, "list_box"); + + setMinimumSize( 280, 200 ); +} + +K3bCddbResultHeader K3bCddbMultiEntriesDialog::selectCddbEntry( K3bCddbQuery* query, QWidget* parent ) +{ + K3bCddbMultiEntriesDialog d( parent ); + + const QValueList headers = query->getInexactMatches(); + + int i = 1; + for( QValueListConstIterator it = headers.begin(); + it != headers.end(); ++it ) { + d.m_listBox->insertItem( QString::number(i) + " " + + (*it).artist + " - " + + (*it).title + " (" + + (*it).category + ")" ); + ++i; + } + + d.m_listBox->setSelected( 0, true ); + + if( d.exec() == QDialog::Accepted ) + return headers[ d.m_listBox->currentItem() >= 0 ? d.m_listBox->currentItem() : 0 ]; + else + return K3bCddbResultHeader(); +} + + +K3bCddbMultiEntriesDialog::~K3bCddbMultiEntriesDialog(){ +} + + +#include "k3bcddbmultientriesdialog.moc" diff --git a/libk3b/cddb/k3bcddbmultientriesdialog.h b/libk3b/cddb/k3bcddbmultientriesdialog.h new file mode 100644 index 0000000..15cc6f8 --- /dev/null +++ b/libk3b/cddb/k3bcddbmultientriesdialog.h @@ -0,0 +1,48 @@ +/* + * + * $Id: k3bcddbmultientriesdialog.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDBMULTIENTRIESDIALOG_H +#define K3BCDDBMULTIENTRIESDIALOG_H + +#include + +#include "k3bcddbquery.h" +#include "k3bcddbresult.h" + + +class QStringList; +class KListBox; + +/** + *@author Sebastian Trueg + */ +class K3bCddbMultiEntriesDialog : public KDialogBase +{ + Q_OBJECT + + public: + ~K3bCddbMultiEntriesDialog(); + + static K3bCddbResultHeader selectCddbEntry( K3bCddbQuery* query, QWidget* parent = 0 ); + + protected: + K3bCddbMultiEntriesDialog( QWidget* parent = 0, const char* name = 0); + + private: + KListBox *m_listBox; +}; + +#endif diff --git a/libk3b/cddb/k3bcddbpquery.cpp b/libk3b/cddb/k3bcddbpquery.cpp new file mode 100644 index 0000000..fefc8e4 --- /dev/null +++ b/libk3b/cddb/k3bcddbpquery.cpp @@ -0,0 +1,278 @@ +/* + * + * $Id: k3bcddbpquery.cpp 619556 2007-01-03 17:38:12Z trueg $ + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bcddbpquery.h" + +#include +#include +#include + +#include +#include + + + + +K3bCddbpQuery::K3bCddbpQuery( QObject* parent, const char* name ) + :K3bCddbQuery( parent, name ) +{ + m_socket = new QSocket( this ); + m_stream.setDevice( m_socket ); + m_stream.setEncoding( QTextStream::UnicodeUTF8 ); + + connect( m_socket, SIGNAL(connected()), this, SLOT(slotConnected()) ); + connect( m_socket, SIGNAL(hostFound()), this, SLOT(slotHostFound()) ); + connect( m_socket, SIGNAL(connectionClosed()), this, SLOT(slotConnectionClosed()) ); + connect( m_socket, SIGNAL(error(int)), this, SLOT(slotError(int)) ); + connect( m_socket, SIGNAL(readyRead()), this, SLOT(slotReadyRead()) ); +} + + +K3bCddbpQuery::~K3bCddbpQuery() +{ + delete m_socket; +} + +void K3bCddbpQuery::doQuery() +{ + setError( WORKING ); + + m_state = GREETING; + + // connect to the server + + m_socket->connectToHost( m_server, m_port ); + emit infoMessage( i18n("Searching %1 on port %2").arg(m_server).arg(m_port) ); +} + + +void K3bCddbpQuery::doMatchQuery() +{ + // we should still be connected + // TODO: check this + + QString read = QString( "cddb read %1 %2").arg( header().category ).arg( header().discid ); + + m_state = READ; + m_parsingBuffer = ""; + + kdDebug() << "(K3bCddbpQuery) Read: " << read << endl; + + m_stream << read << endl << flush; +} + + +void K3bCddbpQuery::slotHostFound() +{ + emit infoMessage( i18n("Host found") ); +} + + +void K3bCddbpQuery::slotConnected() +{ + emit infoMessage( i18n("Connected") ); +} + + +void K3bCddbpQuery::slotConnectionClosed() +{ + emit infoMessage( i18n("Connection closed") ); + emitQueryFinished(); +} + + +void K3bCddbpQuery::cddbpQuit() +{ + m_state = QUIT; + m_stream << "quit" << endl << flush; +} + + +void K3bCddbpQuery::slotReadyRead() +{ + while( m_socket->canReadLine() ) { + QString line = m_stream.readLine(); + + // kdDebug() << "(K3bCddbpQuery) line: " << line << endl; + + switch( m_state ) { + case GREETING: + if( getCode( line ) == 200 || getCode( line ) == 201) { + emit infoMessage( i18n("OK, read access") ); + m_state = HANDSHAKE; + + m_stream << "cddb hello " << handshakeString() << endl << flush; + } + + else { + emit infoMessage( i18n("Connection refused") ); + setError( CONNECTION_ERROR ); + m_socket->close(); + } + break; + + case HANDSHAKE: + if( getCode( line ) == 200 ) { + emit infoMessage( i18n("Handshake successful") ); + + m_state = PROTO; + + m_stream << "proto 6" << endl << flush; + } + + else { + emit infoMessage( i18n("Handshake failed") ); // server closes connection + setError( CONNECTION_ERROR ); + m_socket->close(); // just to be sure + } + break; + + case PROTO: + { + if( getCode( line ) == 501 ) { + kdDebug() << "(K3bCddbpQuery) illigal protocol level!" << endl; + } + + // just ignore the reply since it's not important for the functionality + m_state = QUERY; + + m_stream << queryString() << endl << flush; + break; + } + + case QUERY: + if( getCode( line ) == 200 ) { + // parse exact match and send a read command + K3bCddbResultHeader header; + parseMatchHeader( line.mid( 4 ), header ); + + emit infoMessage( i18n("Found exact match") ); + + queryMatch( header ); + } + + else if( getCode( line ) == 210 ) { + // TODO: perhaps add an "exact" field to K3bCddbEntry + kdDebug() << "(K3bCddbpQuery) Found multiple exact matches" << endl; + + emit infoMessage( i18n("Found multiple exact matches") ); + + m_state = QUERY_DATA; + } + + else if( getCode( line ) == 211 ) { + kdDebug() << "(K3bCddbpQuery) Found inexact matches" << endl; + + emit infoMessage( i18n("Found inexact matches") ); + + m_state = QUERY_DATA; + } + + else if( getCode( line ) == 202 ) { + kdDebug() << "(K3bCddbpQuery) no match found" << endl; + emit infoMessage( i18n("No match found") ); + setError( NO_ENTRY_FOUND ); + cddbpQuit(); + } + + else { + kdDebug() << "(K3bCddbpQuery) Error while querying: " << line << endl; + emit infoMessage( i18n("Error while querying") ); + setError( QUERY_ERROR ); + cddbpQuit(); + } + break; + + case QUERY_DATA: + if( line.startsWith( "." ) ) { + // finished query + // go on reading + + emit inexactMatches( this ); + return; + } + else { + kdDebug() << "(K3bCddbpQuery) inexact match: " << line << endl; + K3bCddbResultHeader header; + parseMatchHeader( line, header ); + m_inexactMatches.append( header ); + } + break; + + case READ: + if( getCode( line ) == 210 ) { + + // we just start parsing the read data + m_state = READ_DATA; + } + + else { + emit infoMessage( i18n("Could not read match") ); + setError( READ_ERROR ); + cddbpQuit(); + } + break; + + + case READ_DATA: + + // kdDebug() << "(K3bCddbpQuery) parsing line: " << line << endl; + + if( line.startsWith( "." ) ) { + + kdDebug() << "(K3bCddbpQuery) query finished." << endl; + + QTextStream strStream( m_parsingBuffer, IO_ReadOnly ); + parseEntry( strStream, result() ); + + setError( SUCCESS ); + cddbpQuit(); + } + + else { + m_parsingBuffer.append(line + "\n"); + } + break; + + case QUIT: + // no parsing needed + break; + } + } +} + + +void K3bCddbpQuery::slotError( int e ) +{ + switch(e) { + case QSocket::ErrConnectionRefused: + kdDebug() << i18n("Connection to %1 refused").arg( m_server ) << endl; + emit infoMessage( i18n("Connection to %1 refused").arg( m_server ) ); + break; + case QSocket::ErrHostNotFound: + kdDebug() << i18n("Could not find host %1").arg( m_server ) << endl; + emit infoMessage( i18n("Could not find host %1").arg( m_server ) ); + break; + case QSocket::ErrSocketRead: + kdDebug() << i18n("Error while reading from %1").arg( m_server ) << endl; + emit infoMessage( i18n("Error while reading from %1").arg( m_server ) ); + break; + } + + m_socket->close(); + emitQueryFinished(); +} + +#include "k3bcddbpquery.moc" diff --git a/libk3b/cddb/k3bcddbpquery.h b/libk3b/cddb/k3bcddbpquery.h new file mode 100644 index 0000000..78fe5df --- /dev/null +++ b/libk3b/cddb/k3bcddbpquery.h @@ -0,0 +1,62 @@ +/* + * + * $Id: k3bcddbpquery.h 619556 2007-01-03 17:38:12Z trueg $ + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDBP_QUERY_H +#define K3BCDDBP_QUERY_H + +#include "k3bcddbquery.h" +#include "k3bcddbresult.h" + +#include +#include +#include + +class QSocket; + +class K3bCddbpQuery : public K3bCddbQuery +{ + Q_OBJECT + + public: + K3bCddbpQuery( QObject* parent = 0, const char* name = 0 ); + ~K3bCddbpQuery(); + + public slots: + void setServer( const QString& s, int port = 8080 ) { m_server = s; m_port = port; } + + protected slots: + void slotHostFound(); + void slotConnected(); + void slotConnectionClosed(); + void slotReadyRead(); + void slotError( int e ); + void doQuery(); + void doMatchQuery(); + + private: + void cddbpQuit(); + enum State { GREETING, HANDSHAKE, PROTO, QUERY, QUERY_DATA, READ, READ_DATA, QUIT }; + + int m_state; + QString m_server; + int m_port; + + QSocket* m_socket; + QTextStream m_stream; + + QString m_parsingBuffer; +}; + +#endif diff --git a/libk3b/cddb/k3bcddbquery.cpp b/libk3b/cddb/k3bcddbquery.cpp new file mode 100644 index 0000000..783f9a4 --- /dev/null +++ b/libk3b/cddb/k3bcddbquery.cpp @@ -0,0 +1,275 @@ +/* + * + * $Id: k3bcddbquery.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include "k3bcddbquery.h" + +#include "k3bcddbresult.h" + +#include +#include +#include +#include + + +#include +#include +#include +#include + +#include + + + + +K3bCddbQuery::K3bCddbQuery( QObject* parent, const char* name ) + : QObject(parent, name) +{ + m_bQueryFinishedEmited = false; +} + + +K3bCddbQuery::~K3bCddbQuery() +{ +} + + +void K3bCddbQuery::query( const K3bDevice::Toc& toc ) +{ + m_bQueryFinishedEmited = false; + m_toc = toc; + m_inexactMatches.clear(); + + QTimer::singleShot( 0, this, SLOT(doQuery()) ); +} + + +void K3bCddbQuery::queryMatch( const K3bCddbResultHeader& header ) +{ + m_header = header; + m_result = K3bCddbResultEntry(); + m_result.category = header.category; + m_result.discid = header.discid; + + QTimer::singleShot( 0, this, SLOT(doMatchQuery()) ); +} + + +const QStringList& K3bCddbQuery::categories() +{ + static QStringList s_cat = QStringList::split( ",", "rock,blues,misc,classical," + "country,data,folk,jazz,newage,reggae,soundtrack" ); + return s_cat; +} + + +bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry ) +{ + entry.rawData = ""; + + stream.setEncoding( QTextStream::UnicodeUTF8 ); + + // parse data + QString line; + while( !(line = stream.readLine()).isNull() ) { + entry.rawData.append(line + "\n"); + + // !all fields may be splitted into several lines! + + if( line.startsWith( "DISCID" ) ) { + // TODO: this could be several discids separated by comma! + } + + else if( line.startsWith( "DYEAR" ) ) { + QString year = line.mid( 6 ); + if( year.length() == 4 ) + entry.year = year.toInt(); + } + + else if( line.startsWith( "DGENRE" ) ) { + entry.genre = line.mid( 7 ); + } + + else if( line.startsWith( "DTITLE" ) ) { + entry.cdTitle += line.mid( 7 ); + } + + else if( line.startsWith( "TTITLE" ) ) { + int eqSgnPos = line.find( "=" ); + bool ok; + uint trackNum = (uint)line.mid( 6, eqSgnPos - 6 ).toInt( &ok ); + if( !ok ) + kdDebug() << "(K3bCddbQuery) !!! PARSE ERROR: " << line << endl; + else { + // kdDebug() << "(K3bCddbQuery) Track title for track " << trackNum << endl; + + // make sure the list is big enough + while( entry.titles.count() <= trackNum ) + entry.titles.append( "" ); + + entry.titles[trackNum] += line.mid( eqSgnPos+1 ); + } + } + + else if( line.startsWith( "EXTD" ) ) { + entry.cdExtInfo += line.mid( 5 ); + } + + else if( line.startsWith( "EXTT" ) ) { + int eqSgnPos = line.find( "=" ); + bool ok; + uint trackNum = (uint)line.mid( 4, eqSgnPos - 4 ).toInt( &ok ); + if( !ok ) + kdDebug() << "(K3bCddbQuery) !!! PARSE ERROR: " << line << endl; + else { + // kdDebug() << "(K3bCddbQuery) Track extr track " << trackNum << endl; + + // make sure the list is big enough + while( entry.extInfos.count() <= trackNum ) + entry.extInfos.append( "" ); + + entry.extInfos[trackNum] += line.mid( eqSgnPos+1 ); + } + } + + else if( line.startsWith( "#" ) ) { + // kdDebug() << "(K3bCddbQuery) comment: " << line << endl; + } + + else { + kdDebug() << "(K3bCddbQuery) Unknown field: " << line << endl; + } + } + + // now split the titles in the last added match + // if no " / " delimiter is present title and artist are the same + // ------------------------------------------------------------------- + QString fullTitle = entry.cdTitle; + int splitPos = fullTitle.find( " / " ); + if( splitPos < 0 ) + entry.cdArtist = fullTitle; + else { + // split + entry.cdTitle = fullTitle.mid( splitPos + 3 ); + entry.cdArtist = fullTitle.left( splitPos ); + } + + + for( QStringList::iterator it = entry.titles.begin(); + it != entry.titles.end(); ++it ) { + QString fullTitle = *it; + int splitPos = fullTitle.find( " / " ); + if( splitPos < 0 ) + entry.artists.append( entry.cdArtist ); + else { + // split + *it = fullTitle.mid( splitPos + 3 ); + entry.artists.append( fullTitle.left( splitPos ) ); + } + } + + + // replace all "\\n" with "\n" + for( QStringList::iterator it = entry.titles.begin(); + it != entry.titles.end(); ++it ) { + (*it).replace( "\\\\\\\\n", "\\n" ); + } + + for( QStringList::iterator it = entry.artists.begin(); + it != entry.artists.end(); ++it ) { + (*it).replace( "\\\\\\\\n", "\\n" ); + } + + for( QStringList::iterator it = entry.extInfos.begin(); + it != entry.extInfos.end(); ++it ) { + (*it).replace( "\\\\\\\\n", "\\n" ); + } + + entry.cdTitle.replace( "\\\\\\\\n", "\\n" ); + entry.cdArtist.replace( "\\\\\\\\n", "\\n" ); + entry.cdExtInfo.replace( "\\\\\\\\n", "\\n" ); + entry.genre.replace( "\\\\\\\\n", "\\n" ); + + return true; +} + + +int K3bCddbQuery::getCode( const QString& line ) +{ + bool ok; + int code = line.left( 3 ).toInt( &ok ); + if( !ok ) + code = -1; + return code; +} + + +QString K3bCddbQuery::handshakeString() const +{ + QString user( getenv("USER") ); + QString host( getenv("HOST") ); + if( user.isEmpty() ) + user = "kde-user"; + if( host.isEmpty() ) + host = "kde-host"; + + return QString("%1 %2 K3b %3").arg(user).arg(host).arg(kapp->aboutData()->version()); +} + + +QString K3bCddbQuery::queryString() const +{ + QString query = "cddb query " + + QString::number( m_toc.discId(), 16 ).rightJustify( 8, '0' ) + + " " + + QString::number( (unsigned int)m_toc.count() ); + + for( K3bDevice::Toc::const_iterator it = m_toc.begin(); it != m_toc.end(); ++it ) { + query.append( QString( " %1" ).arg( (*it).firstSector().lba() ) ); + } + + query.append( QString( " %1" ).arg( m_toc.length().lba() / 75 ) ); + + return query; +} + + +bool K3bCddbQuery::parseMatchHeader( const QString& line, K3bCddbResultHeader& header ) +{ + // format: category id title + // where title could be artist and title splitted with a / + header.category = line.section( ' ', 0, 0 ); + header.discid = line.section( ' ', 1, 1 ); + header.title = line.mid( header.category.length() + header.discid.length() + 2 ); + int slashPos = header.title.find( "/" ); + if( slashPos > 0 ) { + header.artist = header.title.left(slashPos).stripWhiteSpace(); + header.title = header.title.mid( slashPos+1 ).stripWhiteSpace(); + } + return true; +} + + +void K3bCddbQuery::emitQueryFinished() +{ + if( !m_bQueryFinishedEmited ) { + m_bQueryFinishedEmited = true; + emit queryFinished( this ); + } +} + + +#include "k3bcddbquery.moc" diff --git a/libk3b/cddb/k3bcddbquery.h b/libk3b/cddb/k3bcddbquery.h new file mode 100644 index 0000000..569e882 --- /dev/null +++ b/libk3b/cddb/k3bcddbquery.h @@ -0,0 +1,115 @@ +/* + * + * $Id: k3bcddbquery.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDB_QUERY_H +#define K3BCDDB_QUERY_H + +#include +#include +#include + +#include "k3bcddbresult.h" + +#include +#include "k3b_export.h" + + +class LIBK3B_EXPORT K3bCddbQuery : public QObject +{ + Q_OBJECT + + public: + K3bCddbQuery( QObject* parent = 0, const char* name = 0 ); + virtual ~K3bCddbQuery(); + + void query( const K3bDevice::Toc& ); + + /** + * Use this if the query returned multiple matches + */ + void queryMatch( const K3bCddbResultHeader& ); + + const K3bCddbResultEntry& result() const { return m_result; } + + /** + * After emitting the signal inexactMatches one has to choose one + * of these entries and query it with queryInexactMatch + */ + const QValueList& getInexactMatches() const { return m_inexactMatches; } + + static const QStringList& categories(); + + enum Error { SUCCESS = 0, + CANCELED, + NO_ENTRY_FOUND, + CONNECTION_ERROR, + QUERY_ERROR, + READ_ERROR, + FAILURE, + WORKING }; + + int error() const { return m_error; } + + signals: + /** + * This gets emitted if a single entry has been found or + * no entry has been found. + */ + void queryFinished( K3bCddbQuery* ); + + /** + * This gets emitted if multiple entries have been found. + * Call queryInexactMatch() after receiving it. + */ + void inexactMatches( K3bCddbQuery* ); + + void infoMessage( const QString& ); + + protected slots: + virtual void doQuery() = 0; + virtual void doMatchQuery() = 0; + + protected: + const K3bDevice::Toc& toc() const { return m_toc; } + K3bCddbResultHeader& header() { return m_header; } + K3bCddbResultEntry& result() { return m_result; } + void setError( int e ) { m_error = e; } + + bool parseEntry( QTextStream&, K3bCddbResultEntry& ); + int getCode( const QString& ); + QString handshakeString() const; + QString queryString() const; + bool parseMatchHeader( const QString& line, K3bCddbResultHeader& header ); + + /** + * since I'm not quite sure when the socket will emit connectionClosed + * this method makes sure the queryFinished signal + * gets emited only once. + */ + void emitQueryFinished(); + + QValueList m_inexactMatches; + + private: + K3bDevice::Toc m_toc; + K3bCddbResultEntry m_result; + K3bCddbResultHeader m_header; + int m_error; + + bool m_bQueryFinishedEmited; +}; + +#endif diff --git a/libk3b/cddb/k3bcddbresult.cpp b/libk3b/cddb/k3bcddbresult.cpp new file mode 100644 index 0000000..b33b16e --- /dev/null +++ b/libk3b/cddb/k3bcddbresult.cpp @@ -0,0 +1,49 @@ +/* + * + * $Id: k3bcddbresult.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include "k3bcddbresult.h" + + +K3bCddbResult::K3bCddbResult() +{ +} + + +void K3bCddbResult::clear() +{ + m_entries.clear(); +} + + +int K3bCddbResult::foundEntries() const +{ + return m_entries.count(); +} + +const K3bCddbResultEntry& K3bCddbResult::entry( unsigned int number ) const +{ + if( number >= m_entries.count() ) + return m_emptyEntry; + + return m_entries[number]; +} + + +void K3bCddbResult::addEntry( const K3bCddbResultEntry& entry ) +{ + m_entries.append( entry ); +} diff --git a/libk3b/cddb/k3bcddbresult.h b/libk3b/cddb/k3bcddbresult.h new file mode 100644 index 0000000..46dcb9a --- /dev/null +++ b/libk3b/cddb/k3bcddbresult.h @@ -0,0 +1,79 @@ +/* + * + * $Id: k3bcddbresult.h 768492 2008-01-30 08:39:42Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#ifndef K3B_CDDB_RESULT_H +#define K3B_CDDB_RESULT_H + + +#include +#include "k3b_export.h" + + +class LIBK3B_EXPORT K3bCddbResultHeader +{ + public: + QString category; + QString title; + QString artist; + QString discid; +}; + + +class LIBK3B_EXPORT K3bCddbResultEntry +{ + public: + // just to set a default + K3bCddbResultEntry() + : category("misc"), + year(0) { + } + + QStringList titles; + QStringList artists; + QStringList extInfos; + + QString cdTitle; + QString cdArtist; + QString cdExtInfo; + + QString genre; + QString category; + int year; + QString discid; + + QString rawData; +}; + + +class LIBK3B_EXPORT K3bCddbResult +{ + public: + K3bCddbResult(); + // K3bCddbQuery( const K3bCddbQuery& ); + + void clear(); + void addEntry( const K3bCddbResultEntry& = K3bCddbResultEntry() ); + const K3bCddbResultEntry& entry( unsigned int number = 0 ) const; + int foundEntries() const; + + private: + QValueList m_entries; + + K3bCddbResultEntry m_emptyEntry; +}; + +#endif diff --git a/libk3b/cddb/k3bcddbsubmit.cpp b/libk3b/cddb/k3bcddbsubmit.cpp new file mode 100644 index 0000000..a04dbcb --- /dev/null +++ b/libk3b/cddb/k3bcddbsubmit.cpp @@ -0,0 +1,84 @@ +/* + * + * $Id: k3bcddbsubmit.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bcddbsubmit.h" + +#include + + +K3bCddbSubmit::K3bCddbSubmit( QObject* parent, const char* name ) + : QObject( parent, name ) +{ +} + + +K3bCddbSubmit::~K3bCddbSubmit() +{ +} + + +void K3bCddbSubmit::submit( const K3bCddbResultEntry& entry ) +{ + m_resultEntry = entry; + + if( m_resultEntry.rawData.isEmpty() ) + createDataStream( m_resultEntry ); + + QTimer::singleShot( 0, this, SLOT(doSubmit()) ); +} + + +void K3bCddbSubmit::createDataStream( K3bCddbResultEntry& entry ) +{ + entry.rawData.truncate(0); + + QTextStream ts( &entry.rawData, IO_WriteOnly ); + + ts << "#" << endl + << "# Submitted via: K3b" << endl + << "#" << endl; + + ts << "DISCID=" << entry.discid << endl + << "DTITLE=" << entry.cdArtist << " / " << entry.cdTitle << endl + << "DYEAR="; + if( entry.year > 0 ) + ts << entry.year; + ts << endl; + ts << "DGENRE=" << entry.genre << endl; + + bool allEqualArtist = true; + for( unsigned int i = 0; i < entry.artists.count(); ++i ) + if( entry.artists[i] != entry.cdArtist && + !entry.artists[i].isEmpty() ) { + allEqualArtist = false; + break; + } + + for( unsigned int i = 0; i < entry.titles.count(); ++i ) { + ts << "TTITLE" << i << "="; + if( !allEqualArtist ) + ts << entry.artists[i] << " / "; + ts << entry.titles[i] << endl; + } + + ts << "EXTD=" << entry.cdExtInfo << endl; + + for( unsigned int i = 0; i < entry.titles.count(); ++i ) { + ts << "EXTT" << i << "=" << entry.extInfos[i] << endl; + } +} + +#include "k3bcddbsubmit.moc" diff --git a/libk3b/cddb/k3bcddbsubmit.h b/libk3b/cddb/k3bcddbsubmit.h new file mode 100644 index 0000000..ff57101 --- /dev/null +++ b/libk3b/cddb/k3bcddbsubmit.h @@ -0,0 +1,60 @@ +/* + * + * $Id: k3bcddbsubmit.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BCDDB_SUBMIT_H +#define K3BCDDB_SUBMIT_H + +#include +#include + +#include "k3bcddbresult.h" + + + +class K3bCddbSubmit : public QObject +{ + Q_OBJECT + + public: + K3bCddbSubmit( QObject* parent = 0, const char* name = 0 ); + virtual ~K3bCddbSubmit(); + + int error() const { return m_error; } + + enum State { SUCCESS, WORKING, IO_ERROR, CONNECTION_ERROR }; + + public slots: + void submit( const K3bCddbResultEntry& ); + + signals: + void infoMessage( const QString& ); + void submitFinished( K3bCddbSubmit* ); + + protected slots: + virtual void doSubmit() = 0; + void setError( int e ) { m_error = e; } + + protected: + K3bCddbResultEntry& resultEntry() { return m_resultEntry; } + + private: + void createDataStream( K3bCddbResultEntry& entry ); + + int m_error; + K3bCddbResultEntry m_resultEntry; +}; + +#endif diff --git a/libk3b/configure.in.in b/libk3b/configure.in.in new file mode 100644 index 0000000..af0c8f5 --- /dev/null +++ b/libk3b/configure.in.in @@ -0,0 +1,3 @@ +AC_CHECK_FUNCS(stat64) +AC_CHECK_HEADERS(sys/vfs.h) +AC_CHECK_HEADERS(sys/statvfs.h) diff --git a/libk3b/core/Makefile.am b/libk3b/core/Makefile.am new file mode 100644 index 0000000..3764d86 --- /dev/null +++ b/libk3b/core/Makefile.am @@ -0,0 +1,19 @@ +AM_CPPFLAGS = -I$(srcdir)/../../libk3bdevice -I$(srcdir)/../plugin -I$(srcdir)/../tools $(all_includes) + +noinst_LTLIBRARIES = libk3bcore.la + +libk3bcore_la_LIBADD = $(LIB_KIO) $(ARTSC_LIB) + +libk3bcore_la_LDFLAGS = $(all_libraries) + +libk3bcore_la_SOURCES = k3bcore.cpp k3bglobals.cpp k3bdefaultexternalprograms.cpp \ + k3bexternalbinmanager.cpp k3bversion.cpp k3bprocess.cpp k3bjob.cpp \ + k3bthread.cpp k3bthreadjob.cpp k3bglobalsettings.cpp k3bsimplejobhandler.cpp + +include_HEADERS = k3bcore.h k3bdefaultexternalprograms.h k3bexternalbinmanager.h \ + k3bprocess.h k3bversion.h k3bglobals.h k3bjob.h k3bthread.h \ + k3bthreadjob.h k3bglobalsettings.h k3bjobhandler.h \ + k3b_export.h k3bjobhandler.h k3bsimplejobhandler.h + +METASOURCES = AUTO + diff --git a/libk3b/core/k3b_export.h b/libk3b/core/k3b_export.h new file mode 100644 index 0000000..b6272f1 --- /dev/null +++ b/libk3b/core/k3b_export.h @@ -0,0 +1,33 @@ +/* + * + * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $ + * Copyright (c) 2005 Laurent Montel + * Copyright (C) 2005-2007 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_EXPORT_H_ +#define _K3B_EXPORT_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef __KDE_HAVE_GCC_VISIBILITY +#define LIBK3B_NO_EXPORT __attribute__ ((visibility("hidden"))) +#define LIBK3B_EXPORT __attribute__ ((visibility("default"))) +#else +#define LIBK3B_NO_EXPORT +#define LIBK3B_EXPORT +#endif + +#endif + diff --git a/libk3b/core/k3bcore.cpp b/libk3b/core/k3bcore.cpp new file mode 100644 index 0000000..c10fec0 --- /dev/null +++ b/libk3b/core/k3bcore.cpp @@ -0,0 +1,375 @@ +/* + * + * $Id: k3bcore.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include + +#include "k3bcore.h" +#include "k3bjob.h" + +#include +#ifdef HAVE_HAL +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + + +static Qt::HANDLE s_guiThreadHandle = QThread::currentThread(); + +// We cannot use QWaitCondition here since the event might be handled faster +// than the thread starts the waiting +class DeviceBlockingEventDoneCondition { +public: + DeviceBlockingEventDoneCondition() + : m_done(false) { + } + + void done() { + m_doneMutex.lock(); + m_done = true; + m_doneMutex.unlock(); + } + + void wait() { + while( true ) { + m_doneMutex.lock(); + bool done = m_done; + m_doneMutex.unlock(); + if( done ) + return; + } + } + +private: + QMutex m_doneMutex; + bool m_done; +}; + +class DeviceBlockingEvent : public QCustomEvent +{ +public: + DeviceBlockingEvent( bool block_, K3bDevice::Device* dev, DeviceBlockingEventDoneCondition* cond_, bool* success_ ) + : QCustomEvent( QEvent::User + 33 ), + block(block_), + device(dev), + cond(cond_), + success(success_) { + } + + bool block; + K3bDevice::Device* device; + DeviceBlockingEventDoneCondition* cond; + bool* success; +}; + + +class K3bCore::Private { +public: + Private() + : version( LIBK3B_VERSION ), + config(0), + deleteConfig(false), + deviceManager(0), + externalBinManager(0), + pluginManager(0), + globalSettings(0) { + } + + K3bVersion version; + KConfig* config; + bool deleteConfig; + K3bDevice::DeviceManager* deviceManager; + K3bExternalBinManager* externalBinManager; + K3bPluginManager* pluginManager; + K3bGlobalSettings* globalSettings; + + QValueList runningJobs; + QValueList blockedDevices; +}; + + + +K3bCore* K3bCore::s_k3bCore = 0; + + + +K3bCore::K3bCore( QObject* parent, const char* name ) + : QObject( parent, name ) +{ + d = new Private(); + + if( s_k3bCore ) + qFatal("ONLY ONE INSTANCE OF K3BCORE ALLOWED!"); + s_k3bCore = this; + + // create the thread widget instance in the GUI thread + K3bThreadWidget::instance(); +} + + +K3bCore::~K3bCore() +{ + s_k3bCore = 0; + + delete d->globalSettings; + delete d; +} + + +K3bDevice::DeviceManager* K3bCore::deviceManager() const +{ + const_cast(this)->initDeviceManager(); + return d->deviceManager; +} + + +K3bExternalBinManager* K3bCore::externalBinManager() const +{ + const_cast(this)->initExternalBinManager(); + return d->externalBinManager; +} + + +K3bPluginManager* K3bCore::pluginManager() const +{ + const_cast(this)->initPluginManager(); + return d->pluginManager; +} + + +K3bGlobalSettings* K3bCore::globalSettings() const +{ + const_cast(this)->initGlobalSettings(); + return d->globalSettings; +} + + +const K3bVersion& K3bCore::version() const +{ + return d->version; +} + + +KConfig* K3bCore::config() const +{ + if( !d->config ) { + kdDebug() << "(K3bCore) opening k3b config file." << endl; + kdDebug() << "(K3bCore) while I am a " << className() << endl; + d->deleteConfig = true; + d->config = new KConfig( "k3brc" ); + } + + return d->config; +} + + +void K3bCore::init() +{ + initGlobalSettings(); + initExternalBinManager(); + initDeviceManager(); + initPluginManager(); + + // load the plugins before doing anything else + // they might add external bins + pluginManager()->loadAll(); + + externalBinManager()->search(); + +#ifdef HAVE_HAL + connect( K3bDevice::HalConnection::instance(), SIGNAL(deviceAdded(const QString&)), + deviceManager(), SLOT(addDevice(const QString&)) ); + connect( K3bDevice::HalConnection::instance(), SIGNAL(deviceRemoved(const QString&)), + deviceManager(), SLOT(removeDevice(const QString&)) ); + QStringList devList = K3bDevice::HalConnection::instance()->devices(); + if( devList.isEmpty() ) + deviceManager()->scanBus(); + else + for( unsigned int i = 0; i < devList.count(); ++i ) + deviceManager()->addDevice( devList[i] ); +#else + deviceManager()->scanBus(); +#endif +} + + +void K3bCore::initGlobalSettings() +{ + if( !d->globalSettings ) + d->globalSettings = new K3bGlobalSettings(); +} + + +void K3bCore::initExternalBinManager() +{ + if( !d->externalBinManager ) { + d->externalBinManager = new K3bExternalBinManager( this ); + K3b::addDefaultPrograms( d->externalBinManager ); + } +} + + +void K3bCore::initDeviceManager() +{ + if( !d->deviceManager ) + d->deviceManager = new K3bDevice::DeviceManager( this ); +} + + +void K3bCore::initPluginManager() +{ + if( !d->pluginManager ) + d->pluginManager = new K3bPluginManager( this ); +} + + +void K3bCore::readSettings( KConfig* cnf ) +{ + KConfig* c = cnf; + if( !c ) + c = config(); + + QString oldGrp = c->group(); + + globalSettings()->readSettings( c ); + deviceManager()->readConfig( c ); + externalBinManager()->readConfig( c ); + + c->setGroup( oldGrp ); +} + + +void K3bCore::saveSettings( KConfig* cnf ) +{ + KConfig* c = cnf; + if( !c ) + c = config(); + + QString oldGrp = c->group(); + + c->setGroup( "General Options" ); + c->writeEntry( "config version", version() ); + + deviceManager()->saveConfig( c ); + externalBinManager()->saveConfig( c ); + d->globalSettings->saveSettings( c ); + + c->setGroup( oldGrp ); +} + + +void K3bCore::registerJob( K3bJob* job ) +{ + d->runningJobs.append( job ); + emit jobStarted( job ); + if( K3bBurnJob* bj = dynamic_cast( job ) ) + emit burnJobStarted( bj ); +} + + +void K3bCore::unregisterJob( K3bJob* job ) +{ + d->runningJobs.remove( job ); + emit jobFinished( job ); + if( K3bBurnJob* bj = dynamic_cast( job ) ) + emit burnJobFinished( bj ); +} + + +bool K3bCore::jobsRunning() const +{ + return !d->runningJobs.isEmpty(); +} + + +const QValueList& K3bCore::runningJobs() const +{ + return d->runningJobs; +} + + +bool K3bCore::blockDevice( K3bDevice::Device* dev ) +{ + if( QThread::currentThread() == s_guiThreadHandle ) { + return internalBlockDevice( dev ); + } + else { + bool success = false; + DeviceBlockingEventDoneCondition w; + QApplication::postEvent( this, new DeviceBlockingEvent( true, dev, &w, &success ) ); + w.wait(); + return success; + } +} + + +void K3bCore::unblockDevice( K3bDevice::Device* dev ) +{ + if( QThread::currentThread() == s_guiThreadHandle ) { + internalUnblockDevice( dev ); + } + else { + DeviceBlockingEventDoneCondition w; + QApplication::postEvent( this, new DeviceBlockingEvent( false, dev, &w, 0 ) ); + w.wait(); + } +} + + +bool K3bCore::internalBlockDevice( K3bDevice::Device* dev ) +{ + if( !d->blockedDevices.contains( dev ) ) { + d->blockedDevices.append( dev ); + return true; + } + else + return false; +} + + +void K3bCore::internalUnblockDevice( K3bDevice::Device* dev ) +{ + d->blockedDevices.remove( dev ); +} + + +void K3bCore::customEvent( QCustomEvent* e ) +{ + if( DeviceBlockingEvent* de = dynamic_cast(e) ) { + if( de->block ) + *de->success = internalBlockDevice( de->device ); + else + internalUnblockDevice( de->device ); + de->cond->done(); + } +} + +#include "k3bcore.moc" diff --git a/libk3b/core/k3bcore.h b/libk3b/core/k3bcore.h new file mode 100644 index 0000000..ce73e32 --- /dev/null +++ b/libk3b/core/k3bcore.h @@ -0,0 +1,181 @@ +/* + * + * $Id: k3bcore.h 733470 2007-11-06 12:10:29Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3B_CORE_H_ +#define _K3B_CORE_H_ + +#include +#include + +#include "k3b_export.h" + + +#define LIBK3B_VERSION "1.0.5" + +#define k3bcore K3bCore::k3bCore() + + +class K3bExternalBinManager; +class K3bVersion; +class KConfig; +class KAboutData; +class K3bJob; +class K3bBurnJob; +class K3bGlobalSettings; +class K3bPluginManager; +class QCustomEvent; + + +namespace K3bDevice { + class DeviceManager; + class Device; +} + + +/** + * The K3b core takes care of the managers. + * This has been separated from K3bApplication to + * make creating a K3bPart easy. + * This is the heart of the K3b system. Every plugin may use this + * to get the information it needs. + */ +class LIBK3B_EXPORT K3bCore : public QObject +{ + Q_OBJECT + + public: + /** + * Although K3bCore is a singlelton it's constructor is not private to make inheritance + * possible. Just make sure to only create one instance. + */ + K3bCore( QObject* parent = 0, const char* name = 0 ); + virtual ~K3bCore(); + + const QValueList& runningJobs() const; + + /** + * Equals to !runningJobs().isEmpty() + */ + bool jobsRunning() const; + + /** + * The default implementation calls add four initXXX() methods, + * scans for devices, applications, and reads the global settings. + */ + virtual void init(); + + /** + * @param c if 0 K3bCore uses the K3b configuration + */ + virtual void readSettings( KConfig* c = 0 ); + + /** + * @param c if 0 K3bCore uses the K3b configuration + */ + virtual void saveSettings( KConfig* c = 0 ); + + /** + * If this is reimplemented it is recommended to also reimplement + * init(). + */ + virtual K3bDevice::DeviceManager* deviceManager() const; + + /** + * Returns the external bin manager from K3bCore. + * + * By default K3bCore only adds the default programs: + * cdrecord, cdrdao, growisofs, mkisofs, dvd+rw-format, readcd + * + * If you need other programs you have to add them manually like this: + *

externalBinManager()->addProgram( new K3bNormalizeProgram() );
+ */ + K3bExternalBinManager* externalBinManager() const; + K3bPluginManager* pluginManager() const; + + /** + * Global settings used throughout libk3b. Change the settings directly in the + * K3bGlobalSettings object. They will be saved by K3bCore::saveSettings + */ + K3bGlobalSettings* globalSettings() const; + + /** + * returns the version of the library as defined by LIBK3B_VERSION + */ + const K3bVersion& version() const; + + /** + * Default implementation returns the K3b configuration from k3brc. + * Normally this should not be used. + */ + virtual KConfig* config() const; + + /** + * Used by the writing jobs to block a device. + * This makes sure no device is used twice within libk3b + * + * When using this method in a job be aware that reimplementations might + * open dialogs and resulting in a blocking call. + * + * This method calls internalBlockDevice() to do the actual work. + */ + bool blockDevice( K3bDevice::Device* ); + void unblockDevice( K3bDevice::Device* ); + + static K3bCore* k3bCore() { return s_k3bCore; } + + signals: + /** + * Emitted once a new job has been started. This includes burn jobs. + */ + void jobStarted( K3bJob* ); + void burnJobStarted( K3bBurnJob* ); + void jobFinished( K3bJob* ); + void burnJobFinished( K3bBurnJob* ); + + public slots: + /** + * Every running job registers itself with the core. + * For now this is only used to determine if some job + * is running. + */ + void registerJob( K3bJob* job ); + void unregisterJob( K3bJob* job ); + + protected: + /** + * Reimplement this to add additonal checks. + * + * This method is thread safe. blockDevice makes sure + * it is only executed in the GUI thread. + */ + virtual bool internalBlockDevice( K3bDevice::Device* ); + virtual void internalUnblockDevice( K3bDevice::Device* ); + + virtual void initGlobalSettings(); + virtual void initExternalBinManager(); + virtual void initDeviceManager(); + virtual void initPluginManager(); + + virtual void customEvent( QCustomEvent* e ); + + private: + class Private; + Private* d; + + static K3bCore* s_k3bCore; +}; + +#endif diff --git a/libk3b/core/k3bdataevent.h b/libk3b/core/k3bdataevent.h new file mode 100644 index 0000000..b6a4334 --- /dev/null +++ b/libk3b/core/k3bdataevent.h @@ -0,0 +1,48 @@ +/* + * + * $Id: k3bdataevent.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef K3B_DATA_EVENT_H +#define K3B_DATA_EVENT_H + +#include + + +/** + * Custom event class for posting events corresponding to the + * K3bJob signals. This is useful for a threaded job since + * in that case it's not possible to emit signals that directly + * change the GUI (see QThread docu). + */ +class K3bDataEvent : public QCustomEvent +{ + public: + // make sure we get not in the way of K3bProgressInfoEvent + static const int EVENT_TYPE = QEvent::User + 100; + + K3bDataEvent( const char* data, int len ) + : QCustomEvent( EVENT_TYPE ), + m_data(data), + m_length(len) + {} + + const char* data() const { return m_data; } + int length() const { return m_length; } + + private: + const char* m_data; + int m_length; +}; + +#endif diff --git a/libk3b/core/k3bdefaultexternalprograms.cpp b/libk3b/core/k3bdefaultexternalprograms.cpp new file mode 100644 index 0000000..b654d22 --- /dev/null +++ b/libk3b/core/k3bdefaultexternalprograms.cpp @@ -0,0 +1,1030 @@ +/* + * + * $Id: k3bdefaultexternalprograms.cpp 731898 2007-11-02 08:22:18Z trueg $ + * Copyright (C) 2003-2007 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bdefaultexternalprograms.h" +#include "k3bexternalbinmanager.h" +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + + + +void K3b::addDefaultPrograms( K3bExternalBinManager* m ) +{ + m->addProgram( new K3bCdrecordProgram(false) ); + m->addProgram( new K3bMkisofsProgram() ); + m->addProgram( new K3bReadcdProgram() ); + m->addProgram( new K3bCdrdaoProgram() ); + m->addProgram( new K3bGrowisofsProgram() ); + m->addProgram( new K3bDvdformatProgram() ); + // m->addProgram( new K3bDvdBooktypeProgram() ); +} + + +void K3b::addTranscodePrograms( K3bExternalBinManager* m ) +{ + static const char* transcodeTools[] = { "transcode", + 0, // K3b 1.0 only uses the transcode binary + "tcprobe", + "tccat", + "tcscan", + "tcextract", + "tcdecode", + 0 }; + + for( int i = 0; transcodeTools[i]; ++i ) + m->addProgram( new K3bTranscodeProgram( transcodeTools[i] ) ); +} + + +void K3b::addVcdimagerPrograms( K3bExternalBinManager* m ) +{ + // don't know if we need more vcdTools in the future (vcdxrip) + static const char* vcdTools[] = { "vcdxbuild", + "vcdxminfo", + "vcdxrip", + 0 }; + + for( int i = 0; vcdTools[i]; ++i ) + m->addProgram( new K3bVcdbuilderProgram( vcdTools[i] ) ); +} + + +K3bCdrecordProgram::K3bCdrecordProgram( bool dvdPro ) + : K3bExternalProgram( dvdPro ? "cdrecord-prodvd" : "cdrecord" ), + m_dvdPro(dvdPro) +{ +} + + +// +// This is a hack for Debian based systems which use +// a wrapper cdrecord script to call cdrecord.mmap or cdrecord.shm +// depending on the kernel version. +// For 2.0.x and 2.2.x kernels the shm version is used. In all +// other cases it's the mmap version. +// +// But since it may be that someone manually installed cdrecord +// replacing the wrapper we check if cdrecord is a script. +// +static QString& debianWeirdnessHack( QString& path ) +{ + if( QFile::exists( path + ".mmap" ) ) { + kdDebug() << "(K3bCdrecordProgram) checking for Debian cdrecord wrapper script." << endl; + if( QFileInfo( path ).size() < 1024 ) { + kdDebug() << "(K3bCdrecordProgram) Debian Wrapper script size fits. Checking file." << endl; + QFile f( path ); + f.open( IO_ReadOnly ); + QString s = QTextStream( &f ).read(); + if( s.contains( "cdrecord.mmap" ) && s.contains( "cdrecord.shm" ) ) { + kdDebug() << "(K3bCdrecordProgram) Found Debian Wrapper script." << endl; + QString ext; + if( K3b::kernelVersion().versionString().left(3) > "2.2" ) + ext = ".mmap"; + else + ext = ".shm"; + + kdDebug() << "(K3bCdrecordProgram) Using cdrecord" << ext << endl; + + path += ext; + } + } + } + + return path; +} + + +bool K3bCdrecordProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + bool wodim = false; + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + + if( QFile::exists( path + "wodim" ) ) { + wodim = true; + path += "wodim"; + } + else if( QFile::exists( path + "cdrecord" ) ) { + path += "cdrecord"; + } + else + return false; + } + + debianWeirdnessHack( path ); + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path << "-version"; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = -1; + if( wodim ) { + pos = out.output().find( "Wodim" ); + } + else if( m_dvdPro ) { + pos = out.output().find( "Cdrecord-ProDVD" ); + } + else { + pos = out.output().find( "Cdrecord" ); + } + + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("[0-9]"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( QRegExp("\\s"), pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + if( wodim ) + bin->addFeature( "wodim" ); + + pos = out.output().find( "Copyright") + 14; + endPos = out.output().find( "\n", pos ); + + // cdrecord does not use local encoding for the copyright statement but plain latin1 + bin->copyright = QString::fromLatin1( out.output().mid( pos, endPos-pos ).local8Bit() ).stripWhiteSpace(); + } + else { + kdDebug() << "(K3bCdrecordProgram) could not start " << path << endl; + return false; + } + + if( !m_dvdPro && bin->version.suffix().endsWith( "-dvd" ) ) { + bin->addFeature( "dvd-patch" ); + bin->version = QString(bin->version.versionString()).remove("-dvd"); + } + + // probe features + KProcess fp; + out.setProcess( &fp ); + fp << path << "-help"; + if( fp.start( KProcess::Block, KProcess::AllOutput ) ) { + if( out.output().contains( "gracetime" ) ) + bin->addFeature( "gracetime" ); + if( out.output().contains( "-overburn" ) ) + bin->addFeature( "overburn" ); + if( out.output().contains( "-text" ) ) + bin->addFeature( "cdtext" ); + if( out.output().contains( "-clone" ) ) + bin->addFeature( "clone" ); + if( out.output().contains( "-tao" ) ) + bin->addFeature( "tao" ); + if( out.output().contains( "cuefile=" ) && + ( wodim || bin->version > K3bVersion( 2, 1, -1, "a14") ) ) // cuefile handling was still buggy in a14 + bin->addFeature( "cuefile" ); + + // new mode 2 options since cdrecord 2.01a12 + // we use both checks here since the help was not updated in 2.01a12 yet (well, I + // just double-checked and the help page is proper but there is no harm in having + // two checks) + // and the version check does not handle versions like 2.01-dvd properly + if( out.output().contains( "-xamix" ) || + bin->version >= K3bVersion( 2, 1, -1, "a12" ) || + wodim ) + bin->addFeature( "xamix" ); + + // check if we run cdrecord as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + } + else { + kdDebug() << "(K3bCdrecordProgram) could not start " << bin->path << endl; + delete bin; + return false; + } + + if( bin->version < K3bVersion( 2, 0 ) && !wodim ) + bin->addFeature( "outdated" ); + + // FIXME: are these version correct? + if( bin->version >= K3bVersion("1.11a38") || wodim ) + bin->addFeature( "plain-atapi" ); + if( bin->version > K3bVersion("1.11a17") || wodim ) + bin->addFeature( "hacked-atapi" ); + + if( bin->version >= K3bVersion( 2, 1, 1, "a02" ) || wodim ) + bin->addFeature( "short-track-raw" ); + + if( bin->version >= K3bVersion( 2, 1, -1, "a13" ) || wodim ) + bin->addFeature( "audio-stdin" ); + + if( bin->version >= K3bVersion( "1.11a02" ) || wodim ) + bin->addFeature( "burnfree" ); + else + bin->addFeature( "burnproof" ); + + addBin( bin ); + return true; +} + + + +K3bMkisofsProgram::K3bMkisofsProgram() + : K3bExternalProgram( "mkisofs" ) +{ +} + +bool K3bMkisofsProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + bool genisoimage = false; + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + + if( QFile::exists( path + "genisoimage" ) ) { + genisoimage = true; + path += "genisoimage"; + } + else if( QFile::exists( path + "mkisofs" ) ) { + path += "mkisofs"; + } + else + return false; + } + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + vp << path << "-version"; + K3bProcessOutputCollector out( &vp ); + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = -1; + if( genisoimage ) + pos = out.output().find( "genisoimage" ); + else + pos = out.output().find( "mkisofs" ); + + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("[0-9]"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( ' ', pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + if( genisoimage ) + bin->addFeature( "genisoimage" ); + } + else { + kdDebug() << "(K3bMkisofsProgram) could not start " << path << endl; + return false; + } + + + + // probe features + KProcess fp; + fp << path << "-help"; + out.setProcess( &fp ); + if( fp.start( KProcess::Block, KProcess::AllOutput ) ) { + if( out.output().contains( "-udf" ) ) + bin->addFeature( "udf" ); + if( out.output().contains( "-dvd-video" ) ) + bin->addFeature( "dvd-video" ); + if( out.output().contains( "-joliet-long" ) ) + bin->addFeature( "joliet-long" ); + if( out.output().contains( "-xa" ) ) + bin->addFeature( "xa" ); + if( out.output().contains( "-sectype" ) ) + bin->addFeature( "sectype" ); + + // check if we run mkisofs as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + } + else { + kdDebug() << "(K3bMkisofsProgram) could not start " << bin->path << endl; + delete bin; + return false; + } + + if( bin->version < K3bVersion( 1, 14) && !genisoimage ) + bin->addFeature( "outdated" ); + + if( bin->version >= K3bVersion( 1, 15, -1, "a40" ) || genisoimage ) + bin->addFeature( "backslashed_filenames" ); + + if ( genisoimage && bin->version >= K3bVersion( 1, 1, 4 ) ) + bin->addFeature( "no-4gb-limit" ); + + if ( !genisoimage && bin->version >= K3bVersion( 2, 1, 1, "a32" ) ) + bin->addFeature( "no-4gb-limit" ); + + addBin(bin); + return true; +} + + +K3bReadcdProgram::K3bReadcdProgram() + : K3bExternalProgram( "readcd" ) +{ +} + +bool K3bReadcdProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + bool readom = false; + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + + if( QFile::exists( path + "readom" ) ) { + readom = true; + path += "readom"; + } + else if( QFile::exists( path + "readcd" ) ) { + path += "readcd"; + } + else + return false; + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + vp << path << "-version"; + K3bProcessOutputCollector out( &vp ); + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = -1; + if( readom ) + pos = out.output().find( "readom" ); + else + pos = out.output().find( "readcd" ); + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("[0-9]"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( ' ', pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + if( readom ) + bin->addFeature( "readom" ); + } + else { + kdDebug() << "(K3bMkisofsProgram) could not start " << path << endl; + return false; + } + + + + // probe features + KProcess fp; + fp << path << "-help"; + out.setProcess( &fp ); + if( fp.start( KProcess::Block, KProcess::AllOutput ) ) { + if( out.output().contains( "-clone" ) ) + bin->addFeature( "clone" ); + + // check if we run mkisofs as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + } + else { + kdDebug() << "(K3bReadcdProgram) could not start " << bin->path << endl; + delete bin; + return false; + } + + + // FIXME: are these version correct? + if( bin->version >= K3bVersion("1.11a38") || readom ) + bin->addFeature( "plain-atapi" ); + if( bin->version > K3bVersion("1.11a17") || readom ) + bin->addFeature( "hacked-atapi" ); + + addBin(bin); + return true; +} + + +K3bCdrdaoProgram::K3bCdrdaoProgram() + : K3bExternalProgram( "cdrdao" ) +{ +} + +bool K3bCdrdaoProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("cdrdao"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + vp << path ; + K3bProcessOutputCollector out( &vp ); + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "Cdrdao version" ); + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("[0-9]"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( ' ', pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + pos = out.output().find( "(C)", endPos+1 ) + 4; + endPos = out.output().find( '\n', pos ); + bin->copyright = out.output().mid( pos, endPos-pos ); + } + else { + kdDebug() << "(K3bCdrdaoProgram) could not start " << path << endl; + return false; + } + + + + // probe features + KProcess fp; + fp << path << "write" << "-h"; + out.setProcess( &fp ); + if( fp.start( KProcess::Block, KProcess::AllOutput ) ) { + if( out.output().contains( "--overburn" ) ) + bin->addFeature( "overburn" ); + if( out.output().contains( "--multi" ) ) + bin->addFeature( "multisession" ); + + if( out.output().contains( "--buffer-under-run-protection" ) ) + bin->addFeature( "disable-burnproof" ); + + // check if we run cdrdao as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + } + else { + kdDebug() << "(K3bCdrdaoProgram) could not start " << bin->path << endl; + delete bin; + return false; + } + + + // SuSE 9.0 ships with a patched cdrdao 1.1.7 which contains an updated libschily + // Gentoo ships with a patched cdrdao 1.1.7 which contains scglib support + if( bin->version > K3bVersion( 1, 1, 7 ) || + bin->version == K3bVersion( 1, 1, 7, "-gentoo" ) || + bin->version == K3bVersion( 1, 1, 7, "-suse" ) ) { + // bin->addFeature( "plain-atapi" ); + bin->addFeature( "hacked-atapi" ); + } + + if( bin->version >= K3bVersion( 1, 1, 8 ) ) + bin->addFeature( "plain-atapi" ); + + addBin(bin); + return true; +} + + +K3bTranscodeProgram::K3bTranscodeProgram( const QString& transcodeProgram ) + : K3bExternalProgram( transcodeProgram ), + m_transcodeProgram( transcodeProgram ) +{ +} + +bool K3bTranscodeProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + if( path[path.length()-1] != '/' ) + path.append("/"); + + QString appPath = path + m_transcodeProgram; + + if( !QFile::exists( appPath ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + vp << appPath << "-v"; + K3bProcessOutputCollector out( &vp ); + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "transcode v" ); + if( pos < 0 ) + return false; + + pos += 11; + + int endPos = out.output().find( QRegExp("[\\s\\)]"), pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = appPath; + bin->version = out.output().mid( pos, endPos-pos ); + } + else { + kdDebug() << "(K3bTranscodeProgram) could not start " << appPath << endl; + return false; + } + + // + // Check features + // + QString modInfoBin = path + "tcmodinfo"; + KProcess modp; + modp << modInfoBin << "-p"; + out.setProcess( &modp ); + if( modp.start( KProcess::Block, KProcess::AllOutput ) ) { + QString modPath = out.output().stripWhiteSpace(); + QDir modDir( modPath ); + if( !modDir.entryList( "*export_xvid*", QDir::Files ).isEmpty() ) + bin->addFeature( "xvid" ); + if( !modDir.entryList( "*export_lame*", QDir::Files ).isEmpty() ) + bin->addFeature( "lame" ); + if( !modDir.entryList( "*export_ffmpeg*", QDir::Files ).isEmpty() ) + bin->addFeature( "ffmpeg" ); + if( !modDir.entryList( "*export_ac3*", QDir::Files ).isEmpty() ) + bin->addFeature( "ac3" ); + } + + addBin(bin); + return true; +} + + + +K3bVcdbuilderProgram::K3bVcdbuilderProgram( const QString& p ) + : K3bExternalProgram( p ), + m_vcdbuilderProgram( p ) +{ +} + +bool K3bVcdbuilderProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append(m_vcdbuilderProgram); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + vp << path << "-V"; + K3bProcessOutputCollector out( &vp ); + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "GNU VCDImager" ); + if( pos < 0 ) + return false; + + pos += 14; + + int endPos = out.output().find( QRegExp("[\\n\\)]"), pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ).stripWhiteSpace(); + + pos = out.output().find( "Copyright" ) + 14; + endPos = out.output().find( "\n", pos ); + bin->copyright = out.output().mid( pos, endPos-pos ).stripWhiteSpace(); + } + else { + kdDebug() << "(K3bVcdbuilderProgram) could not start " << path << endl; + return false; + } + + addBin(bin); + return true; +} + + +K3bNormalizeProgram::K3bNormalizeProgram() + : K3bExternalProgram( "normalize-audio" ) +{ +} + + +bool K3bNormalizeProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("normalize-audio"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path << "--version"; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "normalize" ); + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("\\d"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( QRegExp("\\s"), pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + pos = out.output().find( "Copyright" )+14; + endPos = out.output().find( "\n", pos ); + bin->copyright = out.output().mid( pos, endPos-pos ).stripWhiteSpace(); + } + else { + kdDebug() << "(K3bCdrecordProgram) could not start " << path << endl; + return false; + } + + addBin( bin ); + return true; +} + + +K3bGrowisofsProgram::K3bGrowisofsProgram() + : K3bExternalProgram( "growisofs" ) +{ +} + +bool K3bGrowisofsProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("growisofs"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path << "-version"; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "growisofs" ); + if( pos < 0 ) + return false; + + pos = out.output().find( QRegExp("\\d"), pos ); + if( pos < 0 ) + return false; + + int endPos = out.output().find( ",", pos+1 ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + } + else { + kdDebug() << "(K3bGrowisofsProgram) could not start " << path << endl; + return false; + } + + // fixed Copyright: + bin->copyright = "Andy Polyakov "; + + // check if we run growisofs as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + + addBin( bin ); + return true; +} + + +K3bDvdformatProgram::K3bDvdformatProgram() + : K3bExternalProgram( "dvd+rw-format" ) +{ +} + +bool K3bDvdformatProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("dvd+rw-format"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + // different locales make searching for the +- char difficult + // so we simply ignore it. + int pos = out.output().find( QRegExp("DVD.*RAM format utility") ); + if( pos < 0 ) + return false; + + pos = out.output().find( "version", pos ); + if( pos < 0 ) + return false; + + pos += 8; + + // the version ends in a dot. + int endPos = out.output().find( QRegExp("\\.\\D"), pos ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + } + else { + kdDebug() << "(K3bDvdformatProgram) could not start " << path << endl; + return false; + } + + // fixed Copyright: + bin->copyright = "Andy Polyakov "; + + // check if we run dvd+rw-format as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + + addBin( bin ); + return true; +} + + +K3bDvdBooktypeProgram::K3bDvdBooktypeProgram() + : K3bExternalProgram( "dvd+rw-booktype" ) +{ +} + +bool K3bDvdBooktypeProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("dvd+rw-booktype"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "dvd+rw-booktype" ); + if( pos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + // No version information. Create dummy version + bin->version = K3bVersion( 1, 0, 0 ); + } + else { + kdDebug() << "(K3bDvdBooktypeProgram) could not start " << path << endl; + return false; + } + + addBin( bin ); + return true; +} + + + +K3bCdda2wavProgram::K3bCdda2wavProgram() + : K3bExternalProgram( "cdda2wav" ) +{ +} + +bool K3bCdda2wavProgram::scan( const QString& p ) +{ + if( p.isEmpty() ) + return false; + + QString path = p; + QFileInfo fi( path ); + if( fi.isDir() ) { + if( path[path.length()-1] != '/' ) + path.append("/"); + path.append("cdda2wav"); + } + + if( !QFile::exists( path ) ) + return false; + + K3bExternalBin* bin = 0; + + // probe version + KProcess vp; + K3bProcessOutputCollector out( &vp ); + + vp << path << "-h"; + if( vp.start( KProcess::Block, KProcess::AllOutput ) ) { + int pos = out.output().find( "cdda2wav" ); + if( pos < 0 ) + return false; + + pos = out.output().find( "Version", pos ); + if( pos < 0 ) + return false; + + pos += 8; + + // the version does not end in a space but the kernel info + int endPos = out.output().find( QRegExp("[^\\d\\.]"), pos ); + if( endPos < 0 ) + return false; + + bin = new K3bExternalBin( this ); + bin->path = path; + bin->version = out.output().mid( pos, endPos-pos ); + + // features (we do this since the cdda2wav help says that the short + // options will disappear soon) + if( out.output().find( "-info-only" ) ) + bin->addFeature( "info-only" ); // otherwise use the -J option + if( out.output().find( "-no-infofile" ) ) + bin->addFeature( "no-infofile" ); // otherwise use the -H option + if( out.output().find( "-gui" ) ) + bin->addFeature( "gui" ); // otherwise use the -g option + if( out.output().find( "-bulk" ) ) + bin->addFeature( "bulk" ); // otherwise use the -B option + if( out.output().find( "dev=" ) ) + bin->addFeature( "dev" ); // otherwise use the -B option + } + else { + kdDebug() << "(K3bCdda2wavProgram) could not start " << path << endl; + return false; + } + + // check if we run as root + struct stat s; + if( !::stat( QFile::encodeName(path), &s ) ) { + if( (s.st_mode & S_ISUID) && s.st_uid == 0 ) + bin->addFeature( "suidroot" ); + } + + addBin( bin ); + return true; +} + diff --git a/libk3b/core/k3bdefaultexternalprograms.h b/libk3b/core/k3bdefaultexternalprograms.h new file mode 100644 index 0000000..3212727 --- /dev/null +++ b/libk3b/core/k3bdefaultexternalprograms.h @@ -0,0 +1,143 @@ +/* + * + * $Id: k3bdefaultexternalprograms.h 623768 2007-01-15 13:33:55Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#ifndef _K3B_DEFAULT_EXTERNAL_BIN_PROGRAMS_H_ +#define _K3B_DEFAULT_EXTERNAL_BIN_PROGRAMS_H_ + +#include "k3bexternalbinmanager.h" +#include "k3b_export.h" +class K3bExternalBinManager; + +namespace K3b +{ + LIBK3B_EXPORT void addDefaultPrograms( K3bExternalBinManager* ); + LIBK3B_EXPORT void addTranscodePrograms( K3bExternalBinManager* ); + LIBK3B_EXPORT void addVcdimagerPrograms( K3bExternalBinManager* ); +} + + +class LIBK3B_EXPORT K3bCdrecordProgram : public K3bExternalProgram +{ + public: + K3bCdrecordProgram( bool dvdPro ); + + bool scan( const QString& ); + + private: + bool m_dvdPro; +}; + + +class LIBK3B_EXPORT K3bMkisofsProgram : public K3bExternalProgram +{ + public: + K3bMkisofsProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bReadcdProgram : public K3bExternalProgram +{ + public: + K3bReadcdProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bCdrdaoProgram : public K3bExternalProgram +{ + public: + K3bCdrdaoProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bTranscodeProgram : public K3bExternalProgram +{ + public: + K3bTranscodeProgram( const QString& transcodeProgram ); + + bool scan( const QString& ); + + // no user parameters (yet) + bool supportsUserParameters() const { return false; } + + private: + QString m_transcodeProgram; +}; + + +class LIBK3B_EXPORT K3bVcdbuilderProgram : public K3bExternalProgram +{ + public: + K3bVcdbuilderProgram( const QString& ); + + bool scan( const QString& ); + + private: + QString m_vcdbuilderProgram; +}; + + +class LIBK3B_EXPORT K3bNormalizeProgram : public K3bExternalProgram +{ + public: + K3bNormalizeProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bGrowisofsProgram : public K3bExternalProgram +{ + public: + K3bGrowisofsProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bDvdformatProgram : public K3bExternalProgram +{ + public: + K3bDvdformatProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bDvdBooktypeProgram : public K3bExternalProgram +{ + public: + K3bDvdBooktypeProgram(); + + bool scan( const QString& ); +}; + + +class LIBK3B_EXPORT K3bCdda2wavProgram : public K3bExternalProgram +{ + public: + K3bCdda2wavProgram(); + + bool scan( const QString& ); +}; + +#endif diff --git a/libk3b/core/k3bexternalbinmanager.cpp b/libk3b/core/k3bexternalbinmanager.cpp new file mode 100644 index 0000000..2b21a85 --- /dev/null +++ b/libk3b/core/k3bexternalbinmanager.cpp @@ -0,0 +1,389 @@ +/* + * + * $Id: k3bexternalbinmanager.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bexternalbinmanager.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + + + +QString K3bExternalBinManager::m_noPath = ""; + + +// /////////////////////////////////////////////////////////// +// +// K3BEXTERNALBIN +// +// /////////////////////////////////////////////////////////// + +K3bExternalBin::K3bExternalBin( K3bExternalProgram* p ) + : m_program(p) +{ +} + + +bool K3bExternalBin::isEmpty() const +{ + return !version.isValid(); +} + + +const QString& K3bExternalBin::name() const +{ + return m_program->name(); +} + + +bool K3bExternalBin::hasFeature( const QString& f ) const +{ + return m_features.contains( f ); +} + + +void K3bExternalBin::addFeature( const QString& f ) +{ + m_features.append( f ); +} + + +const QStringList& K3bExternalBin::userParameters() const +{ + return m_program->userParameters(); +} + + + +// /////////////////////////////////////////////////////////// +// +// K3BEXTERNALPROGRAM +// +// /////////////////////////////////////////////////////////// + + +K3bExternalProgram::K3bExternalProgram( const QString& name ) + : m_name( name ) +{ + m_bins.setAutoDelete( true ); +} + + +K3bExternalProgram::~K3bExternalProgram() +{ +} + + +const K3bExternalBin* K3bExternalProgram::mostRecentBin() const +{ + QPtrListIterator it( m_bins ); + K3bExternalBin* bin = *it; + ++it; + while( *it ) { + if( it.current()->version > bin->version ) + bin = *it; + ++it; + } + return bin; +} + + +void K3bExternalProgram::addBin( K3bExternalBin* bin ) +{ + if( !m_bins.contains( bin ) ) { + // insertion sort + // the first bin in the list is always the one used + // so we default to using the newest one + K3bExternalBin* oldBin = m_bins.first(); + while( oldBin && oldBin->version > bin->version ) + oldBin = m_bins.next(); + + m_bins.insert( oldBin ? m_bins.at() : m_bins.count(), bin ); + } +} + +void K3bExternalProgram::setDefault( const K3bExternalBin* bin ) +{ + if( m_bins.contains( bin ) ) + m_bins.take( m_bins.find( bin ) ); + + // the first bin in the list is always the one used + m_bins.insert( 0, bin ); +} + + +void K3bExternalProgram::setDefault( const QString& path ) +{ + for( QPtrListIterator it( m_bins ); it.current(); ++it ) { + if( it.current()->path == path ) { + setDefault( it.current() ); + return; + } + } +} + + +void K3bExternalProgram::addUserParameter( const QString& p ) +{ + if( !m_userParameters.contains( p ) ) + m_userParameters.append(p); +} + + + +// /////////////////////////////////////////////////////////// +// +// K3BEXTERNALBINMANAGER +// +// /////////////////////////////////////////////////////////// + + +K3bExternalBinManager::K3bExternalBinManager( QObject* parent, const char* name ) + : QObject( parent, name ) +{ +} + + +K3bExternalBinManager::~K3bExternalBinManager() +{ + clear(); +} + + +bool K3bExternalBinManager::readConfig( KConfig* c ) +{ + loadDefaultSearchPath(); + + c->setGroup( "External Programs" ); + + if( c->hasKey( "search path" ) ) + setSearchPath( c->readPathListEntry( "search path" ) ); + + search(); + + for ( QMap::iterator it = m_programs.begin(); it != m_programs.end(); ++it ) { + K3bExternalProgram* p = it.data(); + if( c->hasKey( p->name() + " default" ) ) { + p->setDefault( c->readEntry( p->name() + " default" ) ); + } + if( c->hasKey( p->name() + " user parameters" ) ) { + QStringList list = c->readListEntry( p->name() + " user parameters" ); + for( QStringList::iterator strIt = list.begin(); strIt != list.end(); ++strIt ) + p->addUserParameter( *strIt ); + } + if( c->hasKey( p->name() + " last seen newest version" ) ) { + K3bVersion lastMax( c->readEntry( p->name() + " last seen newest version" ) ); + // now search for a newer version and use it (because it was installed after the last + // K3b run and most users would probably expect K3b to use a newly installed version) + const K3bExternalBin* newestBin = p->mostRecentBin(); + if( newestBin && newestBin->version > lastMax ) + p->setDefault( newestBin ); + } + } + + return true; +} + +bool K3bExternalBinManager::saveConfig( KConfig* c ) +{ + c->setGroup( "External Programs" ); + c->writePathEntry( "search path", m_searchPath ); + + for ( QMap::iterator it = m_programs.begin(); it != m_programs.end(); ++it ) { + K3bExternalProgram* p = it.data(); + if( p->defaultBin() ) + c->writeEntry( p->name() + " default", p->defaultBin()->path ); + + c->writeEntry( p->name() + " user parameters", p->userParameters() ); + + const K3bExternalBin* newestBin = p->mostRecentBin(); + if( newestBin ) + c->writeEntry( p->name() + " last seen newest version", newestBin->version ); + } + + return true; +} + + +bool K3bExternalBinManager::foundBin( const QString& name ) +{ + if( m_programs.find( name ) == m_programs.end() ) + return false; + else + return (m_programs[name]->defaultBin() != 0); +} + + +const QString& K3bExternalBinManager::binPath( const QString& name ) +{ + if( m_programs.find( name ) == m_programs.end() ) + return m_noPath; + + if( m_programs[name]->defaultBin() != 0 ) + return m_programs[name]->defaultBin()->path; + else + return m_noPath; +} + + +const K3bExternalBin* K3bExternalBinManager::binObject( const QString& name ) +{ + if( m_programs.find( name ) == m_programs.end() ) + return 0; + + return m_programs[name]->defaultBin(); +} + + +void K3bExternalBinManager::addProgram( K3bExternalProgram* p ) +{ + m_programs.insert( p->name(), p ); +} + + +void K3bExternalBinManager::clear() +{ + for( QMap::Iterator it = m_programs.begin(); it != m_programs.end(); ++it ) + delete it.data(); + m_programs.clear(); +} + + +void K3bExternalBinManager::search() +{ + if( m_searchPath.isEmpty() ) + loadDefaultSearchPath(); + + for( QMap::iterator it = m_programs.begin(); it != m_programs.end(); ++it ) { + it.data()->clear(); + } + + // do not search one path twice + QStringList paths; + for( QStringList::const_iterator it = m_searchPath.begin(); it != m_searchPath.end(); ++it ) { + QString p = *it; + if( p[p.length()-1] == '/' ) + p.truncate( p.length()-1 ); + if( !paths.contains( p ) && !paths.contains( p + "/" ) ) + paths.append(p); + } + + // get the environment path variable + char* env_path = ::getenv("PATH"); + if( env_path ) { + QStringList env_pathList = QStringList::split(":", QString::fromLocal8Bit(env_path)); + for( QStringList::const_iterator it = env_pathList.begin(); it != env_pathList.end(); ++it ) { + QString p = *it; + if( p[p.length()-1] == '/' ) + p.truncate( p.length()-1 ); + if( !paths.contains( p ) && !paths.contains( p + "/" ) ) + paths.append(p); + } + } + + + for( QStringList::const_iterator it = paths.begin(); it != paths.end(); ++it ) + for( QMap::iterator pit = m_programs.begin(); pit != m_programs.end(); ++pit ) + pit.data()->scan(*it); + + // TESTING + // ///////////////////////// + const K3bExternalBin* bin = program("cdrecord")->defaultBin(); + + if( !bin ) { + kdDebug() << "(K3bExternalBinManager) Probing cdrecord failed" << endl; + } + else { + kdDebug() << "(K3bExternalBinManager) Cdrecord " << bin->version << " features: " + << bin->features().join( ", " ) << endl; + + if( bin->version >= K3bVersion("1.11a02") ) + kdDebug() << "(K3bExternalBinManager) " + << bin->version.majorVersion() << " " << bin->version.minorVersion() << " " << bin->version.patchLevel() + << " " << bin->version.suffix() + << " seems to be cdrecord version >= 1.11a02, using burnfree instead of burnproof" << endl; + if( bin->version >= K3bVersion("1.11a31") ) + kdDebug() << "(K3bExternalBinManager) seems to be cdrecord version >= 1.11a31, support for Just Link via burnfree " + << "driveroption" << endl; + } +} + + +K3bExternalProgram* K3bExternalBinManager::program( const QString& name ) const +{ + if( m_programs.find( name ) == m_programs.end() ) + return 0; + else + return m_programs[name]; +} + + +void K3bExternalBinManager::loadDefaultSearchPath() +{ + static const char* defaultSearchPaths[] = { "/usr/bin/", + "/usr/local/bin/", + "/usr/sbin/", + "/usr/local/sbin/", + "/opt/schily/bin/", + "/sbin", + 0 }; + + m_searchPath.clear(); + for( int i = 0; defaultSearchPaths[i]; ++i ) { + m_searchPath.append( defaultSearchPaths[i] ); + } +} + + +void K3bExternalBinManager::setSearchPath( const QStringList& list ) +{ + loadDefaultSearchPath(); + + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) { + if( !m_searchPath.contains( *it ) ) + m_searchPath.append( *it ); + } +} + + +void K3bExternalBinManager::addSearchPath( const QString& path ) +{ + if( !m_searchPath.contains( path ) ) + m_searchPath.append( path ); +} + + + +const K3bExternalBin* K3bExternalBinManager::mostRecentBinObject( const QString& name ) +{ + if( K3bExternalProgram* p = program( name ) ) + return p->mostRecentBin(); + else + return 0; +} + +#include "k3bexternalbinmanager.moc" + diff --git a/libk3b/core/k3bexternalbinmanager.h b/libk3b/core/k3bexternalbinmanager.h new file mode 100644 index 0000000..e7fe601 --- /dev/null +++ b/libk3b/core/k3bexternalbinmanager.h @@ -0,0 +1,162 @@ +/* + * + * $Id: k3bexternalbinmanager.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef K3B_EXTERNAL_BIN_MANAGER_H +#define K3B_EXTERNAL_BIN_MANAGER_H + +#include +#include +#include +#include +#include +#include "k3b_export.h" +#include "k3bversion.h" + +class KConfig; +class KProcess; + + +class K3bExternalProgram; + + +/** + * A K3bExternalBin represents an installed version of a program. + * All K3bExternalBin objects are managed by K3bExternalPrograms. + * + * A bin may have certain features that are represented by a string. + */ +class LIBK3B_EXPORT K3bExternalBin +{ + public: + K3bExternalBin( K3bExternalProgram* ); + virtual ~K3bExternalBin() {} + + K3bVersion version; + QString path; + QString copyright; + + const QString& name() const; + bool isEmpty() const; + const QStringList& userParameters() const; + const QStringList& features() const { return m_features; } + + bool hasFeature( const QString& ) const; + void addFeature( const QString& ); + + K3bExternalProgram* program() const { return m_program; } + + private: + QStringList m_features; + K3bExternalProgram* m_program; +}; + + +/** + * This is the main class that represents a program + * It's scan method has to be reimplemented for every program + * It manages a list of K3bExternalBin-objects that each represent + * one installed version of the program. + */ +class LIBK3B_EXPORT K3bExternalProgram +{ + public: + K3bExternalProgram( const QString& name ); + virtual ~K3bExternalProgram(); + + const K3bExternalBin* defaultBin() const { return m_bins.getFirst(); } + const K3bExternalBin* mostRecentBin() const; + + void addUserParameter( const QString& ); + void setUserParameters( const QStringList& list ) { m_userParameters = list; } + + const QStringList& userParameters() const { return m_userParameters; } + const QString& name() const { return m_name; } + + void addBin( K3bExternalBin* ); + void clear() { m_bins.clear(); } + void setDefault( const K3bExternalBin* ); + void setDefault( const QString& path ); + + const QPtrList& bins() const { return m_bins; } + + /** + * this scans for the program in the given path, + * adds the found bin object to the list and returnes true. + * if nothing could be found false is returned. + */ + virtual bool scan( const QString& ) {return false;}//= 0; + + /** + * reimplement this if it does not make sense to have the user be able + * to specify additional parameters + */ + virtual bool supportsUserParameters() const { return true; } + + private: + QString m_name; + QStringList m_userParameters; + QPtrList m_bins; +}; + + +class LIBK3B_EXPORT K3bExternalBinManager : public QObject +{ + Q_OBJECT + + public: + K3bExternalBinManager( QObject* parent = 0, const char* name = 0 ); + ~K3bExternalBinManager(); + + void search(); + + /** + * read config and add changes to current map. + * Takes care of setting the config group + */ + bool readConfig( KConfig* ); + + /** + * Takes care of setting the config group + */ + bool saveConfig( KConfig* ); + + bool foundBin( const QString& name ); + const QString& binPath( const QString& name ); + const K3bExternalBin* binObject( const QString& name ); + const K3bExternalBin* mostRecentBinObject( const QString& name ); + + K3bExternalProgram* program( const QString& ) const; + const QMap& programs() const { return m_programs; } + + /** always extends the default searchpath */ + void setSearchPath( const QStringList& ); + void addSearchPath( const QString& ); + void loadDefaultSearchPath(); + + const QStringList& searchPath() const { return m_searchPath; } + + void addProgram( K3bExternalProgram* ); + void clear(); + + private: + QMap m_programs; + QStringList m_searchPath; + + static QString m_noPath; // used for binPath() to return const string + + QString m_gatheredOutput; +}; + +#endif diff --git a/libk3b/core/k3bglobals.cpp b/libk3b/core/k3bglobals.cpp new file mode 100644 index 0000000..fc5a4e1 --- /dev/null +++ b/libk3b/core/k3bglobals.cpp @@ -0,0 +1,634 @@ +/* + * + * $Id: k3bglobals.cpp 659634 2007-04-30 14:51:32Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include + + +#include "k3bglobals.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#if defined(__FreeBSD__) || defined(__NetBSD__) +# include +# include +# include +# define bswap_16(x) bswap16(x) +# define bswap_32(x) bswap32(x) +# define bswap_64(x) bswap64(x) +#else +# include +#endif +#ifdef HAVE_SYS_STATVFS_H +# include +#endif +#ifdef HAVE_SYS_VFS_H +# include +#endif + + +/* +struct Sample { + unsigned char msbLeft; + unsigned char lsbLeft; + unsigned char msbRight; + unsigned char lsbRight; + + short left() const { + return ( msbLeft << 8 ) | lsbLeft; + } + short right() const { + return ( msbRight << 8 ) | lsbRight; + } + void left( short d ) { + msbLeft = d >> 8; + lsbLeft = d; + } + void right( short d ) { + msbRight = d >> 8; + lsbRight = d; + } +}; +*/ + +QString K3b::framesToString( int h, bool showFrames ) +{ + int m = h / 4500; + int s = (h % 4500) / 75; + int f = h % 75; + + QString str; + + if( showFrames ) { + // cdrdao needs the MSF format where 1 second has 75 frames! + str.sprintf( "%.2i:%.2i:%.2i", m, s, f ); + } + else + str.sprintf( "%.2i:%.2i", m, s ); + + return str; +} + +/*QString K3b::sizeToTime(long size) +{ + int h = size / sizeof(Sample) / 588; + return framesToString(h, false); +}*/ + + +Q_INT16 K3b::swapByteOrder( const Q_INT16& i ) +{ + return bswap_16( i ); + //((i << 8) & 0xff00) | ((i >> 8 ) & 0xff); +} + + +Q_INT32 K3b::swapByteOrder( const Q_INT32& i ) +{ + //return ((i << 24) & 0xff000000) | ((i << 8) & 0xff0000) | ((i >> 8) & 0xff00) | ((i >> 24) & 0xff ); + return bswap_32( i ); +} + + +Q_INT64 K3b::swapByteOrder( const Q_INT64& i ) +{ + return bswap_64( i ); +} + + +int K3b::round( double d ) +{ + return (int)( floor(d) + 0.5 <= d ? ceil(d) : floor(d) ); +} + + +QString K3b::findUniqueFilePrefix( const QString& _prefix, const QString& path ) +{ + QString url; + if( path.isEmpty() || !QFile::exists(path) ) + url = defaultTempPath(); + else + url = prepareDir( path ); + + QString prefix = _prefix; + if( prefix.isEmpty() ) + prefix = "k3b_"; + + // now create the unique prefix + QDir dir( url ); + QStringList entries = dir.entryList( QDir::DefaultFilter, QDir::Name ); + int i = 0; + for( QStringList::iterator it = entries.begin(); + it != entries.end(); ++it ) { + if( (*it).startsWith( prefix + QString::number(i) ) ) { + i++; + it = entries.begin(); + } + } + + return url + prefix + QString::number(i); +} + + +QString K3b::findTempFile( const QString& ending, const QString& d ) +{ + return findUniqueFilePrefix( "k3b_", d ) + ( ending.isEmpty() ? QString::null : (QString::fromLatin1(".") + ending) ); +} + + +QString K3b::defaultTempPath() +{ + QString oldGroup = kapp->config()->group(); + kapp->config()->setGroup( "General Options" ); + QString url = kapp->config()->readPathEntry( "Temp Dir", KGlobal::dirs()->resourceDirs( "tmp" ).first() ); + kapp->config()->setGroup( oldGroup ); + return prepareDir(url); +} + + +QString K3b::prepareDir( const QString& dir ) +{ + return (dir + (dir[dir.length()-1] != '/' ? "/" : "")); +} + + +QString K3b::parentDir( const QString& path ) +{ + QString parent = path; + if( path[path.length()-1] == '/' ) + parent.truncate( parent.length()-1 ); + + int pos = parent.findRev( '/' ); + if( pos >= 0 ) + parent.truncate( pos+1 ); + else // relative path, do anything... + parent = "/"; + + return parent; +} + + +QString K3b::fixupPath( const QString& path ) +{ + QString s; + bool lastWasSlash = false; + for( unsigned int i = 0; i < path.length(); ++i ) { + if( path[i] == '/' ) { + if( !lastWasSlash ) { + lastWasSlash = true; + s.append( "/" ); + } + } + else { + lastWasSlash = false; + s.append( path[i] ); + } + } + + return s; +} + + +K3bVersion K3b::kernelVersion() +{ + // initialize kernel version + K3bVersion v; + utsname unameinfo; + if( ::uname(&unameinfo) == 0 ) { + v = QString::fromLocal8Bit( unameinfo.release ); + kdDebug() << "kernel version: " << v << endl; + } + else + kdError() << "could not determine kernel version." << endl; + return v; +} + + +K3bVersion K3b::simpleKernelVersion() +{ + return kernelVersion().simplify(); +} + + +QString K3b::systemName() +{ + QString v; + utsname unameinfo; + if( ::uname(&unameinfo) == 0 ) { + v = QString::fromLocal8Bit( unameinfo.sysname ); + } + else + kdError() << "could not determine system name." << endl; + return v; +} + + +bool K3b::kbFreeOnFs( const QString& path, unsigned long& size, unsigned long& avail ) +{ + struct statvfs fs; + if( ::statvfs( QFile::encodeName(path), &fs ) == 0 ) { + unsigned long kBfak = fs.f_frsize/1024; + + size = fs.f_blocks*kBfak; + avail = fs.f_bavail*kBfak; + + return true; + } + else + return false; +} + + +KIO::filesize_t K3b::filesize( const KURL& url ) +{ + if( url.isLocalFile() ) { + k3b_struct_stat buf; + if ( !k3b_stat( QFile::encodeName( url.path() ), &buf ) ) { + return (KIO::filesize_t)buf.st_size; + } + } + + KIO::UDSEntry uds; + KIO::NetAccess::stat( url, uds, 0 ); + for( KIO::UDSEntry::const_iterator it = uds.begin(); it != uds.end(); ++it ) { + if( (*it).m_uds == KIO::UDS_SIZE ) { + return (*it).m_long; + } + } + + return ( KIO::filesize_t )0; +} + + +KIO::filesize_t K3b::imageFilesize( const KURL& url ) +{ + KIO::filesize_t size = K3b::filesize( url ); + int cnt = 0; + while( KIO::NetAccess::exists( KURL::fromPathOrURL( url.url() + '.' + QString::number(cnt).rightJustify( 3, '0' ) ), true ) ) + size += K3b::filesize( KURL::fromPathOrURL( url.url() + '.' + QString::number(cnt++).rightJustify( 3, '0' ) ) ); + return size; +} + + +QString K3b::cutFilename( const QString& name, unsigned int len ) +{ + if( name.length() > len ) { + QString ret = name; + + // determine extension (we think of an extension to be at most 5 chars in length) + int pos = name.find( '.', -6 ); + if( pos > 0 ) + len -= (name.length() - pos); + + ret.truncate( len ); + + if( pos > 0 ) + ret.append( name.mid( pos ) ); + + return ret; + } + else + return name; +} + + +QString K3b::removeFilenameExtension( const QString& name ) +{ + QString v = name; + int dotpos = v.findRev( '.' ); + if( dotpos > 0 ) + v.truncate( dotpos ); + return v; +} + + +QString K3b::appendNumberToFilename( const QString& name, int num, unsigned int maxlen ) +{ + // determine extension (we think of an extension to be at most 5 chars in length) + QString result = name; + QString ext; + int pos = name.find( '.', -6 ); + if( pos > 0 ) { + ext = name.mid(pos); + result.truncate( pos ); + } + + ext.prepend( QString::number(num) ); + result.truncate( maxlen - ext.length() ); + + return result + ext; +} + + +bool K3b::plainAtapiSupport() +{ + // FIXME: what about BSD? + return ( K3b::simpleKernelVersion() >= K3bVersion( 2, 5, 40 ) ); +} + + +bool K3b::hackedAtapiSupport() +{ + // IMPROVEME!!! + // FIXME: since when does the kernel support this? + return ( K3b::simpleKernelVersion() >= K3bVersion( 2, 4, 0 ) ); +} + + +QString K3b::externalBinDeviceParameter( K3bDevice::Device* dev, const K3bExternalBin* bin ) +{ +#ifdef Q_OS_LINUX + // + // experimental: always use block devices on 2.6 kernels + // + if( simpleKernelVersion() >= K3bVersion( 2, 6, 0 ) ) + return dev->blockDeviceName(); + else +#endif + if( dev->interfaceType() == K3bDevice::SCSI ) + return dev->busTargetLun(); + else if( (plainAtapiSupport() && bin->hasFeature("plain-atapi") ) ) + return dev->blockDeviceName(); + else + return QString("ATAPI:%1").arg(dev->blockDeviceName()); +} + + +int K3b::writingAppFromString( const QString& s ) +{ + if( s.lower() == "cdrdao" ) + return K3b::CDRDAO; + else if( s.lower() == "cdrecord" ) + return K3b::CDRECORD; + else if( s.lower() == "dvdrecord" ) + return K3b::DVDRECORD; + else if( s.lower() == "growisofs" ) + return K3b::GROWISOFS; + else if( s.lower() == "dvd+rw-format" ) + return K3b::DVD_RW_FORMAT; + else + return K3b::DEFAULT; +} + + +QString K3b::writingModeString( int mode ) +{ + if( mode == WRITING_MODE_AUTO ) + return i18n("Auto"); + else + return K3bDevice::writingModeString( mode ); +} + + +QString K3b::resolveLink( const QString& file ) +{ + QFileInfo f( file ); + QStringList steps( f.absFilePath() ); + while( f.isSymLink() ) { + QString p = f.readLink(); + if( !p.startsWith( "/" ) ) + p.prepend( f.dirPath(true) + "/" ); + f.setFile( p ); + if( steps.contains( f.absFilePath() ) ) { + kdDebug() << "(K3b) symlink loop detected." << endl; + break; + } + else + steps.append( f.absFilePath() ); + } + return f.absFilePath(); +} + + +K3bDevice::Device* K3b::urlToDevice( const KURL& deviceUrl ) +{ + if( deviceUrl.protocol() == "media" || deviceUrl.protocol() == "system" ) { + kdDebug() << "(K3b) Asking mediamanager for " << deviceUrl.fileName() << endl; + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("properties(QString)", deviceUrl.fileName()); + QStringList properties = reply; + if( !reply.isValid() || properties.count() < 6 ) { + kdError() << "(K3b) Invalid reply from mediamanager" << endl; + return 0; + } + else { + kdDebug() << "(K3b) Reply from mediamanager " << properties[5] << endl; + return k3bcore->deviceManager()->findDevice( properties[5] ); + } + } + + return k3bcore->deviceManager()->findDevice( deviceUrl.path() ); +} + + +KURL K3b::convertToLocalUrl( const KURL& url ) +{ + if( !url.isLocalFile() ) { +#if KDE_IS_VERSION(3,4,91) + return KIO::NetAccess::mostLocalURL( url, 0 ); +#else +#ifndef UDS_LOCAL_PATH +#define UDS_LOCAL_PATH (72 | KIO::UDS_STRING) +#else + using namespace KIO; +#endif + KIO::UDSEntry e; + if( KIO::NetAccess::stat( url, e, 0 ) ) { + const KIO::UDSEntry::ConstIterator end = e.end(); + for( KIO::UDSEntry::ConstIterator it = e.begin(); it != end; ++it ) { + if( (*it).m_uds == UDS_LOCAL_PATH && !(*it).m_str.isEmpty() ) + return KURL::fromPathOrURL( (*it).m_str ); + } + } +#endif + } + + return url; +} + + +KURL::List K3b::convertToLocalUrls( const KURL::List& urls ) +{ + KURL::List r; + for( KURL::List::const_iterator it = urls.constBegin(); it != urls.constEnd(); ++it ) + r.append( convertToLocalUrl( *it ) ); + return r; +} + + +Q_INT16 K3b::fromLe16( char* data ) +{ +#ifdef WORDS_BIGENDIAN // __BYTE_ORDER == __BIG_ENDIAN + return swapByteOrder( *((Q_INT16*)data) ); +#else + return *((Q_INT16*)data); +#endif +} + + +Q_INT32 K3b::fromLe32( char* data ) +{ +#ifdef WORDS_BIGENDIAN // __BYTE_ORDER == __BIG_ENDIAN + return swapByteOrder( *((Q_INT32*)data) ); +#else + return *((Q_INT32*)data); +#endif +} + + +Q_INT64 K3b::fromLe64( char* data ) +{ +#ifdef WORDS_BIGENDIAN // __BYTE_ORDER == __BIG_ENDIAN + return swapByteOrder( *((Q_INT64*)data) ); +#else + return *((Q_INT64*)data); +#endif +} + + +QString K3b::findExe( const QString& name ) +{ + // first we search the path + QString bin = KStandardDirs::findExe( name ); + + // then go on with our own little list + if( bin.isEmpty() ) + bin = KStandardDirs::findExe( name, k3bcore->externalBinManager()->searchPath().join(":") ); + + return bin; +} + + +bool K3b::isMounted( K3bDevice::Device* dev ) +{ + if( !dev ) + return false; + + return !KIO::findDeviceMountPoint( dev->blockDeviceName() ).isEmpty(); +} + + +bool K3b::unmount( K3bDevice::Device* dev ) +{ + if( !dev ) + return false; + + QString mntDev = dev->blockDeviceName(); + +#if KDE_IS_VERSION(3,4,0) + // first try to unmount it the standard way + if( KIO::NetAccess::synchronousRun( KIO::unmount( mntDev, false ), 0 ) ) + return true; +#endif + + QString umountBin = K3b::findExe( "umount" ); + if( !umountBin.isEmpty() ) { + KProcess p; + p << umountBin; + p << "-l"; // lazy unmount + p << dev->blockDeviceName(); + p.start( KProcess::Block ); + if( !p.exitStatus() ) + return true; + } + + // now try pmount + QString pumountBin = K3b::findExe( "pumount" ); + if( !pumountBin.isEmpty() ) { + KProcess p; + p << pumountBin; + p << "-l"; // lazy unmount + p << dev->blockDeviceName(); + p.start( KProcess::Block ); + return !p.exitStatus(); + } + else { +#ifdef HAVE_HAL + return !K3bDevice::HalConnection::instance()->unmount( dev ); +#else + return false; +#endif + } +} + + +bool K3b::mount( K3bDevice::Device* dev ) +{ + if( !dev ) + return false; + + QString mntDev = dev->blockDeviceName(); + +#if KDE_IS_VERSION(3,4,0) + // first try to mount it the standard way + if( KIO::NetAccess::synchronousRun( KIO::mount( true, 0, mntDev, false ), 0 ) ) + return true; +#endif + +#ifdef HAVE_HAL + if( !K3bDevice::HalConnection::instance()->mount( dev ) ) + return true; +#endif + + // now try pmount + QString pmountBin = K3b::findExe( "pmount" ); + if( !pmountBin.isEmpty() ) { + KProcess p; + p << pmountBin; + p << mntDev; + p.start( KProcess::Block ); + return !p.exitStatus(); + } + return false; +} + + +bool K3b::eject( K3bDevice::Device* dev ) +{ +#ifdef HAVE_HAL + if( !K3bDevice::HalConnection::instance()->eject( dev ) ) + return true; +#endif + + if( K3b::isMounted( dev ) ) + K3b::unmount( dev ); + + return dev->eject(); +} diff --git a/libk3b/core/k3bglobals.h b/libk3b/core/k3bglobals.h new file mode 100644 index 0000000..2795630 --- /dev/null +++ b/libk3b/core/k3bglobals.h @@ -0,0 +1,257 @@ +/* + * + * $Id: k3bglobals.h 630384 2007-02-05 09:33:17Z mlaurent $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BGLOBALS_H +#define K3BGLOBALS_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include "k3b_export.h" + +class KConfig; +class K3bVersion; +class K3bExternalBin; + + +#include + + +#ifdef HAVE_STAT64 +#define k3b_struct_stat struct stat64 +#define k3b_stat ::stat64 +#define k3b_lstat ::lstat64 +#else +#define k3b_struct_stat struct stat +#define k3b_stat ::stat +#define k3b_lstat ::lstat +#endif + + +namespace K3bDevice { + class Device; +} + +namespace K3b +{ + enum WritingApp { + DEFAULT = 1, + CDRECORD = 2, + CDRDAO = 4, + DVDRECORD = 8, + GROWISOFS = 16, + DVD_RW_FORMAT = 32 + }; + + LIBK3B_EXPORT int writingAppFromString( const QString& ); + + /** + * DATA_MODE_AUTO - let K3b determine the best mode + * MODE1 - refers to the default Yellow book mode1 + * MODE2 - refers to CDROM XA mode2 form1 + */ + enum DataMode { + DATA_MODE_AUTO, + MODE1, + MODE2 + }; + + /** + * The sector size denotes the number of bytes K3b provides per sector. + * This is based on the sizes cdrecord's -data, -xa, and -xamix parameters + * demand. + */ + enum SectorSize { + SECTORSIZE_AUDIO = 2352, + SECTORSIZE_DATA_2048 = 2048, + SECTORSIZE_DATA_2048_SUBHEADER = 2056, + SECTORSIZE_DATA_2324 = 2324, + SECTORSIZE_DATA_2324_SUBHEADER = 2332, + SECTORSIZE_RAW = 2448 + }; + + /** + * AUTO - let K3b determine the best mode + * TAO - Track at once + * DAO - Disk at once (or session at once) + * RAW - Raw mode + * + * may be or'ed together (except for WRITING_MODE_AUTO of course) + */ + enum WritingMode { + WRITING_MODE_AUTO = 0, + TAO = K3bDevice::WRITINGMODE_TAO, + DAO = K3bDevice::WRITINGMODE_SAO, + RAW = K3bDevice::WRITINGMODE_RAW, + WRITING_MODE_INCR_SEQ = K3bDevice::WRITINGMODE_INCR_SEQ, // Incremental Sequential + WRITING_MODE_RES_OVWR = K3bDevice::WRITINGMODE_RES_OVWR // Restricted Overwrite + }; + + LIBK3B_EXPORT QString writingModeString( int ); + + LIBK3B_EXPORT QString framesToString( int h, bool showFrames = true ); + /*LIBK3B_EXPORT QString sizeToTime( long size );*/ + + LIBK3B_EXPORT Q_INT16 swapByteOrder( const Q_INT16& i ); + LIBK3B_EXPORT Q_INT32 swapByteOrder( const Q_INT32& i ); + LIBK3B_EXPORT Q_INT64 swapByteOrder( const Q_INT64& i ); + + int round( double ); + + /** + * This checks the free space on the filesystem path is in. + * We use this since we encountered problems with the KDE version. + * @returns true on success. + */ + LIBK3B_EXPORT bool kbFreeOnFs( const QString& path, unsigned long& size, unsigned long& avail ); + + /** + * Cut a filename preserving the extension + */ + LIBK3B_EXPORT QString cutFilename( const QString& name, unsigned int len ); + + LIBK3B_EXPORT QString removeFilenameExtension( const QString& name ); + + /** + * Append a number to a filename preserving the extension. + * The resulting name's length will not exceed @p maxlen + */ + LIBK3B_EXPORT QString appendNumberToFilename( const QString& name, int num, unsigned int maxlen ); + + LIBK3B_EXPORT QString findUniqueFilePrefix( const QString& _prefix = QString::null, const QString& path = QString::null ); + + /** + * Find a unique filename in directory d (if d is empty the method uses the defaultTempPath) + */ + LIBK3B_EXPORT QString findTempFile( const QString& ending = QString::null, const QString& d = QString::null ); + + /** + * Wrapper around KStandardDirs::findExe which searches the PATH and some additional + * directories to find system tools which are normally only in root's PATH. + */ + LIBK3B_EXPORT QString findExe( const QString& name ); + + /** + * get the default K3b temp path to store image files + */ + LIBK3B_EXPORT QString defaultTempPath(); + + /** + * makes sure a path ends with a "/" + */ + LIBK3B_EXPORT QString prepareDir( const QString& dir ); + + /** + * returns the parent dir of a path. + * CAUTION: this does only work well with absolut paths. + * + * Example: /usr/share/doc -> /usr/share/ + */ + QString parentDir( const QString& path ); + + /** + * For now this just replaces multiple occurrences of / with a single / + */ + LIBK3B_EXPORT QString fixupPath( const QString& ); + + /** + * resolves a symlinks completely. Meaning it also handles links to links to links... + */ + LIBK3B_EXPORT QString resolveLink( const QString& ); + + LIBK3B_EXPORT K3bVersion kernelVersion(); + + /** + * Kernel version stripped of all suffixes + */ + LIBK3B_EXPORT K3bVersion simpleKernelVersion(); + + QString systemName(); + + LIBK3B_EXPORT KIO::filesize_t filesize( const KURL& ); + + /** + * Calculate the total size of an image file. This also includes + * images splitted by a K3bFileSplitter. + * + * \returns the total size of the image file at url + */ + LIBK3B_EXPORT KIO::filesize_t imageFilesize( const KURL& url ); + + /** + * true if the kernel supports ATAPI devices without SCSI emulation. + * use in combination with the K3bExternalProgram feature "plain-atapi" + */ + LIBK3B_EXPORT bool plainAtapiSupport(); + + /** + * true if the kernel supports ATAPI devices without SCSI emulation + * via the ATAPI: pseudo stuff + * use in combination with the K3bExternalProgram feature "hacked-atapi" + */ + LIBK3B_EXPORT bool hackedAtapiSupport(); + + /** + * Used to create a parameter for cdrecord, cdrdao or readcd. + * Takes care of SCSI and ATAPI. + */ + QString externalBinDeviceParameter( K3bDevice::Device* dev, const K3bExternalBin* ); + + /** + * Convert an url pointing to a local device to a K3bDevice. + * Supports media:// and system::// urls. + */ + LIBK3B_EXPORT K3bDevice::Device* urlToDevice( const KURL& deviceUrl ); + + /** + * Tries to convert urls from local protocols != "file" to file (for now supports media:/) + */ + LIBK3B_EXPORT KURL convertToLocalUrl( const KURL& url ); + LIBK3B_EXPORT KURL::List convertToLocalUrls( const KURL::List& l ); + + LIBK3B_EXPORT Q_INT16 fromLe16( char* ); + LIBK3B_EXPORT Q_INT32 fromLe32( char* ); + LIBK3B_EXPORT Q_INT64 fromLe64( char* ); + + LIBK3B_EXPORT bool isMounted( K3bDevice::Device* ); + + /** + * Tries to unmount the device ignoring its actual mounting state. + * This method uses both KIO::unmount and pumount if available. + */ + LIBK3B_EXPORT bool unmount( K3bDevice::Device* ); + + /** + * Tries to mount the medium. Since K3b does not gather any information + * about mount points the only methods used are pmount and HAL::mount + */ + LIBK3B_EXPORT bool mount( K3bDevice::Device* ); + + /** + * Ejects the medium in the device or simply opens the tray. + * This method improves over K3bDevice::Device::eject in that it + * unmounts before ejecting and introduces HAL support. + */ + LIBK3B_EXPORT bool eject( K3bDevice::Device* ); +} + +#endif diff --git a/libk3b/core/k3bglobalsettings.cpp b/libk3b/core/k3bglobalsettings.cpp new file mode 100644 index 0000000..6f58592 --- /dev/null +++ b/libk3b/core/k3bglobalsettings.cpp @@ -0,0 +1,61 @@ +/* + * + * $Id: k3bglobalsettings.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bglobalsettings.h" + +#include + + +K3bGlobalSettings::K3bGlobalSettings() + : m_eject(true), + m_burnfree(true), + m_overburn(false), + m_useManualBufferSize(false), + m_bufferSize(4), + m_force(false) +{ +} + + +void K3bGlobalSettings::readSettings( KConfig* c ) +{ + QString lastG = c->group(); + c->setGroup( "General Options" ); + + m_eject = !c->readBoolEntry( "No cd eject", false ); + m_burnfree = c->readBoolEntry( "burnfree", true ); + m_overburn = c->readBoolEntry( "Allow overburning", false ); + m_useManualBufferSize = c->readBoolEntry( "Manual buffer size", false ); + m_bufferSize = c->readNumEntry( "Fifo buffer", 4 ); + m_force = c->readBoolEntry( "Force unsafe operations", false ); + + c->setGroup( lastG ); +} + + +void K3bGlobalSettings::saveSettings( KConfig* c ) +{ + QString lastG = c->group(); + c->setGroup( "General Options" ); + + c->writeEntry( "No cd eject", !m_eject ); + c->writeEntry( "burnfree", m_burnfree ); + c->writeEntry( "Allow overburning", m_overburn ); + c->writeEntry( "Manual buffer size", m_useManualBufferSize ); + c->writeEntry( "Fifo buffer", m_bufferSize ); + c->writeEntry( "Force unsafe operations", m_force ); + + c->setGroup( lastG ); +} diff --git a/libk3b/core/k3bglobalsettings.h b/libk3b/core/k3bglobalsettings.h new file mode 100644 index 0000000..1194789 --- /dev/null +++ b/libk3b/core/k3bglobalsettings.h @@ -0,0 +1,70 @@ +/* + * + * $Id: k3bglobalsettings.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_GLOBAL_SETTINGS_H_ +#define _K3B_GLOBAL_SETTINGS_H_ +#include "k3b_export.h" +class KConfig; + +/** + * Some global settings used throughout K3b. + */ +class LIBK3B_EXPORT K3bGlobalSettings +{ + public: + K3bGlobalSettings(); + + /** + * This method takes care of settings the config group + */ + void readSettings( KConfig* ); + + /** + * This method takes care of settings the config group + */ + void saveSettings( KConfig* ); + + bool ejectMedia() const { return m_eject; } + bool burnfree() const { return m_burnfree; } + bool overburn() const { return m_overburn; } + bool useManualBufferSize() const { return m_useManualBufferSize; } + int bufferSize() const { return m_bufferSize; } + + /** + * If force is set to true K3b will continue in certain "unsafe" situations. + * The most common being a medium not suitable for the writer in terms of + * writing speed. + * Compare cdrecord's parameter -force + */ + bool force() const { return m_force; } + + void setEjectMedia( bool b ) { m_eject = b; } + void setBurnfree( bool b ) { m_burnfree = b; } + void setOverburn( bool b ) { m_overburn = b; } + void setUseManualBufferSize( bool b ) { m_useManualBufferSize = b; } + void setBufferSize( int size ) { m_bufferSize = size; } + void setForce( bool b ) { m_force = b; } + + private: + bool m_eject; + bool m_burnfree; + bool m_overburn; + bool m_useManualBufferSize; + int m_bufferSize; + bool m_force; +}; + + +#endif diff --git a/libk3b/core/k3bjob.cpp b/libk3b/core/k3bjob.cpp new file mode 100644 index 0000000..b545107 --- /dev/null +++ b/libk3b/core/k3bjob.cpp @@ -0,0 +1,253 @@ +/* + * + * $Id: k3bjob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bjob.h" +#include +#include + +#include +#include + +#include +#include + + +class K3bJob::Private +{ +public: +}; + + +const char* K3bJob::DEFAULT_SIGNAL_CONNECTION = "K3bJobDefault"; + + +K3bJob::K3bJob( K3bJobHandler* handler, QObject* parent, const char* name ) + : QObject( parent, name ), + m_jobHandler( handler ), + m_canceled(false), + m_active(false) +{ + connect( this, SIGNAL(canceled()), + this, SLOT(slotCanceled()) ); +} + +K3bJob::~K3bJob() +{ + // + // Normally a job (or the user of a job should take care of this + // but we do this here for security reasons. + // + if( m_active ) + jobFinished( false ); +} + + +void K3bJob::setJobHandler( K3bJobHandler* jh ) +{ + m_jobHandler = jh; +} + + +void K3bJob::jobStarted() +{ + m_canceled = false; + m_active = true; + + if( jobHandler() && jobHandler()->isJob() ) + static_cast(jobHandler())->registerSubJob( this ); + else + k3bcore->registerJob( this ); + + emit started(); +} + + +void K3bJob::jobFinished( bool success ) +{ + m_active = false; + + if( jobHandler() && jobHandler()->isJob() ) + static_cast(jobHandler())->unregisterSubJob( this ); + else + k3bcore->unregisterJob( this ); + + emit finished( success ); +} + + +void K3bJob::slotCanceled() +{ + m_canceled = true; +} + + +int K3bJob::waitForMedia( K3bDevice::Device* device, + int mediaState, + int mediaType, + const QString& message ) +{ + // TODO: What about: emit newSubTask( i18n("Waiting for media") ); + return m_jobHandler->waitForMedia( device, mediaState, mediaType, message ); +} + + +bool K3bJob::questionYesNo( const QString& text, + const QString& caption, + const QString& yesText, + const QString& noText ) +{ + return m_jobHandler->questionYesNo( text, caption, yesText, noText ); +} + + +void K3bJob::blockingInformation( const QString& text, + const QString& caption ) +{ + return m_jobHandler->blockingInformation( text, caption ); +} + + +void K3bJob::connectSubJob( K3bJob* subJob, + const char* finishedSlot, + bool connectProgress, + const char* progressSlot, + const char* subProgressSlot, + const char* processedSizeSlot, + const char* processedSubSizeSlot ) +{ + connect( subJob, SIGNAL(newTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( subJob, SIGNAL(newSubTask(const QString&)), this, SLOT(slotNewSubTask(const QString&)) ); + connect( subJob, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + connect( subJob, SIGNAL(infoMessage(const QString&, int)), + this, SIGNAL(infoMessage(const QString&, int)) ); + connect( subJob, SIGNAL(finished(bool)), this, finishedSlot ); + + if( connectProgress ) { + connect( subJob, SIGNAL(percent(int)), + this, progressSlot != 0 ? progressSlot : SIGNAL(subPercent(int)) ); + if( subProgressSlot ) + connect( subJob, SIGNAL(subPercent(int)), this, subProgressSlot ); + connect( subJob, SIGNAL(processedSize(int, int)), + this, processedSizeSlot != 0 ? processedSizeSlot : SIGNAL(processedSubSize(int, int)) ); + if( processedSubSizeSlot ) + connect( subJob, SIGNAL(processedSubSize(int, int)), this, processedSubSizeSlot ); + } +} + + +void K3bJob::connectSubJob( K3bJob* subJob, + const char* finishedSlot, + const char* newTaskSlot, + const char* newSubTaskSlot, + const char* progressSlot, + const char* subProgressSlot, + const char* processedSizeSlot, + const char* processedSubSizeSlot ) +{ + // standard connections + connect( subJob, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + connect( subJob, SIGNAL(infoMessage(const QString&, int)), + this, SIGNAL(infoMessage(const QString&, int)) ); + + // task connections + if( newTaskSlot == DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(newTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + else if( newTaskSlot ) + connect( subJob, SIGNAL(newTask(const QString&)), this, newTaskSlot ); + + if( newSubTaskSlot == DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(newSubTask(const QString&)), this, SLOT(slotNewSubTask(const QString&)) ); + else if( newSubTaskSlot ) + connect( subJob, SIGNAL(newSubTask(const QString&)), this, newSubTaskSlot ); + + if( finishedSlot && finishedSlot != DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(finished(bool)), this, finishedSlot ); + + // progress + if( progressSlot == DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(percent(int)), this, SIGNAL(subPercent(int)) ); + else if( progressSlot ) + connect( subJob, SIGNAL(percent(int)), this, progressSlot ); + + if( subProgressSlot && subProgressSlot != DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(subPercent(int)), this, subProgressSlot ); + + // processed size + if( processedSizeSlot == DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + else if( processedSizeSlot ) + connect( subJob, SIGNAL(processedSize(int, int)), this, processedSizeSlot ); + + if( processedSubSizeSlot && processedSubSizeSlot != DEFAULT_SIGNAL_CONNECTION ) + connect( subJob, SIGNAL(processedSubSize(int, int)), this, processedSubSizeSlot ); +} + + +unsigned int K3bJob::numRunningSubJobs() const +{ + return m_runningSubJobs.count(); +} + + +void K3bJob::slotNewSubTask( const QString& str ) +{ + emit infoMessage( str, INFO ); +} + + +void K3bJob::registerSubJob( K3bJob* job ) +{ + m_runningSubJobs.append( job ); +} + + +void K3bJob::unregisterSubJob( K3bJob* job ) +{ + m_runningSubJobs.removeRef( job ); +} + + + + +class K3bBurnJob::Private +{ +public: +}; + + + +K3bBurnJob::K3bBurnJob( K3bJobHandler* handler, QObject* parent, const char* name ) + : K3bJob( handler, parent, name ), + m_writeMethod( K3b::DEFAULT ) +{ + d = new Private; +} + + +K3bBurnJob::~K3bBurnJob() +{ + delete d; +} + + +int K3bBurnJob::supportedWritingApps() const +{ + return K3b::DEFAULT | K3b::CDRDAO | K3b::CDRECORD; +} + +#include "k3bjob.moc" diff --git a/libk3b/core/k3bjob.h b/libk3b/core/k3bjob.h new file mode 100644 index 0000000..59e1f9b --- /dev/null +++ b/libk3b/core/k3bjob.h @@ -0,0 +1,311 @@ +/* + * + * $Id: k3bjob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BJOB_H +#define K3BJOB_H + +#include +#include +#include "k3bjobhandler.h" +#include "k3b_export.h" + +class K3bDoc; +namespace K3bDevice { + class Device; +} + + +/** + * This is the baseclass for all the jobs in K3b which actually do the work like burning a cd! + * The K3bJob object takes care of registering with the k3bcore or with a parent K3bJob. + * + * Every job has a jobhandler which can be another job (in which case the job is handled as + * a subjob) or an arbitrary class implementing the K3bJobHandler interface. + * + * A Job should never create any widgets. User interaction should be done through the methods + * questionYesNo, waitForMedia. + * + * @author Sebastian Trueg + */ +class LIBK3B_EXPORT K3bJob : public QObject, public K3bJobHandler +{ + Q_OBJECT + + public: + virtual ~K3bJob(); + + /** + * \reimplemented from K3bJobHandler + */ + bool isJob() const { return true; } + + K3bJobHandler* jobHandler() const { return m_jobHandler; } + + /** + * Is the job active? + * The default implementation is based on the jobStarted() and jobFinished() + * methods and there is normally no need to reimplement this. + */ + virtual bool active() const { return m_active; } + + /** + * The default implementation is based on the canceled() signal. + * + * This means that one cannot count on this value being valid + * in a slot connected to the canceled() signal. It is, however, save + * to call this method from a slot connected to the finished() signal + * in case the job makes proper usage of the jobStarted/jobFinished + * methods. + */ + virtual bool hasBeenCanceled() const { return m_canceled; } + + virtual QString jobDescription() const { return "K3bJob"; } + virtual QString jobDetails() const { return QString::null; } + + /** + * @returns the number of running subjobs. + * this is useful for proper cancellation of jobs. + */ + unsigned int numRunningSubJobs() const; + + const QPtrList& runningSubJobs() const { return m_runningSubJobs; } + + /** + * \deprecated + */ + virtual void connectSubJob( K3bJob* subJob, + const char* finishedSlot = 0, + bool progress = false, + const char* progressSlot = 0, + const char* subProgressSot = 0, + const char* processedSizeSlot = 0, + const char* processedSubSizeSlot = 0 ); + + static const char* DEFAULT_SIGNAL_CONNECTION; + + /** + * \param newTaskSlot If DEFAULT_SIGNAL_CONNECTION the newTask signal from the subjob will + * be connected to the newSubTask signal + * \param newSubTaskSlot If DEFAULT_SIGNAL_CONNECTION the newSubTask signal from the subjob + * will create an infoMessage signal + * \param progressSlot If DEFAULT_SIGNAL_CONNECTION the percent signal of the subjob will be + * connected to the subPercent signal. + * debuggingOutput and infoMessage will always be direcctly connected. + * + * If a parameter is set to 0 it will not be connected at all + */ + virtual void connectSubJob( K3bJob* subJob, + const char* finishedSlot = DEFAULT_SIGNAL_CONNECTION, + const char* newTaskSlot = DEFAULT_SIGNAL_CONNECTION, + const char* newSubTaskSlot = DEFAULT_SIGNAL_CONNECTION, + const char* progressSlot = DEFAULT_SIGNAL_CONNECTION, + const char* subProgressSlot = DEFAULT_SIGNAL_CONNECTION, + const char* processedSizeSlot = DEFAULT_SIGNAL_CONNECTION, + const char* processedSubSizeSlot = DEFAULT_SIGNAL_CONNECTION ); + + /** + * Message types to be used in combination with the infoMessage signal. + * + * \see infoMessage() + */ + enum MessageType { + INFO, /**< Informational message. For example a message that informs the user about what is + currently going on */ + WARNING, /**< A warning message. Something did not go perfectly but the job may continue. */ + ERROR, /**< An error. Only use this message type if the job will actually fail afterwards + with a call to jobFinished( false ) */ + SUCCESS /**< This message type may be used to inform the user that a sub job has + been successfully finished. */ + }; + + /** + * reimplemented from K3bJobHandler + */ + int waitForMedia( K3bDevice::Device*, + int mediaState = K3bDevice::STATE_EMPTY, + int mediaType = K3bDevice::MEDIA_WRITABLE_CD, + const QString& message = QString::null ); + + /** + * reimplemented from K3bJobHandler + */ + bool questionYesNo( const QString& text, + const QString& caption = QString::null, + const QString& yesText = QString::null, + const QString& noText = QString::null ); + + /** + * reimplemented from K3bJobHandler + */ + void blockingInformation( const QString& text, + const QString& caption = QString::null ); + + public slots: + /** + * This is the slot that starts the job. The first call should always + * be jobStarted(). + * + * Once the job has finished it has to call jobFinished() with the result as + * a parameter. + * + * \see jobStarted() + * \see jobFinished() + */ + virtual void start() = 0; + + /** + * This slot should cancel the job. The job has to emit the canceled() signal and make a call + * to jobFinished(). + * It is not important to do any of those two directly in this slot though. + */ + virtual void cancel() = 0; + + void setJobHandler( K3bJobHandler* ); + + signals: + void infoMessage( const QString& msg, int type ); + void percent( int p ); + void subPercent( int p ); + void processedSize( int processed, int size ); + void processedSubSize( int processed, int size ); + void newTask( const QString& job ); + void newSubTask( const QString& job ); + void debuggingOutput(const QString&, const QString&); + void data( const char* data, int len ); + void nextTrack( int track, int numTracks ); + + void canceled(); + + /** + * Emitted once the job has been started. Never emit this signal directly. + * Use jobStarted() instead, otherwise the job will not be properly registered + */ + void started(); + + /** + * Emitted once the job has been finshed. Never emit this signal directly. + * Use jobFinished() instead, otherwise the job will not be properly deregistered + */ + void finished( bool success ); + + protected: + /** + * \param hdl the handler of the job. This allows for some user interaction without + * specifying any details (like the GUI). + * The job handler can also be another job. In that case this job is a sub job + * and will be part of the parents running sub jobs. + * + * \see runningSubJobs() + * \see numRunningSubJobs() + */ + K3bJob( K3bJobHandler* hdl, QObject* parent = 0, const char* name = 0 ); + + /** + * Call this in start() to properly register the job and emit the started() signal. + * Do never emit the started() signal manually. + * + * Always call K3bJob::jobStarted in reimplementations. + */ + virtual void jobStarted(); + + /** + * Call this at the end of the job to properly deregister the job and emit the finished() signal. + * Do never emit the started() signal manually. + * + * Always call K3bJob::jobFinished in reimplementations. + */ + virtual void jobFinished( bool success ); + + private slots: + void slotCanceled(); + void slotNewSubTask( const QString& str ); + + private: + void registerSubJob( K3bJob* ); + void unregisterSubJob( K3bJob* ); + + K3bJobHandler* m_jobHandler; + QPtrList m_runningSubJobs; + + bool m_canceled; + bool m_active; + + class Private; + Private* d; +}; + + +/** + * Every job used to actually burn a medium is derived from K3bBurnJob. + * This class implements additional signals like buffer status or writing speed + * as well as a handling of the used writing application. + */ +class LIBK3B_EXPORT K3bBurnJob : public K3bJob +{ + Q_OBJECT + + public: + K3bBurnJob( K3bJobHandler* hdl, QObject* parent = 0, const char* name = 0 ); + virtual ~K3bBurnJob(); + + /** + * The writing device used by this job. + */ + virtual K3bDevice::Device* writer() const { return 0; } + + /** + * use K3b::WritingApp + */ + int writingApp() const { return m_writeMethod; } + + /** + * K3b::WritingApp "ored" together + */ + virtual int supportedWritingApps() const; + + public slots: + /** + * use K3b::WritingApp + */ + void setWritingApp( int w ) { m_writeMethod = w; } + + signals: + void bufferStatus( int ); + + void deviceBuffer( int ); + + /** + * @param speed current writing speed in Kb + * @param multiplicator use 150 for CDs and 1380 for DVDs + * FIXME: maybe one should be able to ask the burnjob if it burns a CD or a DVD and remove the + * multiplicator parameter) + */ + void writeSpeed( int speed, int multiplicator ); + + /** + * This signal may be used to inform when the burning starts or ends + * The BurningProgressDialog for example uses it to enable and disable + * the buffer and writing speed displays. + */ + void burning(bool); + + private: + int m_writeMethod; + + class Private; + Private* d; +}; +#endif diff --git a/libk3b/core/k3bjobhandler.h b/libk3b/core/k3bjobhandler.h new file mode 100644 index 0000000..1262e0e --- /dev/null +++ b/libk3b/core/k3bjobhandler.h @@ -0,0 +1,64 @@ +/* + * + * $Id: k3bjobhandler.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2004 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_JOB_HANDLER_H_ +#define _K3B_JOB_HANDLER_H_ + + +#include +#include + + +/** + * See @p K3bJobProgressDialog as an example for the usage of + * the K3bJobHandler interface. + */ +class K3bJobHandler +{ + public: + K3bJobHandler() {} + virtual ~K3bJobHandler() {} + + /** + * \return true if the handler itself is also a job + */ + virtual bool isJob() const { return false; } + + /** + * @return K3bDevice::MediaType on success, + * 0 if forced (no media info available), + * and -1 on error (canceled) + */ + virtual int waitForMedia( K3bDevice::Device*, + int mediaState = K3bDevice::STATE_EMPTY, + int mediaType = K3bDevice::MEDIA_WRITABLE_CD, + const QString& message = QString::null ) = 0; + + // FIXME: use KGuiItem + virtual bool questionYesNo( const QString& text, + const QString& caption = QString::null, + const QString& yesText = QString::null, + const QString& noText = QString::null ) = 0; + + /** + * Use this if you need the user to do something before the job is able to continue. + * In all other cases an infoMessage should be used. + */ + virtual void blockingInformation( const QString& text, + const QString& caption = QString::null ) = 0; + +}; + +#endif diff --git a/libk3b/core/k3bprocess.cpp b/libk3b/core/k3bprocess.cpp new file mode 100644 index 0000000..35ddff4 --- /dev/null +++ b/libk3b/core/k3bprocess.cpp @@ -0,0 +1,452 @@ +/* + * + * $Id: k3bprocess.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + + +#include "k3bprocess.h" +#include "k3bexternalbinmanager.h" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + +class K3bProcess::Data +{ +public: + QString unfinishedStdoutLine; + QString unfinishedStderrLine; + + int dupStdoutFd; + int dupStdinFd; + + bool rawStdin; + bool rawStdout; + + int in[2]; + int out[2]; + + bool suppressEmptyLines; +}; + + +K3bProcess::K3bProcess() + : KProcess(), + m_bSplitStdout(false) +{ + d = new Data(); + d->dupStdinFd = d->dupStdoutFd = -1; + d->rawStdout = d->rawStdin = false; + d->in[0] = d->in[1] = -1; + d->out[0] = d->out[1] = -1; + d->suppressEmptyLines = true; +} + +K3bProcess::~K3bProcess() +{ + delete d; +} + + +K3bProcess& K3bProcess::operator<<( const K3bExternalBin* bin ) +{ + return this->operator<<( bin->path ); +} + +K3bProcess& K3bProcess::operator<<( const QString& arg ) +{ + static_cast(this)->operator<<( arg ); + return *this; +} + +K3bProcess& K3bProcess::operator<<( const char* arg ) +{ + static_cast(this)->operator<<( arg ); + return *this; +} + +K3bProcess& K3bProcess::operator<<( const QCString& arg ) +{ + static_cast(this)->operator<<( arg ); + return *this; +} + +K3bProcess& K3bProcess::operator<<( const QStringList& args ) +{ + static_cast(this)->operator<<( args ); + return *this; +} + + +bool K3bProcess::start( RunMode run, Communication com ) +{ + if( com & Stderr ) { + connect( this, SIGNAL(receivedStderr(KProcess*, char*, int)), + this, SLOT(slotSplitStderr(KProcess*, char*, int)) ); + } + if( com & Stdout ) { + connect( this, SIGNAL(receivedStdout(KProcess*, char*, int)), + this, SLOT(slotSplitStdout(KProcess*, char*, int)) ); + } + + return KProcess::start( run, com ); +} + + +void K3bProcess::slotSplitStdout( KProcess*, char* data, int len ) +{ + if( m_bSplitStdout ) { + QStringList lines = splitOutput( data, len, d->unfinishedStdoutLine, d->suppressEmptyLines ); + + for( QStringList::iterator it = lines.begin(); it != lines.end(); ++it ) { + QString& str = *it; + + // just to be sure since something in splitOutput does not do this right + if( d->suppressEmptyLines && str.isEmpty() ) + continue; + + emit stdoutLine( str ); + } + } +} + + +void K3bProcess::slotSplitStderr( KProcess*, char* data, int len ) +{ + QStringList lines = splitOutput( data, len, d->unfinishedStderrLine, d->suppressEmptyLines ); + + for( QStringList::iterator it = lines.begin(); it != lines.end(); ++it ) { + QString& str = *it; + + // just to be sure since something in splitOutput does not do this right + if( d->suppressEmptyLines && str.isEmpty() ) + continue; + + emit stderrLine( str ); + } +} + + +QStringList K3bProcess::splitOutput( char* data, int len, + QString& unfinishedLine, bool suppressEmptyLines ) +{ + // + // The stderr splitting is mainly used for parsing of messages + // That's why we simplify the data before proceeding + // + + QString buffer; + for( int i = 0; i < len; i++ ) { + if( data[i] == '\b' ) { + while( data[i] == '\b' ) // we replace multiple backspaces with a single line feed + i++; + buffer += '\n'; + } + if( data[i] == '\r' ) + buffer += '\n'; + else if( data[i] == '\t' ) // replace tabs with a single space + buffer += " "; + else + buffer += data[i]; + } + + QStringList lines = QStringList::split( '\n', buffer, !suppressEmptyLines ); + + // in case we suppress empty lines we need to handle the following separately + // to make sure we join unfinished lines correctly + if( suppressEmptyLines && buffer[0] == '\n' ) + lines.prepend( QString::null ); + + if( !unfinishedLine.isEmpty() ) { + lines.first().prepend( unfinishedLine ); + unfinishedLine.truncate(0); + + kdDebug() << "(K3bProcess) joined line: '" << (lines.first()) << "'" << endl; + } + + QStringList::iterator it; + + // check if line ends with a newline + // if not save the last line because it is not finished + QChar c = buffer.right(1).at(0); + bool hasUnfinishedLine = ( c != '\n' && c != '\r' && c != QChar(46) ); // What is unicode 46?? It is printed as a point + if( hasUnfinishedLine ) { + kdDebug() << "(K3bProcess) found unfinished line: '" << lines.last() << "'" << endl; + kdDebug() << "(K3bProcess) last char: '" << buffer.right(1) << "'" << endl; + unfinishedLine = lines.last(); + it = lines.end(); + --it; + lines.remove(it); + } + + return lines; +} + + +int K3bProcess::setupCommunication( Communication comm ) +{ + if( KProcess::setupCommunication( comm ) ) { + + // + // Setup our own socketpair + // + + if( d->rawStdin ) { + if( socketpair(AF_UNIX, SOCK_STREAM, 0, d->in) == 0 ) { + fcntl(d->in[0], F_SETFD, FD_CLOEXEC); + fcntl(d->in[1], F_SETFD, FD_CLOEXEC); + } + else + return 0; + } + + if( d->rawStdout ) { + if( socketpair(AF_UNIX, SOCK_STREAM, 0, d->out) == 0 ) { + fcntl(d->out[0], F_SETFD, FD_CLOEXEC); + fcntl(d->out[1], F_SETFD, FD_CLOEXEC); + } + else { + if( d->rawStdin || d->dupStdinFd ) { + close(d->in[0]); + close(d->in[1]); + } + return 0; + } + } + + return 1; + } + else + return 0; +} + + +void K3bProcess::commClose() +{ + if( d->rawStdin ) { + close(d->in[1]); + d->in[1] = -1; + } + if( d->rawStdout ) { + close(d->out[0]); + d->out[0] = -1; + } + + KProcess::commClose(); +} + + +int K3bProcess::commSetupDoneP() +{ + int ok = KProcess::commSetupDoneP(); + + if( d->rawStdin ) + close(d->in[0]); + if( d->rawStdout ) + close(d->out[1]); + + d->in[0] = d->out[1] = -1; + + return ok; +} + + +int K3bProcess::commSetupDoneC() +{ + int ok = KProcess::commSetupDoneC(); + + if( d->dupStdoutFd != -1 ) { + // + // make STDOUT_FILENO a duplicate of d->dupStdoutFd such that writes to STDOUT_FILENO are "redirected" + // to d->dupStdoutFd + // + if( ::dup2( d->dupStdoutFd, STDOUT_FILENO ) < 0 ) { + kdDebug() << "(K3bProcess) Error while dup( " << d->dupStdoutFd << ", " << STDOUT_FILENO << endl; + ok = 0; + } + } + else if( d->rawStdout ) { + if( ::dup2( d->out[1], STDOUT_FILENO ) < 0 ) { + kdDebug() << "(K3bProcess) Error while dup( " << d->out[1] << ", " << STDOUT_FILENO << endl; + ok = 0; + } + } + + if( d->dupStdinFd != -1 ) { + if( ::dup2( d->dupStdinFd, STDIN_FILENO ) < 0 ) { + kdDebug() << "(K3bProcess) Error while dup( " << d->dupStdinFd << ", " << STDIN_FILENO << endl; + ok = 0; + } + } + else if( d->rawStdin ) { + if( ::dup2( d->in[0], STDIN_FILENO ) < 0 ) { + kdDebug() << "(K3bProcess) Error while dup( " << d->in[0] << ", " << STDIN_FILENO << endl; + ok = 0; + } + } + + return ok; +} + + + +int K3bProcess::stdinFd() const +{ + if( d->rawStdin ) + return d->in[1]; + else if( d->dupStdinFd != -1 ) + return d->dupStdinFd; + else + return -1; +} + +int K3bProcess::stdoutFd() const +{ + if( d->rawStdout ) + return d->out[0]; + else if( d->dupStdoutFd != -1 ) + return d->dupStdoutFd; + else + return -1; +} + + +void K3bProcess::dupStdout( int fd ) +{ + writeToFd( fd ); +} + +void K3bProcess::dupStdin( int fd ) +{ + readFromFd( fd ); +} + + +void K3bProcess::writeToFd( int fd ) +{ + d->dupStdoutFd = fd; + if( fd != -1 ) + d->rawStdout = false; +} + +void K3bProcess::readFromFd( int fd ) +{ + d->dupStdinFd = fd; + if( fd != -1 ) + d->rawStdin = false; +} + + +void K3bProcess::setRawStdin(bool b) +{ + if( b ) { + d->rawStdin = true; + d->dupStdinFd = -1; + } + else + d->rawStdin = false; +} + + +void K3bProcess::setRawStdout(bool b) +{ + if( b ) { + d->rawStdout = true; + d->dupStdoutFd = -1; + } + else + d->rawStdout = false; +} + + +void K3bProcess::setSuppressEmptyLines( bool b ) +{ + d->suppressEmptyLines = b; +} + + +bool K3bProcess::closeStdin() +{ + if( d->rawStdin ) { + close(d->in[1]); + d->in[1] = -1; + return true; + } + else + return KProcess::closeStdin(); +} + + +bool K3bProcess::closeStdout() +{ + if( d->rawStdout ) { + close(d->out[0]); + d->out[0] = -1; + return true; + } + else + return KProcess::closeStdout(); +} + + +K3bProcessOutputCollector::K3bProcessOutputCollector( KProcess* p ) + : m_process(0) +{ + setProcess( p ); +} + +void K3bProcessOutputCollector::setProcess( KProcess* p ) +{ + if( m_process ) + m_process->disconnect( this ); + + m_process = p; + if( p ) { + connect( p, SIGNAL(receivedStdout(KProcess*, char*, int)), + this, SLOT(slotGatherStdout(KProcess*, char*, int)) ); + connect( p, SIGNAL(receivedStderr(KProcess*, char*, int)), + this, SLOT(slotGatherStderr(KProcess*, char*, int)) ); + } + + m_gatheredOutput.truncate( 0 ); + m_stderrOutput.truncate( 0 ); + m_stdoutOutput.truncate( 0 ); +} + +void K3bProcessOutputCollector::slotGatherStderr( KProcess*, char* data, int len ) +{ + m_gatheredOutput.append( QString::fromLocal8Bit( data, len ) ); + m_stderrOutput.append( QString::fromLocal8Bit( data, len ) ); +} + +void K3bProcessOutputCollector::slotGatherStdout( KProcess*, char* data, int len ) +{ + m_gatheredOutput.append( QString::fromLocal8Bit( data, len ) ); + m_stdoutOutput.append( QString::fromLocal8Bit( data, len ) ); +} + + +#include "k3bprocess.moc" diff --git a/libk3b/core/k3bprocess.h b/libk3b/core/k3bprocess.h new file mode 100644 index 0000000..959bda1 --- /dev/null +++ b/libk3b/core/k3bprocess.h @@ -0,0 +1,204 @@ +/* + * + * $Id: k3bprocess.h 621644 2007-01-09 12:53:09Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3B_PROCESS_H +#define K3B_PROCESS_H + + +#include +#include +#include "k3b_export.h" + +class K3bExternalBin; + + +/** + * This is an enhanced KProcess. + * It splits the stderr output to lines making sure the client gets every line as it + * was written by the process. + * Aditionally one may set raw stdout and stdin handling using the stdin() and stdout() methods + * to get the process' file descriptors. + * Last but not least K3bProcess is able to duplicate stdout making it possible to connect two + * K3bProcesses like used in K3bDataJob to duplicate mkisofs' stdout to the stdin of the writer + * (cdrecord or cdrdao) + */ +class LIBK3B_EXPORT K3bProcess : public KProcess +{ + Q_OBJECT + + public: + class OutputCollector; + + public: + K3bProcess(); + ~K3bProcess(); + + /** + * In the future this might also set the nice value + */ + K3bProcess& operator<<( const K3bExternalBin* ); + + K3bProcess& operator<<( const QString& arg ); + K3bProcess& operator<<( const char* arg ); + K3bProcess& operator<<( const QCString& arg ); + K3bProcess& operator<<( const QStringList& args ); + + bool start( RunMode run = NotifyOnExit, Communication com = NoCommunication ); + + /** + * get stdin file descriptor + * Only makes sense while process is running. + * + * Only use with setRawStdin + */ + int stdinFd() const; + + /** + * get stdout file descriptor + * Only makes sense while process is running. + * + * Only use with setRawStdout + */ + int stdoutFd() const; + + /** + * @deprecated use writeToFd + */ + void dupStdout( int fd ); + + /** + * @deprecated use readFromFd + */ + void dupStdin( int fd ); + + /** + * Make the process write to @fd instead of Stdout. + * This means you won't get any stdoutReady() or receivedStdout() + * signals anymore. + * + * Only use this before starting the process. + */ + void writeToFd( int fd ); + + /** + * Make the process read from @fd instead of Stdin. + * This means you won't get any wroteStdin() + * signals anymore. + * + * Only use this before starting the process. + */ + void readFromFd( int fd ); + + /** + * If set true the process' stdin fd will be available + * through @stdinFd. + * Be aware that you will not get any wroteStdin signals + * anymore. + * + * Only use this before starting the process. + */ + void setRawStdin(bool b); + + /** + * If set true the process' stdout fd will be available + * through @stdoutFd. + * Be aware that you will not get any stdoutReady or receivedStdout + * signals anymore. + * + * Only use this before starting the process. + */ + void setRawStdout(bool b); + + public slots: + void setSplitStdout( bool b ) { m_bSplitStdout = b; } + + /** + * default is true + */ + void setSuppressEmptyLines( bool b ); + + bool closeStdin(); + bool closeStdout(); + + private slots: + void slotSplitStderr( KProcess*, char*, int ); + void slotSplitStdout( KProcess*, char*, int ); + + signals: + void stderrLine( const QString& line ); + void stdoutLine( const QString& line ); + + /** + * Gets emitted if raw stdout mode has been requested + * The data has to be read from @p fd. + */ + void stdoutReady( int fd ); + + protected: + /** + * reimplemeted from KProcess + */ + int commSetupDoneP(); + + /** + * reimplemeted from KProcess + */ + int commSetupDoneC(); + + /** + * reimplemeted from KProcess + */ + int setupCommunication( Communication comm ); + + /** + * reimplemeted from KProcess + */ + void commClose(); + + private: + static QStringList splitOutput( char*, int, QString&, bool ); + + class Data; + Data* d; + + bool m_bSplitStdout; +}; + +class LIBK3B_EXPORT K3bProcessOutputCollector: public QObject +{ + Q_OBJECT + + public: + K3bProcessOutputCollector( KProcess* ); + void setProcess( KProcess* ); + + const QString& output() const { return m_gatheredOutput; } + const QString& stderrOutput() const { return m_stderrOutput; } + const QString& stdoutOutput() const { return m_stdoutOutput; } + + private slots: + void slotGatherStderr( KProcess*, char*, int ); + void slotGatherStdout( KProcess*, char*, int ); + + private: + QString m_gatheredOutput; + QString m_stderrOutput; + QString m_stdoutOutput; + KProcess* m_process; +}; + + +#endif diff --git a/libk3b/core/k3bprogressinfoevent.h b/libk3b/core/k3bprogressinfoevent.h new file mode 100644 index 0000000..0e77718 --- /dev/null +++ b/libk3b/core/k3bprogressinfoevent.h @@ -0,0 +1,85 @@ +/* + * + * $Id: k3bprogressinfoevent.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef K3B_PROGRESS_INFO_EVENT_H +#define K3B_PROGRESS_INFO_EVENT_H + +#include +#include + + +/** + * Custom event class for posting events corresponding to the + * K3bJob signals. This is useful for a threaded job since + * in that case it's not possible to emit signals that directly + * change the GUI (see QThread docu). + */ +class K3bProgressInfoEvent : public QCustomEvent +{ + public: + K3bProgressInfoEvent( int type ) + : QCustomEvent( type ), + m_type(type) + {} + + K3bProgressInfoEvent( int type, const QString& v1, const QString& v2 = QString::null, + int value1 = 0, int value2 = 0 ) + : QCustomEvent( type ), + m_type( type), + m_firstValue(value1), + m_secondValue(value2), + m_firstString(v1), + m_secondString(v2) + {} + + K3bProgressInfoEvent( int type, int value1, int value2 = 0 ) + : QCustomEvent( type ), + m_type( type), + m_firstValue(value1), + m_secondValue(value2) + {} + + int type() const { return m_type; } + const QString& firstString() const { return m_firstString; } + const QString& secondString() const { return m_secondString; } + int firstValue() const { return m_firstValue; } + int secondValue() const { return m_secondValue; } + + enum K3bProgressInfoEventType { + Progress = QEvent::User + 1, + SubProgress, + ProcessedSize, + ProcessedSubSize, + InfoMessage, + Started, + Canceled, + Finished, + NewTask, + NewSubTask, + DebuggingOutput, + BufferStatus, + WriteSpeed, + NextTrack + }; + + private: + int m_type; + int m_firstValue; + int m_secondValue; + QString m_firstString; + QString m_secondString; +}; + +#endif diff --git a/libk3b/core/k3bsimplejobhandler.cpp b/libk3b/core/k3bsimplejobhandler.cpp new file mode 100644 index 0000000..eaf7cd6 --- /dev/null +++ b/libk3b/core/k3bsimplejobhandler.cpp @@ -0,0 +1,62 @@ +/* + * + * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $ + * Copyright (C) 2006 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bsimplejobhandler.h" + + +K3bSimpleJobHandler::K3bSimpleJobHandler( QObject* parent ) + : QObject( parent ), + K3bJobHandler() +{ +} + +K3bSimpleJobHandler::~K3bSimpleJobHandler() +{ +} + +int K3bSimpleJobHandler::waitForMedia( K3bDevice::Device* dev, + int mediaState, + int mediaType, + const QString& message ) +{ + Q_UNUSED( dev ); + Q_UNUSED( mediaState ); + Q_UNUSED( mediaType ); + Q_UNUSED( message ); + + return 0; +} + +bool K3bSimpleJobHandler::questionYesNo( const QString& text, + const QString& caption, + const QString& yesText, + const QString& noText ) +{ + Q_UNUSED( text ); + Q_UNUSED( caption ); + Q_UNUSED( yesText ); + Q_UNUSED( noText ); + + return true; +} + +void K3bSimpleJobHandler::blockingInformation( const QString& text, + const QString& caption ) +{ + Q_UNUSED( text ); + Q_UNUSED( caption ); +} + +#include "k3bsimplejobhandler.moc" diff --git a/libk3b/core/k3bsimplejobhandler.h b/libk3b/core/k3bsimplejobhandler.h new file mode 100644 index 0000000..f84064e --- /dev/null +++ b/libk3b/core/k3bsimplejobhandler.h @@ -0,0 +1,61 @@ +/* + * + * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $ + * Copyright (C) 2006 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_SIMPLE_JOB_HANDLER_H_ +#define _K3B_SIMPLE_JOB_HANDLER_H_ + +#include + +#include +#include + + +/** + * This is a simplified job handler which just consumes the + * job handler calls without doing anything. + * Use it for very simple jobs that don't need the job handler + * methods. + */ +class LIBK3B_EXPORT K3bSimpleJobHandler : public QObject, public K3bJobHandler +{ + Q_OBJECT + + public: + K3bSimpleJobHandler( QObject* parent = 0 ); + ~K3bSimpleJobHandler(); + + /* + * \return 0 + */ + int waitForMedia( K3bDevice::Device*, + int mediaState = K3bDevice::STATE_EMPTY, + int mediaType = K3bDevice::MEDIA_WRITABLE_CD, + const QString& message = QString::null ); + /** + * \return true + */ + bool questionYesNo( const QString& text, + const QString& caption = QString::null, + const QString& yesText = QString::null, + const QString& noText = QString::null ); + + /** + * Does nothing + */ + void blockingInformation( const QString& text, + const QString& caption = QString::null ); +}; + +#endif diff --git a/libk3b/core/k3bthread.cpp b/libk3b/core/k3bthread.cpp new file mode 100644 index 0000000..07414ad --- /dev/null +++ b/libk3b/core/k3bthread.cpp @@ -0,0 +1,221 @@ +/* + * + * $Id: k3bthread.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bthread.h" +#include "k3bprogressinfoevent.h" +#include "k3bdataevent.h" + +#include + +#include + + +static QPtrList s_threads; + + +void K3bThread::waitUntilFinished() +{ + QPtrListIterator it( s_threads ); + while( it.current() ) { + kdDebug() << "Waiting for thread " << it.current() << endl; + it.current()->wait(); + ++it; + } + + kdDebug() << "Thread waiting done." << endl; +} + + +class K3bThread::Private +{ +public: + Private() + : eventHandler( 0 ) { + } + + QObject* eventHandler; +}; + + +K3bThread::K3bThread( QObject* eventHandler ) + : QThread() +{ + d = new Private; + d->eventHandler = eventHandler; + + s_threads.append(this); +} + + +K3bThread::K3bThread( unsigned int stackSize, QObject* eventHandler ) + : QThread( stackSize ) +{ + d = new Private; + d->eventHandler = eventHandler; + + s_threads.append(this); +} + + +K3bThread::~K3bThread() +{ + s_threads.removeRef(this); + delete d; +} + + +void K3bThread::setProgressInfoEventHandler( QObject* eventHandler ) +{ + d->eventHandler = eventHandler; +} + +QString K3bThread::jobDescription() const +{ + return QString::null; +} + + +QString K3bThread::jobDetails() const +{ + return QString::null; +} + + +void K3bThread::init() +{ + // do nothing... +} + + +void K3bThread::cancel() +{ + if( running() ) { + terminate(); + if( d->eventHandler ) { + emitCanceled(); + emitFinished(false); + } + } +} + + +void K3bThread::emitInfoMessage( const QString& msg, int type ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, + new K3bProgressInfoEvent( K3bProgressInfoEvent::InfoMessage, msg, QString::null, type ) ); + else + kdWarning() << "(K3bThread) call to emitInfoMessage() without eventHandler." << endl; +} + +void K3bThread::emitPercent( int p ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, + new K3bProgressInfoEvent( K3bProgressInfoEvent::Progress, p ) ); + else + kdWarning() << "(K3bThread) call to emitPercent() without eventHandler." << endl; +} + +void K3bThread::emitSubPercent( int p ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, + new K3bProgressInfoEvent( K3bProgressInfoEvent::SubProgress, p ) ); + else + kdWarning() << "(K3bThread) call to emitSubPercent() without eventHandler." << endl; +} + +void K3bThread::emitStarted() +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::Started ) ); + else + kdWarning() << "(K3bThread) call to emitStarted() without eventHandler." << endl; +} + +void K3bThread::emitCanceled() +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::Canceled ) ); + else + kdWarning() << "(K3bThread) call to emitCanceled() without eventHandler." << endl; +} + +void K3bThread::emitFinished( bool success ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::Finished, success ) ); + else + kdWarning() << "(K3bThread) call to emitFinished() without eventHandler." << endl; +} + +void K3bThread::emitProcessedSize( int p, int size ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::ProcessedSize, p, size ) ); + else + kdWarning() << "(K3bThread) call to emitProcessedSize() without eventHandler." << endl; +} + +void K3bThread::emitProcessedSubSize( int p, int size ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::ProcessedSubSize, p, size ) ); + else + kdWarning() << "(K3bThread) call to emitProcessedSubSize() without eventHandler." << endl; +} + +void K3bThread::emitNewTask( const QString& job ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::NewTask, job ) ); + else + kdWarning() << "(K3bThread) call to emitNewTask() without eventHandler." << endl; +} + +void K3bThread::emitNewSubTask( const QString& job ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::NewSubTask, job ) ); + else + kdWarning() << "(K3bThread) call to emitNewSubTask() without eventHandler." << endl; +} + +void K3bThread::emitDebuggingOutput(const QString& group, const QString& text) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::DebuggingOutput, group, text ) ); + else + kdWarning() << "(K3bThread) call to emitDebuggingOutput() without eventHandler." << endl; +} + +void K3bThread::emitData( const char* data, int len ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bDataEvent( data, len ) ); + else + kdWarning() << "(K3bThread) call to emitData() without eventHandler." << endl; +} + +void K3bThread::emitNextTrack( int t, int n ) +{ + if( d->eventHandler ) + QApplication::postEvent( d->eventHandler, new K3bProgressInfoEvent( K3bProgressInfoEvent::NextTrack, t, n ) ); + else + kdWarning() << "(K3bThread) call to emitNextTrack() without eventHandler." << endl; +} + diff --git a/libk3b/core/k3bthread.h b/libk3b/core/k3bthread.h new file mode 100644 index 0000000..f7e68fc --- /dev/null +++ b/libk3b/core/k3bthread.h @@ -0,0 +1,95 @@ +/* + * + * $Id: k3bthread.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3B_THREAD_H_ +#define _K3B_THREAD_H_ + +#include +#include "k3b_export.h" + +class QObject; + +/** + * The threaded couterpart to K3bJob + * instead of emitting the information signals + * one has to use the emitXXX methods which will post + * K3bProgressInfoEvents to the eventhandler. + * + * K3bThreadJob can be used to automatically wrap the thread in a K3bJob. + * + * As in K3bJob it is important to call emitStarted and emitFinished. + * + * See K3bThreadJob for more information. + */ +class LIBK3B_EXPORT K3bThread : public QThread +{ + public: + K3bThread( QObject* eventHandler = 0 ); + K3bThread( unsigned int stackSize, QObject* eventHandler = 0 ); + virtual ~K3bThread(); + + void setProgressInfoEventHandler( QObject* eventHandler ); + + /** + * Initialize the thread before starting it in the GUi thread. + * K3bThreadJob automatically calls this. + * + * The default implementation does nothing. + */ + virtual void init(); + + /** + * to provide the same api like K3bJob + * the default implementation calls terminate and + * emitCancled() and emitFinished(false) + */ + virtual void cancel(); + + virtual QString jobDescription() const; + virtual QString jobDetails() const; + + /** + * waits until all running K3bThread have finished. + * This is used by K3bApplication. + */ + static void waitUntilFinished(); + + protected: + virtual void run() = 0; + + /** + * uses the K3bJob::MessageType enum + */ + void emitInfoMessage( const QString& msg, int type ); + void emitPercent( int p ); + void emitSubPercent( int p ); + void emitStarted(); + void emitCanceled(); + void emitFinished( bool success ); + void emitProcessedSize( int processed, int size ); + void emitProcessedSubSize( int processed, int size ); + void emitNewTask( const QString& job ); + void emitNewSubTask( const QString& job ); + void emitDebuggingOutput(const QString&, const QString&); + void emitData( const char* data, int len ); + void emitNextTrack( int track, int trackNum ); + + private: + class Private; + Private* d; +}; + +#endif diff --git a/libk3b/core/k3bthreadjob.cpp b/libk3b/core/k3bthreadjob.cpp new file mode 100644 index 0000000..a13f10a --- /dev/null +++ b/libk3b/core/k3bthreadjob.cpp @@ -0,0 +1,161 @@ +/* + * + * $Id: k3bthreadjob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bthreadjob.h" +#include "k3bthread.h" +#include "k3bprogressinfoevent.h" +#include "k3bdataevent.h" + +#include +#include + + + +K3bThreadJob::K3bThreadJob( K3bJobHandler* jh, QObject* parent, const char* name ) + : K3bJob( jh, parent, name ), + m_running(false) +{ +} + + +K3bThreadJob::K3bThreadJob( K3bThread* thread, K3bJobHandler* jh, QObject* parent, const char* name ) + : K3bJob( jh, parent, name ), + m_running(false) +{ + setThread(thread); +} + + +K3bThreadJob::~K3bThreadJob() +{ +} + + +QString K3bThreadJob::jobDescription() const +{ + if( m_thread ) + return m_thread->jobDescription(); + else + return QString::null; +} + + +QString K3bThreadJob::jobDetails() const +{ + if( m_thread ) + return m_thread->jobDetails(); + else + return QString::null; +} + + +void K3bThreadJob::setThread( K3bThread* t ) +{ + m_thread = t; + m_thread->setProgressInfoEventHandler(this); +} + + +void K3bThreadJob::start() +{ + if( m_thread ) { + if( !m_running ) { + m_thread->setProgressInfoEventHandler(this); + m_running = true; + m_thread->init(); + m_thread->start(); + } + else + kdDebug() << "(K3bThreadJob) thread not finished yet." << endl; + } + else { + kdError() << "(K3bThreadJob) no job set." << endl; + jobFinished(false); + } +} + + +void K3bThreadJob::cancel() +{ + m_thread->cancel(); + // wait for the thread to finish + // m_thread->wait(); +} + + +void K3bThreadJob::cleanupJob( bool success ) +{ + Q_UNUSED( success ); +} + + +void K3bThreadJob::customEvent( QCustomEvent* e ) +{ + if( K3bDataEvent* de = dynamic_cast(e) ) { + emit data( de->data(), de->length() ); + } + else { + K3bProgressInfoEvent* be = static_cast(e); + switch( be->type() ) { + case K3bProgressInfoEvent::Progress: + emit percent( be->firstValue() ); + break; + case K3bProgressInfoEvent::SubProgress: + emit subPercent( be->firstValue() ); + break; + case K3bProgressInfoEvent::ProcessedSize: + emit processedSize( be->firstValue(), be->secondValue() ); + break; + case K3bProgressInfoEvent::ProcessedSubSize: + emit processedSubSize( be->firstValue(), be->secondValue() ); + break; + case K3bProgressInfoEvent::InfoMessage: + emit infoMessage( be->firstString(), be->firstValue() ); + break; + case K3bProgressInfoEvent::Started: + jobStarted(); + break; + case K3bProgressInfoEvent::Canceled: + emit canceled(); + break; + case K3bProgressInfoEvent::Finished: + // we wait until the thred really finished + // although this may be dangerous if some thread + // emits the finished signal although it has not finished yet + // but makes a lot stuff easier. + kdDebug() << "(K3bThreadJob) waiting for the thread to finish." << endl; + m_thread->wait(); + kdDebug() << "(K3bThreadJob) thread finished." << endl; + cleanupJob( be->firstValue() ); + m_running = false; + jobFinished( be->firstValue() ); + break; + case K3bProgressInfoEvent::NewTask: + emit newTask( be->firstString() ); + break; + case K3bProgressInfoEvent::NewSubTask: + emit newSubTask( be->firstString() ); + break; + case K3bProgressInfoEvent::DebuggingOutput: + emit debuggingOutput( be->firstString(), be->secondString() ); + break; + case K3bProgressInfoEvent::NextTrack: + emit nextTrack( be->firstValue(), be->secondValue() ); + break; + } + } +} + +#include "k3bthreadjob.moc" diff --git a/libk3b/core/k3bthreadjob.h b/libk3b/core/k3bthreadjob.h new file mode 100644 index 0000000..25919f1 --- /dev/null +++ b/libk3b/core/k3bthreadjob.h @@ -0,0 +1,89 @@ +/* + * + * $Id: k3bthreadjob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3B_THREAD_JOB_H_ +#define _K3B_THREAD_JOB_H_ + +#include "k3bjob.h" +#include "k3b_export.h" +class QCustomEvent; +class K3bThread; + + +/** + * A Wrapper to use a K3bThread just like a K3bJob. + * Usage: + *
+ *   K3bThread* thread = new MySuperThread(...);
+ *   K3bThreadJob* job = new K3bThreadJob( thread, ... );
+ *   K3bBurnProgressDialog d;
+ *   d.setJob(job);
+ *   job->start();
+ *   d.exec();
+ *   delete job;
+ * 
+ * Be aware that K3bThreadJob'd destructor does NOT delete the thread. + */ +class LIBK3B_EXPORT K3bThreadJob : public K3bJob +{ + Q_OBJECT + + public: + K3bThreadJob( K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + K3bThreadJob( K3bThread*, K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + virtual ~K3bThreadJob(); + + void setThread( K3bThread* t ); + K3bThread* thread() const { return m_thread; } + + /** + * \reimplemented from K3bJob + * + * \return true if the job has been started and has not yet + * emitted the finished signal + */ + virtual bool active() const { return m_running; } + + virtual QString jobDescription() const; + virtual QString jobDetails() const; + + public slots: + virtual void start(); + virtual void cancel(); + + protected: + /** + * converts K3bThread events to K3bJob signals + */ + virtual void customEvent( QCustomEvent* ); + + /** + * Reimplement this method to do some housekeeping once + * the thread has finished. + * + * The default implementation does nothing. + * + * \param success True if the thread finished successfully + */ + virtual void cleanupJob( bool success ); + + private: + K3bThread* m_thread; + bool m_running; +}; + +#endif + diff --git a/libk3b/core/k3bversion.cpp b/libk3b/core/k3bversion.cpp new file mode 100644 index 0000000..f7af248 --- /dev/null +++ b/libk3b/core/k3bversion.cpp @@ -0,0 +1,318 @@ +/* + * + * $Id: k3bversion.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bversion.h" + +#include +#include + + +K3bVersion::K3bVersion() + : m_majorVersion( -1 ), + m_minorVersion( -1 ), + m_patchLevel( -1 ) +{ +} + +K3bVersion::K3bVersion( const K3bVersion& v ) + : m_versionString( v.versionString() ), + m_majorVersion( v.majorVersion() ), + m_minorVersion( v.minorVersion() ), + m_patchLevel( v.patchLevel() ), + m_suffix( v.suffix() ) +{ +} + +K3bVersion::K3bVersion( const QString& version ) +{ + setVersion( version ); +} + +K3bVersion::K3bVersion( int majorVersion, + int minorVersion, + int patchlevel, + const QString& suffix ) +{ + setVersion( majorVersion, minorVersion, patchlevel, suffix ); +} + +void K3bVersion::setVersion( const QString& v ) +{ + QString suffix; + splitVersionString( v.stripWhiteSpace(), m_majorVersion, suffix ); + if( m_majorVersion >= 0 ) { + if( suffix.startsWith(".") ) { + suffix = suffix.mid( 1 ); + splitVersionString( suffix, m_minorVersion, suffix ); + if( m_minorVersion < 0 ) { + kdDebug() << "(K3bVersion) suffix must not start with a dot!" << endl; + m_majorVersion = -1; + m_minorVersion = -1; + m_patchLevel = -1; + m_suffix = ""; + } + else { + if( suffix.startsWith(".") ) { + suffix = suffix.mid( 1 ); + splitVersionString( suffix, m_patchLevel, suffix ); + if( m_patchLevel < 0 ) { + kdDebug() << "(K3bVersion) suffix must not start with a dot!" << endl; + m_majorVersion = -1; + m_minorVersion = -1; + m_patchLevel = -1; + m_suffix = ""; + } + else { + m_suffix = suffix; + } + } + else { + m_patchLevel = -1; + m_suffix = suffix; + } + } + } + else { + m_minorVersion = -1; + m_patchLevel = -1; + m_suffix = suffix; + } + } + + m_versionString = createVersionString( m_majorVersion, m_minorVersion, m_patchLevel, m_suffix ); +} + + +// splits the leading number from s and puts it in num +// the dot is removed and the rest put in suffix +// if s does not start with a digit or the first non-digit char is not a dot +// suffix = s and num = -1 is returned +void K3bVersion::splitVersionString( const QString& s, int& num, QString& suffix ) +{ + int pos = s.find( QRegExp("\\D") ); + if( pos < 0 ) { + num = s.toInt(); + suffix = ""; + } + else if( pos == 0 ) { + num = -1; + suffix = s; + } + else { + num = s.left( pos ).toInt(); + suffix = s.mid( pos ); + } +} + + +bool K3bVersion::isValid() const +{ + return (m_majorVersion >= 0); +} + + +void K3bVersion::setVersion( int majorVersion, + int minorVersion, + int patchlevel, + const QString& suffix ) +{ + m_majorVersion = majorVersion; + m_minorVersion = minorVersion; + m_patchLevel = patchlevel; + m_suffix = suffix; + m_versionString = createVersionString( majorVersion, minorVersion, patchlevel, suffix ); +} + +K3bVersion& K3bVersion::operator=( const QString& v ) +{ + setVersion( v ); + return *this; +} + +K3bVersion K3bVersion::simplify() const +{ + K3bVersion v( *this ); + v.m_suffix.truncate(0); + return v; +} + +QString K3bVersion::createVersionString( int majorVersion, + int minorVersion, + int patchlevel, + const QString& suffix ) +{ + if( majorVersion >= 0 ) { + QString s = QString::number(majorVersion); + + if( minorVersion > -1 ) { + s.append( QString(".%1").arg(minorVersion) ); + if( patchlevel > -1 ) + s.append( QString(".%1").arg(patchlevel) ); + } + + if( !suffix.isNull() ) + s.append( suffix ); + + return s; + } + else + return ""; +} + + +int K3bVersion::compareSuffix( const QString& suffix1, const QString& suffix2 ) +{ + static QRegExp rcRx( "rc(\\d+)" ); + static QRegExp preRx( "pre(\\d+)" ); + static QRegExp betaRx( "beta(\\d+)" ); + static QRegExp alphaRx( "a(?:lpha)?(\\d+)" ); + + // first we check if one of the suffixes (or both are empty) becasue that case if simple + if( suffix1.isEmpty() ) { + if( suffix2.isEmpty() ) + return 0; + else + return 1; // empty greater than the non-empty (should we treat something like 1.0a as greater than 1.0?) + } + else if( suffix2.isEmpty() ) + return -1; + + // now search for our special suffixes + if( rcRx.exactMatch( suffix1 ) ) { + int v1 = rcRx.cap(1).toInt(); + + if( rcRx.exactMatch( suffix2 ) ) { + int v2 = rcRx.cap(1).toInt(); + return ( v1 == v2 ? 0 : ( v1 < v2 ? -1 : 1 ) ); + } + else if( preRx.exactMatch( suffix2 ) || + betaRx.exactMatch( suffix2 ) || + alphaRx.exactMatch( suffix2 ) ) + return 1; // rc > than all the others + else + return QString::compare( suffix1, suffix2 ); + } + + else if( preRx.exactMatch( suffix1 ) ) { + int v1 = preRx.cap(1).toInt(); + + if( rcRx.exactMatch( suffix2 ) ) { + return -1; // pre is less than rc + } + else if( preRx.exactMatch( suffix2 ) ) { + int v2 = preRx.cap(1).toInt(); + return ( v1 == v2 ? 0 : ( v1 < v2 ? -1 : 1 ) ); + } + else if( betaRx.exactMatch( suffix2 ) || + alphaRx.exactMatch( suffix2 ) ) + return 1; // pre is greater than beta or alpha + else + return QString::compare( suffix1, suffix2 ); + } + + else if( betaRx.exactMatch( suffix1 ) ) { + int v1 = betaRx.cap(1).toInt(); + + if( rcRx.exactMatch( suffix2 ) || + preRx.exactMatch( suffix2 ) ) + return -1; // beta is less than rc or pre + else if( betaRx.exactMatch( suffix2 ) ) { + int v2 = betaRx.cap(1).toInt(); + return ( v1 == v2 ? 0 : ( v1 < v2 ? -1 : 1 ) ); + } + else if( alphaRx.exactMatch( suffix2 ) ) + return 1; // beta is greater then alpha + else + return QString::compare( suffix1, suffix2 ); + } + + else if( alphaRx.exactMatch( suffix1 ) ) { + int v1 = alphaRx.cap(1).toInt(); + + if( rcRx.exactMatch( suffix2 ) || + preRx.exactMatch( suffix2 ) || + betaRx.exactMatch( suffix2 ) ) + return -1; // alpha is less than all the others + else if( alphaRx.exactMatch( suffix2 ) ) { + int v2 = alphaRx.cap(1).toInt(); + return ( v1 == v2 ? 0 : ( v1 < v2 ? -1 : 1 ) ); + } + else + return QString::compare( suffix1, suffix2 ); + } + + else + return QString::compare( suffix1, suffix2 ); +} + + +bool operator<( const K3bVersion& v1, const K3bVersion& v2 ) +{ + // both version objects need to be valid + + if( v1.majorVersion() == v2.majorVersion() ) { + + // 1 == 1.0 + if( ( v1.minorVersion() == v2.minorVersion() ) + || + ( v1.minorVersion() == -1 && v2.minorVersion() == 0 ) + || + ( v2.minorVersion() == -1 && v1.minorVersion() == 0 ) + ) + { + // 1.0 == 1.0.0 + if( ( v1.patchLevel() == v2.patchLevel() ) + || + ( v1.patchLevel() == -1 && v2.patchLevel() == 0 ) + || + ( v2.patchLevel() == -1 && v1.patchLevel() == 0 ) + ) + { + return K3bVersion::compareSuffix( v1.suffix(), v2.suffix() ) < 0; + } + else + return ( v1.patchLevel() < v2.patchLevel() ); + } + else + return ( v1.minorVersion() < v2.minorVersion() ); + } + else + return ( v1.majorVersion() < v2.majorVersion() ); +} + +bool operator>( const K3bVersion& v1, const K3bVersion& v2 ) +{ + return operator<( v2, v1 ); +} + + +bool operator==( const K3bVersion& v1, const K3bVersion& v2 ) +{ + return ( v1.majorVersion() == v2.majorVersion() && + v1.minorVersion() == v2.minorVersion() && + v1.patchLevel() == v2.patchLevel() && + K3bVersion::compareSuffix( v1.suffix(), v2.suffix() ) == 0 ); +} + + +bool operator<=( const K3bVersion& v1, const K3bVersion& v2 ) +{ + return ( operator<( v1, v2 ) || operator==( v1, v2 ) ); +} + +bool operator>=( const K3bVersion& v1, const K3bVersion& v2 ) +{ + return ( operator>( v1, v2 ) || operator==( v1, v2 ) ); +} diff --git a/libk3b/core/k3bversion.h b/libk3b/core/k3bversion.h new file mode 100644 index 0000000..a6e3aee --- /dev/null +++ b/libk3b/core/k3bversion.h @@ -0,0 +1,141 @@ +/* + * + * $Id: k3bversion.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3B_VERSION_H_ +#define _K3B_VERSION_H_ + +#include +#include "k3b_export.h" +/** + * \brief Representation of a version. + * + * K3bVersion represents a version consisting of a major version (accessible via majorVersion()), + * a minor version (accessible via minorVersion()), a patchLevel (accessible via patchLevel()), + * and a suffix (accessible via suffix()). + * + * The major version is mandatory while all other fields are optional (in case of the minor version + * and the patchlevel -1 means that the field is undefined). + * + * K3bVersion tries to treat version suffixes in an "intelligent" way to properly compare versions + * (see compareSuffix() for more details). + * + * K3bVersion may also be used everywhere a QString is needed as it automatically converts to a + * string representation using createVersionString(). + */ +class LIBK3B_EXPORT K3bVersion +{ + public: + /** + * construct an empty version object + * which is invalid + * @ see isValid() + */ + K3bVersion(); + + /** + * copy constructor + */ + K3bVersion( const K3bVersion& ); + + /** + * this constructor tries to parse the given version string + */ + K3bVersion( const QString& version ); + + /** + * sets the version and generates a version string from it + */ + K3bVersion( int majorVersion, int minorVersion, int pachlevel = -1, const QString& suffix = QString::null ); + + /** + * tries to parse the version string + * used by the constructor + */ + void setVersion( const QString& ); + + bool isValid() const; + + /** + * sets the version and generates a version string from it + * used by the constructor + * + * If minorVersion or pachlevel are -1 they will not be used when generating the version string. + */ + void setVersion( int majorVersion, int minorVersion = -1, int patchlevel = -1, const QString& suffix = QString::null ); + + const QString& versionString() const { return m_versionString; } + int majorVersion() const { return m_majorVersion; } + int minorVersion() const { return m_minorVersion; } + int patchLevel() const { return m_patchLevel; } + const QString& suffix() const { return m_suffix; } + + /** + * just to make it possible to use as a QString + */ + operator const QString& () const { return m_versionString; } + K3bVersion& operator=( const QString& v ); + + /** + * \return A new K3bVersion object which equals this one except that the suffix is empty. + */ + K3bVersion simplify() const; + + /** + * If minorVersion or pachlevel are -1 they will not be used when generating the version string. + * If minorVersion is -1 patchlevel will be ignored. + */ + static QString createVersionString( int majorVersion, + int minorVersion = -1, + int patchlevel = -1, + const QString& suffix = QString::null ); + + /** + * "Intelligent" comparison of two version suffixes. + * + * This method checks for the following types of suffixes and treats them in the + * following order: + * + * [empty prefix] > rcX > preX > betaX > alphaX = aX (where X is a number) + * + * Every other suffixes are compared alphanumerical. + * An empty prefix is always considered newer than an unknown non-emtpy suffix (e.g. not one of the above.) + * + * @return \li -1 if suffix1 is less than suffix2 + * \li 0 if suffix1 equals suffix2 (be aware that this is not the same as comparing to strings as + * alphaX equals aX in this case.) + * \li 1 if suffix1 is greater than suffix2 + */ + static int compareSuffix( const QString& suffix1, const QString& suffix2 ); + + private: + static void splitVersionString( const QString& s, int& num, QString& suffix ); + + QString m_versionString; + int m_majorVersion; + int m_minorVersion; + int m_patchLevel; + QString m_suffix; +}; + + +LIBK3B_EXPORT bool operator<( const K3bVersion& v1, const K3bVersion& v2 ); +LIBK3B_EXPORT bool operator>( const K3bVersion& v1, const K3bVersion& v2 ); +LIBK3B_EXPORT bool operator==( const K3bVersion& v1, const K3bVersion& v2 ); +LIBK3B_EXPORT bool operator<=( const K3bVersion& v1, const K3bVersion& v2 ); +LIBK3B_EXPORT bool operator>=( const K3bVersion& v1, const K3bVersion& v2 ); + + +#endif diff --git a/libk3b/dummy.cpp b/libk3b/dummy.cpp new file mode 100644 index 0000000..9f6c7b2 --- /dev/null +++ b/libk3b/dummy.cpp @@ -0,0 +1 @@ +/* dummy file to have anything around.*/ diff --git a/libk3b/jobs/Makefile.am b/libk3b/jobs/Makefile.am new file mode 100644 index 0000000..72a9eac --- /dev/null +++ b/libk3b/jobs/Makefile.am @@ -0,0 +1,43 @@ +AM_CPPFLAGS = -I$(srcdir)/../core \ + -I$(srcdir)/../../libk3bdevice \ + -I$(srcdir)/../../src \ + -I$(srcdir)/../tools \ + -I$(srcdir)/../cddb \ + -I$(srcdir)/../plugin \ + -I$(srcdir)/../projects \ + -I$(srcdir)/../videodvd \ + -I$(srcdir)/../projects/audiocd \ + $(all_includes) + +METASOURCES = AUTO + +noinst_LTLIBRARIES = libjobs.la + +if include_videodvdrip +libjobs_la_SOURCES = k3bdatatrackreader.cpp k3breadcdreader.cpp \ + k3bcdcopyjob.cpp k3bclonejob.cpp k3baudiosessionreadingjob.cpp \ + k3bdvdcopyjob.cpp k3bvideodvdtitletranscodingjob.cpp k3bvideodvdtitledetectclippingjob.cpp \ + k3baudiocuefilewritingjob.cpp k3bbinimagewritingjob.cpp \ + k3biso9660imagewritingjob.cpp \ + k3bdvdformattingjob.cpp k3bblankingjob.cpp k3bclonetocreader.cpp \ + k3bverificationjob.cpp + +include_HEADERS = k3bcdcopyjob.h k3bdvdcopyjob.h k3bclonejob.h \ + k3baudiocuefilewritingjob.h k3bbinimagewritingjob.h \ + k3biso9660imagewritingjob.h k3bdvdformattingjob.h \ + k3bblankingjob.h k3bvideodvdtitletranscodingjob.h k3bvideodvdtitledetectclippingjob.h \ + k3bverificationjob.h +else +libjobs_la_SOURCES = k3bdatatrackreader.cpp k3breadcdreader.cpp \ + k3bcdcopyjob.cpp k3bclonejob.cpp k3baudiosessionreadingjob.cpp \ + k3bdvdcopyjob.cpp \ + k3baudiocuefilewritingjob.cpp k3bbinimagewritingjob.cpp \ + k3biso9660imagewritingjob.cpp \ + k3bdvdformattingjob.cpp k3bblankingjob.cpp k3bclonetocreader.cpp \ + k3bverificationjob.cpp + +include_HEADERS = k3bcdcopyjob.h k3bdvdcopyjob.h k3bclonejob.h \ + k3baudiocuefilewritingjob.h k3bbinimagewritingjob.h \ + k3biso9660imagewritingjob.h k3bdvdformattingjob.h \ + k3bblankingjob.h k3bverificationjob.h +endif diff --git a/libk3b/jobs/k3baudiocuefilewritingjob.cpp b/libk3b/jobs/k3baudiocuefilewritingjob.cpp new file mode 100644 index 0000000..0c5cd9a --- /dev/null +++ b/libk3b/jobs/k3baudiocuefilewritingjob.cpp @@ -0,0 +1,272 @@ +/* + * + * $Id: k3baudiocuefilewritingjob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3baudiocuefilewritingjob.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +class K3bAudioCueFileWritingJob::AnalyserThread : public K3bThread +{ +public: + AnalyserThread() + : K3bThread() { + } + + void setDecoder( K3bAudioDecoder* dec ) { m_decoder = dec; } + +protected: + void run() { + emitStarted(); + m_decoder->analyseFile(); + emitFinished(true); + } + +private: + K3bAudioDecoder* m_decoder; +}; + + +K3bAudioCueFileWritingJob::K3bAudioCueFileWritingJob( K3bJobHandler* jh, QObject* parent, const char* name ) + : K3bBurnJob( jh, parent, name ), + m_decoder(0) +{ + m_analyserThread = new AnalyserThread(); + m_analyserJob = new K3bThreadJob( m_analyserThread, this, this ); + connect( m_analyserJob, SIGNAL(finished(bool)), this, SLOT(slotAnalyserThreadFinished(bool)) ); + + m_audioDoc = new K3bAudioDoc( this ); + m_audioDoc->newDocument(); + m_audioJob = new K3bAudioJob( m_audioDoc, this, this ); + + // just loop all through + connect( m_audioJob, SIGNAL(newTask(const QString&)), this, SIGNAL(newTask(const QString&)) ); + connect( m_audioJob, SIGNAL(newSubTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( m_audioJob, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + connect( m_audioJob, SIGNAL(infoMessage(const QString&, int)), + this, SIGNAL(infoMessage(const QString&, int)) ); + connect( m_audioJob, SIGNAL(finished(bool)), this, SIGNAL(finished(bool)) ); + connect( m_audioJob, SIGNAL(canceled()), this, SIGNAL(canceled()) ); + connect( m_audioJob, SIGNAL(percent(int)), this, SIGNAL(percent(int)) ); + connect( m_audioJob, SIGNAL(subPercent(int)), this, SIGNAL(subPercent(int)) ); + connect( m_audioJob, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + connect( m_audioJob, SIGNAL(processedSubSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + connect( m_audioJob, SIGNAL(burning(bool)), this, SIGNAL(burning(bool)) ); + connect( m_audioJob, SIGNAL(bufferStatus(int)), this, SIGNAL(bufferStatus(int)) ); + connect( m_audioJob, SIGNAL(deviceBuffer(int)), this, SIGNAL(deviceBuffer(int)) ); + connect( m_audioJob, SIGNAL(writeSpeed(int, int)), this, SIGNAL(writeSpeed(int, int)) ); + + m_canceled = false; + m_audioJobRunning = false; +} + + +K3bAudioCueFileWritingJob::~K3bAudioCueFileWritingJob() +{ + // the threadjob does not delete the thread + delete m_analyserThread; +} + + +K3bDevice::Device* K3bAudioCueFileWritingJob::writer() const +{ + return m_audioDoc->burner(); +} + + +QString K3bAudioCueFileWritingJob::jobDescription() const +{ + return i18n("Writing Audio Cue File"); +} + + +QString K3bAudioCueFileWritingJob::jobDetails() const +{ + return m_cueFile.section( '/', -1 ); +} + + +void K3bAudioCueFileWritingJob::start() +{ + // FIXME: here we trust that a job won't be started twice :( + jobStarted(); + m_canceled = false; + m_audioJobRunning = false; + importCueInProject(); +} + + +void K3bAudioCueFileWritingJob::cancel() +{ + m_canceled = true; + + // the AudioJob cancel method is very stupid. It emits the canceled signal even if it was never running :( + if( m_audioJobRunning ) + m_audioJob->cancel(); + m_analyserJob->cancel(); +} + + +void K3bAudioCueFileWritingJob::setCueFile( const QString& s ) +{ + m_cueFile = s; +} + + +void K3bAudioCueFileWritingJob::setOnTheFly( bool b ) +{ + m_audioDoc->setOnTheFly( b ); +} + + +void K3bAudioCueFileWritingJob::setSpeed( int s ) +{ + m_audioDoc->setSpeed( s ); +} + + +void K3bAudioCueFileWritingJob::setBurnDevice( K3bDevice::Device* dev ) +{ + m_audioDoc->setBurner( dev ); +} + + +void K3bAudioCueFileWritingJob::setWritingMode( int mode ) +{ + m_audioDoc->setWritingMode( mode ); +} + + +void K3bAudioCueFileWritingJob::setSimulate( bool b ) +{ + m_audioDoc->setDummy( b ); +} + + +void K3bAudioCueFileWritingJob::setCopies( int c ) +{ + m_audioDoc->setCopies( c ); +} + + +void K3bAudioCueFileWritingJob::setTempDir( const QString& s ) +{ + m_audioDoc->setTempDir( s ); +} + + +void K3bAudioCueFileWritingJob::slotAnalyserThreadFinished( bool ) +{ + if( !m_canceled ) { + if( m_audioDoc->lastTrack()->length() == 0 ) { + emit infoMessage( i18n("Analysing the audio file failed. Corrupt file?"), ERROR ); + jobFinished(false); + } + else { + // FIXME: m_audioJobRunning is never reset + m_audioJobRunning = true; + m_audioJob->start(); // from here on the audio job takes over completely + } + } + else { + emit canceled(); + jobFinished(false); + } +} + + +void K3bAudioCueFileWritingJob::importCueInProject() +{ + // cleanup the project (this wil also delete the decoder) + // we do not use newDocument as that would overwrite the settings already made + while( m_audioDoc->firstTrack() ) + delete m_audioDoc->firstTrack()->take(); + + m_decoder = 0; + + K3bCueFileParser parser( m_cueFile ); + if( parser.isValid() && parser.toc().contentType() == K3bDevice::AUDIO ) { + + kdDebug() << "(K3bAudioCueFileWritingJob::importCueFile) parsed with image: " << parser.imageFilename() << endl; + + // global cd-text + m_audioDoc->setTitle( parser.cdText().title() ); + m_audioDoc->setPerformer( parser.cdText().performer() ); + m_audioDoc->writeCdText( !parser.cdText().title().isEmpty() ); + + m_decoder = K3bAudioDecoderFactory::createDecoder( parser.imageFilename() ); + if( m_decoder ) { + m_decoder->setFilename( parser.imageFilename() ); + + K3bAudioTrack* after = 0; + K3bAudioFile* newFile = 0; + unsigned int i = 0; + for( K3bDevice::Toc::const_iterator it = parser.toc().begin(); + it != parser.toc().end(); ++it ) { + const K3bDevice::Track& track = *it; + + newFile = new K3bAudioFile( m_decoder, m_audioDoc ); + newFile->setStartOffset( track.firstSector() ); + newFile->setEndOffset( track.lastSector()+1 ); + + K3bAudioTrack* newTrack = new K3bAudioTrack( m_audioDoc ); + newTrack->addSource( newFile ); + newTrack->moveAfter( after ); + + // cd-text + newTrack->setTitle( parser.cdText()[i].title() ); + newTrack->setPerformer( parser.cdText()[i].performer() ); + + // add the next track after this one + after = newTrack; + ++i; + } + + // let the last source use the data up to the end of the file + if( newFile ) + newFile->setEndOffset(0); + + // now analyze the source + emit newTask( i18n("Analysing the audio file") ); + emit newSubTask( i18n("Analysing %1").arg( parser.imageFilename() ) ); + + // start the analyser thread + m_analyserThread->setDecoder( m_decoder ); + m_analyserJob->start(); + } + else { + emit infoMessage( i18n("Unable to handle '%1' due to an unsupported format.").arg( m_cueFile ), ERROR ); + jobFinished(false); + } + } + else { + emit infoMessage( i18n("No valid audio cue file: '%1'").arg( m_cueFile ), ERROR ); + jobFinished(false); + } +} + +#include "k3baudiocuefilewritingjob.moc" diff --git a/libk3b/jobs/k3baudiocuefilewritingjob.h b/libk3b/jobs/k3baudiocuefilewritingjob.h new file mode 100644 index 0000000..6e0a3c2 --- /dev/null +++ b/libk3b/jobs/k3baudiocuefilewritingjob.h @@ -0,0 +1,79 @@ +/* + * + * $Id: k3baudiocuefilewritingjob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_AUDIO_CUE_FILEWRITING_JOB_H_ +#define _K3B_AUDIO_CUE_FILEWRITING_JOB_H_ + +#include +#include "k3b_export.h" +class K3bAudioDoc; +class K3bAudioJob; +class K3bAudioDecoder; +class K3bThreadJob; +namespace K3bDevice { + class Device; +} + + +class LIBK3B_EXPORT K3bAudioCueFileWritingJob : public K3bBurnJob +{ + Q_OBJECT + + public: + K3bAudioCueFileWritingJob( K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + ~K3bAudioCueFileWritingJob(); + + K3bDevice::Device* writer() const; + + QString jobDescription() const; + QString jobDetails() const; + + const QString& cueFile() const { return m_cueFile; } + + public slots: + void start(); + void cancel(); + + void setCueFile( const QString& ); + void setSpeed( int s ); + void setBurnDevice( K3bDevice::Device* dev ); + void setWritingMode( int mode ); + void setSimulate( bool b ); + void setCopies( int c ); + void setOnTheFly( bool b ); + void setTempDir( const QString& ); + + private slots: + void slotAnalyserThreadFinished(bool); + + private: + void importCueInProject(); + + K3bDevice::Device* m_device; + + QString m_cueFile; + K3bAudioDoc* m_audioDoc; + K3bAudioJob* m_audioJob; + K3bAudioDecoder* m_decoder; + + bool m_canceled; + bool m_audioJobRunning; + + class AnalyserThread; + AnalyserThread* m_analyserThread; + K3bThreadJob* m_analyserJob; +}; + +#endif diff --git a/libk3b/jobs/k3baudiosessionreadingjob.cpp b/libk3b/jobs/k3baudiosessionreadingjob.cpp new file mode 100644 index 0000000..f4ac550 --- /dev/null +++ b/libk3b/jobs/k3baudiosessionreadingjob.cpp @@ -0,0 +1,278 @@ +/* + * + * $Id: k3baudiosessionreadingjob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3baudiosessionreadingjob.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +class K3bAudioSessionReadingJob::WorkThread : public K3bThread +{ +public: + WorkThread(); + ~WorkThread(); + + void init(); + void run(); + void cancel(); + + bool canceled; + + int fd; + K3bCdparanoiaLib* paranoia; + K3bDevice::Device* device; + K3bDevice::Toc toc; + K3bWaveFileWriter* waveFileWriter; + QStringList filenames; + int paranoiaMode; + int retries; + bool neverSkip; +}; + + +K3bAudioSessionReadingJob::WorkThread::WorkThread() + : K3bThread(), + fd(-1), + paranoia(0), + waveFileWriter(0), + paranoiaMode(0), + retries(50), + neverSkip(false) +{ +} + + +K3bAudioSessionReadingJob::WorkThread::~WorkThread() +{ + delete waveFileWriter; + delete paranoia; +} + + +void K3bAudioSessionReadingJob::WorkThread::init() +{ + canceled = false; +} + + +void K3bAudioSessionReadingJob::WorkThread::run() +{ + if( !paranoia ) + paranoia = K3bCdparanoiaLib::create(); + + if( !paranoia ) { + emitInfoMessage( i18n("Could not load libcdparanoia."), K3bJob::ERROR ); + emitFinished(false); + return; + } + + if( toc.isEmpty() ) + toc = device->readToc(); + + if( !paranoia->initParanoia( device, toc ) ) { + emitInfoMessage( i18n("Could not open device %1").arg(device->blockDeviceName()), + K3bJob::ERROR ); + emitFinished(false); + return; + } + + if( !paranoia->initReading() ) { + emitInfoMessage( i18n("Error while initializing audio ripping."), K3bJob::ERROR ); + emitFinished(false); + return; + } + + device->block( true ); + + // init settings + paranoia->setMaxRetries( retries ); + paranoia->setParanoiaMode( paranoiaMode ); + paranoia->setNeverSkip( neverSkip ); + + bool writeError = false; + unsigned int trackNum = 1; + unsigned int currentTrack = 0; + unsigned long trackRead = 0; + unsigned long totalRead = 0; + unsigned int lastTrackPercent = 0; + unsigned int lastTotalPercent = 0; + bool newTrack = true; + int status = 0; + char* buffer = 0; + while( !canceled && (buffer = paranoia->read( &status, &trackNum, fd == -1 /*when writing to a wav be want little endian */ )) ) { + + if( currentTrack != trackNum ) { + emitNextTrack( trackNum, paranoia->toc().count() ); + trackRead = 0; + lastTrackPercent = 0; + + currentTrack = trackNum; + newTrack = true; + } + + if( fd > 0 ) { + if( ::write( fd, buffer, CD_FRAMESIZE_RAW ) != CD_FRAMESIZE_RAW ) { + kdDebug() << "(K3bAudioSessionCopyJob::WorkThread) error while writing to fd " << fd << endl; + writeError = true; + break; + } + } + else { + if( newTrack ) { + newTrack = false; + + if( !waveFileWriter ) + waveFileWriter = new K3bWaveFileWriter(); + + if( filenames.count() < currentTrack ) { + kdDebug() << "(K3bAudioSessionCopyJob) not enough image filenames given: " << currentTrack << endl; + writeError = true; + break; + } + + if( !waveFileWriter->open( filenames[currentTrack-1] ) ) { + emitInfoMessage( i18n("Unable to open '%1' for writing.").arg(filenames[currentTrack-1]), K3bJob::ERROR ); + writeError = true; + break; + } + } + + waveFileWriter->write( buffer, + CD_FRAMESIZE_RAW, + K3bWaveFileWriter::LittleEndian ); + } + + trackRead++; + totalRead++; + + unsigned int trackPercent = 100 * trackRead / toc[currentTrack-1].length().lba(); + if( trackPercent > lastTrackPercent ) { + lastTrackPercent = trackPercent; + emitSubPercent( lastTrackPercent ); + } + unsigned int totalPercent = 100 * totalRead / paranoia->rippedDataLength(); + if( totalPercent > lastTotalPercent ) { + lastTotalPercent = totalPercent; + emitPercent( lastTotalPercent ); + } + } + + if( waveFileWriter ) + waveFileWriter->close(); + + paranoia->close(); + + device->block( false ); + + if( status != K3bCdparanoiaLib::S_OK ) { + emitInfoMessage( i18n("Unrecoverable error while ripping track %1.").arg(trackNum), K3bJob::ERROR ); + emitFinished(false); + return; + } + + emitFinished( !writeError & !canceled ); +} + + +void K3bAudioSessionReadingJob::WorkThread::cancel() +{ + canceled = true; + // FIXME: add backup killing like in the audio ripping and make sure to close paranoia +} + + + + +K3bAudioSessionReadingJob::K3bAudioSessionReadingJob( K3bJobHandler* jh, QObject* parent, const char* name ) + : K3bThreadJob( jh, parent, name ) +{ + m_thread = new WorkThread(); + setThread( m_thread ); +} + + +K3bAudioSessionReadingJob::~K3bAudioSessionReadingJob() +{ + delete m_thread; +} + + +void K3bAudioSessionReadingJob::setDevice( K3bDevice::Device* dev ) +{ + m_thread->device = dev; + m_thread->toc = K3bDevice::Toc(); +} + + +void K3bAudioSessionReadingJob::setToc( const K3bDevice::Toc& toc ) +{ + m_thread->toc = toc; +} + + +void K3bAudioSessionReadingJob::writeToFd( int fd ) +{ + m_thread->fd = fd; +} + +void K3bAudioSessionReadingJob::setImageNames( const QStringList& l ) +{ + m_thread->filenames = l; + m_thread->fd = -1; +} + + +void K3bAudioSessionReadingJob::setParanoiaMode( int m ) +{ + m_thread->paranoiaMode = m; +} + + +void K3bAudioSessionReadingJob::setReadRetries( int r ) +{ + m_thread->retries = r; +} + +void K3bAudioSessionReadingJob::setNeverSkip( bool b ) +{ + m_thread->neverSkip = b; +} + + +void K3bAudioSessionReadingJob::start() +{ + k3bcore->blockDevice( m_thread->device ); + K3bThreadJob::start(); +} + + +void K3bAudioSessionReadingJob::cleanupJob( bool success ) +{ + Q_UNUSED( success ); + k3bcore->unblockDevice( m_thread->device ); +} + +#include "k3baudiosessionreadingjob.moc" diff --git a/libk3b/jobs/k3baudiosessionreadingjob.h b/libk3b/jobs/k3baudiosessionreadingjob.h new file mode 100644 index 0000000..21f3d50 --- /dev/null +++ b/libk3b/jobs/k3baudiosessionreadingjob.h @@ -0,0 +1,75 @@ +/* + * + * $Id: k3baudiosessionreadingjob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_AUDIOSESSION_READING_JOB_H_ +#define _K3B_AUDIOSESSION_READING_JOB_H_ + +#include + +#include + + +namespace K3bDevice { + class Device; + class Toc; +} + + +class K3bAudioSessionReadingJob : public K3bThreadJob +{ + Q_OBJECT + + public: + K3bAudioSessionReadingJob( K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + ~K3bAudioSessionReadingJob(); + + /** + * For now this simply reads all the audio tracks at the beginning + * since we only support CD-Extra mixed mode cds. + */ + void setDevice( K3bDevice::Device* ); + + /** + * Use for faster initialization + */ + void setToc( const K3bDevice::Toc& toc ); + + /** + * the data gets written directly into fd instead of imagefiles. + * To disable just set fd to -1 (the default) + */ + void writeToFd( int fd ); + + /** + * Used if fd == -1 + */ + void setImageNames( const QStringList& l ); + + void setParanoiaMode( int m ); + void setReadRetries( int ); + void setNeverSkip( bool b ); + + public slots: + void start(); + + protected: + void cleanupJob( bool success ); + + private: + class WorkThread; + WorkThread* m_thread; +}; + +#endif diff --git a/libk3b/jobs/k3bbinimagewritingjob.cpp b/libk3b/jobs/k3bbinimagewritingjob.cpp new file mode 100644 index 0000000..de76e3f --- /dev/null +++ b/libk3b/jobs/k3bbinimagewritingjob.cpp @@ -0,0 +1,234 @@ +/* + * + * $Id: k3bbinimagewritingjob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Klaus-Dieter Krannich + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bbinimagewritingjob.h" +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + + +K3bBinImageWritingJob::K3bBinImageWritingJob( K3bJobHandler* hdl, QObject* parent ) + : K3bBurnJob( hdl, parent ), + m_device(0), + m_simulate(false), + m_force(false), + m_noFix(false), + m_tocFile(0), + m_speed(2), + m_copies(1), + m_writer(0) +{ +} + +K3bBinImageWritingJob::~K3bBinImageWritingJob() +{ +} + +void K3bBinImageWritingJob::start() +{ + m_canceled = false; + + if( m_copies < 1 ) + m_copies = 1; + m_finishedCopies = 0; + + jobStarted(); + emit newTask( i18n("Write Binary Image") ); + + if( prepareWriter() ) + writerStart(); + else + cancel(); + +} + +void K3bBinImageWritingJob::cancel() +{ + m_canceled = true; + m_writer->cancel(); + emit canceled(); + jobFinished( false ); +} + +bool K3bBinImageWritingJob::prepareWriter() +{ + if( m_writer ) + delete m_writer; + + int usedWritingApp = writingApp(); + const K3bExternalBin* cdrecordBin = k3bcore->externalBinManager()->binObject("cdrecord"); + if( usedWritingApp == K3b::CDRECORD || + ( usedWritingApp == K3b::DEFAULT && cdrecordBin && cdrecordBin->hasFeature("cuefile") && m_device->dao() ) ) { + usedWritingApp = K3b::CDRECORD; + + // IMPROVEME: check if it's a cdrdao toc-file + if( m_tocFile.right(4) == ".toc" ) { + kdDebug() << "(K3bBinImageWritingJob) imagefile has ending toc." << endl; + usedWritingApp = K3b::CDRDAO; + } + else { + // TODO: put this into K3bCueFileParser + // TODO: check K3bCueFileParser::imageFilenameInCue() + // let's see if cdrecord can handle the cue file + QFile f( m_tocFile ); + if( f.open( IO_ReadOnly ) ) { + QTextStream fStr( &f ); + if( fStr.read().contains( "MODE1/2352" ) ) { + kdDebug() << "(K3bBinImageWritingJob) cuefile contains MODE1/2352 track. using cdrdao." << endl; + usedWritingApp = K3b::CDRDAO; + } + f.close(); + } + else + kdDebug() << "(K3bBinImageWritingJob) could not open file " << m_tocFile << endl; + } + } + else + usedWritingApp = K3b::CDRDAO; + + if( usedWritingApp == K3b::CDRECORD ) { + // create cdrecord job + K3bCdrecordWriter* writer = new K3bCdrecordWriter( m_device, this ); + + writer->setDao( true ); + writer->setSimulate( m_simulate ); + writer->setBurnSpeed( m_speed ); + writer->setCueFile ( m_tocFile ); + + if( m_noFix ) { + writer->addArgument("-multi"); + } + + if( m_force ) { + writer->addArgument("-force"); + } + + m_writer = writer; + } + else { + // create cdrdao job + K3bCdrdaoWriter* writer = new K3bCdrdaoWriter( m_device, this ); + writer->setCommand( K3bCdrdaoWriter::WRITE ); + writer->setSimulate( m_simulate ); + writer->setBurnSpeed( m_speed ); + writer->setForce( m_force ); + + // multisession + writer->setMulti( m_noFix ); + + writer->setTocFile( m_tocFile ); + + m_writer = writer; + } + + connect( m_writer, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) ); + connect( m_writer, SIGNAL(percent(int)), this, SLOT(copyPercent(int)) ); + connect( m_writer, SIGNAL(subPercent(int)), this, SLOT(copySubPercent(int)) ); + connect( m_writer, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSize(int, int)) ); + connect( m_writer, SIGNAL(buffer(int)), this, SIGNAL(bufferStatus(int)) ); + connect( m_writer, SIGNAL(deviceBuffer(int)), this, SIGNAL(deviceBuffer(int)) ); + connect( m_writer, SIGNAL(writeSpeed(int, int)), this, SIGNAL(writeSpeed(int, int)) ); + connect( m_writer, SIGNAL(finished(bool)), this, SLOT(writerFinished(bool)) ); + connect( m_writer, SIGNAL(newTask(const QString&)), this, SIGNAL(newTask(const QString&)) ); + connect( m_writer, SIGNAL(newSubTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( m_writer, SIGNAL(nextTrack(int, int)), this, SLOT(slotNextTrack(int, int)) ); + connect( m_writer, SIGNAL(debuggingOutput(const QString&, const QString&)), this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + + return true; +} + + +void K3bBinImageWritingJob::writerStart() +{ + + if( waitForMedia( m_device ) < 0 ) { + cancel(); + } + // just to be sure we did not get canceled during the async discWaiting + else if( !m_canceled ) { + emit burning(true); + m_writer->start(); + } +} + +void K3bBinImageWritingJob::copyPercent(int p) +{ + emit percent( (100*m_finishedCopies + p)/m_copies ); +} + +void K3bBinImageWritingJob::copySubPercent(int p) +{ + emit subPercent(p); +} + +void K3bBinImageWritingJob::writerFinished(bool ok) +{ + if( m_canceled ) + return; + + if (ok) { + m_finishedCopies++; + if ( m_finishedCopies == m_copies ) { + emit infoMessage( i18n("%n copy successfully created", "%n copies successfully created", m_copies),K3bJob::INFO ); + jobFinished( true ); + } + else { + writerStart(); + } + } + else { + jobFinished(false); + } +} + + +void K3bBinImageWritingJob::slotNextTrack( int t, int tt ) +{ + emit newSubTask( i18n("Writing track %1 of %2").arg(t).arg(tt) ); +} + + +QString K3bBinImageWritingJob::jobDescription() const +{ + return ( i18n("Writing cue/bin Image") + + ( m_copies > 1 + ? i18n(" - %n Copy", " - %n Copies", m_copies) + : QString::null ) ); +} + + +QString K3bBinImageWritingJob::jobDetails() const +{ + return m_tocFile.section("/", -1); +} + + +void K3bBinImageWritingJob::setTocFile(const QString& s) +{ + m_tocFile = s; +} + +#include "k3bbinimagewritingjob.moc" diff --git a/libk3b/jobs/k3bbinimagewritingjob.h b/libk3b/jobs/k3bbinimagewritingjob.h new file mode 100644 index 0000000..3666793 --- /dev/null +++ b/libk3b/jobs/k3bbinimagewritingjob.h @@ -0,0 +1,79 @@ +/* + * + * $Id$ + * Copyright (C) 2003 Klaus-Dieter Krannich + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef K3BBINIMAGEWRITINGJOB_H +#define K3BBINIMAGEWRITINGJOB_H + +#include +#include "k3b_export.h" +class K3bAbstractWriter; +namespace K3bDevice { + class Device; +} + +/** + *@author Klaus-Dieter Krannich + */ +class LIBK3B_EXPORT K3bBinImageWritingJob : public K3bBurnJob +{ + Q_OBJECT + + public: + K3bBinImageWritingJob( K3bJobHandler*, QObject* parent = 0 ); + ~K3bBinImageWritingJob(); + + K3bDevice::Device* writer() const { return m_device; }; + + QString jobDescription() const; + QString jobDetails() const; + + public slots: + void start(); + void cancel(); + + void setWriter( K3bDevice::Device* dev ) { m_device = dev; } + void setSimulate( bool b ) { m_simulate = b; } + void setForce(bool b) { m_force = b; } + void setMulti( bool b ) { m_noFix = b; } + void setTocFile( const QString& s); + void setCopies(int c) { m_copies = c; } + void setSpeed( int s ) { m_speed = s; } + + private slots: + void writerFinished(bool); + void copyPercent(int p); + void copySubPercent(int p); + void slotNextTrack( int, int ); + + private: + void writerStart(); + bool prepareWriter(); + + K3bDevice::Device* m_device; + bool m_simulate; + bool m_force; + bool m_noFix; + QString m_tocFile; + int m_speed; + int m_copies; + int m_finishedCopies; + + bool m_canceled; + + K3bAbstractWriter* m_writer; +}; + +#endif diff --git a/libk3b/jobs/k3bblankingjob.cpp b/libk3b/jobs/k3bblankingjob.cpp new file mode 100644 index 0000000..c11f4b4 --- /dev/null +++ b/libk3b/jobs/k3bblankingjob.cpp @@ -0,0 +1,176 @@ +/* + * + * $Id: k3bblankingjob.cpp 630823 2007-02-06 14:07:10Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bblankingjob.h" +#include "k3bcdrecordwriter.h" +#include "k3bcdrdaowriter.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + + + +K3bBlankingJob::K3bBlankingJob( K3bJobHandler* hdl, QObject* parent ) + : K3bBurnJob( hdl, parent ), + m_writerJob(0), + m_force(true), + m_device(0), + m_speed(0), + m_mode(Fast), + m_writingApp(K3b::DEFAULT), + m_canceled(false), + m_forceNoEject(false) +{ +} + + +K3bBlankingJob::~K3bBlankingJob() +{ + delete m_writerJob; +} + + +K3bDevice::Device* K3bBlankingJob::writer() const +{ + return m_device; +} + + +void K3bBlankingJob::setDevice( K3bDevice::Device* dev ) +{ + m_device = dev; +} + + +void K3bBlankingJob::start() +{ + if( m_device == 0 ) + return; + + jobStarted(); + + slotStartErasing(); +} + +void K3bBlankingJob::slotStartErasing() +{ + m_canceled = false; + + if( m_writerJob ) + delete m_writerJob; + + if( m_writingApp == K3b::CDRDAO ) { + K3bCdrdaoWriter* writer = new K3bCdrdaoWriter( m_device, this ); + m_writerJob = writer; + + writer->setCommand(K3bCdrdaoWriter::BLANK); + writer->setBlankMode( m_mode == Fast ? K3bCdrdaoWriter::MINIMAL : K3bCdrdaoWriter::FULL ); + writer->setForce(m_force); + writer->setBurnSpeed(m_speed); + writer->setForceNoEject( m_forceNoEject ); + } + else { + K3bCdrecordWriter* writer = new K3bCdrecordWriter( m_device, this ); + m_writerJob = writer; + + QString mode; + switch( m_mode ) { + case Fast: + mode = "fast"; + break; + case Complete: + mode = "all"; + break; + case Track: + mode = "track"; + break; + case Unclose: + mode = "unclose"; + break; + case Session: + mode = "session"; + break; + } + + writer->addArgument("blank="+ mode); + + if (m_force) + writer->addArgument("-force"); + writer->setBurnSpeed(m_speed); + writer->setForceNoEject( m_forceNoEject ); + } + + connect(m_writerJob, SIGNAL(finished(bool)), this, SLOT(slotFinished(bool))); + connect(m_writerJob, SIGNAL(infoMessage( const QString&, int)), + this,SIGNAL(infoMessage( const QString&, int))); + connect( m_writerJob, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + + if( waitForMedia( m_device, + K3bDevice::STATE_COMPLETE|K3bDevice::STATE_INCOMPLETE, + K3bDevice::MEDIA_CD_RW, + i18n("Please insert a rewritable CD medium into drive

%1 %2 (%3).") + .arg(m_device->vendor()) + .arg(m_device->description()) + .arg(m_device->devicename()) ) < 0 ) { + emit canceled(); + jobFinished(false); + return; + } + + m_writerJob->start(); +} + + +void K3bBlankingJob::cancel() +{ + m_canceled = true; + + if( m_writerJob ) + m_writerJob->cancel(); +} + + +void K3bBlankingJob::slotFinished(bool success) +{ + if( success ) { + emit infoMessage( i18n("Process completed successfully"), K3bJob::SUCCESS ); + jobFinished( true ); + } + else { + if( m_canceled ) { + emit infoMessage( i18n("Canceled."), ERROR ); + emit canceled(); + } + else { + emit infoMessage( i18n("Blanking error "), K3bJob::ERROR ); + emit infoMessage( i18n("Sorry, no error handling yet."), K3bJob::ERROR ); + } + jobFinished( false ); + } +} + + + +#include "k3bblankingjob.moc" diff --git a/libk3b/jobs/k3bblankingjob.h b/libk3b/jobs/k3bblankingjob.h new file mode 100644 index 0000000..8cfe0a1 --- /dev/null +++ b/libk3b/jobs/k3bblankingjob.h @@ -0,0 +1,71 @@ +/* + * + * $Id: k3bblankingjob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef K3B_BLANKING_JOB_H +#define K3B_BLANKING_JOB_H + +#include +#include "k3b_export.h" +class KProcess; +class QString; +class K3bDevice::Device; +class K3bAbstractWriter; + + +class LIBK3B_EXPORT K3bBlankingJob : public K3bBurnJob +{ + Q_OBJECT + + public: + K3bBlankingJob( K3bJobHandler*, QObject* parent = 0 ); + ~K3bBlankingJob(); + + K3bDevice::Device* writer() const; + + bool hasBeenCanceled() const { return m_canceled; } + + enum blank_mode { Fast, Complete, Track, Unclose, Session }; + + public slots: + void start(); + void cancel(); + void setForce( bool f ) { m_force = f; } + void setDevice( K3bDevice::Device* d ); + void setSpeed( int s ) { m_speed = s; } + void setMode( int m ) { m_mode = m; } + void setWritingApp (int app) { m_writingApp = app; } + + /** + * If set true the job ignores the global K3b setting + * and does not eject the CD-RW after finishing + */ + void setForceNoEject( bool b ) { m_forceNoEject = b; } + + private slots: + void slotFinished(bool); + void slotStartErasing(); + + private: + K3bAbstractWriter* m_writerJob; + bool m_force; + K3bDevice::Device* m_device; + int m_speed; + int m_mode; + int m_writingApp; + bool m_canceled; + bool m_forceNoEject; +}; + +#endif diff --git a/libk3b/jobs/k3bcdcopyjob.cpp b/libk3b/jobs/k3bcdcopyjob.cpp new file mode 100644 index 0000000..ff8f35d --- /dev/null +++ b/libk3b/jobs/k3bcdcopyjob.cpp @@ -0,0 +1,1213 @@ +/* + * + * $Id.cpp,v 1.82 2005/02/04 09:27:19 trueg Exp $ + * Copyright (C) 2003-2007 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include "k3bcdcopyjob.h" +#include "k3baudiosessionreadingjob.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class K3bCdCopyJob::Private +{ +public: + Private() + : canceled(false), + running(false), + readcdReader(0), + dataTrackReader(0), + audioSessionReader(0), + cdrecordWriter(0), + infFileWriter(0), + cddb(0) { + } + + bool canceled; + bool error; + bool readingSuccessful; + bool running; + + unsigned int numSessions; + bool doNotCloseLastSession; + + unsigned int doneCopies; + unsigned int currentReadSession; + unsigned int currentWrittenSession; + + K3bDevice::Toc toc; + QByteArray cdTextRaw; + + K3bReadcdReader* readcdReader; + K3bDataTrackReader* dataTrackReader; + K3bAudioSessionReadingJob* audioSessionReader; + K3bCdrecordWriter* cdrecordWriter; + K3bInfFileWriter* infFileWriter; + + bool audioReaderRunning; + bool dataReaderRunning; + bool writerRunning; + + // image filenames, one for every track + QStringList imageNames; + + // inf-filenames for writing audio tracks + QStringList infNames; + + // indicates if we created a dir or not + bool deleteTempDir; + + K3bCddb* cddb; + K3bCddbResultEntry cddbInfo; + + bool haveCddb; + bool haveCdText; + + QValueVector dataSessionProbablyTAORecorded; + + // used to determine progress + QValueVector sessionSizes; + long overallSize; +}; + + +K3bCdCopyJob::K3bCdCopyJob( K3bJobHandler* hdl, QObject* parent ) + : K3bBurnJob( hdl, parent ), + m_simulate(false), + m_copies(1), + m_onlyCreateImages(false), + m_onTheFly(true), + m_ignoreDataReadErrors(false), + m_ignoreAudioReadErrors(true), + m_noCorrection(false), + m_dataReadRetries(128), + m_audioReadRetries(5), + m_preferCdText(false), + m_copyCdText(true), + m_writingMode( K3b::WRITING_MODE_AUTO ) +{ + d = new Private(); +} + + +K3bCdCopyJob::~K3bCdCopyJob() +{ + delete d->infFileWriter; + delete d; +} + + +void K3bCdCopyJob::start() +{ + d->running = true; + d->canceled = false; + d->error = false; + d->readingSuccessful = false; + d->audioReaderRunning = d->dataReaderRunning = d->writerRunning = false; + d->sessionSizes.clear(); + d->dataSessionProbablyTAORecorded.clear(); + d->deleteTempDir = false; + d->haveCdText = false; + d->haveCddb = false; + + jobStarted(); + + emit newTask( i18n("Checking Source Medium") ); + + emit burning(false); + emit newSubTask( i18n("Waiting for source medium") ); + + // wait for a source disk + if( waitForMedia( m_readerDevice, + K3bDevice::STATE_COMPLETE|K3bDevice::STATE_INCOMPLETE, + K3bDevice::MEDIA_WRITABLE_CD|K3bDevice::MEDIA_CD_ROM ) < 0 ) { + finishJob( true, false ); + return; + } + + emit newSubTask( i18n("Checking source medium") ); + + // FIXME: read ISRCs and MCN + + connect( K3bDevice::diskInfo( m_readerDevice ), SIGNAL(finished(K3bDevice::DeviceHandler*)), + this, SLOT(slotDiskInfoReady(K3bDevice::DeviceHandler*)) ); +} + + +void K3bCdCopyJob::slotDiskInfoReady( K3bDevice::DeviceHandler* dh ) +{ + if( dh->success() ) { + d->toc = dh->toc(); + + // + // for now we copy audio, pure data (aka 1 data track), cd-extra (2 session, audio and data), + // and data multisession which one track per session. + // Everything else will be rejected + // + bool canCopy = true; + bool audio = false; + d->numSessions = dh->diskInfo().numSessions(); + d->doNotCloseLastSession = (dh->diskInfo().diskState() == K3bDevice::STATE_INCOMPLETE); + switch( dh->toc().contentType() ) { + case K3bDevice::DATA: + // check if every track is in it's own session + // only then we copy the cd + if( (int)dh->toc().count() != dh->diskInfo().numSessions() ) { + emit infoMessage( i18n("K3b does not copy CDs containing multiple data tracks."), ERROR ); + canCopy = false; + } + else if( dh->diskInfo().numSessions() > 1 ) + emit infoMessage( i18n("Copying Multisession Data CD."), INFO ); + else + emit infoMessage( i18n("Copying Data CD."), INFO ); + break; + + case K3bDevice::MIXED: + audio = true; + if( dh->diskInfo().numSessions() != 2 || d->toc[0].type() != K3bDevice::Track::AUDIO ) { + emit infoMessage( i18n("K3b can only copy CD-Extra mixed mode CDs."), ERROR ); + canCopy = false; + } + else + emit infoMessage( i18n("Copying Enhanced Audio CD (CD-Extra)."), INFO ); + break; + + case K3bDevice::AUDIO: + audio = true; + emit infoMessage( i18n("Copying Audio CD."), INFO ); + break; + + case K3bDevice::NONE: + default: + emit infoMessage( i18n("The source disk is empty."), ERROR ); + canCopy = false; + break; + } + + // + // A data track recorded in TAO mode has two run-out blocks which cannot be read and contain + // zero data anyway. The problem is that I do not know of a valid method to determine if a track + // was written in TAO (the control nibble does definitely not work, I never saw one which did not + // equal 4). + // So the solution for now is to simply try to read the last sector of a data track. If this is not + // possible we assume it was written in TAO mode and reduce the length by 2 sectors + // + unsigned char buffer[2048]; + int i = 1; + for( K3bDevice::Toc::iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + if( (*it).type() == K3bDevice::Track::DATA ) { + // we try twice just to be sure + if( m_readerDevice->read10( buffer, 2048, (*it).lastSector().lba(), 1 ) || + m_readerDevice->read10( buffer, 2048, (*it).lastSector().lba(), 1 ) ) { + d->dataSessionProbablyTAORecorded.append(false); + kdDebug() << "(K3bCdCopyJob) track " << i << " probably DAO recorded." << endl; + } + else { + d->dataSessionProbablyTAORecorded.append(true); + kdDebug() << "(K3bCdCopyJob) track " << i << " probably TAO recorded." << endl; + } + } + + ++i; + } + + + // + // To copy mode2 data tracks we need cdrecord >= 2.01a12 which introduced the -xa1 and -xamix options + // + if( k3bcore->externalBinManager()->binObject("cdrecord") && + !k3bcore->externalBinManager()->binObject("cdrecord")->hasFeature( "xamix" ) ) { + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + if( (*it).type() == K3bDevice::Track::DATA && + ( (*it).mode() == K3bDevice::Track::XA_FORM1 || + (*it).mode() == K3bDevice::Track::XA_FORM2 ) ) { + emit infoMessage( i18n("K3b needs cdrecord 2.01a12 or newer to copy Mode2 data tracks."), ERROR ); + finishJob( true, false ); + return; + } + } + } + + + // + // It is not possible to create multisession cds in raw writing mode + // + if( d->numSessions > 1 && m_writingMode == K3b::RAW ) { + if( !questionYesNo( i18n("You will only be able to copy the first session in raw writing mode. " + "Continue anyway?"), + i18n("Multisession CD") ) ) { + finishJob( true, false ); + return; + } + else { + emit infoMessage( i18n("Only copying first session."), WARNING ); + // TODO: remove the second session from the progress stuff + } + } + + + // + // We already create the temp filenames here since we need them to check the free space + // + if( !m_onTheFly || m_onlyCreateImages ) { + if( !prepareImageFiles() ) { + finishJob( false, true ); + return; + } + + // + // check free temp space + // + KIO::filesize_t imageSpaceNeeded = 0; + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + if( (*it).type() == K3bDevice::Track::AUDIO ) + imageSpaceNeeded += (*it).length().audioBytes() + 44; + else + imageSpaceNeeded += (*it).length().mode1Bytes(); + } + + unsigned long avail, size; + QString pathToTest = m_tempPath.left( m_tempPath.findRev( '/' ) ); + if( !K3b::kbFreeOnFs( pathToTest, size, avail ) ) { + emit infoMessage( i18n("Unable to determine free space in temporary directory '%1'.").arg(pathToTest), ERROR ); + d->error = true; + canCopy = false; + } + else { + if( avail < imageSpaceNeeded/1024 ) { + emit infoMessage( i18n("Not enough space left in temporary directory."), ERROR ); + d->error = true; + canCopy = false; + } + } + } + + if( canCopy ) { + if( K3b::isMounted( m_readerDevice ) ) { + emit infoMessage( i18n("Unmounting source medium"), INFO ); + K3b::unmount( m_readerDevice ); + } + + d->overallSize = 0; + + // now create some progress helper values + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + d->overallSize += (*it).length().lba(); + if( d->sessionSizes.isEmpty() || (*it).type() == K3bDevice::Track::DATA ) + d->sessionSizes.append( (*it).length().lba() ); + else + d->sessionSizes[0] += (*it).length().lba(); + } + + if( audio && !m_onlyCreateImages ) { + if( m_copyCdText ) + searchCdText(); + else + queryCddb(); + } + else + startCopy(); + } + else { + finishJob( false, true ); + } + } + else { + emit infoMessage( i18n("Unable to read TOC"), ERROR ); + finishJob( false, true ); + } +} + + +void K3bCdCopyJob::searchCdText() +{ + emit newSubTask( i18n("Searching CD-TEXT") ); + + connect( K3bDevice::sendCommand( K3bDevice::DeviceHandler::CD_TEXT_RAW, m_readerDevice ), + SIGNAL(finished(K3bDevice::DeviceHandler*)), + this, + SLOT(slotCdTextReady(K3bDevice::DeviceHandler*)) ); +} + + +void K3bCdCopyJob::slotCdTextReady( K3bDevice::DeviceHandler* dh ) +{ + if( dh->success() ) { + if( K3bDevice::CdText::checkCrc( dh->cdTextRaw() ) ) { + K3bDevice::CdText cdt( dh->cdTextRaw() ); + emit infoMessage( i18n("Found CD-TEXT (%1 - %2).").arg(cdt.performer()).arg(cdt.title()), SUCCESS ); + d->haveCdText = true; + d->cdTextRaw = dh->cdTextRaw(); + } + else { + emit infoMessage( i18n("Found corrupted CD-TEXT. Ignoring it."), WARNING ); + d->haveCdText = false; + } + + if( d->haveCdText && m_preferCdText ) + startCopy(); + else + queryCddb(); + } + else { + emit infoMessage( i18n("No CD-TEXT found."), INFO ); + + d->haveCdText = false; + + queryCddb(); + } +} + + +void K3bCdCopyJob::queryCddb() +{ + emit newSubTask( i18n("Querying Cddb") ); + + d->haveCddb = false; + + if( !d->cddb ) { + d->cddb = new K3bCddb( this ); + connect( d->cddb, SIGNAL(queryFinished(int)), + this, SLOT(slotCddbQueryFinished(int)) ); + } + + KConfig* c = k3bcore->config(); + c->setGroup("Cddb"); + + d->cddb->readConfig( c ); + d->cddb->query( d->toc ); +} + + +void K3bCdCopyJob::slotCddbQueryFinished( int error ) +{ + if( error == K3bCddbQuery::SUCCESS ) { + d->cddbInfo = d->cddb->result(); + d->haveCddb = true; + + emit infoMessage( i18n("Found Cddb entry (%1 - %2).").arg(d->cddbInfo.cdArtist).arg(d->cddbInfo.cdTitle), SUCCESS ); + + // save the entry locally + KConfig* c = k3bcore->config(); + c->setGroup( "Cddb" ); + if( c->readBoolEntry( "save cddb entries locally", true ) ) + d->cddb->saveEntry( d->cddbInfo ); + } + else if( error == K3bCddbQuery::NO_ENTRY_FOUND ) { + emit infoMessage( i18n("No Cddb entry found."), WARNING ); + } + else { + emit infoMessage( i18n("Cddb error (%1).").arg(d->cddb->errorString()), ERROR ); + } + + startCopy(); +} + + +void K3bCdCopyJob::startCopy() +{ + d->currentWrittenSession = d->currentReadSession = 1; + d->doneCopies = 0; + + if( m_onTheFly ) { + emit newSubTask( i18n("Preparing write process...") ); + + if( writeNextSession() ) + readNextSession(); + else { + finishJob( d->canceled, d->error ); + } + } + else + readNextSession(); +} + + +void K3bCdCopyJob::cancel() +{ + d->canceled = true; + + if( d->writerRunning ) { + // + // we will handle cleanup in slotWriterFinished() + // if we are writing onthefly the reader won't be able to write + // anymore and will finish unsuccessfully, too + // + d->cdrecordWriter->cancel(); + } + else if( d->audioReaderRunning ) + d->audioSessionReader->cancel(); + else if( d->dataReaderRunning ) + // d->readcdReader->cancel(); + d->dataTrackReader->cancel(); +} + + +bool K3bCdCopyJob::prepareImageFiles() +{ + kdDebug() << "(K3bCdCopyJob) prepareImageFiles()" << endl; + + d->imageNames.clear(); + d->infNames.clear(); + d->deleteTempDir = false; + + QFileInfo fi( m_tempPath ); + + if( d->toc.count() > 1 || d->toc.contentType() == K3bDevice::AUDIO ) { + // create a directory which contains all the images and inf and stuff + // and save it in some cool structure + + bool tempDirReady = false; + if( !fi.isDir() ) { + if( QFileInfo( m_tempPath.section( '/', 0, -2 ) ).isDir() ) { + if( !QFile::exists( m_tempPath ) ) { + QDir dir( m_tempPath.section( '/', 0, -2 ) ); + dir.mkdir( m_tempPath.section( '/', -1 ) ); + tempDirReady = true; + } + else + m_tempPath = m_tempPath.section( '/', 0, -2 ); + } + else { + emit infoMessage( i18n("Specified an unusable temporary path. Using default."), WARNING ); + m_tempPath = K3b::defaultTempPath(); + } + } + + // create temp dir + if( !tempDirReady ) { + QDir dir( m_tempPath ); + m_tempPath = K3b::findUniqueFilePrefix( "k3bCdCopy", m_tempPath ); + kdDebug() << "(K3bCdCopyJob) creating temp dir: " << m_tempPath << endl; + if( !dir.mkdir( m_tempPath, true ) ) { + emit infoMessage( i18n("Unable to create temporary directory '%1'.").arg(m_tempPath), ERROR ); + return false; + } + d->deleteTempDir = true; + } + + m_tempPath = K3b::prepareDir( m_tempPath ); + emit infoMessage( i18n("Using temporary directory %1.").arg(m_tempPath), INFO ); + + // create temp filenames + int i = 1; + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + if( (*it).type() == K3bDevice::Track::AUDIO ) { + d->imageNames.append( m_tempPath + QString("Track%1.wav").arg(QString::number(i).rightJustify(2, '0')) ); + d->infNames.append( m_tempPath + QString("Track%1.inf").arg(QString::number(i).rightJustify(2, '0')) ); + } + else + d->imageNames.append( m_tempPath + QString("Track%1.iso").arg(QString::number(i).rightJustify(2, '0')) ); + ++i; + } + + kdDebug() << "(K3bCdCopyJob) created image filenames:" << endl; + for( unsigned int i = 0; i < d->imageNames.count(); ++i ) + kdDebug() << "(K3bCdCopyJob) " << d->imageNames[i] << endl; + + return true; + } + else { + // we only need a single image file + if( !fi.isFile() || + questionYesNo( i18n("Do you want to overwrite %1?").arg(m_tempPath), + i18n("File Exists") ) ) { + if( fi.isDir() ) + m_tempPath = K3b::findTempFile( "iso", m_tempPath ); + else if( !QFileInfo( m_tempPath.section( '/', 0, -2 ) ).isDir() ) { + emit infoMessage( i18n("Specified an unusable temporary path. Using default."), WARNING ); + m_tempPath = K3b::findTempFile( "iso" ); + } + // else the user specified a file in an existing dir + + emit infoMessage( i18n("Writing image file to %1.").arg(m_tempPath), INFO ); + } + else + return false; + + d->imageNames.append( m_tempPath ); + + return true; + } +} + + +void K3bCdCopyJob::readNextSession() +{ + if( !m_onTheFly || m_onlyCreateImages ) { + if( d->numSessions > 1 ) + emit newTask( i18n("Reading Session %1").arg(d->currentReadSession) ); + else + emit newTask( i18n("Reading Source Medium") ); + + if( d->currentReadSession == 1 ) + emit newSubTask( i18n("Reading track %1 of %2").arg(1).arg(d->toc.count()) ); + } + + // there is only one situation where we need the audiosessionreader: + // if the first session is an audio session. That means the first track + // is an audio track + if( d->currentReadSession == 1 && d->toc[0].type() == K3bDevice::Track::AUDIO ) { + if( !d->audioSessionReader ) { + d->audioSessionReader = new K3bAudioSessionReadingJob( this, this ); + connect( d->audioSessionReader, SIGNAL(nextTrack(int, int)), + this, SLOT(slotReadingNextTrack(int, int)) ); + connectSubJob( d->audioSessionReader, + SLOT(slotSessionReaderFinished(bool)), + true, + SLOT(slotReaderProgress(int)), + SLOT(slotReaderSubProgress(int)) ); + } + + d->audioSessionReader->setDevice( m_readerDevice ); + d->audioSessionReader->setToc( d->toc ); + d->audioSessionReader->setParanoiaMode( m_paranoiaMode ); + d->audioSessionReader->setReadRetries( m_audioReadRetries ); + d->audioSessionReader->setNeverSkip( !m_ignoreAudioReadErrors ); + if( m_onTheFly ) + d->audioSessionReader->writeToFd( d->cdrecordWriter->fd() ); + else + d->audioSessionReader->setImageNames( d->imageNames ); // the audio tracks are always the first tracks + + d->audioReaderRunning = true; + d->audioSessionReader->start(); + } + else { + if( !d->dataTrackReader ) { + d->dataTrackReader = new K3bDataTrackReader( this, this ); + connect( d->dataTrackReader, SIGNAL(percent(int)), this, SLOT(slotReaderProgress(int)) ); + connect( d->dataTrackReader, SIGNAL(processedSize(int, int)), this, SLOT(slotReaderProcessedSize(int, int)) ); + connect( d->dataTrackReader, SIGNAL(finished(bool)), this, SLOT(slotSessionReaderFinished(bool)) ); + connect( d->dataTrackReader, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) ); + connect( d->dataTrackReader, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + } + + d->dataTrackReader->setDevice( m_readerDevice ); + d->dataTrackReader->setIgnoreErrors( m_ignoreDataReadErrors ); + d->dataTrackReader->setNoCorrection( m_noCorrection ); + d->dataTrackReader->setRetries( m_dataReadRetries ); + if( m_onlyCreateImages ) + d->dataTrackReader->setSectorSize( K3bDataTrackReader::MODE1 ); + else + d->dataTrackReader->setSectorSize( K3bDataTrackReader::AUTO ); + + K3bTrack* track = 0; + unsigned int dataTrackIndex = 0; + if( d->toc.contentType() == K3bDevice::MIXED ) { + track = &d->toc[d->toc.count()-1]; + dataTrackIndex = 0; + } + else { + track = &d->toc[d->currentReadSession-1]; // only one track per session + dataTrackIndex = d->currentReadSession-1; + } + + // HACK: if the track is TAO recorded cut the two run-out sectors + if( d->dataSessionProbablyTAORecorded.count() > dataTrackIndex && + d->dataSessionProbablyTAORecorded[dataTrackIndex] ) + d->dataTrackReader->setSectorRange( track->firstSector(), track->lastSector() - 2 ); + else + d->dataTrackReader->setSectorRange( track->firstSector(), track->lastSector() ); + + int trackNum = d->currentReadSession; + if( d->toc.contentType() == K3bDevice::MIXED ) + trackNum = d->toc.count(); + + if( m_onTheFly ) + d->dataTrackReader->writeToFd( d->cdrecordWriter->fd() ); + else + d->dataTrackReader->setImagePath( d->imageNames[trackNum-1] ); + + d->dataReaderRunning = true; + if( !m_onTheFly || m_onlyCreateImages ) + slotReadingNextTrack( 1, 1 ); + + d->dataTrackReader->start(); + } +} + + +bool K3bCdCopyJob::writeNextSession() +{ + // we emit our own task since the cdrecord task is way too simple + if( d->numSessions > 1 ) { + if( m_simulate ) + emit newTask( i18n("Simulating Session %1").arg(d->currentWrittenSession) ); + else if( m_copies > 1 ) + emit newTask( i18n("Writing Copy %1 (Session %2)").arg(d->doneCopies+1).arg(d->currentWrittenSession) ); + else + emit newTask( i18n("Writing Copy (Session %2)").arg(d->currentWrittenSession) ); + } + else { + if( m_simulate ) + emit newTask( i18n("Simulating") ); + else if( m_copies > 1 ) + emit newTask( i18n("Writing Copy %1").arg(d->doneCopies+1) ); + else + emit newTask( i18n("Writing Copy") ); + } + + emit newSubTask( i18n("Waiting for media") ); + + // if session > 1 we wait for an appendable CD + if( waitForMedia( m_writerDevice, + d->currentWrittenSession > 1 && !m_simulate + ? K3bDevice::STATE_INCOMPLETE + : K3bDevice::STATE_EMPTY, + K3bDevice::MEDIA_WRITABLE_CD ) < 0 ) { + + finishJob( true, false ); + return false; + } + + if( !d->cdrecordWriter ) { + d->cdrecordWriter = new K3bCdrecordWriter( m_writerDevice, this, this ); + connect( d->cdrecordWriter, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) ); + connect( d->cdrecordWriter, SIGNAL(percent(int)), this, SLOT(slotWriterProgress(int)) ); + connect( d->cdrecordWriter, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSize(int, int)) ); + connect( d->cdrecordWriter, SIGNAL(subPercent(int)), this, SIGNAL(subPercent(int)) ); + connect( d->cdrecordWriter, SIGNAL(processedSubSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + connect( d->cdrecordWriter, SIGNAL(nextTrack(int, int)), this, SLOT(slotWritingNextTrack(int, int)) ); + connect( d->cdrecordWriter, SIGNAL(buffer(int)), this, SIGNAL(bufferStatus(int)) ); + connect( d->cdrecordWriter, SIGNAL(deviceBuffer(int)), this, SIGNAL(deviceBuffer(int)) ); + connect( d->cdrecordWriter, SIGNAL(writeSpeed(int, int)), this, SIGNAL(writeSpeed(int, int)) ); + connect( d->cdrecordWriter, SIGNAL(finished(bool)), this, SLOT(slotWriterFinished(bool)) ); + // connect( d->cdrecordWriter, SIGNAL(newTask(const QString&)), this, SIGNAL(newTask(const QString&)) ); + connect( d->cdrecordWriter, SIGNAL(newSubTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( d->cdrecordWriter, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + } + + d->cdrecordWriter->setBurnDevice( m_writerDevice ); + d->cdrecordWriter->clearArguments(); + d->cdrecordWriter->setSimulate( m_simulate ); + d->cdrecordWriter->setBurnSpeed( m_speed ); + + + // create the cdrecord arguments + if( d->currentWrittenSession == 1 && d->toc[0].type() == K3bDevice::Track::AUDIO ) { + // + // Audio session + // + + + if( !d->infFileWriter ) + d->infFileWriter = new K3bInfFileWriter(); + + // + // create the inf files if not already done + // + if( d->infNames.isEmpty() || !QFile::exists( d->infNames[0] ) ) { + + unsigned int trackNumber = 1; + + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + const K3bDevice::Track& track = *it; + + if( track.type() == K3bDevice::Track::DATA ) + break; + + d->infFileWriter->setTrack( track ); + d->infFileWriter->setTrackNumber( trackNumber ); + + if( d->haveCddb ) { + d->infFileWriter->setTrackTitle( d->cddbInfo.titles[trackNumber-1] ); + d->infFileWriter->setTrackPerformer( d->cddbInfo.artists[trackNumber-1] ); + d->infFileWriter->setTrackMessage( d->cddbInfo.extInfos[trackNumber-1] ); + + d->infFileWriter->setAlbumTitle( d->cddbInfo.cdTitle ); + d->infFileWriter->setAlbumPerformer( d->cddbInfo.cdArtist ); + } + + if( m_onTheFly ) { + + d->infFileWriter->setBigEndian( true ); + + // we let KTempFile choose a temp file but delete it on our own + // the same way we delete them when writing with images + // It is important that the files have the ending inf because + // cdrecord only checks this + + KTempFile tmp( QString::null, ".inf" ); + d->infNames.append( tmp.name() ); + bool success = d->infFileWriter->save( *tmp.textStream() ); + tmp.close(); + if( !success ) + return false; + } + else { + d->infFileWriter->setBigEndian( false ); + + if( !d->infFileWriter->save( d->infNames[trackNumber-1] ) ) + return false; + } + + ++trackNumber; + } + } + + // + // the inf files are ready and named correctly when writing with images + // + int usedWritingMode = m_writingMode; + if( usedWritingMode == K3b::WRITING_MODE_AUTO ) { + // + // there are a lot of writers out there which produce coasters + // in dao mode if the CD contains pregaps of length 0 (or maybe already != 2 secs?) + // + bool zeroPregap = false; + if( d->numSessions == 1 ) { + for( K3bDevice::Toc::const_iterator it = d->toc.begin(); it != d->toc.end(); ++it ) { + const K3bDevice::Track& track = *it; + if( track.index0() == 0 ) { + ++it; + if( it != d->toc.end() ) + zeroPregap = true; + --it; + } + } + } + + if( zeroPregap && m_writerDevice->supportsRawWriting() ) { + if( d->numSessions == 1 ) + usedWritingMode = K3b::RAW; + else + usedWritingMode = K3b::TAO; + } + else if( m_writerDevice->dao() ) + usedWritingMode = K3b::DAO; + else if( m_writerDevice->supportsRawWriting() ) + usedWritingMode = K3b::RAW; + else + usedWritingMode = K3b::TAO; + } + d->cdrecordWriter->setWritingMode( usedWritingMode ); + + if( d->numSessions > 1 ) + d->cdrecordWriter->addArgument( "-multi" ); + + if( d->haveCddb || d->haveCdText ) { + if( usedWritingMode == K3b::TAO ) { + emit infoMessage( i18n("It is not possible to write CD-Text in TAO mode."), WARNING ); + } + else if( d->haveCdText && ( !d->haveCddb || m_preferCdText ) ) { + // use the raw CDTEXT data + d->cdrecordWriter->setRawCdText( d->cdTextRaw ); + } + else { + // make sure the writer job does not create raw cdtext + d->cdrecordWriter->setRawCdText( QByteArray() ); + // cdrecord will use the cdtext data in the inf files + d->cdrecordWriter->addArgument( "-text" ); + } + } + + d->cdrecordWriter->addArgument( "-useinfo" ); + + // + // add all the audio tracks + // + d->cdrecordWriter->addArgument( "-audio" )->addArgument( "-shorttrack" ); + + for( unsigned int i = 0; i < d->infNames.count(); ++i ) { + if( m_onTheFly ) + d->cdrecordWriter->addArgument( d->infNames[i] ); + else + d->cdrecordWriter->addArgument( d->imageNames[i] ); + } + } + else { + // + // Data Session + // + K3bTrack* track = 0; + unsigned int dataTrackIndex = 0; + if( d->toc.contentType() == K3bDevice::MIXED ) { + track = &d->toc[d->toc.count()-1]; + dataTrackIndex = 0; + } + else { + track = &d->toc[d->currentWrittenSession-1]; + dataTrackIndex = d->currentWrittenSession-1; + } + + bool multi = d->doNotCloseLastSession || (d->numSessions > 1 && d->currentWrittenSession < d->toc.count()); + int usedWritingMode = m_writingMode; + if( usedWritingMode == K3b::WRITING_MODE_AUTO ) { + // at least the NEC3540a does write 2056 byte sectors only in tao mode. Same for LG4040b + // since writing data tracks in TAO mode is no loss let's default to TAO in the case of 2056 byte + // sectors (which is when writing xa form1 sectors here) + if( m_writerDevice->dao() && + d->toc.count() == 1 && + !multi && + track->mode() == K3bDevice::Track::MODE1 ) + usedWritingMode = K3b::DAO; + else + usedWritingMode = K3b::TAO; + } + d->cdrecordWriter->setWritingMode( usedWritingMode ); + + // + // all but the last session of a multisession disk are written in multi mode + // and every data track has it's own session which we forced above + // + if( multi ) + d->cdrecordWriter->addArgument( "-multi" ); + + // just to let the reader init + if( m_onTheFly ) + d->cdrecordWriter->addArgument( "-waiti" ); + + if( track->mode() == K3bDevice::Track::MODE1 ) + d->cdrecordWriter->addArgument( "-data" ); + else if( track->mode() == K3bDevice::Track::XA_FORM1 ) + d->cdrecordWriter->addArgument( "-xa1" ); + else + d->cdrecordWriter->addArgument( "-xamix" ); + + if( m_onTheFly ) { + // HACK: if the track is TAO recorded cut the two run-out sectors + unsigned long trackLen = track->length().lba(); + if( d->dataSessionProbablyTAORecorded.count() > dataTrackIndex && + d->dataSessionProbablyTAORecorded[dataTrackIndex] ) + trackLen -= 2; + + if( track->mode() == K3bDevice::Track::MODE1 ) + trackLen = trackLen * 2048; + else if( track->mode() == K3bDevice::Track::XA_FORM1 ) + trackLen = trackLen * 2056; // see k3bdatatrackreader.h + else + trackLen = trackLen * 2332; // see k3bdatatrackreader.h + d->cdrecordWriter->addArgument( QString("-tsize=%1").arg(trackLen) )->addArgument("-"); + } + else if( d->toc.contentType() == K3bDevice::MIXED ) + d->cdrecordWriter->addArgument( d->imageNames[d->toc.count()-1] ); + else + d->cdrecordWriter->addArgument( d->imageNames[d->currentWrittenSession-1] ); + + // clear cd text from previous sessions + d->cdrecordWriter->setRawCdText( QByteArray() ); + } + + + // + // Finally start the writer + // + emit burning(true); + d->writerRunning = true; + d->cdrecordWriter->start(); + + return true; +} + + +// both the readcdreader and the audiosessionreader are connected to this slot +void K3bCdCopyJob::slotSessionReaderFinished( bool success ) +{ + d->audioReaderRunning = d->dataReaderRunning = false; + + if( success ) { + if( d->numSessions > 1 ) + emit infoMessage( i18n("Successfully read session %1.").arg(d->currentReadSession), SUCCESS ); + else + emit infoMessage( i18n("Successfully read source disk."), SUCCESS ); + + if( !m_onTheFly ) { + if( d->numSessions > d->currentReadSession ) { + d->currentReadSession++; + readNextSession(); + } + else { + d->readingSuccessful = true; + if( !m_onlyCreateImages ) { + if( m_readerDevice == m_writerDevice ) { + // eject the media (we do this blocking to know if it worked + // becasue if it did not it might happen that k3b overwrites a CD-RW + // source) + if( !m_readerDevice->eject() ) { + blockingInformation( i18n("K3b was unable to eject the source disk. Please do so manually.") ); + } + } + + if( !writeNextSession() ) { + // nothing is running here... + finishJob( d->canceled, d->error ); + } + } + else { + finishJob( false, false ); + } + } + } + } + else { + if( !d->canceled ) { + emit infoMessage( i18n("Error while reading session %1.").arg(d->currentReadSession), ERROR ); + if( m_onTheFly ) + d->cdrecordWriter->setSourceUnreadable(true); + } + + finishJob( d->canceled, !d->canceled ); + } +} + + +void K3bCdCopyJob::slotWriterFinished( bool success ) +{ + emit burning(false); + + d->writerRunning = false; + + if( success ) { + // + // if this was the last written session we need to reset d->currentWrittenSession + // and start a new writing if more copies are wanted + // + + if( d->currentWrittenSession < d->numSessions ) { + d->currentWrittenSession++; + d->currentReadSession++; + + // reload the media + emit newSubTask( i18n("Reloading the medium") ); + connect( K3bDevice::reload( m_writerDevice ), SIGNAL(finished(K3bDevice::DeviceHandler*)), + this, SLOT(slotMediaReloadedForNextSession(K3bDevice::DeviceHandler*)) ); + } + else { + d->doneCopies++; + + if( !m_simulate && d->doneCopies < m_copies ) { + // start next copy + K3bDevice::eject( m_writerDevice ); + + d->currentWrittenSession = 1; + d->currentReadSession = 1; + if( writeNextSession() ) { + if( m_onTheFly ) + readNextSession(); + } + else { + // nothing running here... + finishJob( d->canceled, d->error ); + } + } + else { + finishJob( false, false ); + } + } + } + else { + // + // If we are writing on the fly the reader will also stop when it is not able to write anymore + // The error handling will be done only here in that case + // + + // the K3bCdrecordWriter emitted an error message + + finishJob( d->canceled, !d->canceled ); + } +} + + +void K3bCdCopyJob::slotMediaReloadedForNextSession( K3bDevice::DeviceHandler* dh ) +{ + if( !dh->success() ) + blockingInformation( i18n("Please reload the medium and press 'ok'"), + i18n("Unable to close the tray") ); + + if( !writeNextSession() ) { + // nothing is running here... + finishJob( d->canceled, d->error ); + } + else if( m_onTheFly ) + readNextSession(); +} + + +void K3bCdCopyJob::cleanup() +{ + if( m_onTheFly || !m_keepImage || ((d->canceled || d->error) && !d->readingSuccessful) ) { + emit infoMessage( i18n("Removing temporary files."), INFO ); + for( QStringList::iterator it = d->infNames.begin(); it != d->infNames.end(); ++it ) + QFile::remove( *it ); + } + + if( !m_onTheFly && (!m_keepImage || ((d->canceled || d->error) && !d->readingSuccessful)) ) { + emit infoMessage( i18n("Removing image files."), INFO ); + for( QStringList::iterator it = d->imageNames.begin(); it != d->imageNames.end(); ++it ) + QFile::remove( *it ); + + // remove the tempdir created in prepareImageFiles() + if( d->deleteTempDir ) { + KIO::NetAccess::del( KURL::fromPathOrURL(m_tempPath), 0 ); + d->deleteTempDir = false; + } + } +} + + +void K3bCdCopyJob::slotReaderProgress( int p ) +{ + if( !m_onTheFly || m_onlyCreateImages ) { + int bigParts = ( m_onlyCreateImages ? 1 : (m_simulate ? 2 : m_copies + 1 ) ); + double done = (double)p * (double)d->sessionSizes[d->currentReadSession-1] / 100.0; + for( unsigned int i = 0; i < d->currentReadSession-1; ++i ) + done += (double)d->sessionSizes[i]; + emit percent( (int)(100.0*done/(double)d->overallSize/(double)bigParts) ); + + if( d->dataReaderRunning ) + emit subPercent(p); + } +} + + +void K3bCdCopyJob::slotReaderSubProgress( int p ) +{ + // only if reading an audiosession + if( !m_onTheFly || m_onlyCreateImages ) { + emit subPercent( p ); + } +} + + +void K3bCdCopyJob::slotReaderProcessedSize( int p, int pp ) +{ + if( !m_onTheFly ) + emit processedSubSize( p, pp ); +} + + +void K3bCdCopyJob::slotWriterProgress( int p ) +{ + int bigParts = ( m_simulate ? 1 : m_copies ) + ( m_onTheFly ? 0 : 1 ); + long done = ( m_onTheFly ? d->doneCopies : d->doneCopies+1 ) * d->overallSize + + (p * d->sessionSizes[d->currentWrittenSession-1] / 100); + for( unsigned int i = 0; i < d->currentWrittenSession-1; ++i ) + done += d->sessionSizes[i]; + emit percent( 100*done/d->overallSize/bigParts ); +} + + +void K3bCdCopyJob::slotWritingNextTrack( int t, int tt ) +{ + if( d->toc.contentType() == K3bDevice::MIXED ) { + if( d->currentWrittenSession == 1 ) + emit newSubTask( i18n("Writing track %1 of %2").arg(t).arg(d->toc.count()) ); + else + emit newSubTask( i18n("Writing track %1 of %2").arg(d->toc.count()).arg(d->toc.count()) ); + } + else if( d->numSessions > 1 ) + emit newSubTask( i18n("Writing track %1 of %2").arg(d->currentWrittenSession).arg(d->toc.count()) ); + else + emit newSubTask( i18n("Writing track %1 of %2").arg(t).arg(tt) ); +} + + +void K3bCdCopyJob::slotReadingNextTrack( int t, int ) +{ + if( !m_onTheFly || m_onlyCreateImages ) { + int track = t; + if( d->audioReaderRunning ) + track = t; + else if( d->toc.contentType() == K3bDevice::MIXED ) + track = d->toc.count(); + else + track = d->currentReadSession; + + emit newSubTask( i18n("Reading track %1 of %2").arg(track).arg(d->toc.count()) ); + } +} + + +QString K3bCdCopyJob::jobDescription() const +{ + if( m_onlyCreateImages ) { + return i18n("Creating CD Image"); + } + else if( m_simulate ) { + if( m_onTheFly ) + return i18n("Simulating CD Copy On-The-Fly"); + else + return i18n("Simulating CD Copy"); + } + else { + if( m_onTheFly ) + return i18n("Copying CD On-The-Fly"); + else + return i18n("Copying CD"); + } +} + + +QString K3bCdCopyJob::jobDetails() const +{ + return i18n("Creating 1 copy", + "Creating %n copies", + (m_simulate||m_onlyCreateImages) ? 1 : m_copies ); +} + + +void K3bCdCopyJob::finishJob( bool c, bool e ) +{ + if( d->running ) { + if( c ) { + d->canceled = true; + emit canceled(); + } + if( e ) + d->error = true; + + cleanup(); + + d->running = false; + + jobFinished( !(c||e) ); + } +} + +#include "k3bcdcopyjob.moc" diff --git a/libk3b/jobs/k3bcdcopyjob.h b/libk3b/jobs/k3bcdcopyjob.h new file mode 100644 index 0000000..3ab77e8 --- /dev/null +++ b/libk3b/jobs/k3bcdcopyjob.h @@ -0,0 +1,117 @@ +/* + * + * $Id: k3bcdcopyjob.h 690187 2007-07-20 09:18:03Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + + +#ifndef _K3BCDCOPYJOB_H_ +#define _K3BCDCOPYJOB_H_ + +#include +#include "k3b_export.h" + +namespace K3bDevice { + class Device; + class DeviceHandler; +} + + +/** + *@author Sebastian Trueg + */ +class LIBK3B_EXPORT K3bCdCopyJob : public K3bBurnJob +{ + Q_OBJECT + + public: + K3bCdCopyJob( K3bJobHandler* hdl, QObject* parent = 0 ); + ~K3bCdCopyJob(); + + K3bDevice::Device* writer() const { return m_onlyCreateImages ? 0 : m_writerDevice; } + K3bDevice::Device* reader() const { return m_readerDevice; } + + QString jobDescription() const; + QString jobDetails() const; + + public slots: + void start(); + void cancel(); + + public: + void setWriterDevice( K3bDevice::Device* dev ) { m_writerDevice = dev; } + void setReaderDevice( K3bDevice::Device* dev ) { m_readerDevice = dev; } + void setWritingMode( int m ) { m_writingMode = m; } + void setSpeed( int s ) { m_speed = s; } + void setOnTheFly( bool b ) { m_onTheFly = b; } + void setKeepImage( bool b ) { m_keepImage = b; } + void setOnlyCreateImage( bool b ) { m_onlyCreateImages = b; } + void setSimulate( bool b ) { m_simulate = b; } + void setTempPath( const QString& path ) { m_tempPath= path; } + void setCopies( unsigned int c ) { m_copies = c; } + void setParanoiaMode( int i ) { m_paranoiaMode = i; } + void setIgnoreDataReadErrors( bool b ) { m_ignoreDataReadErrors = b; } + void setDataReadRetries( int i ) { m_dataReadRetries = i; } + void setIgnoreAudioReadErrors( bool b ) { m_ignoreAudioReadErrors = b; } + void setAudioReadRetries( int i ) { m_audioReadRetries = i; } + void setPreferCdText( bool b ) { m_preferCdText = b; } + void setCopyCdText( bool b ) { m_copyCdText = b; } + void setNoCorrection( bool b ) { m_noCorrection = b; } + + private slots: + void slotDiskInfoReady( K3bDevice::DeviceHandler* ); + void slotCdTextReady( K3bDevice::DeviceHandler* ); + void slotMediaReloadedForNextSession( K3bDevice::DeviceHandler* dh ); + void slotCddbQueryFinished(int); + void slotWritingNextTrack( int t, int tt ); + void slotReadingNextTrack( int t, int tt ); + void slotSessionReaderFinished( bool success ); + void slotWriterFinished( bool success ); + void slotReaderProgress( int p ); + void slotReaderSubProgress( int p ); + void slotWriterProgress( int p ); + void slotReaderProcessedSize( int p, int pp ); + + private: + void startCopy(); + void searchCdText(); + void queryCddb(); + bool writeNextSession(); + void readNextSession(); + bool prepareImageFiles(); + void cleanup(); + void finishJob( bool canceled, bool error ); + + K3bDevice::Device* m_writerDevice; + K3bDevice::Device* m_readerDevice; + bool m_simulate; + int m_speed; + int m_paranoiaMode; + unsigned int m_copies; + bool m_keepImage; + bool m_onlyCreateImages; + bool m_onTheFly; + bool m_ignoreDataReadErrors; + bool m_ignoreAudioReadErrors; + bool m_noCorrection; + int m_dataReadRetries; + int m_audioReadRetries; + bool m_preferCdText; + bool m_copyCdText; + QString m_tempPath; + int m_writingMode; + + class Private; + Private* d; +}; + +#endif diff --git a/libk3b/jobs/k3bcdda2wavreader.cpp b/libk3b/jobs/k3bcdda2wavreader.cpp new file mode 100644 index 0000000..3df87d3 --- /dev/null +++ b/libk3b/jobs/k3bcdda2wavreader.cpp @@ -0,0 +1,254 @@ +/* + * + * $Id: k3bcdda2wavreader.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bcdda2wavreader.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + +class K3bCdda2wavReader::Private +{ +public: + Private() + : cdda2wavBin(0), + process(0), + cancaled(false), + running(false), + fdToWriteTo(-1) { + } + + const K3bExternalBin* cdda2wavBin; + K3bProcess* process; + + bool cancaled; + bool running; + + int fdToWriteTo; + + int currentTrack; + QValueVector trackOffsets; +}; + + +K3bCdda2wavReader::K3bCdda2wavReader( QObject* parent, const char* name ) + : K3bJob( parent, name ) +{ + d = new Private(); +} + + +K3bCdda2wavReader::~K3bCdda2wavReader() +{ + delete d->process; + delete d; +} + + +bool K3bCdda2wavReader::active() const +{ + return d->running; +} + + +void K3bCdda2wavReader::writeToFd( int fd ) +{ + d->fdToWriteTo = fd; +} + + +void K3bCdda2wavReader::start() +{ + start( false ); +} + + +void K3bCdda2wavReader::start( bool onlyInfo ) +{ + d->running = true; + d->cancaled = false; + d->currentTrack = 1; + d->trackOffsets.clear(); + + jobStarted(); + + d->cdda2wavBin = k3bcore->externalBinManager()->binObject( "cdda2wav" ); + if( !d->cdda2wavBin ) { + emit infoMessage( i18n("Could not find %1 executable.").arg("cdda2wav"), ERROR ); + jobFinished(false); + d->running = false; + return; + } + + // prepare the process + delete d->process; + d->process = new K3bProcess(); + d->process->setSplitStdout(true); + d->process->setSuppressEmptyLines(true); + d->process->setWorkingDirectory( m_imagePath ); + connect( d->process, SIGNAL(stdoutLine(const QString&)), this, SLOT(slotProcessLine(const QString&)) ); + connect( d->process, SIGNAL(stderrLine(const QString&)), this, SLOT(slotProcessLine(const QString&)) ); + connect( d->process, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcessExited(KProcess*)) ); + + // create the command line + *d->process << d->cdda2wavBin->path; + *d->process << "-vall" << ( d->cdda2wavBin->hasFeature( "gui" ) ? "-gui" : "-g" ); + if( d->cdda2wavBin->hasFeature( "dev" ) ) + *d->process << QString("dev=%1").arg(K3bDevice::externalBinDeviceParameter(m_device, d->cdda2wavBin)); + else + *d->process << "-D" << K3bDevice::externalBinDeviceParameter(m_device, d->cdda2wavBin); + *d->process << ( d->cdda2wavBin->hasFeature( "bulk" ) ? "-bulk" : "-B" ); + if( onlyInfo ) + *d->process << ( d->cdda2wavBin->hasFeature( "info-only" ) ? "-info-only" : "-J" ); + else if( d->fdToWriteTo != -1 ) + *d->process << ( d->cdda2wavBin->hasFeature( "no-infofile" ) ? "-no-infofile" : "-H" ); + + // additional user parameters from config + const QStringList& params = d->cdda2wavBin->userParameters(); + for( QStringList::const_iterator it = params.begin(); it != params.end(); ++it ) + *d->process << *it; + + // start the thing + if( !d->process->start( KProcess::NotifyOnExit, KProcess::All ) ) { + // something went wrong when starting the program + // it "should" be the executable + kdDebug() << "(K3bCdda2wavReader) could not start cdda2wav" << endl; + emit infoMessage( i18n("Could not start %1.").arg("cdda2wav"), K3bJob::ERROR ); + d->running = false; + jobFinished(false); + } +} + + +void K3bCdda2wavReader::cancel() +{ + if( d->running ) { + d->cancaled = true; + if( d->process ) + if( d->process->isRunning() ) + d->process->kill(); + } +} + + +void K3bCdda2wavReader::slotProcessLine( const QString& line ) +{ + // Tracks:11 44:37.30 + // CDINDEX discid: ZvzBXv614ACgzn1bWWy107cs0nA- + // CDDB discid: 0x8a0a730b + // CD-Text: not detected + // CD-Extra: not detected + // Album title: '' from '' + // T01: 0 3:39.70 audio linear copydenied stereo title '' from '' + // T02: 16495 3:10.47 audio linear copydenied stereo title '' from '' + // T03: 30792 3:30.00 audio linear copydenied stereo title '' from '' + // T04: 46542 4:05.05 audio linear copydenied stereo title '' from '' + // T05: 64922 3:44.35 audio linear copydenied stereo title '' from '' + // T06: 81757 4:36.45 audio linear copydenied stereo title '' from '' + // T07: 102502 3:59.30 audio linear copydenied stereo title '' from '' + // T08: 120457 5:24.30 audio linear copydenied stereo title '' from '' + // T09: 144787 3:26.28 audio linear copydenied stereo title '' from '' + // T10: 160265 4:07.20 audio linear copydenied stereo title '' from '' + // T11: 178810 4:51.20 audio linear copydenied stereo title '' from '' + + // percent_done: + // 100% track 1 successfully recorded + // 100% track 2 successfully recorded + // 100% track 3 successfully recorded + + + + static QRegExp rx( "T\\d\\d:" ); + if( rx.exactMatch( line.left(4) ) || line.startsWith( "Leadout" ) ) { + int pos = line.find( " " ); + int endpos = line.find( QRegExp( "\\d" ), pos ); + endpos = line.find( " ", endpos ); + bool ok; + int offset = line.mid( pos, endpos-pos ).toInt(&ok); + if( ok ) + d->trackOffsets.append( offset ); + else + kdDebug() << "(K3bCdda2wavReader) track offset parsing error: '" << line.mid( pos, endpos-pos ) << "'" << endl; + } + + else if( line.startsWith( "percent_done" ) ) { + // the reading starts + d->currentTrack = 1; + emit nextTrack( d->currentTrack, d->trackOffsets.count() ); + } + + else if( line.contains("successfully recorded") ) { + d->currentTrack++; + emit nextTrack( d->currentTrack, d->trackOffsets.count() ); + } + + else if( line.contains("%") ) { + // parse progress + bool ok; + int p = line.left(3).toInt(&ok); + if( ok ) { + emit subPercent( p ); + + int overall = d->trackOffsets[d->currentTrack-1]; + int tSize = d->trackOffsets[d->currentTrack] - d->trackOffsets[d->currentTrack-1]; + overall += (tSize*p/100); + + emit percent( overall*100/d->trackOffsets[d->trackOffsets.count()-1] ); + } + else + kdDebug() << "(K3bCdda2wavReader) track progress parsing error: '" << line.left(3) << "'" << endl; + } +} + + +void K3bCdda2wavReader::slotProcessExited( KProcess* p ) +{ + d->running = false; + + if( d->cancaled ) { + emit canceled(); + jobFinished(false); + return; + } + + if( p->normalExit() ) { + // TODO: improve this + + if( p->exitStatus() == 0 ) { + jobFinished( true ); + } + else { + emit infoMessage( i18n("%1 returned an unknown error (code %2).") + .arg("Cdda2wav").arg(p->exitStatus()), ERROR ); + jobFinished( false ); + } + } + else { + emit infoMessage( i18n("%1 did not exit cleanly.").arg("Cdda2wav"), + ERROR ); + jobFinished( false ); + } +} + +#include "k3bcdda2wavreader.moc" diff --git a/libk3b/jobs/k3bcdda2wavreader.h b/libk3b/jobs/k3bcdda2wavreader.h new file mode 100644 index 0000000..edde65c --- /dev/null +++ b/libk3b/jobs/k3bcdda2wavreader.h @@ -0,0 +1,70 @@ +/* + * + * $Id: k3bcdda2wavreader.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_CDDA2WAV_READER_H_ +#define _K3B_CDDA2WAV_READER_H_ + +#include + +class KProcess; +namespace K3bDevice { + class Device; +}; + + +/** + * An Audio CD reader completely based on cdda2wav. + * It does not use K3bDevice::Device but parses the track offsets + * from the cdda2wav output. + */ +class K3bCdda2wavReader : public K3bJob +{ + Q_OBJECT + + public: + K3bCdda2wavReader( QObject* parent = 0, const char* name = 0 ); + ~K3bCdda2wavReader(); + + bool active() const; + + public slots: + void start(); + void start( bool onlyReadInfo ); + void cancel(); + + void setReadDevice( K3bDevice::Device* dev ) { m_device = dev; } + void setImagePath( const QString& p ) { m_imagePath = p; } + + /** + * the data gets written directly into fd instead of the imagefile. + * Be aware that this only makes sense before starting the job. + * To disable just set fd to -1 + */ + void writeToFd( int fd ); + + private slots: + void slotProcessLine( const QString& ); + void slotProcessExited( KProcess* ); + + private: + K3bDevice::Device* m_device; + + QString m_imagePath; + + class Private; + Private* d; +}; + +#endif diff --git a/libk3b/jobs/k3bclonejob.cpp b/libk3b/jobs/k3bclonejob.cpp new file mode 100644 index 0000000..9fb61ab --- /dev/null +++ b/libk3b/jobs/k3bclonejob.cpp @@ -0,0 +1,375 @@ +/* + * + * $Id: k3bclonejob.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bclonejob.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + + +class K3bCloneJob::Private +{ +public: + Private() + : doneCopies(0) { + } + + int doneCopies; +}; + + +K3bCloneJob::K3bCloneJob( K3bJobHandler* hdl, QObject* parent, const char* name ) + : K3bBurnJob( hdl, parent, name ), + m_writerDevice(0), + m_readerDevice(0), + m_writerJob(0), + m_readcdReader(0), + m_removeImageFiles(false), + m_canceled(false), + m_running(false), + m_simulate(false), + m_speed(1), + m_copies(1), + m_onlyCreateImage(false), + m_onlyBurnExistingImage(false), + m_readRetries(128) +{ + d = new Private; +} + + +K3bCloneJob::~K3bCloneJob() +{ + delete d; +} + + +void K3bCloneJob::start() +{ + jobStarted(); + + m_canceled = false; + m_running = true; + + + // TODO: check the cd size and warn the user if not enough space + + // + // We first check if cdrecord has clone support + // The readcdReader will check the same for readcd + // + const K3bExternalBin* cdrecordBin = k3bcore->externalBinManager()->binObject( "cdrecord" ); + if( !cdrecordBin ) { + emit infoMessage( i18n("Could not find %1 executable.").arg("cdrecord"), ERROR ); + jobFinished(false); + m_running = false; + return; + } + else if( !cdrecordBin->hasFeature( "clone" ) ) { + emit infoMessage( i18n("Cdrecord version %1 does not have cloning support.").arg(cdrecordBin->version), ERROR ); + jobFinished(false); + m_running = false; + return; + } + + if( (!m_onlyCreateImage && !writer()) || + (!m_onlyBurnExistingImage && !readingDevice()) ) { + emit infoMessage( i18n("No device set."), ERROR ); + jobFinished(false); + m_running = false; + return; + } + + if( !m_onlyCreateImage ) { + if( !writer()->supportsWritingMode( K3bDevice::RAW_R96R ) && + !writer()->supportsWritingMode( K3bDevice::RAW_R16 ) ) { + emit infoMessage( i18n("CD writer %1 does not support cloning.") + .arg(writer()->vendor()) + .arg(writer()->description()), ERROR ); + m_running = false; + jobFinished(false); + return; + } + } + + if( m_imagePath.isEmpty() ) { + m_imagePath = K3b::findTempFile( "img" ); + } + else if( QFileInfo(m_imagePath).isDir() ) { + m_imagePath = K3b::findTempFile( "img", m_imagePath ); + } + + if( m_onlyBurnExistingImage ) { + startWriting(); + } + else { + emit burning( false ); + + prepareReader(); + + if( waitForMedia( readingDevice(), + K3bDevice::STATE_COMPLETE, + K3bDevice::MEDIA_WRITABLE_CD|K3bDevice::MEDIA_CD_ROM ) < 0 ) { + m_running = false; + emit canceled(); + jobFinished(false); + return; + } + + emit newTask( i18n("Reading clone image") ); + + m_readcdReader->start(); + } +} + + +void K3bCloneJob::prepareReader() +{ + if( !m_readcdReader ) { + m_readcdReader = new K3bReadcdReader( this, this ); + connect( m_readcdReader, SIGNAL(percent(int)), this, SLOT(slotReadingPercent(int)) ); + connect( m_readcdReader, SIGNAL(percent(int)), this, SIGNAL(subPercent(int)) ); + connect( m_readcdReader, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + connect( m_readcdReader, SIGNAL(finished(bool)), this, SLOT(slotReadingFinished(bool)) ); + connect( m_readcdReader, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) ); + connect( m_readcdReader, SIGNAL(newTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( m_readcdReader, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + } + + m_readcdReader->setReadDevice( readingDevice() ); + m_readcdReader->setReadSpeed( 0 ); // MAX + m_readcdReader->setDisableCorrection( m_noCorrection ); + m_readcdReader->setImagePath( m_imagePath ); + m_readcdReader->setClone( true ); + m_readcdReader->setRetries( m_readRetries ); +} + + +void K3bCloneJob::prepareWriter() +{ + if( !m_writerJob ) { + m_writerJob = new K3bCdrecordWriter( writer(), this, this ); + connect( m_writerJob, SIGNAL(infoMessage(const QString&, int)), this, SIGNAL(infoMessage(const QString&, int)) ); + connect( m_writerJob, SIGNAL(percent(int)), this, SLOT(slotWriterPercent(int)) ); + connect( m_writerJob, SIGNAL(percent(int)), this, SIGNAL(subPercent(int)) ); + connect( m_writerJob, SIGNAL(nextTrack(int, int)), this, SLOT(slotWriterNextTrack(int, int)) ); + connect( m_writerJob, SIGNAL(processedSize(int, int)), this, SIGNAL(processedSubSize(int, int)) ); + connect( m_writerJob, SIGNAL(buffer(int)), this, SIGNAL(bufferStatus(int)) ); + connect( m_writerJob, SIGNAL(deviceBuffer(int)), this, SIGNAL(deviceBuffer(int)) ); + connect( m_writerJob, SIGNAL(writeSpeed(int, int)), this, SIGNAL(writeSpeed(int, int)) ); + connect( m_writerJob, SIGNAL(finished(bool)), this, SLOT(slotWriterFinished(bool)) ); + // connect( m_writerJob, SIGNAL(newTask(const QString&)), this, SIGNAL(newTask(const QString&)) ); + connect( m_writerJob, SIGNAL(newSubTask(const QString&)), this, SIGNAL(newSubTask(const QString&)) ); + connect( m_writerJob, SIGNAL(debuggingOutput(const QString&, const QString&)), + this, SIGNAL(debuggingOutput(const QString&, const QString&)) ); + } + + m_writerJob->clearArguments(); + m_writerJob->setWritingMode( K3b::RAW ); + m_writerJob->setClone( true ); + m_writerJob->setSimulate( m_simulate ); + m_writerJob->setBurnSpeed( m_speed ); + m_writerJob->addArgument( m_imagePath ); +} + + +void K3bCloneJob::cancel() +{ + if( m_running ) { + m_canceled = true; + if( m_readcdReader ) + m_readcdReader->cancel(); + if( m_writerJob ) + m_writerJob->cancel(); + } +} + + +void K3bCloneJob::slotWriterPercent( int p ) +{ + if( m_onlyBurnExistingImage ) + emit percent( (int)((double)(d->doneCopies)*100.0/(double)(m_copies) + (double)p/(double)(m_copies)) ); + else + emit percent( (int)((double)(1+d->doneCopies)*100.0/(double)(1+m_copies) + (double)p/(double)(1+m_copies)) ); +} + + +void K3bCloneJob::slotWriterNextTrack( int t, int tt ) +{ + emit newSubTask( i18n("Writing Track %1 of %2").arg(t).arg(tt) ); +} + + +void K3bCloneJob::slotWriterFinished( bool success ) +{ + if( m_canceled ) { + removeImageFiles(); + m_running = false; + emit canceled(); + jobFinished(false); + return; + } + + if( success ) { + d->doneCopies++; + + emit infoMessage( i18n("Successfully written clone copy %1.").arg(d->doneCopies), INFO ); + + if( d->doneCopies < m_copies ) { + K3bDevice::eject( writer() ); + startWriting(); + } + else { + if( m_removeImageFiles ) + removeImageFiles(); + m_running = false; + jobFinished(true); + } + } + else { + removeImageFiles(); + m_running = false; + jobFinished(false); + } +} + + +void K3bCloneJob::slotReadingPercent( int p ) +{ + emit percent( m_onlyCreateImage ? p : (int)((double)p/(double)(1+m_copies)) ); +} + + +void K3bCloneJob::slotReadingFinished( bool success ) +{ + if( m_canceled ) { + removeImageFiles(); + m_running = false; + emit canceled(); + jobFinished(false); + return; + } + + if( success ) { + // + // Make a quick test if the image is really valid. + // Readcd does not seem to have proper exit codes + // + K3bCloneTocReader ctr( m_imagePath ); + if( ctr.isValid() ) { + emit infoMessage( i18n("Successfully read disk."), INFO ); + if( m_onlyCreateImage ) { + m_running = false; + jobFinished(true); + } + else { + if( writer() == readingDevice() ) + K3bDevice::eject( writer() ); + startWriting(); + } + } + else { + emit infoMessage( i18n("Failed to read disk completely in clone mode."), ERROR ); + removeImageFiles(); + m_running = false; + jobFinished(false); + } + } + else { + emit infoMessage( i18n("Error while reading disk."), ERROR ); + removeImageFiles(); + m_running = false; + jobFinished(false); + } +} + + +void K3bCloneJob::startWriting() +{ + emit burning( true ); + + // start writing + prepareWriter(); + + if( waitForMedia( writer(), + K3bDevice::STATE_EMPTY, + K3bDevice::MEDIA_WRITABLE_CD ) < 0 ) { + removeImageFiles(); + m_running = false; + emit canceled(); + jobFinished(false); + return; + } + + if( m_simulate ) + emit newTask( i18n("Simulating clone copy") ); + else + emit newTask( i18n("Writing clone copy %1").arg(d->doneCopies+1) ); + + m_writerJob->start(); +} + + +void K3bCloneJob::removeImageFiles() +{ + if( !m_onlyBurnExistingImage ) { + emit infoMessage( i18n("Removing image files."), INFO ); + if( QFile::exists( m_imagePath ) ) + QFile::remove( m_imagePath ); + if( QFile::exists( m_imagePath + ".toc" ) ) + QFile::remove( m_imagePath + ".toc" ); + } +} + + +QString K3bCloneJob::jobDescription() const +{ + if( m_onlyCreateImage ) + return i18n("Creating Clone Image"); + else if( m_onlyBurnExistingImage ) { + if( m_simulate ) + return i18n("Simulating Clone Image"); + else + return i18n("Burning Clone Image"); + } + else if( m_simulate ) + return i18n("Simulating CD Cloning"); + else + return i18n("Cloning CD"); +} + + +QString K3bCloneJob::jobDetails() const +{ + return i18n("Creating 1 clone copy", + "Creating %n clone copies", + (m_simulate||m_onlyCreateImage) ? 1 : m_copies ); +} + +#include "k3bclonejob.moc" diff --git a/libk3b/jobs/k3bclonejob.h b/libk3b/jobs/k3bclonejob.h new file mode 100644 index 0000000..80c8ea9 --- /dev/null +++ b/libk3b/jobs/k3bclonejob.h @@ -0,0 +1,99 @@ +/* + * + * $Id: k3bclonejob.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_CLONE_JOB_H_ +#define _K3B_CLONE_JOB_H_ + +#include +#include "k3b_export.h" +#include + + +namespace K3bDevice { + class Device; +} +class K3bCdrecordWriter; +class K3bReadcdReader; + + +class LIBK3B_EXPORT K3bCloneJob : public K3bBurnJob +{ + Q_OBJECT + + public: + K3bCloneJob( K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + ~K3bCloneJob(); + + K3bDevice::Device* writer() const { return m_writerDevice; } + K3bDevice::Device* readingDevice() const { return m_readerDevice; } + + QString jobDescription() const; + QString jobDetails() const; + + public slots: + void start(); + void cancel(); + + void setWriterDevice( K3bDevice::Device* w ) { m_writerDevice = w; } + void setReaderDevice( K3bDevice::Device* w ) { m_readerDevice = w; } + void setImagePath( const QString& p ) { m_imagePath = p; } + void setNoCorrection( bool b ) { m_noCorrection = b; } + void setRemoveImageFiles( bool b ) { m_removeImageFiles = b; } + void setOnlyCreateImage( bool b ) { m_onlyCreateImage = b; } + void setOnlyBurnExistingImage( bool b ) { m_onlyBurnExistingImage = b; } + void setSimulate( bool b ) { m_simulate = b; } + void setWriteSpeed( int s ) { m_speed = s; } + void setCopies( int c ) { m_copies = c; } + void setReadRetries( int i ) { m_readRetries = i; } + + private slots: + void slotWriterPercent( int ); + void slotWriterFinished( bool ); + void slotWriterNextTrack( int, int ); + void slotReadingPercent( int ); + void slotReadingFinished( bool ); + + private: + void removeImageFiles(); + void prepareReader(); + void prepareWriter(); + void startWriting(); + + K3bDevice::Device* m_writerDevice; + K3bDevice::Device* m_readerDevice; + QString m_imagePath; + + K3bCdrecordWriter* m_writerJob; + K3bReadcdReader* m_readcdReader; + + bool m_noCorrection; + bool m_removeImageFiles; + + bool m_canceled; + bool m_running; + + bool m_simulate; + int m_speed; + int m_copies; + bool m_onlyCreateImage; + bool m_onlyBurnExistingImage; + int m_readRetries; + + class Private; + Private* d; +}; + + +#endif diff --git a/libk3b/jobs/k3bclonetocreader.cpp b/libk3b/jobs/k3bclonetocreader.cpp new file mode 100644 index 0000000..5dd8b8b --- /dev/null +++ b/libk3b/jobs/k3bclonetocreader.cpp @@ -0,0 +1,235 @@ +/* + * + * $Id: k3bclonetocreader.cpp 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include + + +#include "k3bclonetocreader.h" + +#include +#include + +#include +#include + +#include + + +class K3bCloneTocReader::Private +{ +public: + Private() + : size(0) { + } + + K3b::Msf size; + QString tocFile; +}; + + + +K3bCloneTocReader::K3bCloneTocReader( const QString& filename ) + : K3bImageFileReader() +{ + d = new Private; + openFile( filename ); +} + + +K3bCloneTocReader::~K3bCloneTocReader() +{ + delete d; +} + + +const K3b::Msf& K3bCloneTocReader::imageSize() const +{ + return d->size; +} + + +void K3bCloneTocReader::readFile() +{ + // first of all we check if we find the image file which contains the data for this toc + // cdrecord always uses this strange file naming: + // somedata + // somedata.toc + + // filename should always be the toc file + if( filename().right( 4 ) == ".toc" ) + d->tocFile = filename(); + else + d->tocFile = filename() + ".toc"; + + // now get rid of the ".toc" extension + QString imageFileName = d->tocFile.left( d->tocFile.length()-4 ); + if( !QFile::exists( imageFileName ) ) { + kdDebug() << "(K3bCloneTocReader) could not find image file " << imageFileName << endl; + return; + } + + setImageFilename( imageFileName ); + + d->size = 0; + + QFile f( d->tocFile ); + if( f.open( IO_ReadOnly ) ) { + // + // Inspired by clone.c from the cdrecord sources + // + char buffer[2048]; + int read = f.readBlock( buffer, 2048 ); + f.close(); + + if( read == 2048 ) { + kdDebug() << "(K3bCloneTocReader) TOC too large." << endl; + return; + } + + // the toc starts with a tocheader + struct tocheader { + unsigned char len[2]; + unsigned char first; // first session + unsigned char last; // last session + }; + + struct tocheader* th = (struct tocheader*)buffer; + int dataLen = K3bDevice::from2Byte( th->len ) + 2; // the len field does not include it's own length + + if( th->first != 1 ) { + kdDebug() << "(K3bCloneTocReader) first session != 1" << endl; + return; + } + + // the following bytes are multiple instances of + struct ftrackdesc { + unsigned char sess_number; +#ifdef WORDS_BIGENDIAN // __BYTE_ORDER == __BIG_ENDIAN + unsigned char adr : 4; + unsigned char control : 4; +#else + unsigned char control : 4; + unsigned char adr : 4; +#endif + unsigned char track; + unsigned char point; + unsigned char amin; + unsigned char asec; + unsigned char aframe; + unsigned char res7; + unsigned char pmin; + unsigned char psec; + unsigned char pframe; + }; + + for( int i = 4; i < dataLen; i += 11) { + struct ftrackdesc* ft = (struct ftrackdesc*)&buffer[i]; + + if( ft->sess_number != 1 ) { + kdDebug() << "(K3bCloneTocReader} session number != 1" << endl; + return; + } + + // now we check some of the values + if( ft->point >= 0x1 && ft->point <= 0x63 ) { + if( ft->adr == 1 ) { + // check track starttime + if( ft->psec > 60 || ft->pframe > 75 ) { + kdDebug() << "(K3bCloneTocReader) invalid track start: " + << (int)ft->pmin << "." + << (int)ft->psec << "." + << (int)ft->pframe << endl; + return; + } + } + } + else { + switch( ft->point ) { + case 0xa0: + if( ft->adr != 1 ) { + kdDebug() << "(K3bCloneTocReader) adr != 1" << endl; + return; + } + + // disk type in psec + if( ft->psec != 0x00 && ft->psec != 0x10 && ft->psec != 0x20 ) { + kdDebug() << "(K3bCloneTocReader) invalid disktype: " << ft->psec << endl; + return; + } + + if( ft->pmin != 1 ) { + kdDebug() << "(K3bCloneTocReader) first track number != 1 " << endl; + return; + } + + if( ft->pframe != 0x0 ) { + kdDebug() << "(K3bCloneTocReader) found data when there should be 0x0" << endl; + return; + } + break; + + case 0xa1: + if( ft->adr != 1 ) { + kdDebug() << "(K3bCloneTocReader) adr != 1" << endl; + return; + } + + if( !(ft->pmin >= 1) ) { + kdDebug() << "(K3bCloneTocReader) last track number needs to be >= 1." << endl; + return; + } + if( ft->psec != 0x0 || ft->pframe != 0x0 ) { + kdDebug() << "(K3bCloneTocReader) found data when there should be 0x0" << endl; + return; + } + break; + + case 0xa2: + if( ft->adr != 1 ) { + kdDebug() << "(K3bCloneTocReader) adr != 1" << endl; + return; + } + + // start of the leadout = size of the image + // substract 2 seconds since in cdrecord other than in K3b lba 0 = msf 2:00 + // (the cdrecord way is actually more accurate but we use k3b::Msf for many + // things and it is simpler this way.) + d->size = K3b::Msf( ft->pmin, ft->psec, ft->pframe ) - K3b::Msf( 0, 2, 0 ); + + // leadout... no check so far... + break; + + default: + if( ft->adr != 5 ) { + kdDebug() << "(K3bCloneTocReader) adr != 5" << endl; + return; + } + break; + } + } + } + + if( d->size.rawBytes() != K3b::filesize( imageFileName ) ) { + kdDebug() << "(K3bCloneTocReader) image file size invalid." << endl; + return; + } + + // ok, could be a cdrecord toc file + setValid(true); + } + else { + kdDebug() << "(K3bCloneTocReader) could not open file " << d->tocFile << endl; + } +} diff --git a/libk3b/jobs/k3bclonetocreader.h b/libk3b/jobs/k3bclonetocreader.h new file mode 100644 index 0000000..17e80d7 --- /dev/null +++ b/libk3b/jobs/k3bclonetocreader.h @@ -0,0 +1,45 @@ +/* + * + * $Id: k3bclonetocreader.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_CLONETOC_FILE_PARSER_H_ +#define _K3B_CLONETOC_FILE_PARSER_H_ + +#include "k3bimagefilereader.h" + +#include + +#include "k3b_export.h" + + +/** + * Reads a cdrecord clone toc file and searches for the + * corresponding image file. + */ +class LIBK3B_EXPORT K3bCloneTocReader : public K3bImageFileReader +{ + public: + K3bCloneTocReader( const QString& filename = QString::null ); + ~K3bCloneTocReader(); + + const K3b::Msf& imageSize() const; + + protected: + void readFile(); + + class Private; + Private* d; +}; + +#endif diff --git a/libk3b/jobs/k3bdatatrackreader.cpp b/libk3b/jobs/k3bdatatrackreader.cpp new file mode 100644 index 0000000..8300ada --- /dev/null +++ b/libk3b/jobs/k3bdatatrackreader.cpp @@ -0,0 +1,515 @@ +/* + * + * $Id: k3bdatatrackreader.cpp 690529 2007-07-21 10:51:47Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bdatatrackreader.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + + + +// FIXME: determine max DMA buffer size +static int s_bufferSizeSectors = 10; + + +class K3bDataTrackReader::WorkThread : public K3bThread +{ +public: + WorkThread(); + ~WorkThread(); + + void init(); + void run(); + int read( unsigned char* buffer, unsigned long sector, unsigned int len ); + bool retryRead( unsigned char* buffer, unsigned long startSector, unsigned int len ); + bool setErrorRecovery( K3bDevice::Device* dev, int code ); + void cancel(); + + bool m_canceled; + bool m_ignoreReadErrors; + bool m_noCorrection; + int m_retries; + K3bDevice::Device* m_device; + K3b::Msf m_firstSector; + K3b::Msf m_lastSector; + K3b::Msf m_nextReadSector; + int m_fd; + QString m_imagePath; + int m_sectorSize; + bool m_useLibdvdcss; + K3bLibDvdCss* m_libcss; + + int m_oldErrorRecoveryMode; + + int m_errorSectorCount; + +private: + int m_usedSectorSize; +}; + + +K3bDataTrackReader::K3bDataTrackReader( K3bJobHandler* jh, QObject* parent, const char* name ) + : K3bThreadJob( jh, parent, name ) +{ + m_thread = new WorkThread(); + setThread( m_thread ); +} + + +K3bDataTrackReader::WorkThread::WorkThread() + : K3bThread(), + m_canceled(false), + m_ignoreReadErrors(false), + m_noCorrection(false), + m_retries(10), + m_device(0), + m_fd(-1), + m_libcss(0) +{ +} + + +K3bDataTrackReader::WorkThread::~WorkThread() +{ + delete m_libcss; +} + + +void K3bDataTrackReader::WorkThread::init() +{ + m_canceled = false; +} + + +void K3bDataTrackReader::WorkThread::run() +{ + emitStarted(); + + if( !m_device->open() ) { + emitInfoMessage( i18n("Could not open device %1").arg(m_device->blockDeviceName()), K3bJob::ERROR ); + emitFinished(false); + return; + } + + // 1. determine sector size by checking the first sectors mode + // if impossible or MODE2 (mode2 formless) finish(false) + + m_useLibdvdcss = false; + m_usedSectorSize = m_sectorSize; + if( m_device->isDVD() ) { + m_usedSectorSize = MODE1; + + // + // In case of an encrypted VideoDVD we read with libdvdcss which takes care of decrypting the vobs + // + if( m_device->copyrightProtectionSystemType() == 1 ) { + + // close the device for libdvdcss + m_device->close(); + + kdDebug() << "(K3bDataTrackReader::WorkThread) found encrypted dvd. using libdvdcss." << endl; + + // open the libdvdcss stuff + if( !m_libcss ) + m_libcss = K3bLibDvdCss::create(); + if( !m_libcss ) { + emitInfoMessage( i18n("Unable to open libdvdcss."), K3bJob::ERROR ); + emitFinished(false); + return; + } + + if( !m_libcss->open(m_device) ) { + emitInfoMessage( i18n("Could not open device %1").arg(m_device->blockDeviceName()), K3bJob::ERROR ); + emitFinished(false); + return; + } + + emitInfoMessage( i18n("Retrieving all CSS keys. This might take a while."), K3bJob::INFO ); + if( !m_libcss->crackAllKeys() ) { + m_libcss->close(); + emitInfoMessage( i18n("Failed to retrieve all CSS keys."), K3bJob::ERROR ); + emitInfoMessage( i18n("Video DVD decryption failed."), K3bJob::ERROR ); + emitFinished(false); + return; + } + + m_useLibdvdcss = true; + } + } + else { + if( m_usedSectorSize == AUTO ) { + switch( m_device->getDataMode( m_firstSector ) ) { + case K3bDevice::Track::MODE1: + case K3bDevice::Track::DVD: + m_usedSectorSize = MODE1; + break; + case K3bDevice::Track::XA_FORM1: + m_usedSectorSize = MODE2FORM1; + break; + case K3bDevice::Track::XA_FORM2: + m_usedSectorSize = MODE2FORM2; + break; + case K3bDevice::Track::MODE2: + emitInfoMessage( i18n("No support for reading formless Mode2 sectors."), K3bJob::ERROR ); + default: + emitInfoMessage( i18n("Unsupported sector type."), K3bJob::ERROR ); + m_device->close(); + emitFinished(false); + return; + } + } + } + + emitInfoMessage( i18n("Reading with sector size %1.").arg(m_usedSectorSize), K3bJob::INFO ); + emitDebuggingOutput( "K3bDataTrackReader", + QString("reading sectors %1 to %2 with sector size %3. Length: %4 sectors, %5 bytes.") + .arg( m_firstSector.lba() ) + .arg( m_lastSector.lba() ) + .arg( m_usedSectorSize ) + .arg( m_lastSector.lba() - m_firstSector.lba() + 1 ) + .arg( Q_UINT64(m_usedSectorSize) * (Q_UINT64)(m_lastSector.lba() - m_firstSector.lba() + 1) ) ); + + QFile file; + if( m_fd == -1 ) { + file.setName( m_imagePath ); + if( !file.open( IO_WriteOnly ) ) { + m_device->close(); + if( m_useLibdvdcss ) + m_libcss->close(); + emitInfoMessage( i18n("Unable to open '%1' for writing.").arg(m_imagePath), K3bJob::ERROR ); + emitFinished( false ); + return; + } + } + + k3bcore->blockDevice( m_device ); + m_device->block( true ); + + // + // set the error recovery mode to 0x21 or 0x20 depending on m_ignoreReadErrors + // TODO: should we also set RC=1 in m_ignoreReadErrors mode (0x11 because TB is ignored) + // + setErrorRecovery( m_device, m_noCorrection ? 0x21 : 0x20 ); + + // + // Let the drive determine the optimal reading speed + // + m_device->setSpeed( 0xffff, 0xffff ); + + s_bufferSizeSectors = 128; + unsigned char* buffer = new unsigned char[m_usedSectorSize*s_bufferSizeSectors]; + while( s_bufferSizeSectors > 0 && read( buffer, m_firstSector.lba(), s_bufferSizeSectors ) < 0 ) { + kdDebug() << "(K3bDataTrackReader) determine max read sectors: " + << s_bufferSizeSectors << " too high." << endl; + s_bufferSizeSectors--; + } + kdDebug() << "(K3bDataTrackReader) determine max read sectors: " + << s_bufferSizeSectors << " is max." << endl; + + // s_bufferSizeSectors = K3bDevice::determineMaxReadingBufferSize( m_device, m_firstSector ); + if( s_bufferSizeSectors <= 0 ) { + emitInfoMessage( i18n("Error while reading sector %1.").arg(m_firstSector.lba()), K3bJob::ERROR ); + emitFinished(false); + m_device->block( false ); + k3bcore->unblockDevice( m_device ); + return; + } + + kdDebug() << "(K3bDataTrackReader) using buffer size of " << s_bufferSizeSectors << " blocks." << endl; + emitDebuggingOutput( "K3bDataTrackReader", QString("using buffer size of %1 blocks.").arg( s_bufferSizeSectors ) ); + + // 2. get it on + K3b::Msf currentSector = m_firstSector; + K3b::Msf totalReadSectors; + m_nextReadSector = 0; + m_errorSectorCount = 0; + bool writeError = false; + bool readError = false; + int lastPercent = 0; + unsigned long lastReadMb = 0; + int bufferLen = s_bufferSizeSectors*m_usedSectorSize; + while( !m_canceled && currentSector <= m_lastSector ) { + + int maxReadSectors = QMIN( bufferLen/m_usedSectorSize, m_lastSector.lba()-currentSector.lba()+1 ); + + int readSectors = read( buffer, + currentSector.lba(), + maxReadSectors ); + if( readSectors < 0 ) { + if( !retryRead( buffer, + currentSector.lba(), + maxReadSectors ) ) { + readError = true; + break; + } + else + readSectors = maxReadSectors; + } + + totalReadSectors += readSectors; + + int readBytes = readSectors * m_usedSectorSize; + + if( m_fd != -1 ) { + if( ::write( m_fd, reinterpret_cast(buffer), readBytes ) != readBytes ) { + kdDebug() << "(K3bDataTrackReader::WorkThread) error while writing to fd " << m_fd + << " current sector: " << (currentSector.lba()-m_firstSector.lba()) << endl; + emitDebuggingOutput( "K3bDataTrackReader", + QString("Error while writing to fd %1. Current sector is %2.") + .arg(m_fd).arg(currentSector.lba()-m_firstSector.lba()) ); + writeError = true; + break; + } + } + else { + if( file.writeBlock( reinterpret_cast(buffer), readBytes ) != readBytes ) { + kdDebug() << "(K3bDataTrackReader::WorkThread) error while writing to file " << m_imagePath + << " current sector: " << (currentSector.lba()-m_firstSector.lba()) << endl; + emitDebuggingOutput( "K3bDataTrackReader", + QString("Error while writing to file %1. Current sector is %2.") + .arg(m_imagePath).arg(currentSector.lba()-m_firstSector.lba()) ); + writeError = true; + break; + } + } + + currentSector += readSectors; + + int percent = 100 * (currentSector.lba() - m_firstSector.lba() + 1 ) / + (m_lastSector.lba() - m_firstSector.lba() + 1 ); + + if( percent > lastPercent ) { + lastPercent = percent; + emitPercent( percent ); + } + + unsigned long readMb = (currentSector.lba() - m_firstSector.lba() + 1) / 512; + if( readMb > lastReadMb ) { + lastReadMb = readMb; + emitProcessedSize( readMb, ( m_lastSector.lba() - m_firstSector.lba() + 1 ) / 512 ); + } + } + + if( m_errorSectorCount > 0 ) + emitInfoMessage( i18n("Ignored %n erroneous sector.", "Ignored a total of %n erroneous sectors.", m_errorSectorCount ), + K3bJob::ERROR ); + + // reset the error recovery mode + setErrorRecovery( m_device, m_oldErrorRecoveryMode ); + + m_device->block( false ); + k3bcore->unblockDevice( m_device ); + + // cleanup + if( m_useLibdvdcss ) + m_libcss->close(); + m_device->close(); + delete [] buffer; + + emitDebuggingOutput( "K3bDataTrackReader", + QString("Read a total of %1 sectors (%2 bytes)") + .arg(totalReadSectors.lba()) + .arg((Q_UINT64)totalReadSectors.lba()*(Q_UINT64)m_usedSectorSize) ); + + if( m_canceled ) + emitCanceled(); + + emitFinished( !m_canceled && !writeError && !readError ); +} + + +int K3bDataTrackReader::WorkThread::read( unsigned char* buffer, unsigned long sector, unsigned int len ) +{ + + // + // Encrypted DVD reading with libdvdcss + // + if( m_useLibdvdcss ) { + return m_libcss->readWrapped( reinterpret_cast(buffer), sector, len ); + } + + // + // Standard reading + // + else { + bool success = false; + // setErrorRecovery( m_device, m_ignoreReadErrors ? 0x21 : 0x20 ); + if( m_usedSectorSize == 2048 ) + success = m_device->read10( buffer, len*2048, sector, len ); + else + success = m_device->readCd( buffer, + len*m_usedSectorSize, + 0, // all sector types + false, // no dap + sector, + len, + false, // no sync + false, // no header + m_usedSectorSize != MODE1, // subheader + true, // user data + false, // no edc/ecc + 0, // no c2 error info... FIXME: should we check this?? + 0 // no subchannel data + ); + + if( success ) + return len; + else + return -1; + } +} + + +// here we read every single sector for itself to find the troubleing ones +bool K3bDataTrackReader::WorkThread::retryRead( unsigned char* buffer, unsigned long startSector, unsigned int len ) +{ + emitDebuggingOutput( "K3bDataTrackReader", QString( "Problem while reading. Retrying from sector %1.").arg(startSector) ); + emitInfoMessage( i18n("Problem while reading. Retrying from sector %1.").arg(startSector), K3bJob::WARNING ); + + int sectorsRead = -1; + bool success = true; + for( unsigned long sector = startSector; sector < startSector+len; ++sector ) { + int retry = m_retries; + while( !m_canceled && retry && (sectorsRead = read( &buffer[( sector - startSector ) * m_usedSectorSize], sector, 1 )) < 0 ) + --retry; + + success = ( sectorsRead > 0 ); + + if( m_canceled ) + return false; + + if( !success ) { + if( m_ignoreReadErrors ) { + emitInfoMessage( i18n("Ignoring read error in sector %1.").arg(sector), K3bJob::ERROR ); + emitDebuggingOutput( "K3bDataTrackReader", QString( "Ignoring read error in sector %1.").arg(sector) ); + + ++m_errorSectorCount; + // ::memset( &buffer[i], 0, 1 ); + success = true; + } + else { + emitInfoMessage( i18n("Error while reading sector %1.").arg(sector), K3bJob::ERROR ); + emitDebuggingOutput( "K3bDataTrackReader", QString( "Read error in sector %1.").arg(sector) ); + break; + } + } + } + + return success; +} + + +bool K3bDataTrackReader::WorkThread::setErrorRecovery( K3bDevice::Device* dev, int code ) +{ + unsigned char* data = 0; + unsigned int dataLen = 0; + if( !dev->modeSense( &data, dataLen, 0x01 ) ) + return false; + + // in MMC1 the page has 8 bytes (12 in MMC4 but we only need the first 3 anyway) + if( dataLen < 8+8 ) { + kdDebug() << "(K3bDataTrackReader) modepage 0x01 data too small: " << dataLen << endl; + delete [] data; + return false; + } + + m_oldErrorRecoveryMode = data[8+2]; + data[8+2] = code; + + if( m_oldErrorRecoveryMode != code ) + kdDebug() << "(K3bDataTrackReader) changing data recovery mode from " << m_oldErrorRecoveryMode << " to " << code << endl; + + bool success = dev->modeSelect( data, dataLen, true, false ); + + delete [] data; + + return success; +} + + +void K3bDataTrackReader::WorkThread::cancel() +{ + m_canceled = true; +} + + + + + +K3bDataTrackReader::~K3bDataTrackReader() +{ + delete m_thread; +} + + +void K3bDataTrackReader::setDevice( K3bDevice::Device* dev ) +{ + m_thread->m_device = dev; +} + + +void K3bDataTrackReader::setSectorRange( const K3b::Msf& start, const K3b::Msf& end ) +{ + m_thread->m_firstSector = start; + m_thread->m_lastSector = end; +} + + +void K3bDataTrackReader::setRetries( int r ) +{ + m_thread->m_retries = r; +} + + +void K3bDataTrackReader::setIgnoreErrors( bool b ) +{ + m_thread->m_ignoreReadErrors = b; +} + + +void K3bDataTrackReader::setNoCorrection( bool b ) +{ + m_thread->m_noCorrection = b; +} + + +void K3bDataTrackReader::writeToFd( int fd ) +{ + m_thread->m_fd = fd; +} + + +void K3bDataTrackReader::setImagePath( const QString& p ) +{ + m_thread->m_imagePath = p; + m_thread->m_fd = -1; +} + + +void K3bDataTrackReader::setSectorSize( SectorSize size ) +{ + m_thread->m_sectorSize = size; +} diff --git a/libk3b/jobs/k3bdatatrackreader.h b/libk3b/jobs/k3bdatatrackreader.h new file mode 100644 index 0000000..814c01c --- /dev/null +++ b/libk3b/jobs/k3bdatatrackreader.h @@ -0,0 +1,87 @@ +/* + * + * $Id: k3bdatatrackreader.h 619556 2007-01-03 17:38:12Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef _K3B_DATATRACK_READER_H_ +#define _K3B_DATATRACK_READER_H_ + + +#include +#include +#include + +namespace K3bDevice { + class Device; +} + + +/** + * This is a replacement for readcd. We need this since + * it is not possible to influence the sector size used + * by readcd and readcd is not very good to handle anyway. + * + * The sector size read is the following: + * @li Mode1: 2048 bytes (only user data) + * @li Mode2 Form1: 2056 bytes containing the subheader and the user data + * @li Mode2 Form2: 2332 bytes containing the subheader and the user data + * + * Formless Mode2 sectors will not be read. + */ +class K3bDataTrackReader : public K3bThreadJob +{ + public: + K3bDataTrackReader( K3bJobHandler*, QObject* parent = 0, const char* name = 0 ); + ~K3bDataTrackReader(); + + enum SectorSize { + AUTO = 0, + MODE1 = K3b::SECTORSIZE_DATA_2048, + MODE2FORM1 = K3b::SECTORSIZE_DATA_2048_SUBHEADER, + MODE2FORM2 = K3b::SECTORSIZE_DATA_2324_SUBHEADER + }; + + void setSectorSize( SectorSize size ); + + void setDevice( K3bDevice::Device* ); + + /** + * @param start the first sector to be read + * @end the last sector to be read + */ + void setSectorRange( const K3b::Msf& start, const K3b::Msf& end ); + void setRetries( int ); + + /** + * If true unreadable sectors will be replaced by zero data to always + * maintain the track length. + */ + void setIgnoreErrors( bool b ); + + void setNoCorrection( bool b ); + + /** + * the data gets written directly into fd instead of the imagefile. + * Be aware that this only makes sense before starting the job. + * To disable just set fd to -1 + */ + void writeToFd( int fd ); + + void setImagePath( const QString& p ); + + private: + class WorkThread; + WorkThread* m_thread; +}; + +#endif diff --git a/libk3b/jobs/k3bdvdcopyjob.cpp b/libk3b/jobs/k3bdvdcopyjob.cpp new file mode 100644 index 0000000..96d727c --- /dev/null +++ b/libk3b/jobs/k3bdvdcopyjob.cpp @@ -0,0 +1,894 @@ +/* + * + * $Id: k3bdvdcopyjob.cpp 690529 2007-07-21 10:51:47Z trueg $ + * Copyright (C) 2003 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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. + * See the file "COPYING" for the exact licensing terms. + */ + +#include "k3bdvdcopyjob.h" +#include "k3blibdvdcss.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + + +class K3bDvdCopyJob::Private +{ +public: + Private() + : doneCopies(0), + running(false), + canceled(false), + writerJob(0), + readcdReader(0), + dataTrackReader(0), + verificationJob(0), + usedWritingMode(0), + verifyData(false) { + outPipe.readFromIODevice( &imageFile ); + } + + int doneCopies; + + bool running; + bool readerRunning; + bool writerRunning; + bool canceled; + + K3bGrowisofsWriter* writerJob; + K3bReadcdReader* readcdReader; + K3bDataTrackReader* dataTrackReader; + K3bVerificationJob* verificationJob; + + K3bDevice::DiskInfo sourceDiskInfo; + + K3b::Msf lastSector; + + int usedWritingMode; + + K3bFileSplitter imageFile; + K3bChecksumPipe inPipe; + K3bActivePipe outPipe; + + bool verifyData; +}; + + +K3bDvdCopyJob::K3bDvdCopyJob( K3bJobHandler* hdl, QObject* parent, const char* name ) + : K3bBurnJob( hdl, parent, name ), + m_writerDevice(0), + m_readerDevice(0), + m_onTheFly(false), + m_removeImageFiles(false), + m_simulate(false), + m_speed(1), + m_copies(1), + m_onlyCreateImage(false), + m_ignoreReadErrors(false), + m_readRetries(128), + m_writingMode( K3b::WRITING_MODE_AUTO ) +{ + d = new Private(); +} + + +K3bDvdCopyJob::~K3bDvdCopyJob() +{ + delete d; +} + + +void K3bDvdCopyJob::start() +{ + jobStarted(); + emit burning(false); + + d->canceled = false; + d->running = true; + d->readerRunning = d->writerRunning = false; + + emit newTask( i18n("Checking Source Medium") ); + + if( m_onTheFly && + k3bcore->externalBinManager()->binObject( "growisofs" )->version < K3bVersion( 5, 12 ) ) { + m_onTheFly = false; + emit infoMessage( i18n("K3b does not support writing on-the-fly with growisofs %1.") + .arg(k3bcore->externalBinManager()->binObject( "growisofs" )->version), ERROR ); + emit infoMessage( i18n("Disabling on-the-fly writing."), INFO ); + } + + emit newSubTask( i18n("Waiting for source medium") ); + + // wait for a source disk + if( waitForMedia( m_readerDevice, + K3bDevice::STATE_COMPLETE|K3bDevice::STATE_INCOMPLETE, + K3bDevice::MEDIA_WRITABLE_DVD|K3bDevice::MEDIA_DVD_ROM ) < 0 ) { + emit canceled(); + d->running = false; + jobFinished( false ); + return; + } + + emit newSubTask( i18n("Checking source medium") ); + + connect( K3bDevice::sendCommand( K3bDevice::DeviceHandler::DISKINFO, m_readerDevice ), + SIGNAL(finished(K3bDevice::DeviceHandler*)), + this, + SLOT(slotDiskInfoReady(K3bDevice::DeviceHandler*)) ); +} + + +void K3bDvdCopyJob::slotDiskInfoReady( K3bDevice::DeviceHandler* dh ) +{ + if( d->canceled ) { + emit canceled(); + jobFinished(false); + d->running = false; + } + + d->sourceDiskInfo = dh->diskInfo(); + + if( dh->diskInfo().empty() || dh->diskInfo().diskState() == K3bDevice::STATE_NO_MEDIA ) { + emit infoMessage( i18n("No source medium found."), ERROR ); + jobFinished(false); + d->running = false; + } + else { + if( m_readerDevice->copyrightProtectionSystemType() == 1 ) { + emit infoMessage( i18n("Found encrypted DVD."), WARNING ); + // check for libdvdcss + bool haveLibdvdcss = false; + kdDebug() << "(K3bDvdCopyJob) trying to open libdvdcss." << endl; + if( K3bLibDvdCss* libcss = K3bLibDvdCss::create() ) { + kdDebug() << "(K3bDvdCopyJob) succeeded." << endl; + kdDebug() << "(K3bDvdCopyJob) dvdcss_open(" << m_readerDevice->blockDeviceName() << ") = " + << libcss->open(m_readerDevice) << endl; + haveLibdvdcss = true; + + delete libcss; + } + else + kdDebug() << "(K3bDvdCopyJob) failed." << endl; + + if( !haveLibdvdcss ) { + emit infoMessage( i18n("Cannot copy encrypted DVDs."), ERROR ); + d->running = false; + jobFinished( false ); + return; + } + } + + + // + // We cannot rely on the kernel to determine the size of the DVD for some reason + // On the other hand it is not always a good idea to rely on the size from the ISO9660 + // header since that may be wrong due to some buggy encoder or some boot code appended + // after creating the image. + // That is why we try our best to determine the size of the DVD. For DVD-ROM this is very + // easy since it has only one track. The same goes for single session DVD-R(W) and DVD+R. + // Multisession DVDs we will simply not copy. ;) + // For DVD+RW and DVD-RW in restricted overwrite mode we are left with no other choice but + // to use the ISO9660 header. + // + // On the other hand: in on-the-fly mode growisofs determines the size of the data to be written + // by looking at the ISO9660 header when writing in DAO mode. So in this case + // it would be best for us to do the same.... + // + // With growisofs 5.15 we have the option to specify the size of the image to be written in DAO mode. + // + + switch( dh->diskInfo().mediaType() ) { + case K3bDevice::MEDIA_DVD_ROM: + case K3bDevice::MEDIA_DVD_PLUS_R_DL: + case K3bDevice::MEDIA_DVD_R_DL: + case K3bDevice::MEDIA_DVD_R_DL_SEQ: + case K3bDevice::MEDIA_DVD_R_DL_JUMP: + if( !m_onlyCreateImage ) { + if( dh->diskInfo().numLayers() > 1 && + dh->diskInfo().size().mode1Bytes() > 4700372992LL ) { + if( !(m_writerDevice->type() & (K3bDevice::DEVICE_DVD_R_DL|K3bDevice::DEVICE_DVD_PLUS_R_DL)) ) { + emit infoMessage( i18n("The writer does not support writing Double Layer DVD."), ERROR ); + d->running = false; + jobFinished(false); + return; + } + // FIXME: check for growisofs 5.22 (or whatever version is needed) for DVD-R DL + else if( k3bcore->externalBinManager()->binObject( "growisofs" ) && + k3bcore->externalBinManager()->binObject( "growisofs" )->version < K3bVersion( 5, 20 ) ) { + emit infoMessage( i18n("Growisofs >= 5.20 is needed to write Double Layer DVD+R."), ERROR ); + d->running = false; + jobFinished(false); + return; + } + } + } + case K3bDevice::MEDIA_DVD_R: + case K3bDevice::MEDIA_DVD_R_SEQ: + case K3bDevice::MEDIA_DVD_RW: + case K3bDevice::MEDIA_DVD_RW_SEQ: + case K3bDevice::MEDIA_DVD_PLUS_R: + + if( dh->diskInfo().numSessions() > 1 ) { + emit infoMessage( i18n("K3b does not support copying multi-session DVDs."), ERROR ); + d->running = false; + jobFinished(false); + return; + } + + // growisofs only uses the size from the PVD for reserving + // writable space in DAO mode + // with version >= 5.15 growisofs supports specifying the size of the track + if( m_writingMode != K3b::DAO || !m_onTheFly || m_onlyCreateImage || + ( k3bcore->externalBinManager()->binObject( "growisofs" ) && + k3bcore->externalBinManager()->binObject( "growisofs" )->version >= K3bVersion( 5, 15, -1 ) ) ) { + d->lastSector = dh->toc().lastSector(); + break; + } + + // fallthrough + + case K3bDevice::MEDIA_DVD_PLUS_RW: + case K3bDevice::MEDIA_DVD_RW_OVWR: + { + emit infoMessage( i18n("K3b relies on the size saved in the ISO9660 header."), WARNING ); + emit infoMessage( i18n("This might result in a corrupt copy if the source was mastered with buggy software."), WARNING ); + + K3bIso9660 isoF( m_readerDevice, 0 ); + if( isoF.open() ) { + d->lastSector = ((long long)isoF.primaryDescriptor().logicalBlockSize*isoF.primaryDescriptor().volumeSpaceSize)/2048LL - 1; + } + else { + emit infoMessage( i18n("Unable to determine the ISO9660 filesystem size."), ERROR ); + jobFinished(false); + d->running = false; + return; + } + } + break; + + case K3bDevice::MEDIA_DVD_RAM: + emit infoMessage( i18n("K3b does not support copying DVD-