--- /dev/null
+Till Kamppeter, OpenPrinting/Canonical (till.kamppeter@gmail.com)
+Michael Sweet, Apple (msweet@apple.com)
+Koji Otani, BBR Inc. (sho@bbr.jp)
+Tobias Hoffmann (th55@gmx.de)
+Lars Uebernickel, Canonical (lars@uebernic.de)
+Robert Sander (robert.sander@epigenomics.com)
+Tim Waugh (twaugh@redhat.com)
+Tomáš Chvátal (tomas.chvatal@gmail.com)
+Franz Pförtsch (Franz.Pfoertsch@brose.com)
+Neil 'Superna' Armstrong (superna9999@gmail.com)
--- /dev/null
+
+ OpenPrinting CUPS Filters License Agreements
+ ============================================
+
+
+Copyright 1993-2007 Easy Software Products
+Copyright 2007-2011 Apple Inc.
+Copyright 2012 Canonical Ltd.
+Copyright 2006-2012 BBR Inc.
+Copyright 2008-2012 Till Kamppeter
+Copyright 2008,2012 Tobias Hoffmann
+Copyright 2003 Robert Sander
+Copyright 2003-2006 Red Hat, Inc.
+Copyright 2003-2006 Tim Waugh
+Copyright 2012 Franz Pförtsch
+Copyright 2012 Tomáš Chvátal
+Copyright 2010 Neil 'Superna' Armstrong
+
+
+The filters and backends which were part of CUPS formerly
+(commandtoescpx, commandtopclx, imagetoraster, pdftops, rastertoescpx,
+rastertopclx, parallel, serial) and also imagetopdf, pstopdf, and
+texttopdf and all their auxiliary files are provided under the terms
+of version 2 of the GNU General Public License. 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.
+
+The libcupsfilters library is provided under the terms of version 2 of
+the GNU Library General Public License. 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.
+
+The libfontembed library is provided under the terms of the MIT license.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+The filter textonly and its PPD file textonly.ppd and also the filters
+texttops and imagetops are provided under the terms of version 2 of
+the GNU General Public 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.
+
+The filter bannertopdf and all their auxiliary files is provided under
+the terms of version 3 of the GNU General Public License. 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.
+
+The filter urftopdf and all their auxiliary files is provided under
+the terms of version 3 of the GNU General Public License, or 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.
+
+The filters pdftoijs, pdftoopvp, pdftopdf, and pdftoraster and all
+their auxiliary files and also libfontembed in the filter/fontembed
+subdirectory (used by texttopdf) are also free software and are
+published under MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
+trademarks of Apple Inc.
+
+The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+
+This software is based in part on the work of the Independent JPEG
+Group.
+
+
+CUPS TRADEMARKS
+---------------
+
+CUPS and the CUPS logo (the "CUPS Marks") are trademarks of Apple
+Inc. Apple grants you a non-exclusive and non-transferable right
+to use the CUPS Marks in any direct port or binary distribution
+incorporating CUPS software and in any promotional material
+therefor. You agree that your products will meet the highest
+levels of quality and integrity for similar goods, not be unlawful,
+and be developed, manufactured, and distributed in compliance with
+this license. You will not interfere with Apple's rights in the
+CUPS Marks, and all use of the CUPS Marks shall inure to the
+benefit of Apple. This license does not apply to use of the CUPS
+Marks in a derivative products, which requires prior written
+permission from Apple Inc.
+
+
+GNU GPL and LGPL
+----------------
+
+For those not familiar with the GNU GPL, the license basically
+allows you to:
+
+ - Use the software at no charge.
+ - Distribute verbatim copies of the software in source or
+ binary form.
+ - Sell verbatim copies of the software for a media fee, or
+ sell support for the software.
+
+What this license *does not* allow you to do is make changes or add
+features to the software and then sell a binary distribution without
+source code. You must provide source for any changes or additions to
+the software, and all code must be provided under the GPL or LGPL as
+appropriate. The only exceptions to this are the portions of the CUPS
+software covered by the Apple operating system license exceptions
+outlined later in this license agreement.
+
+The GNU LGPL relaxes the "link-to" restriction, allowing you to
+develop applications that use the CUPS and CUPS Imaging libraries
+under other licenses and/or conditions as appropriate for your
+application, driver, or filter.
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+ 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.)
+\f
+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.
+\f
+ 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.
+\f
+ 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
+\f
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+\f
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ [This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+\f
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+\f
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null
+INSTALL - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+--------------------------------------------------------
+
+This file describes how to compile and install OpenPrinting CUPS
+Filters from source code. For more information on OpenPrinting CUPS
+Filters see the file called "README.txt". A complete change log can
+be found in "CHANGES.txt".
+
+**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
+**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
+**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
+**** CUPS AND BEFORE YOU INSTALL THIS PACKAGE. ****
+
+
+BEFORE YOU BEGIN
+
+ You'll need ANSI-compliant C and C++ compilers, plus a make program and
+ POSIX-compliant shell (/bin/sh). The GNU compiler tools and Bash work well
+ and we have tested the current CUPS code against several versions of GCC
+ with excellent results.
+
+ The makefiles used by the project should work with most versions of make.
+ We've tested them with GNU make as well as the make programs shipped by
+ Compaq, HP, SGI, and Sun. BSD users should use GNU make (gmake) since BSD
+ make does not support "include".
+
+ Poppler, libijs, freetype, fontconfig, and liblcms (liblcms2 recommended)
+ must be installed to be able to compile this package.
+
+ Besides these tools you'll want the JPEG, PNG, TIFF, ZLIB libraries for
+ image support. CUPS Filters will compile and run without these, however
+ you'll miss out on many of the features provided by CUPS Filters.
+
+
+COMPILING THE BZR REPOSITORY CODE
+
+ The CUPS Filters BZR repository doesn't hold a copy of the pre-built
+ configure script. You'll need to run the GNU autoconf software (2.65 or
+ higher) to create it:
+
+ ./autogen.sh
+
+
+CONFIGURATION
+
+ CUPS Filters uses GNU autoconf, so you should find the usual "configure"
+ script in the main CUPS Filters source directory. To configure CUPS
+ Filters for your system, type:
+
+ ./configure
+
+ The default installation will put the CUPS Filters software in the
+ "/etc" and "/usr" directories on your system, which will overwrite
+ some of the original filters and their auxiliary files of CUPS
+ 1.5.x or earlier and the auxiliary files of bannertops in all CUPS
+ versions including version 1.6.x (see also the section "PACKAGING
+ THE SOFTWARE FOR OPERATING SYSTEM DISTRIBUTIONS" below). The
+ system will still have the same functionality as before, but CUPS
+ will not convert all incoming files into PostScript any more, it
+ will convert them into PDF instead and after applying page
+ management (N-up, selected pages, reverse order, ...) by the
+ pdftopdf filter and convert PDF into the printer's native format
+ then (PDF-based printing workflow). CUPS 1.6.x or later does not
+ contain any filters which this package provides. It requires the
+ installation of this package for printing with filters and drivers
+ under Linux (or other non-Mac-OS-X operation systems).
+
+ Use the "--prefix" option to install the CUPS Filters software in another
+ location:
+
+ ./configure --prefix=/some/directory
+
+ To see a complete list of configuration options, use the --help option:
+
+ ./configure --help
+
+ If any of the dependent libraries are not installed in a system default
+ location (typically "/usr/include" and "/usr/lib") you'll need to set the
+ CFLAGS, CPPFLAGS, CXXFLAGS, DSOFLAGS, and LDFLAGS environment variables
+ prior to running configure:
+
+ setenv CFLAGS "-I/some/directory"
+ setenv CPPFLAGS "-I/some/directory"
+ setenv CXXFLAGS "-I/some/directory"
+ setenv DSOFLAGS "-L/some/directory"
+ setenv LDFLAGS "-L/some/directory"
+ ./configure ...
+
+ or:
+
+ CFLAGS="-I/some/directory" \
+ CPPFLAGS="-I/some/directory" \
+ CXXFLAGS="-I/some/directory" \
+ DSOFLAGS="-L/some/directory" \
+ LDFLAGS="-L/some/directory" \
+ ./configure ...
+
+ Once you have configured things, just type:
+
+ make ENTER
+
+ or if you have FreeBSD, NetBSD, or OpenBSD type:
+
+ gmake ENTER
+
+ to build the software.
+
+
+INSTALLING THE SOFTWARE
+
+ Once you have built the software you need to install it. The "install"
+ target provides a quick way to install the software on your local system:
+
+ make install ENTER
+
+ or for FreeBSD, NetBSD, or OpenBSD:
+
+ gmake install ENTER
+
+PACKAGING THE SOFTWARE FOR OPERATING SYSTEM DISTRIBUTIONS
+
+ The use of cups-filters is supported for CUPS from version 1.5.x
+ on (to switch to the PDF-based printing workflow already now) and
+ required for CUPS 1.6.x (as it does not ship a complete filter set
+ any more). In both cases cups-filters ships some files which exist
+ also in CUPS, but the versions of cups-filters have to be used to
+ assure that printing works correctly. So in the packaging of CUPS
+ the files should be removed.
+
+ Use the alternatives facility (see update-alternatives(8)) only if
+ your CUPS version is 1.5.x and you want to make the use of
+ cups-filters optional. Note that then the files of cups-filters
+ need to have priority.
+
+ When using cups-filters with CUPS 1.5.x, many of the original CUPS
+ filters get replaced or at least useless. Please remove the
+ following files from your CUPS package:
+
+ /usr/lib/cups/backend/serial
+ /usr/lib/cups/backend/parallel
+ /usr/lib/cups/filter/bannertops
+ /usr/lib/cups/filter/commandtoescpx
+ /usr/lib/cups/filter/commandtopclx
+ /usr/lib/cups/filter/imagetops
+ /usr/lib/cups/filter/imagetoraster
+ /usr/lib/cups/filter/pdftops
+ /usr/lib/cups/filter/rastertoescpx
+ /usr/lib/cups/filter/rastertopclx
+ /usr/lib/cups/filter/texttops
+ /usr/share/cups/banners/*
+ /usr/share/cups/data/testprint
+ /usr/share/cups/data/psglyphs
+ /usr/share/cups/fonts/*
+
+ Also comment out all conversion rules which use any of the removed
+ filters. You can do it with the following command line:
+
+ perl -p -i -e 's:^(.*\s+(pdftops|texttops|imagetops|bannertops|imagetoraster)\s*)$:#\1:' /usr/share/cups/mime/mime.convs
+
+ If you use CUPS 1.6.x there is less to remove from the CUPS
+ package. It is only bannertops and its auxiliary files which are
+ in the way for bannertopdf:
+
+ /usr/lib/cups/filter/bannertops
+ /usr/share/cups/banners/*
+ /usr/share/cups/data/testprint
+
+ The conversion rules get commented out via:
+
+ perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' /usr/share/cups/mime/mime.convs
+
+ For CUPS 1.6.x a bug report/feature request is posted to ask for
+ (at least optional) removal of bannertops:
+
+ http://www.cups.org/str.php?L4120
--- /dev/null
+ACLOCAL_AMFLAGS = -I m4
+
+pkgconfdir = $(libdir)/pkgconfig
+pkgconf_DATA = \
+ libcupsfilters.pc \
+ libfontembed.pc
+
+doc_DATA = \
+ AUTHORS \
+ COPYING \
+ NEWS \
+ INSTALL \
+ README
+
+EXTRA_DIST = \
+ $(doc_DATA) \
+ autogen.sh \
+ libcupsfilters.pc.in \
+ libfontembed.pc.in
+
+# ========
+# Backends
+# ========
+pkgbackenddir = $(CUPS_SERVERBIN)/backend
+pkgbackend_PROGRAMS = parallel serial
+
+check_PROGRAMS = test1284
+# We need ieee1284 up and running.
+# Leave it to the user to run if they have the bus.
+#TESTS = test1284
+
+parallel_SOURCES = \
+ backend/backend-private.h \
+ backend/ieee1284.c \
+ backend/parallel.c
+parallel_LDADD = $(CUPS_LIBS)
+parallel_CFLAGS = $(CUPS_CFLAGS)
+
+serial_SOURCES = \
+ backend/backend-private.h \
+ backend/serial.c
+serial_LDADD = $(CUPS_LIBS)
+serial_CFLAGS = $(CUPS_CFLAGS)
+
+test1284_SOURCES = \
+ backend/backend-private.h \
+ backend/ieee1284.c \
+ backend/test1284.c
+test1284_LDADD = $(CUPS_LIBS)
+test1284_CFLAGS = $(CUPS_CFLAGS)
+
+# ====================
+# CUPS Filters library
+# ====================
+pkgfiltersincludedir = $(includedir)/cupsfilters
+pkgfiltersinclude_DATA = \
+ cupsfilters/driver.h \
+ cupsfilters/image.h
+
+lib_LTLIBRARIES = libcupsfilters.la
+
+check_PROGRAMS += \
+ testcmyk \
+ testdither \
+ testimage \
+ testrgb
+TESTS = \
+ testdither
+# testcmyk # fails as it opens some image.ppm which is nowerhe to be found.
+# testimage # requires also some ppm file as argument
+# testrgb # same error
+# FIXME: run old testdither
+# ./testdither > test/0-255.pgm 2>test/0-255.log
+# ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log
+# ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log
+# ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log
+# ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log
+# ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log
+# ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log
+# ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log
+
+
+libcupsfilters_la_SOURCES = \
+ cupsfilters/attr.c \
+ cupsfilters/check.c \
+ cupsfilters/cmyk.c \
+ cupsfilters/dither.c \
+ cupsfilters/image.c \
+ cupsfilters/image-bmp.c \
+ cupsfilters/image-colorspace.c \
+ cupsfilters/image-gif.c \
+ cupsfilters/image-jpeg.c \
+ cupsfilters/image-photocd.c \
+ cupsfilters/image-pix.c \
+ cupsfilters/image-png.c \
+ cupsfilters/image-pnm.c \
+ cupsfilters/image-private.h \
+ cupsfilters/image-sgi.c \
+ cupsfilters/image-sgi.h \
+ cupsfilters/image-sgilib.c \
+ cupsfilters/image-sun.c \
+ cupsfilters/image-tiff.c \
+ cupsfilters/image-zoom.c \
+ cupsfilters/lut.c \
+ cupsfilters/pack.c \
+ cupsfilters/rgb.c \
+ cupsfilters/srgb.c \
+ $(pkgfiltersinclude_DATA)
+libcupsfilters_la_LIBADD = \
+ $(CUPS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ -lm
+libcupsfilters_la_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS)
+
+libcupsfilters_la_LDFLAGS = \
+ -no-undefined \
+ -version-info 1
+
+testcmyk_SOURCES = \
+ cupsfilters/testcmyk.c \
+ $(pkgfiltersinclude_DATA)
+testcmyk_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+testdither_SOURCES = \
+ cupsfilters/testdither.c \
+ $(pkgfiltersinclude_DATA)
+testdither_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+testimage_SOURCES = \
+ cupsfilters/testimage.c \
+ $(pkgfiltersinclude_DATA)
+testimage_LDADD = \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la \
+ -lm
+testimage_CFLAGS = \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS)
+
+testrgb_SOURCES = \
+ cupsfilters/testrgb.c \
+ $(pkgfiltersinclude_DATA)
+testrgb_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+EXTRA_DIST += \
+ $(pkgfiltersinclude_DATA) \
+ cupsfilters/image.pgm \
+ cupsfilters/image.ppm
+
+# =====
+# MIMEs
+# =====
+pkgmimedir = $(CUPS_DATADIR)/mime
+pkgmime_DATA = \
+ mime/cupsfilters.convs \
+ mime/cupsfilters.types
+
+EXTRA_DIST += $(pkgmime_DATA)
+
+# =================
+# Fontembed library
+# =================
+pkgfontembedincludedir = $(includedir)/fontembed
+pkgfontembedinclude_DATA = \
+ fontembed/bitset.h \
+ fontembed/embed.h \
+ fontembed/fontfile.h \
+ fontembed/iofn.h \
+ fontembed/sfnt.h
+
+lib_LTLIBRARIES += libfontembed.la
+
+bin_PROGRAMS = ttfread
+
+check_PROGRAMS += \
+ test_analyze \
+ test_pdf \
+ test_ps
+TESTS += \
+ test_analyze \
+ test_pdf \
+ test_ps
+
+libfontembed_la_SOURCES = \
+ fontembed/aglfn13.c \
+ fontembed/bitset.h \
+ fontembed/dynstring.c \
+ fontembed/dynstring.h \
+ fontembed/embed.c \
+ fontembed/embed.h \
+ fontembed/embed_sfnt.c \
+ fontembed/embed_sfnt_int.h \
+ fontembed/embed_pdf.c \
+ fontembed/embed_pdf.h \
+ fontembed/embed_pdf_int.h \
+ fontembed/fontfile.c \
+ fontembed/fontfile.h \
+ fontembed/frequent.c \
+ fontembed/frequent.h \
+ fontembed/iofn.h \
+ fontembed/macroman.h \
+ fontembed/sfnt.c \
+ fontembed/sfnt.h \
+ fontembed/sfnt_int.h \
+ fontembed/sfnt_subset.c
+libfontembed_la_LDFLAGS = \
+ -no-undefined \
+ -version-info 1
+
+ttfread_SOURCES = fontembed/main.c
+ttfread_LDADD = libfontembed.la
+
+test_analyze_SOURCES = fontembed/test_analyze.c
+test_analyze_LDADD = libfontembed.la
+
+test_pdf_SOURCES = fontembed/test_pdf.c
+test_pdf_LDADD = libfontembed.la
+
+test_ps_SOURCES = fontembed/test_ps.c
+test_ps_LDADD = libfontembed.la
+
+EXTRA_DIST += \
+ $(pkgfontembedinclude_DATA) \
+ fontembed/README
+
+# ===========
+# PDF to OPVP
+# ===========
+pkgfilterdir = $(CUPS_SERVERBIN)/filter
+pkgfilter_PROGRAMS = pdftoopvp
+
+pkgfontconfigdir = $(sysconfdir)/$(FONTDIR)
+pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf
+
+pdftoopvp_SOURCES = \
+ filter/pdftoopvp/oprs/OPRS.cxx \
+ filter/pdftoopvp/oprs/OPRS.h \
+ filter/pdftoopvp/oprs/OPVPSplashClip.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashClip.h \
+ filter/pdftoopvp/oprs/OPVPSplash.cxx \
+ filter/pdftoopvp/oprs/OPVPSplash.h \
+ filter/pdftoopvp/oprs/OPVPSplashPath.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashPath.h \
+ filter/pdftoopvp/oprs/OPVPSplashState.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashState.h \
+ filter/pdftoopvp/oprs/OPVPSplashXPath.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashXPath.h \
+ filter/pdftoopvp/oprs/OPVPWrapper.cxx \
+ filter/pdftoopvp/oprs/OPVPWrapper.h \
+ filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx \
+ filter/pdftoopvp/oprs/OPVPWrapper_0_2.h \
+ filter/pdftoopvp/OPVPError.h \
+ filter/pdftoopvp/opvp/opvp_common.h \
+ filter/pdftoopvp/opvp/opvp.h \
+ filter/pdftoopvp/opvp/opvp_0_2_0.h \
+ filter/pdftoopvp/OPVPOutputDev.cxx \
+ filter/pdftoopvp/OPVPOutputDev.h \
+ filter/pdftoopvp/pdftoopvp.cxx
+pdftoopvp_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(FREETYPE_CFLAGS) \
+ $(FONTCONFIG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(POPPLER_CFLAGS) \
+ -I$(srcdir)/filter/pdftoopvp/oprs \
+ -I$(srcdir)/filter/pdftoopvp/opvp
+pdftoopvp_CXXFLAGS = $(pdftoopvp_CFLAGS)
+pdftoopvp_LDADD = \
+ $(CUPS_LIBS) \
+ $(FREETYPE_LIBS) \
+ $(FONTCONFIG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(POPPLER_LIBS)
+ $(DLOPEN_LIBS)
+
+EXTRA_DIST += $(pkgfontconfig_DATA)
+
+# ==========
+# PDF to PDF
+# ==========
+pkgfilter_PROGRAMS += pdftopdf
+
+pdftopdf_SOURCES = \
+ filter/pdftopdf/pdftopdf.cc \
+ filter/pdftopdf/pdftopdf_jcl.cc \
+ filter/pdftopdf/pdftopdf_jcl.h \
+ filter/pdftopdf/pdftopdf_processor.cc \
+ filter/pdftopdf/pdftopdf_processor.h \
+ filter/pdftopdf/qpdf_pdftopdf_processor.cc \
+ filter/pdftopdf/qpdf_pdftopdf_processor.h \
+ filter/pdftopdf/pptypes.cc \
+ filter/pdftopdf/pptypes.h \
+ filter/pdftopdf/nup.cc \
+ filter/pdftopdf/nup.h \
+ filter/pdftopdf/intervalset.cc \
+ filter/pdftopdf/intervalset.h \
+ filter/pdftopdf/qpdf_tools.cc \
+ filter/pdftopdf/qpdf_tools.h \
+ filter/pdftopdf/qpdf_xobject.cc \
+ filter/pdftopdf/qpdf_xobject.h \
+ filter/pdftopdf/qpdf_pdftopdf.cc \
+ filter/pdftopdf/qpdf_pdftopdf.h \
+ filter/pdftopdf/qpdf_cm.cc \
+ filter/pdftopdf/qpdf_cm.h
+pdftopdf_CFLAGS = \
+ $(LIBQPDF_CFLAGS) \
+ $(CUPS_CFLAGS)
+pdftopdf_CXXFLAGS = -std=c++0x $(pdftopdf_CFLAGS) # -std=c++11
+pdftopdf_LDADD = \
+ $(LIBQPDF_LIBS) \
+ $(CUPS_LIBS)
+
+# ======================
+# Simple filter binaries
+# ======================
+pkgfilter_SCRIPTS = \
+ filter/imagetops \
+ filter/pstopdf \
+ filter/textonly \
+ filter/texttops
+pkgfilter_PROGRAMS += \
+ commandtoescpx \
+ commandtopclx \
+ pdftoijs \
+ pdftops \
+ pdftoraster \
+ rastertoescpx \
+ rastertopclx \
+ texttopdf
+if ENABLE_IMAGEFILTERS
+pkgfilter_PROGRAMS += \
+ imagetopdf \
+ imagetoraster
+endif
+
+check_PROGRAMS += \
+ test_pdf1 \
+ test_pdf2
+
+TESTS += \
+ test_pdf1 \
+ test_pdf2
+
+commandtoescpx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/commandtoescpx.c \
+ filter/pcl.h
+commandtoescpx_CFLAGS= \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+commandtoescpx_LDADD = $(CUPS_LIBS)
+
+commandtopclx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/commandtopclx.c \
+ filter/pcl.h
+commandtopclx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+commandtopclx_LDADD = $(CUPS_LIBS)
+
+imagetopdf_SOURCES = \
+ cupsfilters/image.h \
+ filter/common.c \
+ filter/common.h \
+ filter/imagetopdf.c
+imagetopdf_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+imagetopdf_LDADD = \
+ $(CUPS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la
+
+imagetoraster_SOURCES = \
+ cupsfilters/image.h \
+ cupsfilters/image-private.h \
+ filter/common.c \
+ filter/common.h \
+ filter/imagetoraster.c
+imagetoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+imagetoraster_LDADD = \
+ $(CUPS_LIBS) \
+ libcupsfilters.la
+
+pdftoijs_SOURCES = \
+ filter/pdftoijs.cxx \
+ filter/PDFError.h
+pdftoijs_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(IJS_CFLAGS) \
+ $(POPPLER_CFLAGS)
+pdftoijs_CXXFLAGS = $(pdftoijs_CFLAGS)
+pdftoijs_LDADD = \
+ $(CUPS_LIBS) \
+ $(IJS_LIBS) \
+ $(POPPLER_LIBS)
+
+pdftops_SOURCES = \
+ filter/common.c \
+ filter/common.h \
+ filter/pdftops.c
+EXTRA_pdftops_SOURCES = filter/strcasestr.c
+pdftops_CFLAGS = $(CUPS_CFLAGS)
+pdftops_LDADD = $(STRCASESTR) $(CUPS_LIBS)
+pdftops_DEPENDENCIES = $(STRCASESTR)
+
+pdftoraster_SOURCES = \
+ filter/pdftoraster.cxx \
+ filter/PDFError.h
+pdftoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LCMS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(POPPLER_CFLAGS) \
+ $(TIFF_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+pdftoraster_CXXFLAGS = $(pdftoraster_CFLAGS)
+pdftoraster_LDADD = \
+ $(CUPS_LIBS) \
+ $(LCMS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(POPPLER_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la
+
+rastertoescpx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/escp.h \
+ filter/rastertoescpx.c
+rastertoescpx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+rastertoescpx_LDADD = \
+ $(CUPS_LIBS) \
+ libcupsfilters.la
+
+rastertopclx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/pcl.h \
+ filter/pcl-common.c \
+ filter/pcl-common.h \
+ filter/rastertopclx.c
+rastertopclx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+rastertopclx_LDADD = \
+ $(CUPS_LIBS) \
+ $(LIBPNG_LIBS) \
+ libcupsfilters.la
+
+test_pdf1_SOURCES = \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/test_pdf1.c \
+ fontembed/embed.h \
+ fontembed/sfnt.h
+test_pdf1_CFLAGS = -I$(srcdir)/fontembed/
+test_pdf1_LDADD = libfontembed.la
+
+test_pdf2_SOURCES = \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/test_pdf2.c \
+ fontembed/embed.h \
+ fontembed/sfnt.h
+test_pdf2_CFLAGS = -I$(srcdir)/fontembed/
+test_pdf2_LDADD = libfontembed.la
+
+texttopdf_SOURCES = \
+ filter/common.c \
+ filter/common.h \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/textcommon.c \
+ filter/textcommon.h \
+ filter/texttopdf.c \
+ fontembed/bitset.h \
+ fontembed/embed.h \
+ fontembed/fontfile.h \
+ fontembed/iofn.h \
+ fontembed/sfnt.h
+texttopdf_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(FONTCONFIG_CFLAGS) \
+ -I$(srcdir)/fontembed/
+texttopdf_LDADD = \
+ $(CUPS_LIBS) \
+ $(FONTCONFIG_LIBS) \
+ libfontembed.la
+
+# Not reliable bash script
+#TESTS += filter/test.sh
+
+EXTRA_DIST += \
+ $(pkgfilter_SCRIPTS) \
+ filter/test.sh
+
+# ===
+# PPD
+# ===
+ppddir = $(datadir)/ppd/cupsfilters
+ppd_DATA = \
+ ppd/Generic-PDF_Printer-PDF.ppd \
+ ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \
+ ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \
+ ppd/textonly.ppd
+
+EXTRA_DIST += $(ppd_DATA)
+
+# =========
+# Scripting
+# =========
+if WITH_PHP
+phpextensiondir = $(PHPDIR)
+phpextension_LTLIBRARIES = libphpcups.la
+libphpcups_la_SOURCES = \
+ scripting/php/phpcups.c \
+ scripting/php/phpcups.h
+libphpcups_la_LIBADD = $(CUPS_LIBS)
+libphpcups_la_CFLAGS = $(CUPS_CFLAGS)
+libphpcups_la_LDFLAGS = -no-undefined
+endif # WITH_PHP
+
+EXTRA_DIST += \
+ scripting/perl \
+ scripting/php/README \
+ scripting/php/phpcups.php
+
+distclean-local:
+ rm -rf *.cache *~
--- /dev/null
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+pkgbackend_PROGRAMS = parallel$(EXEEXT) serial$(EXEEXT)
+check_PROGRAMS = test1284$(EXEEXT) testcmyk$(EXEEXT) \
+ testdither$(EXEEXT) testimage$(EXEEXT) testrgb$(EXEEXT) \
+ test_analyze$(EXEEXT) test_pdf$(EXEEXT) test_ps$(EXEEXT) \
+ test_pdf1$(EXEEXT) test_pdf2$(EXEEXT)
+TESTS = testdither$(EXEEXT) test_analyze$(EXEEXT) test_pdf$(EXEEXT) \
+ test_ps$(EXEEXT) test_pdf1$(EXEEXT) test_pdf2$(EXEEXT)
+bin_PROGRAMS = ttfread$(EXEEXT)
+pkgfilter_PROGRAMS = pdftoopvp$(EXEEXT) pdftopdf$(EXEEXT) \
+ commandtoescpx$(EXEEXT) \
+ commandtopclx$(EXEEXT) pdftoijs$(EXEEXT) pdftops$(EXEEXT) \
+ pdftoraster$(EXEEXT) rastertoescpx$(EXEEXT) \
+ rastertopclx$(EXEEXT) texttopdf$(EXEEXT) \
+ $(am__EXEEXT_1)
+@ENABLE_IMAGEFILTERS_TRUE@am__append_1 = \
+@ENABLE_IMAGEFILTERS_TRUE@ imagetopdf \
+@ENABLE_IMAGEFILTERS_TRUE@ imagetoraster
+
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(srcdir)/libcupsfilters.pc.in $(srcdir)/libfontembed.pc.in \
+ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+ compile config.guess config.sub depcomp install-sh ltmain.sh \
+ missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/ax_compare_version.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = libcupsfilters.pc libfontembed.pc
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" \
+ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" \
+ "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(pkgfilterdir)" \
+ "$(DESTDIR)$(docdir)" \
+ "$(DESTDIR)$(pkgconfdir)" \
+ "$(DESTDIR)$(pkgdriverdir)" \
+ "$(DESTDIR)$(pkgfiltersincludedir)" \
+ "$(DESTDIR)$(pkgfontconfigdir)" \
+ "$(DESTDIR)$(pkgfontembedincludedir)" \
+ "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(ppddir)"
+LTLIBRARIES = $(lib_LTLIBRARIES) $(phpextension_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libcupsfilters_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__objects_1 =
+am_libcupsfilters_la_OBJECTS = libcupsfilters_la-attr.lo \
+ libcupsfilters_la-check.lo libcupsfilters_la-cmyk.lo \
+ libcupsfilters_la-dither.lo libcupsfilters_la-image.lo \
+ libcupsfilters_la-image-bmp.lo \
+ libcupsfilters_la-image-colorspace.lo \
+ libcupsfilters_la-image-gif.lo libcupsfilters_la-image-jpeg.lo \
+ libcupsfilters_la-image-photocd.lo \
+ libcupsfilters_la-image-pix.lo libcupsfilters_la-image-png.lo \
+ libcupsfilters_la-image-pnm.lo libcupsfilters_la-image-sgi.lo \
+ libcupsfilters_la-image-sgilib.lo \
+ libcupsfilters_la-image-sun.lo libcupsfilters_la-image-tiff.lo \
+ libcupsfilters_la-image-zoom.lo libcupsfilters_la-lut.lo \
+ libcupsfilters_la-pack.lo libcupsfilters_la-rgb.lo \
+ libcupsfilters_la-srgb.lo $(am__objects_1)
+libcupsfilters_la_OBJECTS = $(am_libcupsfilters_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+libcupsfilters_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libcupsfilters_la_CFLAGS) $(CFLAGS) \
+ $(libcupsfilters_la_LDFLAGS) $(LDFLAGS) -o $@
+libfontembed_la_LIBADD =
+am_libfontembed_la_OBJECTS = aglfn13.lo dynstring.lo embed.lo \
+ embed_sfnt.lo embed_pdf.lo fontfile.lo frequent.lo sfnt.lo \
+ sfnt_subset.lo
+libfontembed_la_OBJECTS = $(am_libfontembed_la_OBJECTS)
+libfontembed_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libfontembed_la_LDFLAGS) $(LDFLAGS) \
+ -o $@
+@WITH_PHP_TRUE@libphpcups_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__libphpcups_la_SOURCES_DIST = scripting/php/phpcups.c \
+ scripting/php/phpcups.h
+@WITH_PHP_TRUE@am_libphpcups_la_OBJECTS = libphpcups_la-phpcups.lo
+libphpcups_la_OBJECTS = $(am_libphpcups_la_OBJECTS)
+libphpcups_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libphpcups_la_CFLAGS) \
+ $(CFLAGS) $(libphpcups_la_LDFLAGS) $(LDFLAGS) -o $@
+@WITH_PHP_TRUE@am_libphpcups_la_rpath = -rpath $(phpextensiondir)
+@ENABLE_IMAGEFILTERS_TRUE@am__EXEEXT_1 = imagetopdf$(EXEEXT) \
+@ENABLE_IMAGEFILTERS_TRUE@ imagetoraster$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS) $(pkgbackend_PROGRAMS) \
+ $(pkgfilter_PROGRAMS)
+am_commandtoescpx_OBJECTS = commandtoescpx-commandtoescpx.$(OBJEXT)
+commandtoescpx_OBJECTS = $(am_commandtoescpx_OBJECTS)
+commandtoescpx_DEPENDENCIES = $(am__DEPENDENCIES_1)
+commandtoescpx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(commandtoescpx_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
+ $@
+am_commandtopclx_OBJECTS = commandtopclx-commandtopclx.$(OBJEXT)
+commandtopclx_OBJECTS = $(am_commandtopclx_OBJECTS)
+commandtopclx_DEPENDENCIES = $(am__DEPENDENCIES_1)
+commandtopclx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(commandtopclx_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_imagetopdf_OBJECTS = imagetopdf-common.$(OBJEXT) \
+ imagetopdf-imagetopdf.$(OBJEXT)
+imagetopdf_OBJECTS = $(am_imagetopdf_OBJECTS)
+imagetopdf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) libcupsfilters.la
+imagetopdf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(imagetopdf_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_imagetoraster_OBJECTS = imagetoraster-common.$(OBJEXT) \
+ imagetoraster-imagetoraster.$(OBJEXT)
+imagetoraster_OBJECTS = $(am_imagetoraster_OBJECTS)
+imagetoraster_DEPENDENCIES = $(am__DEPENDENCIES_1) libcupsfilters.la
+imagetoraster_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(imagetoraster_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_parallel_OBJECTS = parallel-ieee1284.$(OBJEXT) \
+ parallel-parallel.$(OBJEXT)
+parallel_OBJECTS = $(am_parallel_OBJECTS)
+parallel_DEPENDENCIES = $(am__DEPENDENCIES_1)
+parallel_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(parallel_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_pdftoijs_OBJECTS = pdftoijs-pdftoijs.$(OBJEXT)
+pdftoijs_OBJECTS = $(am_pdftoijs_OBJECTS)
+pdftoijs_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+pdftoijs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftoijs_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_pdftoopvp_OBJECTS = pdftoopvp-OPRS.$(OBJEXT) \
+ pdftoopvp-OPVPSplashClip.$(OBJEXT) \
+ pdftoopvp-OPVPSplash.$(OBJEXT) \
+ pdftoopvp-OPVPSplashPath.$(OBJEXT) \
+ pdftoopvp-OPVPSplashState.$(OBJEXT) \
+ pdftoopvp-OPVPSplashXPath.$(OBJEXT) \
+ pdftoopvp-OPVPWrapper.$(OBJEXT) \
+ pdftoopvp-OPVPWrapper_0_2.$(OBJEXT) \
+ pdftoopvp-OPVPOutputDev.$(OBJEXT) \
+ pdftoopvp-pdftoopvp.$(OBJEXT)
+pdftoopvp_OBJECTS = $(am_pdftoopvp_OBJECTS)
+pdftoopvp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+pdftoopvp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftoopvp_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_pdftopdf_OBJECTS = pdftopdf-pdftopdf.$(OBJEXT) \
+ pdftopdf-pdftopdf_jcl.$(OBJEXT) \
+ pdftopdf-pdftopdf_processor.$(OBJEXT) \
+ pdftopdf-qpdf_pdftopdf_processor.$(OBJEXT) \
+ pdftopdf-pptypes.$(OBJEXT) pdftopdf-nup.$(OBJEXT) \
+ pdftopdf-intervalset.$(OBJEXT) pdftopdf-qpdf_tools.$(OBJEXT) \
+ pdftopdf-qpdf_xobject.$(OBJEXT) \
+ pdftopdf-qpdf_pdftopdf.$(OBJEXT) pdftopdf-qpdf_cm.$(OBJEXT)
+pdftopdf_OBJECTS = $(am_pdftopdf_OBJECTS)
+pdftopdf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+pdftopdf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftopdf_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_pdftops_OBJECTS = pdftops-common.$(OBJEXT) \
+ pdftops-pdftops.$(OBJEXT)
+pdftops_OBJECTS = $(am_pdftops_OBJECTS)
+pdftops_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(pdftops_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_pdftoraster_OBJECTS = pdftoraster-pdftoraster.$(OBJEXT)
+pdftoraster_OBJECTS = $(am_pdftoraster_OBJECTS)
+pdftoraster_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) libcupsfilters.la
+pdftoraster_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftoraster_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_rastertoescpx_OBJECTS = rastertoescpx-rastertoescpx.$(OBJEXT)
+rastertoescpx_OBJECTS = $(am_rastertoescpx_OBJECTS)
+rastertoescpx_DEPENDENCIES = $(am__DEPENDENCIES_1) libcupsfilters.la
+rastertoescpx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(rastertoescpx_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_rastertopclx_OBJECTS = rastertopclx-pcl-common.$(OBJEXT) \
+ rastertopclx-rastertopclx.$(OBJEXT)
+rastertopclx_OBJECTS = $(am_rastertopclx_OBJECTS)
+rastertopclx_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) libcupsfilters.la
+rastertopclx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(rastertopclx_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_serial_OBJECTS = serial-serial.$(OBJEXT)
+serial_OBJECTS = $(am_serial_OBJECTS)
+serial_DEPENDENCIES = $(am__DEPENDENCIES_1)
+serial_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(serial_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_test1284_OBJECTS = test1284-ieee1284.$(OBJEXT) \
+ test1284-test1284.$(OBJEXT)
+test1284_OBJECTS = $(am_test1284_OBJECTS)
+test1284_DEPENDENCIES = $(am__DEPENDENCIES_1)
+test1284_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test1284_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_test_analyze_OBJECTS = test_analyze.$(OBJEXT)
+test_analyze_OBJECTS = $(am_test_analyze_OBJECTS)
+test_analyze_DEPENDENCIES = libfontembed.la
+am_test_pdf_OBJECTS = test_pdf.$(OBJEXT)
+test_pdf_OBJECTS = $(am_test_pdf_OBJECTS)
+test_pdf_DEPENDENCIES = libfontembed.la
+am_test_pdf1_OBJECTS = test_pdf1-pdfutils.$(OBJEXT) \
+ test_pdf1-test_pdf1.$(OBJEXT)
+test_pdf1_OBJECTS = $(am_test_pdf1_OBJECTS)
+test_pdf1_DEPENDENCIES = libfontembed.la
+test_pdf1_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_pdf1_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_test_pdf2_OBJECTS = test_pdf2-pdfutils.$(OBJEXT) \
+ test_pdf2-test_pdf2.$(OBJEXT)
+test_pdf2_OBJECTS = $(am_test_pdf2_OBJECTS)
+test_pdf2_DEPENDENCIES = libfontembed.la
+test_pdf2_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_pdf2_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_test_ps_OBJECTS = test_ps.$(OBJEXT)
+test_ps_OBJECTS = $(am_test_ps_OBJECTS)
+test_ps_DEPENDENCIES = libfontembed.la
+am_testcmyk_OBJECTS = testcmyk.$(OBJEXT) $(am__objects_1)
+testcmyk_OBJECTS = $(am_testcmyk_OBJECTS)
+testcmyk_DEPENDENCIES = libcupsfilters.la
+am_testdither_OBJECTS = testdither.$(OBJEXT) $(am__objects_1)
+testdither_OBJECTS = $(am_testdither_OBJECTS)
+testdither_DEPENDENCIES = libcupsfilters.la
+am_testimage_OBJECTS = testimage-testimage.$(OBJEXT) $(am__objects_1)
+testimage_OBJECTS = $(am_testimage_OBJECTS)
+testimage_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ libcupsfilters.la
+testimage_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testimage_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_testrgb_OBJECTS = testrgb.$(OBJEXT) $(am__objects_1)
+testrgb_OBJECTS = $(am_testrgb_OBJECTS)
+testrgb_DEPENDENCIES = libcupsfilters.la
+am_texttopdf_OBJECTS = texttopdf-common.$(OBJEXT) \
+ texttopdf-pdfutils.$(OBJEXT) texttopdf-textcommon.$(OBJEXT) \
+ texttopdf-texttopdf.$(OBJEXT)
+texttopdf_OBJECTS = $(am_texttopdf_OBJECTS)
+texttopdf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ libfontembed.la
+texttopdf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(texttopdf_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_ttfread_OBJECTS = main.$(OBJEXT)
+ttfread_OBJECTS = $(am_ttfread_OBJECTS)
+ttfread_DEPENDENCIES = libfontembed.la
+SCRIPTS = $(pkgfilter_SCRIPTS)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libcupsfilters_la_SOURCES) $(libfontembed_la_SOURCES) \
+ $(libphpcups_la_SOURCES) \
+ $(commandtoescpx_SOURCES) \
+ $(commandtopclx_SOURCES) $(imagetopdf_SOURCES) \
+ $(imagetoraster_SOURCES) $(parallel_SOURCES) \
+ $(pdftoijs_SOURCES) $(pdftoopvp_SOURCES) $(pdftopdf_SOURCES) \
+ $(pdftops_SOURCES) $(EXTRA_pdftops_SOURCES) \
+ $(pdftoraster_SOURCES) $(rastertoescpx_SOURCES) \
+ $(rastertopclx_SOURCES) $(serial_SOURCES) $(test1284_SOURCES) \
+ $(test_analyze_SOURCES) $(test_pdf_SOURCES) \
+ $(test_pdf1_SOURCES) $(test_pdf2_SOURCES) $(test_ps_SOURCES) \
+ $(testcmyk_SOURCES) $(testdither_SOURCES) $(testimage_SOURCES) \
+ $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES)
+DIST_SOURCES = $(libcupsfilters_la_SOURCES) $(libfontembed_la_SOURCES) \
+ $(am__libphpcups_la_SOURCES_DIST) \
+ $(commandtoescpx_SOURCES) \
+ $(commandtopclx_SOURCES) $(imagetopdf_SOURCES) \
+ $(imagetoraster_SOURCES) $(parallel_SOURCES) \
+ $(pdftoijs_SOURCES) $(pdftoopvp_SOURCES) $(pdftopdf_SOURCES) \
+ $(pdftops_SOURCES) $(EXTRA_pdftops_SOURCES) \
+ $(pdftoraster_SOURCES) $(rastertoescpx_SOURCES) \
+ $(rastertopclx_SOURCES) $(serial_SOURCES) $(test1284_SOURCES) \
+ $(test_analyze_SOURCES) $(test_pdf_SOURCES) \
+ $(test_pdf1_SOURCES) $(test_pdf2_SOURCES) $(test_ps_SOURCES) \
+ $(testcmyk_SOURCES) $(testdither_SOURCES) $(testimage_SOURCES) \
+ $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(doc_DATA) \
+ $(pkgconf_DATA) \
+ $(pkgfiltersinclude_DATA) $(pkgfontconfig_DATA) \
+ $(pkgfontembedinclude_DATA) $(pkgmime_DATA) $(ppd_DATA)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).tar.xz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CUPSCONFIG = @CUPSCONFIG@
+CUPS_ACROREAD = @CUPS_ACROREAD@
+CUPS_CFLAGS = @CUPS_CFLAGS@
+CUPS_DATADIR = @CUPS_DATADIR@
+CUPS_FONTPATH = @CUPS_FONTPATH@
+CUPS_GHOSTSCRIPT = @CUPS_GHOSTSCRIPT@
+CUPS_LIBS = @CUPS_LIBS@
+CUPS_PDFTOPS = @CUPS_PDFTOPS@
+CUPS_SERVERBIN = @CUPS_SERVERBIN@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DLOPEN_LIBS = @DLOPEN_LIBS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FONTDIR = @FONTDIR@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GETLINE = @GETLINE@
+GREP = @GREP@
+IJS_CFLAGS = @IJS_CFLAGS@
+IJS_LIBS = @IJS_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LARGEFILE = @LARGEFILE@
+LCMS_CFLAGS = @LCMS_CFLAGS@
+LCMS_LIBS = @LCMS_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG_LIBS = @LIBJPEG_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBPNG_CFLAGS = @LIBPNG_CFLAGS@
+LIBPNG_LIBS = @LIBPNG_LIBS@
+LIBQPDF_CFLAGS = @LIBQPDF_CFLAGS@
+LIBQPDF_LIBS = @LIBQPDF_LIBS@
+LIBS = @LIBS@
+LIBTIFF_LIBS = @LIBTIFF_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PHPCONFIG = @PHPCONFIG@
+PHPDIR = @PHPDIR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POPPLER_CFLAGS = @POPPLER_CFLAGS@
+POPPLER_LIBS = @POPPLER_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRCASESTR = @STRCASESTR@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I m4
+pkgconfdir = $(libdir)/pkgconfig
+pkgconf_DATA = \
+ libcupsfilters.pc \
+ libfontembed.pc
+
+doc_DATA = \
+ AUTHORS \
+ COPYING \
+ NEWS \
+ INSTALL \
+ README
+
+
+# Not reliable bash script
+#TESTS += filter/test.sh
+EXTRA_DIST = $(doc_DATA) autogen.sh libcupsfilters.pc.in \
+ libfontembed.pc.in \
+ $(pkgfiltersinclude_DATA) cupsfilters/image.pgm \
+ cupsfilters/image.ppm \
+ $(pkgmime_DATA) $(pkgfontembedinclude_DATA) fontembed/README \
+ $(pkgfontconfig_DATA) $(pkgfilter_SCRIPTS) filter/test.sh \
+ $(ppd_DATA) scripting/perl scripting/php/README \
+ scripting/php/phpcups.php
+
+# ========
+# Backends
+# ========
+pkgbackenddir = $(CUPS_SERVERBIN)/backend
+# We need ieee1284 up and running.
+# Leave it to the user to run if they have the bus.
+#TESTS = test1284
+parallel_SOURCES = \
+ backend/backend-private.h \
+ backend/ieee1284.c \
+ backend/parallel.c
+
+parallel_LDADD = $(CUPS_LIBS)
+parallel_CFLAGS = $(CUPS_CFLAGS)
+serial_SOURCES = \
+ backend/backend-private.h \
+ backend/serial.c
+
+serial_LDADD = $(CUPS_LIBS)
+serial_CFLAGS = $(CUPS_CFLAGS)
+test1284_SOURCES = \
+ backend/backend-private.h \
+ backend/ieee1284.c \
+ backend/test1284.c
+
+test1284_LDADD = $(CUPS_LIBS)
+test1284_CFLAGS = $(CUPS_CFLAGS)
+
+# ====================
+# CUPS Filters library
+# ====================
+pkgfiltersincludedir = $(includedir)/cupsfilters
+pkgfiltersinclude_DATA = \
+ cupsfilters/driver.h \
+ cupsfilters/image.h
+
+lib_LTLIBRARIES = libcupsfilters.la libfontembed.la
+# testcmyk # fails as it opens some image.ppm which is nowerhe to be found.
+# testimage # requires also some ppm file as argument
+# testrgb # same error
+# FIXME: run old testdither
+# ./testdither > test/0-255.pgm 2>test/0-255.log
+# ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log
+# ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log
+# ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log
+# ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log
+# ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log
+# ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log
+# ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log
+libcupsfilters_la_SOURCES = \
+ cupsfilters/attr.c \
+ cupsfilters/check.c \
+ cupsfilters/cmyk.c \
+ cupsfilters/dither.c \
+ cupsfilters/image.c \
+ cupsfilters/image-bmp.c \
+ cupsfilters/image-colorspace.c \
+ cupsfilters/image-gif.c \
+ cupsfilters/image-jpeg.c \
+ cupsfilters/image-photocd.c \
+ cupsfilters/image-pix.c \
+ cupsfilters/image-png.c \
+ cupsfilters/image-pnm.c \
+ cupsfilters/image-private.h \
+ cupsfilters/image-sgi.c \
+ cupsfilters/image-sgi.h \
+ cupsfilters/image-sgilib.c \
+ cupsfilters/image-sun.c \
+ cupsfilters/image-tiff.c \
+ cupsfilters/image-zoom.c \
+ cupsfilters/lut.c \
+ cupsfilters/pack.c \
+ cupsfilters/rgb.c \
+ cupsfilters/srgb.c \
+ $(pkgfiltersinclude_DATA)
+
+libcupsfilters_la_LIBADD = \
+ $(CUPS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ -lm
+
+libcupsfilters_la_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS)
+
+libcupsfilters_la_LDFLAGS = \
+ -no-undefined \
+ -version-info 1
+
+testcmyk_SOURCES = \
+ cupsfilters/testcmyk.c \
+ $(pkgfiltersinclude_DATA)
+
+testcmyk_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+testdither_SOURCES = \
+ cupsfilters/testdither.c \
+ $(pkgfiltersinclude_DATA)
+
+testdither_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+testimage_SOURCES = \
+ cupsfilters/testimage.c \
+ $(pkgfiltersinclude_DATA)
+
+testimage_LDADD = \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la \
+ -lm
+
+testimage_CFLAGS = \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS)
+
+testrgb_SOURCES = \
+ cupsfilters/testrgb.c \
+ $(pkgfiltersinclude_DATA)
+
+testrgb_LDADD = \
+ libcupsfilters.la \
+ -lm
+
+# =====
+# MIMEs
+# =====
+pkgmimedir = $(CUPS_DATADIR)/mime
+pkgmime_DATA = \
+ mime/cupsfilters.convs \
+ mime/cupsfilters.types
+
+
+# =================
+# Fontembed library
+# =================
+pkgfontembedincludedir = $(includedir)/fontembed
+pkgfontembedinclude_DATA = \
+ fontembed/bitset.h \
+ fontembed/embed.h \
+ fontembed/fontfile.h \
+ fontembed/iofn.h \
+ fontembed/sfnt.h
+
+libfontembed_la_SOURCES = \
+ fontembed/aglfn13.c \
+ fontembed/bitset.h \
+ fontembed/dynstring.c \
+ fontembed/dynstring.h \
+ fontembed/embed.c \
+ fontembed/embed.h \
+ fontembed/embed_sfnt.c \
+ fontembed/embed_sfnt_int.h \
+ fontembed/embed_pdf.c \
+ fontembed/embed_pdf.h \
+ fontembed/embed_pdf_int.h \
+ fontembed/fontfile.c \
+ fontembed/fontfile.h \
+ fontembed/frequent.c \
+ fontembed/frequent.h \
+ fontembed/iofn.h \
+ fontembed/macroman.h \
+ fontembed/sfnt.c \
+ fontembed/sfnt.h \
+ fontembed/sfnt_int.h \
+ fontembed/sfnt_subset.c
+
+libfontembed_la_LDFLAGS = \
+ -no-undefined \
+ -version-info 1
+
+ttfread_SOURCES = fontembed/main.c
+ttfread_LDADD = libfontembed.la
+test_analyze_SOURCES = fontembed/test_analyze.c
+test_analyze_LDADD = libfontembed.la
+test_pdf_SOURCES = fontembed/test_pdf.c
+test_pdf_LDADD = libfontembed.la
+test_ps_SOURCES = fontembed/test_ps.c
+test_ps_LDADD = libfontembed.la
+
+# ===========
+# PDF to OPVP
+# ===========
+pkgfilterdir = $(CUPS_SERVERBIN)/filter
+pkgfontconfigdir = $(sysconfdir)/$(FONTDIR)
+pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf
+pdftoopvp_SOURCES = \
+ filter/pdftoopvp/oprs/OPRS.cxx \
+ filter/pdftoopvp/oprs/OPRS.h \
+ filter/pdftoopvp/oprs/OPVPSplashClip.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashClip.h \
+ filter/pdftoopvp/oprs/OPVPSplash.cxx \
+ filter/pdftoopvp/oprs/OPVPSplash.h \
+ filter/pdftoopvp/oprs/OPVPSplashPath.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashPath.h \
+ filter/pdftoopvp/oprs/OPVPSplashState.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashState.h \
+ filter/pdftoopvp/oprs/OPVPSplashXPath.cxx \
+ filter/pdftoopvp/oprs/OPVPSplashXPath.h \
+ filter/pdftoopvp/oprs/OPVPWrapper.cxx \
+ filter/pdftoopvp/oprs/OPVPWrapper.h \
+ filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx \
+ filter/pdftoopvp/oprs/OPVPWrapper_0_2.h \
+ filter/pdftoopvp/OPVPError.h \
+ filter/pdftoopvp/opvp/opvp_common.h \
+ filter/pdftoopvp/opvp/opvp.h \
+ filter/pdftoopvp/opvp/opvp_0_2_0.h \
+ filter/pdftoopvp/OPVPOutputDev.cxx \
+ filter/pdftoopvp/OPVPOutputDev.h \
+ filter/pdftoopvp/pdftoopvp.cxx
+
+pdftoopvp_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(FREETYPE_CFLAGS) \
+ $(FONTCONFIG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(POPPLER_CFLAGS) \
+ -I$(srcdir)/filter/pdftoopvp/oprs \
+ -I$(srcdir)/filter/pdftoopvp/opvp
+
+pdftoopvp_CXXFLAGS = $(pdftoopvp_CFLAGS)
+pdftoopvp_LDADD = \
+ $(CUPS_LIBS) \
+ $(FREETYPE_LIBS) \
+ $(FONTCONFIG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(POPPLER_LIBS)
+
+pdftopdf_SOURCES = \
+ filter/pdftopdf/pdftopdf.cc \
+ filter/pdftopdf/pdftopdf_jcl.cc \
+ filter/pdftopdf/pdftopdf_jcl.h \
+ filter/pdftopdf/pdftopdf_processor.cc \
+ filter/pdftopdf/pdftopdf_processor.h \
+ filter/pdftopdf/qpdf_pdftopdf_processor.cc \
+ filter/pdftopdf/qpdf_pdftopdf_processor.h \
+ filter/pdftopdf/pptypes.cc \
+ filter/pdftopdf/pptypes.h \
+ filter/pdftopdf/nup.cc \
+ filter/pdftopdf/nup.h \
+ filter/pdftopdf/intervalset.cc \
+ filter/pdftopdf/intervalset.h \
+ filter/pdftopdf/qpdf_tools.cc \
+ filter/pdftopdf/qpdf_tools.h \
+ filter/pdftopdf/qpdf_xobject.cc \
+ filter/pdftopdf/qpdf_xobject.h \
+ filter/pdftopdf/qpdf_pdftopdf.cc \
+ filter/pdftopdf/qpdf_pdftopdf.h \
+ filter/pdftopdf/qpdf_cm.cc \
+ filter/pdftopdf/qpdf_cm.h
+
+pdftopdf_CFLAGS = \
+ $(LIBQPDF_CFLAGS) \
+ $(CUPS_CFLAGS)
+
+pdftopdf_CXXFLAGS = -std=c++0x $(pdftopdf_CFLAGS) # -std=c++11
+pdftopdf_LDADD = \
+ $(LIBQPDF_LIBS) \
+ $(CUPS_LIBS)
+
+
+# ======================
+# Simple filter binaries
+# ======================
+pkgfilter_SCRIPTS = \
+ filter/imagetops \
+ filter/pstopdf \
+ filter/textonly \
+ filter/texttops
+
+commandtoescpx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/commandtoescpx.c \
+ filter/pcl.h
+
+commandtoescpx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+commandtoescpx_LDADD = $(CUPS_LIBS)
+commandtopclx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/commandtopclx.c \
+ filter/pcl.h
+
+commandtopclx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+commandtopclx_LDADD = $(CUPS_LIBS)
+imagetopdf_SOURCES = \
+ cupsfilters/image.h \
+ filter/common.c \
+ filter/common.h \
+ filter/imagetopdf.c
+
+imagetopdf_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(TIFF_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+imagetopdf_LDADD = \
+ $(CUPS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la
+
+imagetoraster_SOURCES = \
+ cupsfilters/image.h \
+ cupsfilters/image-private.h \
+ filter/common.c \
+ filter/common.h \
+ filter/imagetoraster.c
+
+imagetoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+imagetoraster_LDADD = \
+ $(CUPS_LIBS) \
+ libcupsfilters.la
+
+pdftoijs_SOURCES = \
+ filter/pdftoijs.cxx \
+ filter/PDFError.h
+
+pdftoijs_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(IJS_CFLAGS) \
+ $(POPPLER_CFLAGS)
+
+pdftoijs_CXXFLAGS = $(pdftoijs_CFLAGS)
+pdftoijs_LDADD = \
+ $(CUPS_LIBS) \
+ $(IJS_LIBS) \
+ $(POPPLER_LIBS)
+
+pdftops_SOURCES = \
+ filter/common.c \
+ filter/common.h \
+ filter/pdftops.c
+
+EXTRA_pdftops_SOURCES = filter/strcasestr.c
+pdftops_CFLAGS = $(CUPS_CFLAGS)
+pdftops_LDADD = $(STRCASESTR) $(CUPS_LIBS)
+pdftops_DEPENDENCIES = $(STRCASESTR)
+pdftoraster_SOURCES = \
+ filter/pdftoraster.cxx \
+ filter/PDFError.h
+
+pdftoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LCMS_CFLAGS) \
+ $(LIBJPEG_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ $(POPPLER_CFLAGS) \
+ $(TIFF_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+pdftoraster_CXXFLAGS = $(pdftoraster_CFLAGS)
+pdftoraster_LDADD = \
+ $(CUPS_LIBS) \
+ $(LCMS_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBPNG_LIBS) \
+ $(POPPLER_LIBS) \
+ $(TIFF_LIBS) \
+ libcupsfilters.la
+
+rastertoescpx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/escp.h \
+ filter/rastertoescpx.c
+
+rastertoescpx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+rastertoescpx_LDADD = \
+ $(CUPS_LIBS) \
+ libcupsfilters.la
+
+rastertopclx_SOURCES = \
+ cupsfilters/driver.h \
+ filter/pcl.h \
+ filter/pcl-common.c \
+ filter/pcl-common.h \
+ filter/rastertopclx.c
+
+rastertopclx_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(LIBPNG_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+rastertopclx_LDADD = \
+ $(CUPS_LIBS) \
+ $(LIBPNG_LIBS) \
+ libcupsfilters.la
+
+test_pdf1_SOURCES = \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/test_pdf1.c \
+ fontembed/embed.h \
+ fontembed/sfnt.h
+
+test_pdf1_CFLAGS = -I$(srcdir)/fontembed/
+test_pdf1_LDADD = libfontembed.la
+test_pdf2_SOURCES = \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/test_pdf2.c \
+ fontembed/embed.h \
+ fontembed/sfnt.h
+
+test_pdf2_CFLAGS = -I$(srcdir)/fontembed/
+test_pdf2_LDADD = libfontembed.la
+texttopdf_SOURCES = \
+ filter/common.c \
+ filter/common.h \
+ filter/pdfutils.c \
+ filter/pdfutils.h \
+ filter/textcommon.c \
+ filter/textcommon.h \
+ filter/texttopdf.c \
+ fontembed/bitset.h \
+ fontembed/embed.h \
+ fontembed/fontfile.h \
+ fontembed/iofn.h \
+ fontembed/sfnt.h
+
+texttopdf_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(FONTCONFIG_CFLAGS) \
+ -I$(srcdir)/fontembed/
+
+texttopdf_LDADD = \
+ $(CUPS_LIBS) \
+ $(FONTCONFIG_LIBS) \
+ libfontembed.la
+
+
+# ===
+# PPD
+# ===
+ppddir = $(datadir)/ppd/cupsfilters
+ppd_DATA = \
+ ppd/Generic-PDF_Printer-PDF.ppd \
+ ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \
+ ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \
+ ppd/textonly.ppd
+
+
+# =========
+# Scripting
+# =========
+@WITH_PHP_TRUE@phpextensiondir = $(PHPDIR)
+@WITH_PHP_TRUE@phpextension_LTLIBRARIES = libphpcups.la
+@WITH_PHP_TRUE@libphpcups_la_SOURCES = \
+@WITH_PHP_TRUE@ scripting/php/phpcups.c \
+@WITH_PHP_TRUE@ scripting/php/phpcups.h
+
+@WITH_PHP_TRUE@libphpcups_la_LIBADD = $(CUPS_LIBS)
+@WITH_PHP_TRUE@libphpcups_la_CFLAGS = $(CUPS_CFLAGS)
+@WITH_PHP_TRUE@libphpcups_la_LDFLAGS = -no-undefined
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .cpp .cxx .lo .o .obj
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+libcupsfilters.pc: $(top_builddir)/config.status $(srcdir)/libcupsfilters.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+libfontembed.pc: $(top_builddir)/config.status $(srcdir)/libfontembed.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-phpextensionLTLIBRARIES: $(phpextension_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(phpextension_LTLIBRARIES)'; test -n "$(phpextensiondir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(phpextensiondir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(phpextensiondir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(phpextensiondir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(phpextensiondir)"; \
+ }
+
+uninstall-phpextensionLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(phpextension_LTLIBRARIES)'; test -n "$(phpextensiondir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(phpextensiondir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(phpextensiondir)/$$f"; \
+ done
+
+clean-phpextensionLTLIBRARIES:
+ -test -z "$(phpextension_LTLIBRARIES)" || rm -f $(phpextension_LTLIBRARIES)
+ @list='$(phpextension_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libcupsfilters.la: $(libcupsfilters_la_OBJECTS) $(libcupsfilters_la_DEPENDENCIES) $(EXTRA_libcupsfilters_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libcupsfilters_la_LINK) -rpath $(libdir) $(libcupsfilters_la_OBJECTS) $(libcupsfilters_la_LIBADD) $(LIBS)
+libfontembed.la: $(libfontembed_la_OBJECTS) $(libfontembed_la_DEPENDENCIES) $(EXTRA_libfontembed_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libfontembed_la_LINK) -rpath $(libdir) $(libfontembed_la_OBJECTS) $(libfontembed_la_LIBADD) $(LIBS)
+libphpcups.la: $(libphpcups_la_OBJECTS) $(libphpcups_la_DEPENDENCIES) $(EXTRA_libphpcups_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libphpcups_la_LINK) $(am_libphpcups_la_rpath) $(libphpcups_la_OBJECTS) $(libphpcups_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-pkgbackendPROGRAMS: $(pkgbackend_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgbackend_PROGRAMS)'; test -n "$(pkgbackenddir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgbackenddir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgbackenddir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkgbackenddir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkgbackenddir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-pkgbackendPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgbackend_PROGRAMS)'; test -n "$(pkgbackenddir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgbackenddir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgbackenddir)" && rm -f $$files
+
+clean-pkgbackendPROGRAMS:
+ @list='$(pkgbackend_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-pkgfilterPROGRAMS: $(pkgfilter_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgfilter_PROGRAMS)'; test -n "$(pkgfilterdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgfilterdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgfilterdir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkgfilterdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkgfilterdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-pkgfilterPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgfilter_PROGRAMS)'; test -n "$(pkgfilterdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgfilterdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgfilterdir)" && rm -f $$files
+
+clean-pkgfilterPROGRAMS:
+ @list='$(pkgfilter_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+commandtoescpx$(EXEEXT): $(commandtoescpx_OBJECTS) $(commandtoescpx_DEPENDENCIES) $(EXTRA_commandtoescpx_DEPENDENCIES)
+ @rm -f commandtoescpx$(EXEEXT)
+ $(AM_V_CCLD)$(commandtoescpx_LINK) $(commandtoescpx_OBJECTS) $(commandtoescpx_LDADD) $(LIBS)
+commandtopclx$(EXEEXT): $(commandtopclx_OBJECTS) $(commandtopclx_DEPENDENCIES) $(EXTRA_commandtopclx_DEPENDENCIES)
+ @rm -f commandtopclx$(EXEEXT)
+ $(AM_V_CCLD)$(commandtopclx_LINK) $(commandtopclx_OBJECTS) $(commandtopclx_LDADD) $(LIBS)
+imagetopdf$(EXEEXT): $(imagetopdf_OBJECTS) $(imagetopdf_DEPENDENCIES) $(EXTRA_imagetopdf_DEPENDENCIES)
+ @rm -f imagetopdf$(EXEEXT)
+ $(AM_V_CCLD)$(imagetopdf_LINK) $(imagetopdf_OBJECTS) $(imagetopdf_LDADD) $(LIBS)
+imagetoraster$(EXEEXT): $(imagetoraster_OBJECTS) $(imagetoraster_DEPENDENCIES) $(EXTRA_imagetoraster_DEPENDENCIES)
+ @rm -f imagetoraster$(EXEEXT)
+ $(AM_V_CCLD)$(imagetoraster_LINK) $(imagetoraster_OBJECTS) $(imagetoraster_LDADD) $(LIBS)
+parallel$(EXEEXT): $(parallel_OBJECTS) $(parallel_DEPENDENCIES) $(EXTRA_parallel_DEPENDENCIES)
+ @rm -f parallel$(EXEEXT)
+ $(AM_V_CCLD)$(parallel_LINK) $(parallel_OBJECTS) $(parallel_LDADD) $(LIBS)
+pdftoijs$(EXEEXT): $(pdftoijs_OBJECTS) $(pdftoijs_DEPENDENCIES) $(EXTRA_pdftoijs_DEPENDENCIES)
+ @rm -f pdftoijs$(EXEEXT)
+ $(AM_V_CXXLD)$(pdftoijs_LINK) $(pdftoijs_OBJECTS) $(pdftoijs_LDADD) $(LIBS)
+pdftoopvp$(EXEEXT): $(pdftoopvp_OBJECTS) $(pdftoopvp_DEPENDENCIES) $(EXTRA_pdftoopvp_DEPENDENCIES)
+ @rm -f pdftoopvp$(EXEEXT)
+ $(AM_V_CXXLD)$(pdftoopvp_LINK) $(pdftoopvp_OBJECTS) $(pdftoopvp_LDADD) $(LIBS)
+pdftopdf$(EXEEXT): $(pdftopdf_OBJECTS) $(pdftopdf_DEPENDENCIES) $(EXTRA_pdftopdf_DEPENDENCIES)
+ @rm -f pdftopdf$(EXEEXT)
+ $(AM_V_CXXLD)$(pdftopdf_LINK) $(pdftopdf_OBJECTS) $(pdftopdf_LDADD) $(LIBS)
+pdftops$(EXEEXT): $(pdftops_OBJECTS) $(pdftops_DEPENDENCIES) $(EXTRA_pdftops_DEPENDENCIES)
+ @rm -f pdftops$(EXEEXT)
+ $(AM_V_CCLD)$(pdftops_LINK) $(pdftops_OBJECTS) $(pdftops_LDADD) $(LIBS)
+pdftoraster$(EXEEXT): $(pdftoraster_OBJECTS) $(pdftoraster_DEPENDENCIES) $(EXTRA_pdftoraster_DEPENDENCIES)
+ @rm -f pdftoraster$(EXEEXT)
+ $(AM_V_CXXLD)$(pdftoraster_LINK) $(pdftoraster_OBJECTS) $(pdftoraster_LDADD) $(LIBS)
+rastertoescpx$(EXEEXT): $(rastertoescpx_OBJECTS) $(rastertoescpx_DEPENDENCIES) $(EXTRA_rastertoescpx_DEPENDENCIES)
+ @rm -f rastertoescpx$(EXEEXT)
+ $(AM_V_CCLD)$(rastertoescpx_LINK) $(rastertoescpx_OBJECTS) $(rastertoescpx_LDADD) $(LIBS)
+rastertopclx$(EXEEXT): $(rastertopclx_OBJECTS) $(rastertopclx_DEPENDENCIES) $(EXTRA_rastertopclx_DEPENDENCIES)
+ @rm -f rastertopclx$(EXEEXT)
+ $(AM_V_CCLD)$(rastertopclx_LINK) $(rastertopclx_OBJECTS) $(rastertopclx_LDADD) $(LIBS)
+serial$(EXEEXT): $(serial_OBJECTS) $(serial_DEPENDENCIES) $(EXTRA_serial_DEPENDENCIES)
+ @rm -f serial$(EXEEXT)
+ $(AM_V_CCLD)$(serial_LINK) $(serial_OBJECTS) $(serial_LDADD) $(LIBS)
+test1284$(EXEEXT): $(test1284_OBJECTS) $(test1284_DEPENDENCIES) $(EXTRA_test1284_DEPENDENCIES)
+ @rm -f test1284$(EXEEXT)
+ $(AM_V_CCLD)$(test1284_LINK) $(test1284_OBJECTS) $(test1284_LDADD) $(LIBS)
+test_analyze$(EXEEXT): $(test_analyze_OBJECTS) $(test_analyze_DEPENDENCIES) $(EXTRA_test_analyze_DEPENDENCIES)
+ @rm -f test_analyze$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_analyze_OBJECTS) $(test_analyze_LDADD) $(LIBS)
+test_pdf$(EXEEXT): $(test_pdf_OBJECTS) $(test_pdf_DEPENDENCIES) $(EXTRA_test_pdf_DEPENDENCIES)
+ @rm -f test_pdf$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_pdf_OBJECTS) $(test_pdf_LDADD) $(LIBS)
+test_pdf1$(EXEEXT): $(test_pdf1_OBJECTS) $(test_pdf1_DEPENDENCIES) $(EXTRA_test_pdf1_DEPENDENCIES)
+ @rm -f test_pdf1$(EXEEXT)
+ $(AM_V_CCLD)$(test_pdf1_LINK) $(test_pdf1_OBJECTS) $(test_pdf1_LDADD) $(LIBS)
+test_pdf2$(EXEEXT): $(test_pdf2_OBJECTS) $(test_pdf2_DEPENDENCIES) $(EXTRA_test_pdf2_DEPENDENCIES)
+ @rm -f test_pdf2$(EXEEXT)
+ $(AM_V_CCLD)$(test_pdf2_LINK) $(test_pdf2_OBJECTS) $(test_pdf2_LDADD) $(LIBS)
+test_ps$(EXEEXT): $(test_ps_OBJECTS) $(test_ps_DEPENDENCIES) $(EXTRA_test_ps_DEPENDENCIES)
+ @rm -f test_ps$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_ps_OBJECTS) $(test_ps_LDADD) $(LIBS)
+testcmyk$(EXEEXT): $(testcmyk_OBJECTS) $(testcmyk_DEPENDENCIES) $(EXTRA_testcmyk_DEPENDENCIES)
+ @rm -f testcmyk$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(testcmyk_OBJECTS) $(testcmyk_LDADD) $(LIBS)
+testdither$(EXEEXT): $(testdither_OBJECTS) $(testdither_DEPENDENCIES) $(EXTRA_testdither_DEPENDENCIES)
+ @rm -f testdither$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(testdither_OBJECTS) $(testdither_LDADD) $(LIBS)
+testimage$(EXEEXT): $(testimage_OBJECTS) $(testimage_DEPENDENCIES) $(EXTRA_testimage_DEPENDENCIES)
+ @rm -f testimage$(EXEEXT)
+ $(AM_V_CCLD)$(testimage_LINK) $(testimage_OBJECTS) $(testimage_LDADD) $(LIBS)
+testrgb$(EXEEXT): $(testrgb_OBJECTS) $(testrgb_DEPENDENCIES) $(EXTRA_testrgb_DEPENDENCIES)
+ @rm -f testrgb$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(testrgb_OBJECTS) $(testrgb_LDADD) $(LIBS)
+texttopdf$(EXEEXT): $(texttopdf_OBJECTS) $(texttopdf_DEPENDENCIES) $(EXTRA_texttopdf_DEPENDENCIES)
+ @rm -f texttopdf$(EXEEXT)
+ $(AM_V_CCLD)$(texttopdf_LINK) $(texttopdf_OBJECTS) $(texttopdf_LDADD) $(LIBS)
+ttfread$(EXEEXT): $(ttfread_OBJECTS) $(ttfread_DEPENDENCIES) $(EXTRA_ttfread_DEPENDENCIES)
+ @rm -f ttfread$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(ttfread_OBJECTS) $(ttfread_LDADD) $(LIBS)
+install-pkgfilterSCRIPTS: $(pkgfilter_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgfilter_SCRIPTS)'; test -n "$(pkgfilterdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgfilterdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgfilterdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pkgfilterdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pkgfilterdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-pkgfilterSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgfilter_SCRIPTS)'; test -n "$(pkgfilterdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(pkgfilterdir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aglfn13.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtoescpx-commandtoescpx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtopclx-commandtopclx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynstring.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed_pdf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed_sfnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frequent.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetopdf-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetopdf-imagetopdf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetoraster-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetoraster-imagetoraster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-attr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-check.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-cmyk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-dither.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-bmp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-colorspace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-gif.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-jpeg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-photocd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-pix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-png.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-pnm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-sgi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-sgilib.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-sun.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-tiff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image-zoom.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-lut.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-pack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-rgb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-srgb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libphpcups_la-phpcups.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel-ieee1284.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel-parallel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoijs-pdftoijs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPRS.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPOutputDev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashClip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashPath.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashState.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPWrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-pdftoopvp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-intervalset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-nup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-pdftopdf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-pdftopdf_jcl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-pdftopdf_processor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-pptypes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-qpdf_cm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-qpdf_pdftopdf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-qpdf_tools.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-qpdf_xobject.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftops-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftops-pdftops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftops-strcasestr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoraster-pdftoraster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rastertoescpx-rastertoescpx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rastertopclx-pcl-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rastertopclx-rastertopclx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serial-serial.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfnt_subset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test1284-ieee1284.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test1284-test1284.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_analyze.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pdf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pdf1-pdfutils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pdf1-test_pdf1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pdf2-pdfutils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pdf2-test_pdf2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcmyk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdither.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testimage-testimage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrgb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texttopdf-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texttopdf-pdfutils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texttopdf-textcommon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texttopdf-texttopdf.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libcupsfilters_la-attr.lo: cupsfilters/attr.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-attr.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-attr.Tpo -c -o libcupsfilters_la-attr.lo `test -f 'cupsfilters/attr.c' || echo '$(srcdir)/'`cupsfilters/attr.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-attr.Tpo $(DEPDIR)/libcupsfilters_la-attr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/attr.c' object='libcupsfilters_la-attr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-attr.lo `test -f 'cupsfilters/attr.c' || echo '$(srcdir)/'`cupsfilters/attr.c
+
+libcupsfilters_la-check.lo: cupsfilters/check.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-check.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-check.Tpo -c -o libcupsfilters_la-check.lo `test -f 'cupsfilters/check.c' || echo '$(srcdir)/'`cupsfilters/check.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-check.Tpo $(DEPDIR)/libcupsfilters_la-check.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/check.c' object='libcupsfilters_la-check.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-check.lo `test -f 'cupsfilters/check.c' || echo '$(srcdir)/'`cupsfilters/check.c
+
+libcupsfilters_la-cmyk.lo: cupsfilters/cmyk.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-cmyk.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-cmyk.Tpo -c -o libcupsfilters_la-cmyk.lo `test -f 'cupsfilters/cmyk.c' || echo '$(srcdir)/'`cupsfilters/cmyk.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-cmyk.Tpo $(DEPDIR)/libcupsfilters_la-cmyk.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/cmyk.c' object='libcupsfilters_la-cmyk.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-cmyk.lo `test -f 'cupsfilters/cmyk.c' || echo '$(srcdir)/'`cupsfilters/cmyk.c
+
+libcupsfilters_la-dither.lo: cupsfilters/dither.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-dither.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-dither.Tpo -c -o libcupsfilters_la-dither.lo `test -f 'cupsfilters/dither.c' || echo '$(srcdir)/'`cupsfilters/dither.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-dither.Tpo $(DEPDIR)/libcupsfilters_la-dither.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/dither.c' object='libcupsfilters_la-dither.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-dither.lo `test -f 'cupsfilters/dither.c' || echo '$(srcdir)/'`cupsfilters/dither.c
+
+libcupsfilters_la-image.lo: cupsfilters/image.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image.Tpo -c -o libcupsfilters_la-image.lo `test -f 'cupsfilters/image.c' || echo '$(srcdir)/'`cupsfilters/image.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image.Tpo $(DEPDIR)/libcupsfilters_la-image.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image.c' object='libcupsfilters_la-image.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image.lo `test -f 'cupsfilters/image.c' || echo '$(srcdir)/'`cupsfilters/image.c
+
+libcupsfilters_la-image-bmp.lo: cupsfilters/image-bmp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-bmp.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-bmp.Tpo -c -o libcupsfilters_la-image-bmp.lo `test -f 'cupsfilters/image-bmp.c' || echo '$(srcdir)/'`cupsfilters/image-bmp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-bmp.Tpo $(DEPDIR)/libcupsfilters_la-image-bmp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-bmp.c' object='libcupsfilters_la-image-bmp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-bmp.lo `test -f 'cupsfilters/image-bmp.c' || echo '$(srcdir)/'`cupsfilters/image-bmp.c
+
+libcupsfilters_la-image-colorspace.lo: cupsfilters/image-colorspace.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-colorspace.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-colorspace.Tpo -c -o libcupsfilters_la-image-colorspace.lo `test -f 'cupsfilters/image-colorspace.c' || echo '$(srcdir)/'`cupsfilters/image-colorspace.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-colorspace.Tpo $(DEPDIR)/libcupsfilters_la-image-colorspace.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-colorspace.c' object='libcupsfilters_la-image-colorspace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-colorspace.lo `test -f 'cupsfilters/image-colorspace.c' || echo '$(srcdir)/'`cupsfilters/image-colorspace.c
+
+libcupsfilters_la-image-gif.lo: cupsfilters/image-gif.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-gif.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-gif.Tpo -c -o libcupsfilters_la-image-gif.lo `test -f 'cupsfilters/image-gif.c' || echo '$(srcdir)/'`cupsfilters/image-gif.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-gif.Tpo $(DEPDIR)/libcupsfilters_la-image-gif.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-gif.c' object='libcupsfilters_la-image-gif.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-gif.lo `test -f 'cupsfilters/image-gif.c' || echo '$(srcdir)/'`cupsfilters/image-gif.c
+
+libcupsfilters_la-image-jpeg.lo: cupsfilters/image-jpeg.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-jpeg.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-jpeg.Tpo -c -o libcupsfilters_la-image-jpeg.lo `test -f 'cupsfilters/image-jpeg.c' || echo '$(srcdir)/'`cupsfilters/image-jpeg.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-jpeg.Tpo $(DEPDIR)/libcupsfilters_la-image-jpeg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-jpeg.c' object='libcupsfilters_la-image-jpeg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-jpeg.lo `test -f 'cupsfilters/image-jpeg.c' || echo '$(srcdir)/'`cupsfilters/image-jpeg.c
+
+libcupsfilters_la-image-photocd.lo: cupsfilters/image-photocd.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-photocd.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-photocd.Tpo -c -o libcupsfilters_la-image-photocd.lo `test -f 'cupsfilters/image-photocd.c' || echo '$(srcdir)/'`cupsfilters/image-photocd.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-photocd.Tpo $(DEPDIR)/libcupsfilters_la-image-photocd.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-photocd.c' object='libcupsfilters_la-image-photocd.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-photocd.lo `test -f 'cupsfilters/image-photocd.c' || echo '$(srcdir)/'`cupsfilters/image-photocd.c
+
+libcupsfilters_la-image-pix.lo: cupsfilters/image-pix.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-pix.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-pix.Tpo -c -o libcupsfilters_la-image-pix.lo `test -f 'cupsfilters/image-pix.c' || echo '$(srcdir)/'`cupsfilters/image-pix.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-pix.Tpo $(DEPDIR)/libcupsfilters_la-image-pix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-pix.c' object='libcupsfilters_la-image-pix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-pix.lo `test -f 'cupsfilters/image-pix.c' || echo '$(srcdir)/'`cupsfilters/image-pix.c
+
+libcupsfilters_la-image-png.lo: cupsfilters/image-png.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-png.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-png.Tpo -c -o libcupsfilters_la-image-png.lo `test -f 'cupsfilters/image-png.c' || echo '$(srcdir)/'`cupsfilters/image-png.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-png.Tpo $(DEPDIR)/libcupsfilters_la-image-png.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-png.c' object='libcupsfilters_la-image-png.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-png.lo `test -f 'cupsfilters/image-png.c' || echo '$(srcdir)/'`cupsfilters/image-png.c
+
+libcupsfilters_la-image-pnm.lo: cupsfilters/image-pnm.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-pnm.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-pnm.Tpo -c -o libcupsfilters_la-image-pnm.lo `test -f 'cupsfilters/image-pnm.c' || echo '$(srcdir)/'`cupsfilters/image-pnm.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-pnm.Tpo $(DEPDIR)/libcupsfilters_la-image-pnm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-pnm.c' object='libcupsfilters_la-image-pnm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-pnm.lo `test -f 'cupsfilters/image-pnm.c' || echo '$(srcdir)/'`cupsfilters/image-pnm.c
+
+libcupsfilters_la-image-sgi.lo: cupsfilters/image-sgi.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-sgi.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-sgi.Tpo -c -o libcupsfilters_la-image-sgi.lo `test -f 'cupsfilters/image-sgi.c' || echo '$(srcdir)/'`cupsfilters/image-sgi.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-sgi.Tpo $(DEPDIR)/libcupsfilters_la-image-sgi.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-sgi.c' object='libcupsfilters_la-image-sgi.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-sgi.lo `test -f 'cupsfilters/image-sgi.c' || echo '$(srcdir)/'`cupsfilters/image-sgi.c
+
+libcupsfilters_la-image-sgilib.lo: cupsfilters/image-sgilib.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-sgilib.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-sgilib.Tpo -c -o libcupsfilters_la-image-sgilib.lo `test -f 'cupsfilters/image-sgilib.c' || echo '$(srcdir)/'`cupsfilters/image-sgilib.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-sgilib.Tpo $(DEPDIR)/libcupsfilters_la-image-sgilib.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-sgilib.c' object='libcupsfilters_la-image-sgilib.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-sgilib.lo `test -f 'cupsfilters/image-sgilib.c' || echo '$(srcdir)/'`cupsfilters/image-sgilib.c
+
+libcupsfilters_la-image-sun.lo: cupsfilters/image-sun.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-sun.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-sun.Tpo -c -o libcupsfilters_la-image-sun.lo `test -f 'cupsfilters/image-sun.c' || echo '$(srcdir)/'`cupsfilters/image-sun.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-sun.Tpo $(DEPDIR)/libcupsfilters_la-image-sun.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-sun.c' object='libcupsfilters_la-image-sun.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-sun.lo `test -f 'cupsfilters/image-sun.c' || echo '$(srcdir)/'`cupsfilters/image-sun.c
+
+libcupsfilters_la-image-tiff.lo: cupsfilters/image-tiff.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-tiff.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-tiff.Tpo -c -o libcupsfilters_la-image-tiff.lo `test -f 'cupsfilters/image-tiff.c' || echo '$(srcdir)/'`cupsfilters/image-tiff.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-tiff.Tpo $(DEPDIR)/libcupsfilters_la-image-tiff.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-tiff.c' object='libcupsfilters_la-image-tiff.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-tiff.lo `test -f 'cupsfilters/image-tiff.c' || echo '$(srcdir)/'`cupsfilters/image-tiff.c
+
+libcupsfilters_la-image-zoom.lo: cupsfilters/image-zoom.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-image-zoom.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-image-zoom.Tpo -c -o libcupsfilters_la-image-zoom.lo `test -f 'cupsfilters/image-zoom.c' || echo '$(srcdir)/'`cupsfilters/image-zoom.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-image-zoom.Tpo $(DEPDIR)/libcupsfilters_la-image-zoom.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/image-zoom.c' object='libcupsfilters_la-image-zoom.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-image-zoom.lo `test -f 'cupsfilters/image-zoom.c' || echo '$(srcdir)/'`cupsfilters/image-zoom.c
+
+libcupsfilters_la-lut.lo: cupsfilters/lut.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-lut.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-lut.Tpo -c -o libcupsfilters_la-lut.lo `test -f 'cupsfilters/lut.c' || echo '$(srcdir)/'`cupsfilters/lut.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-lut.Tpo $(DEPDIR)/libcupsfilters_la-lut.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/lut.c' object='libcupsfilters_la-lut.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-lut.lo `test -f 'cupsfilters/lut.c' || echo '$(srcdir)/'`cupsfilters/lut.c
+
+libcupsfilters_la-pack.lo: cupsfilters/pack.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-pack.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-pack.Tpo -c -o libcupsfilters_la-pack.lo `test -f 'cupsfilters/pack.c' || echo '$(srcdir)/'`cupsfilters/pack.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-pack.Tpo $(DEPDIR)/libcupsfilters_la-pack.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/pack.c' object='libcupsfilters_la-pack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-pack.lo `test -f 'cupsfilters/pack.c' || echo '$(srcdir)/'`cupsfilters/pack.c
+
+libcupsfilters_la-rgb.lo: cupsfilters/rgb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-rgb.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-rgb.Tpo -c -o libcupsfilters_la-rgb.lo `test -f 'cupsfilters/rgb.c' || echo '$(srcdir)/'`cupsfilters/rgb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-rgb.Tpo $(DEPDIR)/libcupsfilters_la-rgb.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/rgb.c' object='libcupsfilters_la-rgb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-rgb.lo `test -f 'cupsfilters/rgb.c' || echo '$(srcdir)/'`cupsfilters/rgb.c
+
+libcupsfilters_la-srgb.lo: cupsfilters/srgb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-srgb.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-srgb.Tpo -c -o libcupsfilters_la-srgb.lo `test -f 'cupsfilters/srgb.c' || echo '$(srcdir)/'`cupsfilters/srgb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-srgb.Tpo $(DEPDIR)/libcupsfilters_la-srgb.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/srgb.c' object='libcupsfilters_la-srgb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-srgb.lo `test -f 'cupsfilters/srgb.c' || echo '$(srcdir)/'`cupsfilters/srgb.c
+
+aglfn13.lo: fontembed/aglfn13.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT aglfn13.lo -MD -MP -MF $(DEPDIR)/aglfn13.Tpo -c -o aglfn13.lo `test -f 'fontembed/aglfn13.c' || echo '$(srcdir)/'`fontembed/aglfn13.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/aglfn13.Tpo $(DEPDIR)/aglfn13.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/aglfn13.c' object='aglfn13.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aglfn13.lo `test -f 'fontembed/aglfn13.c' || echo '$(srcdir)/'`fontembed/aglfn13.c
+
+dynstring.lo: fontembed/dynstring.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dynstring.lo -MD -MP -MF $(DEPDIR)/dynstring.Tpo -c -o dynstring.lo `test -f 'fontembed/dynstring.c' || echo '$(srcdir)/'`fontembed/dynstring.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dynstring.Tpo $(DEPDIR)/dynstring.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/dynstring.c' object='dynstring.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dynstring.lo `test -f 'fontembed/dynstring.c' || echo '$(srcdir)/'`fontembed/dynstring.c
+
+embed.lo: fontembed/embed.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT embed.lo -MD -MP -MF $(DEPDIR)/embed.Tpo -c -o embed.lo `test -f 'fontembed/embed.c' || echo '$(srcdir)/'`fontembed/embed.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/embed.Tpo $(DEPDIR)/embed.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/embed.c' object='embed.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o embed.lo `test -f 'fontembed/embed.c' || echo '$(srcdir)/'`fontembed/embed.c
+
+embed_sfnt.lo: fontembed/embed_sfnt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT embed_sfnt.lo -MD -MP -MF $(DEPDIR)/embed_sfnt.Tpo -c -o embed_sfnt.lo `test -f 'fontembed/embed_sfnt.c' || echo '$(srcdir)/'`fontembed/embed_sfnt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/embed_sfnt.Tpo $(DEPDIR)/embed_sfnt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/embed_sfnt.c' object='embed_sfnt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o embed_sfnt.lo `test -f 'fontembed/embed_sfnt.c' || echo '$(srcdir)/'`fontembed/embed_sfnt.c
+
+embed_pdf.lo: fontembed/embed_pdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT embed_pdf.lo -MD -MP -MF $(DEPDIR)/embed_pdf.Tpo -c -o embed_pdf.lo `test -f 'fontembed/embed_pdf.c' || echo '$(srcdir)/'`fontembed/embed_pdf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/embed_pdf.Tpo $(DEPDIR)/embed_pdf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/embed_pdf.c' object='embed_pdf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o embed_pdf.lo `test -f 'fontembed/embed_pdf.c' || echo '$(srcdir)/'`fontembed/embed_pdf.c
+
+fontfile.lo: fontembed/fontfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fontfile.lo -MD -MP -MF $(DEPDIR)/fontfile.Tpo -c -o fontfile.lo `test -f 'fontembed/fontfile.c' || echo '$(srcdir)/'`fontembed/fontfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fontfile.Tpo $(DEPDIR)/fontfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/fontfile.c' object='fontfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fontfile.lo `test -f 'fontembed/fontfile.c' || echo '$(srcdir)/'`fontembed/fontfile.c
+
+frequent.lo: fontembed/frequent.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT frequent.lo -MD -MP -MF $(DEPDIR)/frequent.Tpo -c -o frequent.lo `test -f 'fontembed/frequent.c' || echo '$(srcdir)/'`fontembed/frequent.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/frequent.Tpo $(DEPDIR)/frequent.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/frequent.c' object='frequent.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o frequent.lo `test -f 'fontembed/frequent.c' || echo '$(srcdir)/'`fontembed/frequent.c
+
+sfnt.lo: fontembed/sfnt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sfnt.lo -MD -MP -MF $(DEPDIR)/sfnt.Tpo -c -o sfnt.lo `test -f 'fontembed/sfnt.c' || echo '$(srcdir)/'`fontembed/sfnt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sfnt.Tpo $(DEPDIR)/sfnt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/sfnt.c' object='sfnt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sfnt.lo `test -f 'fontembed/sfnt.c' || echo '$(srcdir)/'`fontembed/sfnt.c
+
+sfnt_subset.lo: fontembed/sfnt_subset.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sfnt_subset.lo -MD -MP -MF $(DEPDIR)/sfnt_subset.Tpo -c -o sfnt_subset.lo `test -f 'fontembed/sfnt_subset.c' || echo '$(srcdir)/'`fontembed/sfnt_subset.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sfnt_subset.Tpo $(DEPDIR)/sfnt_subset.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/sfnt_subset.c' object='sfnt_subset.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sfnt_subset.lo `test -f 'fontembed/sfnt_subset.c' || echo '$(srcdir)/'`fontembed/sfnt_subset.c
+
+libphpcups_la-phpcups.lo: scripting/php/phpcups.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libphpcups_la_CFLAGS) $(CFLAGS) -MT libphpcups_la-phpcups.lo -MD -MP -MF $(DEPDIR)/libphpcups_la-phpcups.Tpo -c -o libphpcups_la-phpcups.lo `test -f 'scripting/php/phpcups.c' || echo '$(srcdir)/'`scripting/php/phpcups.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libphpcups_la-phpcups.Tpo $(DEPDIR)/libphpcups_la-phpcups.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scripting/php/phpcups.c' object='libphpcups_la-phpcups.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libphpcups_la_CFLAGS) $(CFLAGS) -c -o libphpcups_la-phpcups.lo `test -f 'scripting/php/phpcups.c' || echo '$(srcdir)/'`scripting/php/phpcups.c
+
+commandtoescpx-commandtoescpx.o: filter/commandtoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtoescpx_CFLAGS) $(CFLAGS) -MT commandtoescpx-commandtoescpx.o -MD -MP -MF $(DEPDIR)/commandtoescpx-commandtoescpx.Tpo -c -o commandtoescpx-commandtoescpx.o `test -f 'filter/commandtoescpx.c' || echo '$(srcdir)/'`filter/commandtoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/commandtoescpx-commandtoescpx.Tpo $(DEPDIR)/commandtoescpx-commandtoescpx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/commandtoescpx.c' object='commandtoescpx-commandtoescpx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtoescpx_CFLAGS) $(CFLAGS) -c -o commandtoescpx-commandtoescpx.o `test -f 'filter/commandtoescpx.c' || echo '$(srcdir)/'`filter/commandtoescpx.c
+
+commandtoescpx-commandtoescpx.obj: filter/commandtoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtoescpx_CFLAGS) $(CFLAGS) -MT commandtoescpx-commandtoescpx.obj -MD -MP -MF $(DEPDIR)/commandtoescpx-commandtoescpx.Tpo -c -o commandtoescpx-commandtoescpx.obj `if test -f 'filter/commandtoescpx.c'; then $(CYGPATH_W) 'filter/commandtoescpx.c'; else $(CYGPATH_W) '$(srcdir)/filter/commandtoescpx.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/commandtoescpx-commandtoescpx.Tpo $(DEPDIR)/commandtoescpx-commandtoescpx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/commandtoescpx.c' object='commandtoescpx-commandtoescpx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtoescpx_CFLAGS) $(CFLAGS) -c -o commandtoescpx-commandtoescpx.obj `if test -f 'filter/commandtoescpx.c'; then $(CYGPATH_W) 'filter/commandtoescpx.c'; else $(CYGPATH_W) '$(srcdir)/filter/commandtoescpx.c'; fi`
+
+commandtopclx-commandtopclx.o: filter/commandtopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtopclx_CFLAGS) $(CFLAGS) -MT commandtopclx-commandtopclx.o -MD -MP -MF $(DEPDIR)/commandtopclx-commandtopclx.Tpo -c -o commandtopclx-commandtopclx.o `test -f 'filter/commandtopclx.c' || echo '$(srcdir)/'`filter/commandtopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/commandtopclx-commandtopclx.Tpo $(DEPDIR)/commandtopclx-commandtopclx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/commandtopclx.c' object='commandtopclx-commandtopclx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtopclx_CFLAGS) $(CFLAGS) -c -o commandtopclx-commandtopclx.o `test -f 'filter/commandtopclx.c' || echo '$(srcdir)/'`filter/commandtopclx.c
+
+commandtopclx-commandtopclx.obj: filter/commandtopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtopclx_CFLAGS) $(CFLAGS) -MT commandtopclx-commandtopclx.obj -MD -MP -MF $(DEPDIR)/commandtopclx-commandtopclx.Tpo -c -o commandtopclx-commandtopclx.obj `if test -f 'filter/commandtopclx.c'; then $(CYGPATH_W) 'filter/commandtopclx.c'; else $(CYGPATH_W) '$(srcdir)/filter/commandtopclx.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/commandtopclx-commandtopclx.Tpo $(DEPDIR)/commandtopclx-commandtopclx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/commandtopclx.c' object='commandtopclx-commandtopclx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtopclx_CFLAGS) $(CFLAGS) -c -o commandtopclx-commandtopclx.obj `if test -f 'filter/commandtopclx.c'; then $(CYGPATH_W) 'filter/commandtopclx.c'; else $(CYGPATH_W) '$(srcdir)/filter/commandtopclx.c'; fi`
+
+imagetopdf-common.o: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -MT imagetopdf-common.o -MD -MP -MF $(DEPDIR)/imagetopdf-common.Tpo -c -o imagetopdf-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetopdf-common.Tpo $(DEPDIR)/imagetopdf-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='imagetopdf-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -c -o imagetopdf-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+
+imagetopdf-common.obj: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -MT imagetopdf-common.obj -MD -MP -MF $(DEPDIR)/imagetopdf-common.Tpo -c -o imagetopdf-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetopdf-common.Tpo $(DEPDIR)/imagetopdf-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='imagetopdf-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -c -o imagetopdf-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+
+imagetopdf-imagetopdf.o: filter/imagetopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -MT imagetopdf-imagetopdf.o -MD -MP -MF $(DEPDIR)/imagetopdf-imagetopdf.Tpo -c -o imagetopdf-imagetopdf.o `test -f 'filter/imagetopdf.c' || echo '$(srcdir)/'`filter/imagetopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetopdf-imagetopdf.Tpo $(DEPDIR)/imagetopdf-imagetopdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/imagetopdf.c' object='imagetopdf-imagetopdf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -c -o imagetopdf-imagetopdf.o `test -f 'filter/imagetopdf.c' || echo '$(srcdir)/'`filter/imagetopdf.c
+
+imagetopdf-imagetopdf.obj: filter/imagetopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -MT imagetopdf-imagetopdf.obj -MD -MP -MF $(DEPDIR)/imagetopdf-imagetopdf.Tpo -c -o imagetopdf-imagetopdf.obj `if test -f 'filter/imagetopdf.c'; then $(CYGPATH_W) 'filter/imagetopdf.c'; else $(CYGPATH_W) '$(srcdir)/filter/imagetopdf.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetopdf-imagetopdf.Tpo $(DEPDIR)/imagetopdf-imagetopdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/imagetopdf.c' object='imagetopdf-imagetopdf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -c -o imagetopdf-imagetopdf.obj `if test -f 'filter/imagetopdf.c'; then $(CYGPATH_W) 'filter/imagetopdf.c'; else $(CYGPATH_W) '$(srcdir)/filter/imagetopdf.c'; fi`
+
+imagetoraster-common.o: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -MT imagetoraster-common.o -MD -MP -MF $(DEPDIR)/imagetoraster-common.Tpo -c -o imagetoraster-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetoraster-common.Tpo $(DEPDIR)/imagetoraster-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='imagetoraster-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -c -o imagetoraster-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+
+imagetoraster-common.obj: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -MT imagetoraster-common.obj -MD -MP -MF $(DEPDIR)/imagetoraster-common.Tpo -c -o imagetoraster-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetoraster-common.Tpo $(DEPDIR)/imagetoraster-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='imagetoraster-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -c -o imagetoraster-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+
+imagetoraster-imagetoraster.o: filter/imagetoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -MT imagetoraster-imagetoraster.o -MD -MP -MF $(DEPDIR)/imagetoraster-imagetoraster.Tpo -c -o imagetoraster-imagetoraster.o `test -f 'filter/imagetoraster.c' || echo '$(srcdir)/'`filter/imagetoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetoraster-imagetoraster.Tpo $(DEPDIR)/imagetoraster-imagetoraster.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/imagetoraster.c' object='imagetoraster-imagetoraster.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -c -o imagetoraster-imagetoraster.o `test -f 'filter/imagetoraster.c' || echo '$(srcdir)/'`filter/imagetoraster.c
+
+imagetoraster-imagetoraster.obj: filter/imagetoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -MT imagetoraster-imagetoraster.obj -MD -MP -MF $(DEPDIR)/imagetoraster-imagetoraster.Tpo -c -o imagetoraster-imagetoraster.obj `if test -f 'filter/imagetoraster.c'; then $(CYGPATH_W) 'filter/imagetoraster.c'; else $(CYGPATH_W) '$(srcdir)/filter/imagetoraster.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetoraster-imagetoraster.Tpo $(DEPDIR)/imagetoraster-imagetoraster.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/imagetoraster.c' object='imagetoraster-imagetoraster.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetoraster_CFLAGS) $(CFLAGS) -c -o imagetoraster-imagetoraster.obj `if test -f 'filter/imagetoraster.c'; then $(CYGPATH_W) 'filter/imagetoraster.c'; else $(CYGPATH_W) '$(srcdir)/filter/imagetoraster.c'; fi`
+
+parallel-ieee1284.o: backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -MT parallel-ieee1284.o -MD -MP -MF $(DEPDIR)/parallel-ieee1284.Tpo -c -o parallel-ieee1284.o `test -f 'backend/ieee1284.c' || echo '$(srcdir)/'`backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parallel-ieee1284.Tpo $(DEPDIR)/parallel-ieee1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/ieee1284.c' object='parallel-ieee1284.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -c -o parallel-ieee1284.o `test -f 'backend/ieee1284.c' || echo '$(srcdir)/'`backend/ieee1284.c
+
+parallel-ieee1284.obj: backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -MT parallel-ieee1284.obj -MD -MP -MF $(DEPDIR)/parallel-ieee1284.Tpo -c -o parallel-ieee1284.obj `if test -f 'backend/ieee1284.c'; then $(CYGPATH_W) 'backend/ieee1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/ieee1284.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parallel-ieee1284.Tpo $(DEPDIR)/parallel-ieee1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/ieee1284.c' object='parallel-ieee1284.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -c -o parallel-ieee1284.obj `if test -f 'backend/ieee1284.c'; then $(CYGPATH_W) 'backend/ieee1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/ieee1284.c'; fi`
+
+parallel-parallel.o: backend/parallel.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -MT parallel-parallel.o -MD -MP -MF $(DEPDIR)/parallel-parallel.Tpo -c -o parallel-parallel.o `test -f 'backend/parallel.c' || echo '$(srcdir)/'`backend/parallel.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parallel-parallel.Tpo $(DEPDIR)/parallel-parallel.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/parallel.c' object='parallel-parallel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -c -o parallel-parallel.o `test -f 'backend/parallel.c' || echo '$(srcdir)/'`backend/parallel.c
+
+parallel-parallel.obj: backend/parallel.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -MT parallel-parallel.obj -MD -MP -MF $(DEPDIR)/parallel-parallel.Tpo -c -o parallel-parallel.obj `if test -f 'backend/parallel.c'; then $(CYGPATH_W) 'backend/parallel.c'; else $(CYGPATH_W) '$(srcdir)/backend/parallel.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parallel-parallel.Tpo $(DEPDIR)/parallel-parallel.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/parallel.c' object='parallel-parallel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(parallel_CFLAGS) $(CFLAGS) -c -o parallel-parallel.obj `if test -f 'backend/parallel.c'; then $(CYGPATH_W) 'backend/parallel.c'; else $(CYGPATH_W) '$(srcdir)/backend/parallel.c'; fi`
+
+pdftops-common.o: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-common.o -MD -MP -MF $(DEPDIR)/pdftops-common.Tpo -c -o pdftops-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-common.Tpo $(DEPDIR)/pdftops-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='pdftops-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+
+pdftops-common.obj: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-common.obj -MD -MP -MF $(DEPDIR)/pdftops-common.Tpo -c -o pdftops-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-common.Tpo $(DEPDIR)/pdftops-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='pdftops-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+
+pdftops-pdftops.o: filter/pdftops.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-pdftops.o -MD -MP -MF $(DEPDIR)/pdftops-pdftops.Tpo -c -o pdftops-pdftops.o `test -f 'filter/pdftops.c' || echo '$(srcdir)/'`filter/pdftops.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-pdftops.Tpo $(DEPDIR)/pdftops-pdftops.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdftops.c' object='pdftops-pdftops.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-pdftops.o `test -f 'filter/pdftops.c' || echo '$(srcdir)/'`filter/pdftops.c
+
+pdftops-pdftops.obj: filter/pdftops.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-pdftops.obj -MD -MP -MF $(DEPDIR)/pdftops-pdftops.Tpo -c -o pdftops-pdftops.obj `if test -f 'filter/pdftops.c'; then $(CYGPATH_W) 'filter/pdftops.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdftops.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-pdftops.Tpo $(DEPDIR)/pdftops-pdftops.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdftops.c' object='pdftops-pdftops.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-pdftops.obj `if test -f 'filter/pdftops.c'; then $(CYGPATH_W) 'filter/pdftops.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdftops.c'; fi`
+
+pdftops-strcasestr.o: filter/strcasestr.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-strcasestr.o -MD -MP -MF $(DEPDIR)/pdftops-strcasestr.Tpo -c -o pdftops-strcasestr.o `test -f 'filter/strcasestr.c' || echo '$(srcdir)/'`filter/strcasestr.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-strcasestr.Tpo $(DEPDIR)/pdftops-strcasestr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/strcasestr.c' object='pdftops-strcasestr.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-strcasestr.o `test -f 'filter/strcasestr.c' || echo '$(srcdir)/'`filter/strcasestr.c
+
+pdftops-strcasestr.obj: filter/strcasestr.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -MT pdftops-strcasestr.obj -MD -MP -MF $(DEPDIR)/pdftops-strcasestr.Tpo -c -o pdftops-strcasestr.obj `if test -f 'filter/strcasestr.c'; then $(CYGPATH_W) 'filter/strcasestr.c'; else $(CYGPATH_W) '$(srcdir)/filter/strcasestr.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftops-strcasestr.Tpo $(DEPDIR)/pdftops-strcasestr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/strcasestr.c' object='pdftops-strcasestr.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftops_CFLAGS) $(CFLAGS) -c -o pdftops-strcasestr.obj `if test -f 'filter/strcasestr.c'; then $(CYGPATH_W) 'filter/strcasestr.c'; else $(CYGPATH_W) '$(srcdir)/filter/strcasestr.c'; fi`
+
+rastertoescpx-rastertoescpx.o: filter/rastertoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertoescpx_CFLAGS) $(CFLAGS) -MT rastertoescpx-rastertoescpx.o -MD -MP -MF $(DEPDIR)/rastertoescpx-rastertoescpx.Tpo -c -o rastertoescpx-rastertoescpx.o `test -f 'filter/rastertoescpx.c' || echo '$(srcdir)/'`filter/rastertoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertoescpx-rastertoescpx.Tpo $(DEPDIR)/rastertoescpx-rastertoescpx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/rastertoescpx.c' object='rastertoescpx-rastertoescpx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertoescpx_CFLAGS) $(CFLAGS) -c -o rastertoescpx-rastertoescpx.o `test -f 'filter/rastertoescpx.c' || echo '$(srcdir)/'`filter/rastertoescpx.c
+
+rastertoescpx-rastertoescpx.obj: filter/rastertoescpx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertoescpx_CFLAGS) $(CFLAGS) -MT rastertoescpx-rastertoescpx.obj -MD -MP -MF $(DEPDIR)/rastertoescpx-rastertoescpx.Tpo -c -o rastertoescpx-rastertoescpx.obj `if test -f 'filter/rastertoescpx.c'; then $(CYGPATH_W) 'filter/rastertoescpx.c'; else $(CYGPATH_W) '$(srcdir)/filter/rastertoescpx.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertoescpx-rastertoescpx.Tpo $(DEPDIR)/rastertoescpx-rastertoescpx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/rastertoescpx.c' object='rastertoescpx-rastertoescpx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertoescpx_CFLAGS) $(CFLAGS) -c -o rastertoescpx-rastertoescpx.obj `if test -f 'filter/rastertoescpx.c'; then $(CYGPATH_W) 'filter/rastertoescpx.c'; else $(CYGPATH_W) '$(srcdir)/filter/rastertoescpx.c'; fi`
+
+rastertopclx-pcl-common.o: filter/pcl-common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -MT rastertopclx-pcl-common.o -MD -MP -MF $(DEPDIR)/rastertopclx-pcl-common.Tpo -c -o rastertopclx-pcl-common.o `test -f 'filter/pcl-common.c' || echo '$(srcdir)/'`filter/pcl-common.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertopclx-pcl-common.Tpo $(DEPDIR)/rastertopclx-pcl-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pcl-common.c' object='rastertopclx-pcl-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -c -o rastertopclx-pcl-common.o `test -f 'filter/pcl-common.c' || echo '$(srcdir)/'`filter/pcl-common.c
+
+rastertopclx-pcl-common.obj: filter/pcl-common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -MT rastertopclx-pcl-common.obj -MD -MP -MF $(DEPDIR)/rastertopclx-pcl-common.Tpo -c -o rastertopclx-pcl-common.obj `if test -f 'filter/pcl-common.c'; then $(CYGPATH_W) 'filter/pcl-common.c'; else $(CYGPATH_W) '$(srcdir)/filter/pcl-common.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertopclx-pcl-common.Tpo $(DEPDIR)/rastertopclx-pcl-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pcl-common.c' object='rastertopclx-pcl-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -c -o rastertopclx-pcl-common.obj `if test -f 'filter/pcl-common.c'; then $(CYGPATH_W) 'filter/pcl-common.c'; else $(CYGPATH_W) '$(srcdir)/filter/pcl-common.c'; fi`
+
+rastertopclx-rastertopclx.o: filter/rastertopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -MT rastertopclx-rastertopclx.o -MD -MP -MF $(DEPDIR)/rastertopclx-rastertopclx.Tpo -c -o rastertopclx-rastertopclx.o `test -f 'filter/rastertopclx.c' || echo '$(srcdir)/'`filter/rastertopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertopclx-rastertopclx.Tpo $(DEPDIR)/rastertopclx-rastertopclx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/rastertopclx.c' object='rastertopclx-rastertopclx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -c -o rastertopclx-rastertopclx.o `test -f 'filter/rastertopclx.c' || echo '$(srcdir)/'`filter/rastertopclx.c
+
+rastertopclx-rastertopclx.obj: filter/rastertopclx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -MT rastertopclx-rastertopclx.obj -MD -MP -MF $(DEPDIR)/rastertopclx-rastertopclx.Tpo -c -o rastertopclx-rastertopclx.obj `if test -f 'filter/rastertopclx.c'; then $(CYGPATH_W) 'filter/rastertopclx.c'; else $(CYGPATH_W) '$(srcdir)/filter/rastertopclx.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rastertopclx-rastertopclx.Tpo $(DEPDIR)/rastertopclx-rastertopclx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/rastertopclx.c' object='rastertopclx-rastertopclx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rastertopclx_CFLAGS) $(CFLAGS) -c -o rastertopclx-rastertopclx.obj `if test -f 'filter/rastertopclx.c'; then $(CYGPATH_W) 'filter/rastertopclx.c'; else $(CYGPATH_W) '$(srcdir)/filter/rastertopclx.c'; fi`
+
+serial-serial.o: backend/serial.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(serial_CFLAGS) $(CFLAGS) -MT serial-serial.o -MD -MP -MF $(DEPDIR)/serial-serial.Tpo -c -o serial-serial.o `test -f 'backend/serial.c' || echo '$(srcdir)/'`backend/serial.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/serial-serial.Tpo $(DEPDIR)/serial-serial.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/serial.c' object='serial-serial.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(serial_CFLAGS) $(CFLAGS) -c -o serial-serial.o `test -f 'backend/serial.c' || echo '$(srcdir)/'`backend/serial.c
+
+serial-serial.obj: backend/serial.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(serial_CFLAGS) $(CFLAGS) -MT serial-serial.obj -MD -MP -MF $(DEPDIR)/serial-serial.Tpo -c -o serial-serial.obj `if test -f 'backend/serial.c'; then $(CYGPATH_W) 'backend/serial.c'; else $(CYGPATH_W) '$(srcdir)/backend/serial.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/serial-serial.Tpo $(DEPDIR)/serial-serial.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/serial.c' object='serial-serial.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(serial_CFLAGS) $(CFLAGS) -c -o serial-serial.obj `if test -f 'backend/serial.c'; then $(CYGPATH_W) 'backend/serial.c'; else $(CYGPATH_W) '$(srcdir)/backend/serial.c'; fi`
+
+test1284-ieee1284.o: backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -MT test1284-ieee1284.o -MD -MP -MF $(DEPDIR)/test1284-ieee1284.Tpo -c -o test1284-ieee1284.o `test -f 'backend/ieee1284.c' || echo '$(srcdir)/'`backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test1284-ieee1284.Tpo $(DEPDIR)/test1284-ieee1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/ieee1284.c' object='test1284-ieee1284.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -c -o test1284-ieee1284.o `test -f 'backend/ieee1284.c' || echo '$(srcdir)/'`backend/ieee1284.c
+
+test1284-ieee1284.obj: backend/ieee1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -MT test1284-ieee1284.obj -MD -MP -MF $(DEPDIR)/test1284-ieee1284.Tpo -c -o test1284-ieee1284.obj `if test -f 'backend/ieee1284.c'; then $(CYGPATH_W) 'backend/ieee1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/ieee1284.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test1284-ieee1284.Tpo $(DEPDIR)/test1284-ieee1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/ieee1284.c' object='test1284-ieee1284.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -c -o test1284-ieee1284.obj `if test -f 'backend/ieee1284.c'; then $(CYGPATH_W) 'backend/ieee1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/ieee1284.c'; fi`
+
+test1284-test1284.o: backend/test1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -MT test1284-test1284.o -MD -MP -MF $(DEPDIR)/test1284-test1284.Tpo -c -o test1284-test1284.o `test -f 'backend/test1284.c' || echo '$(srcdir)/'`backend/test1284.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test1284-test1284.Tpo $(DEPDIR)/test1284-test1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/test1284.c' object='test1284-test1284.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -c -o test1284-test1284.o `test -f 'backend/test1284.c' || echo '$(srcdir)/'`backend/test1284.c
+
+test1284-test1284.obj: backend/test1284.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -MT test1284-test1284.obj -MD -MP -MF $(DEPDIR)/test1284-test1284.Tpo -c -o test1284-test1284.obj `if test -f 'backend/test1284.c'; then $(CYGPATH_W) 'backend/test1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/test1284.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test1284-test1284.Tpo $(DEPDIR)/test1284-test1284.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backend/test1284.c' object='test1284-test1284.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test1284_CFLAGS) $(CFLAGS) -c -o test1284-test1284.obj `if test -f 'backend/test1284.c'; then $(CYGPATH_W) 'backend/test1284.c'; else $(CYGPATH_W) '$(srcdir)/backend/test1284.c'; fi`
+
+test_analyze.o: fontembed/test_analyze.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_analyze.o -MD -MP -MF $(DEPDIR)/test_analyze.Tpo -c -o test_analyze.o `test -f 'fontembed/test_analyze.c' || echo '$(srcdir)/'`fontembed/test_analyze.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_analyze.Tpo $(DEPDIR)/test_analyze.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_analyze.c' object='test_analyze.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_analyze.o `test -f 'fontembed/test_analyze.c' || echo '$(srcdir)/'`fontembed/test_analyze.c
+
+test_analyze.obj: fontembed/test_analyze.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_analyze.obj -MD -MP -MF $(DEPDIR)/test_analyze.Tpo -c -o test_analyze.obj `if test -f 'fontembed/test_analyze.c'; then $(CYGPATH_W) 'fontembed/test_analyze.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_analyze.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_analyze.Tpo $(DEPDIR)/test_analyze.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_analyze.c' object='test_analyze.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_analyze.obj `if test -f 'fontembed/test_analyze.c'; then $(CYGPATH_W) 'fontembed/test_analyze.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_analyze.c'; fi`
+
+test_pdf.o: fontembed/test_pdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_pdf.o -MD -MP -MF $(DEPDIR)/test_pdf.Tpo -c -o test_pdf.o `test -f 'fontembed/test_pdf.c' || echo '$(srcdir)/'`fontembed/test_pdf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf.Tpo $(DEPDIR)/test_pdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_pdf.c' object='test_pdf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_pdf.o `test -f 'fontembed/test_pdf.c' || echo '$(srcdir)/'`fontembed/test_pdf.c
+
+test_pdf.obj: fontembed/test_pdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_pdf.obj -MD -MP -MF $(DEPDIR)/test_pdf.Tpo -c -o test_pdf.obj `if test -f 'fontembed/test_pdf.c'; then $(CYGPATH_W) 'fontembed/test_pdf.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_pdf.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf.Tpo $(DEPDIR)/test_pdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_pdf.c' object='test_pdf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_pdf.obj `if test -f 'fontembed/test_pdf.c'; then $(CYGPATH_W) 'fontembed/test_pdf.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_pdf.c'; fi`
+
+test_pdf1-pdfutils.o: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -MT test_pdf1-pdfutils.o -MD -MP -MF $(DEPDIR)/test_pdf1-pdfutils.Tpo -c -o test_pdf1-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf1-pdfutils.Tpo $(DEPDIR)/test_pdf1-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='test_pdf1-pdfutils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -c -o test_pdf1-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+
+test_pdf1-pdfutils.obj: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -MT test_pdf1-pdfutils.obj -MD -MP -MF $(DEPDIR)/test_pdf1-pdfutils.Tpo -c -o test_pdf1-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf1-pdfutils.Tpo $(DEPDIR)/test_pdf1-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='test_pdf1-pdfutils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -c -o test_pdf1-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+
+test_pdf1-test_pdf1.o: filter/test_pdf1.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -MT test_pdf1-test_pdf1.o -MD -MP -MF $(DEPDIR)/test_pdf1-test_pdf1.Tpo -c -o test_pdf1-test_pdf1.o `test -f 'filter/test_pdf1.c' || echo '$(srcdir)/'`filter/test_pdf1.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf1-test_pdf1.Tpo $(DEPDIR)/test_pdf1-test_pdf1.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/test_pdf1.c' object='test_pdf1-test_pdf1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -c -o test_pdf1-test_pdf1.o `test -f 'filter/test_pdf1.c' || echo '$(srcdir)/'`filter/test_pdf1.c
+
+test_pdf1-test_pdf1.obj: filter/test_pdf1.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -MT test_pdf1-test_pdf1.obj -MD -MP -MF $(DEPDIR)/test_pdf1-test_pdf1.Tpo -c -o test_pdf1-test_pdf1.obj `if test -f 'filter/test_pdf1.c'; then $(CYGPATH_W) 'filter/test_pdf1.c'; else $(CYGPATH_W) '$(srcdir)/filter/test_pdf1.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf1-test_pdf1.Tpo $(DEPDIR)/test_pdf1-test_pdf1.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/test_pdf1.c' object='test_pdf1-test_pdf1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf1_CFLAGS) $(CFLAGS) -c -o test_pdf1-test_pdf1.obj `if test -f 'filter/test_pdf1.c'; then $(CYGPATH_W) 'filter/test_pdf1.c'; else $(CYGPATH_W) '$(srcdir)/filter/test_pdf1.c'; fi`
+
+test_pdf2-pdfutils.o: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -MT test_pdf2-pdfutils.o -MD -MP -MF $(DEPDIR)/test_pdf2-pdfutils.Tpo -c -o test_pdf2-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf2-pdfutils.Tpo $(DEPDIR)/test_pdf2-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='test_pdf2-pdfutils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -c -o test_pdf2-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+
+test_pdf2-pdfutils.obj: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -MT test_pdf2-pdfutils.obj -MD -MP -MF $(DEPDIR)/test_pdf2-pdfutils.Tpo -c -o test_pdf2-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf2-pdfutils.Tpo $(DEPDIR)/test_pdf2-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='test_pdf2-pdfutils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -c -o test_pdf2-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+
+test_pdf2-test_pdf2.o: filter/test_pdf2.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -MT test_pdf2-test_pdf2.o -MD -MP -MF $(DEPDIR)/test_pdf2-test_pdf2.Tpo -c -o test_pdf2-test_pdf2.o `test -f 'filter/test_pdf2.c' || echo '$(srcdir)/'`filter/test_pdf2.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf2-test_pdf2.Tpo $(DEPDIR)/test_pdf2-test_pdf2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/test_pdf2.c' object='test_pdf2-test_pdf2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -c -o test_pdf2-test_pdf2.o `test -f 'filter/test_pdf2.c' || echo '$(srcdir)/'`filter/test_pdf2.c
+
+test_pdf2-test_pdf2.obj: filter/test_pdf2.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -MT test_pdf2-test_pdf2.obj -MD -MP -MF $(DEPDIR)/test_pdf2-test_pdf2.Tpo -c -o test_pdf2-test_pdf2.obj `if test -f 'filter/test_pdf2.c'; then $(CYGPATH_W) 'filter/test_pdf2.c'; else $(CYGPATH_W) '$(srcdir)/filter/test_pdf2.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_pdf2-test_pdf2.Tpo $(DEPDIR)/test_pdf2-test_pdf2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/test_pdf2.c' object='test_pdf2-test_pdf2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_pdf2_CFLAGS) $(CFLAGS) -c -o test_pdf2-test_pdf2.obj `if test -f 'filter/test_pdf2.c'; then $(CYGPATH_W) 'filter/test_pdf2.c'; else $(CYGPATH_W) '$(srcdir)/filter/test_pdf2.c'; fi`
+
+test_ps.o: fontembed/test_ps.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ps.o -MD -MP -MF $(DEPDIR)/test_ps.Tpo -c -o test_ps.o `test -f 'fontembed/test_ps.c' || echo '$(srcdir)/'`fontembed/test_ps.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ps.Tpo $(DEPDIR)/test_ps.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_ps.c' object='test_ps.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ps.o `test -f 'fontembed/test_ps.c' || echo '$(srcdir)/'`fontembed/test_ps.c
+
+test_ps.obj: fontembed/test_ps.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_ps.obj -MD -MP -MF $(DEPDIR)/test_ps.Tpo -c -o test_ps.obj `if test -f 'fontembed/test_ps.c'; then $(CYGPATH_W) 'fontembed/test_ps.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_ps.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ps.Tpo $(DEPDIR)/test_ps.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/test_ps.c' object='test_ps.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_ps.obj `if test -f 'fontembed/test_ps.c'; then $(CYGPATH_W) 'fontembed/test_ps.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/test_ps.c'; fi`
+
+testcmyk.o: cupsfilters/testcmyk.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testcmyk.o -MD -MP -MF $(DEPDIR)/testcmyk.Tpo -c -o testcmyk.o `test -f 'cupsfilters/testcmyk.c' || echo '$(srcdir)/'`cupsfilters/testcmyk.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testcmyk.Tpo $(DEPDIR)/testcmyk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testcmyk.c' object='testcmyk.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testcmyk.o `test -f 'cupsfilters/testcmyk.c' || echo '$(srcdir)/'`cupsfilters/testcmyk.c
+
+testcmyk.obj: cupsfilters/testcmyk.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testcmyk.obj -MD -MP -MF $(DEPDIR)/testcmyk.Tpo -c -o testcmyk.obj `if test -f 'cupsfilters/testcmyk.c'; then $(CYGPATH_W) 'cupsfilters/testcmyk.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testcmyk.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testcmyk.Tpo $(DEPDIR)/testcmyk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testcmyk.c' object='testcmyk.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testcmyk.obj `if test -f 'cupsfilters/testcmyk.c'; then $(CYGPATH_W) 'cupsfilters/testcmyk.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testcmyk.c'; fi`
+
+testdither.o: cupsfilters/testdither.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testdither.o -MD -MP -MF $(DEPDIR)/testdither.Tpo -c -o testdither.o `test -f 'cupsfilters/testdither.c' || echo '$(srcdir)/'`cupsfilters/testdither.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testdither.Tpo $(DEPDIR)/testdither.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testdither.c' object='testdither.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testdither.o `test -f 'cupsfilters/testdither.c' || echo '$(srcdir)/'`cupsfilters/testdither.c
+
+testdither.obj: cupsfilters/testdither.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testdither.obj -MD -MP -MF $(DEPDIR)/testdither.Tpo -c -o testdither.obj `if test -f 'cupsfilters/testdither.c'; then $(CYGPATH_W) 'cupsfilters/testdither.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testdither.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testdither.Tpo $(DEPDIR)/testdither.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testdither.c' object='testdither.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testdither.obj `if test -f 'cupsfilters/testdither.c'; then $(CYGPATH_W) 'cupsfilters/testdither.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testdither.c'; fi`
+
+testimage-testimage.o: cupsfilters/testimage.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testimage_CFLAGS) $(CFLAGS) -MT testimage-testimage.o -MD -MP -MF $(DEPDIR)/testimage-testimage.Tpo -c -o testimage-testimage.o `test -f 'cupsfilters/testimage.c' || echo '$(srcdir)/'`cupsfilters/testimage.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testimage-testimage.Tpo $(DEPDIR)/testimage-testimage.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testimage.c' object='testimage-testimage.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testimage_CFLAGS) $(CFLAGS) -c -o testimage-testimage.o `test -f 'cupsfilters/testimage.c' || echo '$(srcdir)/'`cupsfilters/testimage.c
+
+testimage-testimage.obj: cupsfilters/testimage.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testimage_CFLAGS) $(CFLAGS) -MT testimage-testimage.obj -MD -MP -MF $(DEPDIR)/testimage-testimage.Tpo -c -o testimage-testimage.obj `if test -f 'cupsfilters/testimage.c'; then $(CYGPATH_W) 'cupsfilters/testimage.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testimage.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testimage-testimage.Tpo $(DEPDIR)/testimage-testimage.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testimage.c' object='testimage-testimage.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testimage_CFLAGS) $(CFLAGS) -c -o testimage-testimage.obj `if test -f 'cupsfilters/testimage.c'; then $(CYGPATH_W) 'cupsfilters/testimage.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testimage.c'; fi`
+
+testrgb.o: cupsfilters/testrgb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrgb.o -MD -MP -MF $(DEPDIR)/testrgb.Tpo -c -o testrgb.o `test -f 'cupsfilters/testrgb.c' || echo '$(srcdir)/'`cupsfilters/testrgb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrgb.Tpo $(DEPDIR)/testrgb.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testrgb.c' object='testrgb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrgb.o `test -f 'cupsfilters/testrgb.c' || echo '$(srcdir)/'`cupsfilters/testrgb.c
+
+testrgb.obj: cupsfilters/testrgb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testrgb.obj -MD -MP -MF $(DEPDIR)/testrgb.Tpo -c -o testrgb.obj `if test -f 'cupsfilters/testrgb.c'; then $(CYGPATH_W) 'cupsfilters/testrgb.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testrgb.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testrgb.Tpo $(DEPDIR)/testrgb.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/testrgb.c' object='testrgb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testrgb.obj `if test -f 'cupsfilters/testrgb.c'; then $(CYGPATH_W) 'cupsfilters/testrgb.c'; else $(CYGPATH_W) '$(srcdir)/cupsfilters/testrgb.c'; fi`
+
+texttopdf-common.o: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-common.o -MD -MP -MF $(DEPDIR)/texttopdf-common.Tpo -c -o texttopdf-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-common.Tpo $(DEPDIR)/texttopdf-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='texttopdf-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
+
+texttopdf-common.obj: filter/common.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-common.obj -MD -MP -MF $(DEPDIR)/texttopdf-common.Tpo -c -o texttopdf-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-common.Tpo $(DEPDIR)/texttopdf-common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/common.c' object='texttopdf-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-common.obj `if test -f 'filter/common.c'; then $(CYGPATH_W) 'filter/common.c'; else $(CYGPATH_W) '$(srcdir)/filter/common.c'; fi`
+
+texttopdf-pdfutils.o: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-pdfutils.o -MD -MP -MF $(DEPDIR)/texttopdf-pdfutils.Tpo -c -o texttopdf-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-pdfutils.Tpo $(DEPDIR)/texttopdf-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='texttopdf-pdfutils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-pdfutils.o `test -f 'filter/pdfutils.c' || echo '$(srcdir)/'`filter/pdfutils.c
+
+texttopdf-pdfutils.obj: filter/pdfutils.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-pdfutils.obj -MD -MP -MF $(DEPDIR)/texttopdf-pdfutils.Tpo -c -o texttopdf-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-pdfutils.Tpo $(DEPDIR)/texttopdf-pdfutils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/pdfutils.c' object='texttopdf-pdfutils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-pdfutils.obj `if test -f 'filter/pdfutils.c'; then $(CYGPATH_W) 'filter/pdfutils.c'; else $(CYGPATH_W) '$(srcdir)/filter/pdfutils.c'; fi`
+
+texttopdf-textcommon.o: filter/textcommon.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-textcommon.o -MD -MP -MF $(DEPDIR)/texttopdf-textcommon.Tpo -c -o texttopdf-textcommon.o `test -f 'filter/textcommon.c' || echo '$(srcdir)/'`filter/textcommon.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-textcommon.Tpo $(DEPDIR)/texttopdf-textcommon.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/textcommon.c' object='texttopdf-textcommon.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-textcommon.o `test -f 'filter/textcommon.c' || echo '$(srcdir)/'`filter/textcommon.c
+
+texttopdf-textcommon.obj: filter/textcommon.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-textcommon.obj -MD -MP -MF $(DEPDIR)/texttopdf-textcommon.Tpo -c -o texttopdf-textcommon.obj `if test -f 'filter/textcommon.c'; then $(CYGPATH_W) 'filter/textcommon.c'; else $(CYGPATH_W) '$(srcdir)/filter/textcommon.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-textcommon.Tpo $(DEPDIR)/texttopdf-textcommon.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/textcommon.c' object='texttopdf-textcommon.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-textcommon.obj `if test -f 'filter/textcommon.c'; then $(CYGPATH_W) 'filter/textcommon.c'; else $(CYGPATH_W) '$(srcdir)/filter/textcommon.c'; fi`
+
+texttopdf-texttopdf.o: filter/texttopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-texttopdf.o -MD -MP -MF $(DEPDIR)/texttopdf-texttopdf.Tpo -c -o texttopdf-texttopdf.o `test -f 'filter/texttopdf.c' || echo '$(srcdir)/'`filter/texttopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-texttopdf.Tpo $(DEPDIR)/texttopdf-texttopdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/texttopdf.c' object='texttopdf-texttopdf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-texttopdf.o `test -f 'filter/texttopdf.c' || echo '$(srcdir)/'`filter/texttopdf.c
+
+texttopdf-texttopdf.obj: filter/texttopdf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -MT texttopdf-texttopdf.obj -MD -MP -MF $(DEPDIR)/texttopdf-texttopdf.Tpo -c -o texttopdf-texttopdf.obj `if test -f 'filter/texttopdf.c'; then $(CYGPATH_W) 'filter/texttopdf.c'; else $(CYGPATH_W) '$(srcdir)/filter/texttopdf.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/texttopdf-texttopdf.Tpo $(DEPDIR)/texttopdf-texttopdf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/texttopdf.c' object='texttopdf-texttopdf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(texttopdf_CFLAGS) $(CFLAGS) -c -o texttopdf-texttopdf.obj `if test -f 'filter/texttopdf.c'; then $(CYGPATH_W) 'filter/texttopdf.c'; else $(CYGPATH_W) '$(srcdir)/filter/texttopdf.c'; fi`
+
+main.o: fontembed/main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main.o -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.o `test -f 'fontembed/main.c' || echo '$(srcdir)/'`fontembed/main.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/main.c' object='main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main.o `test -f 'fontembed/main.c' || echo '$(srcdir)/'`fontembed/main.c
+
+main.obj: fontembed/main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main.obj -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.obj `if test -f 'fontembed/main.c'; then $(CYGPATH_W) 'fontembed/main.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/main.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fontembed/main.c' object='main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main.obj `if test -f 'fontembed/main.c'; then $(CYGPATH_W) 'fontembed/main.c'; else $(CYGPATH_W) '$(srcdir)/fontembed/main.c'; fi`
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+pdftoijs-pdftoijs.o: filter/pdftoijs.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoijs_CXXFLAGS) $(CXXFLAGS) -MT pdftoijs-pdftoijs.o -MD -MP -MF $(DEPDIR)/pdftoijs-pdftoijs.Tpo -c -o pdftoijs-pdftoijs.o `test -f 'filter/pdftoijs.cxx' || echo '$(srcdir)/'`filter/pdftoijs.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoijs-pdftoijs.Tpo $(DEPDIR)/pdftoijs-pdftoijs.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoijs.cxx' object='pdftoijs-pdftoijs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoijs_CXXFLAGS) $(CXXFLAGS) -c -o pdftoijs-pdftoijs.o `test -f 'filter/pdftoijs.cxx' || echo '$(srcdir)/'`filter/pdftoijs.cxx
+
+pdftoijs-pdftoijs.obj: filter/pdftoijs.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoijs_CXXFLAGS) $(CXXFLAGS) -MT pdftoijs-pdftoijs.obj -MD -MP -MF $(DEPDIR)/pdftoijs-pdftoijs.Tpo -c -o pdftoijs-pdftoijs.obj `if test -f 'filter/pdftoijs.cxx'; then $(CYGPATH_W) 'filter/pdftoijs.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoijs.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoijs-pdftoijs.Tpo $(DEPDIR)/pdftoijs-pdftoijs.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoijs.cxx' object='pdftoijs-pdftoijs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoijs_CXXFLAGS) $(CXXFLAGS) -c -o pdftoijs-pdftoijs.obj `if test -f 'filter/pdftoijs.cxx'; then $(CYGPATH_W) 'filter/pdftoijs.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoijs.cxx'; fi`
+
+pdftoopvp-OPRS.o: filter/pdftoopvp/oprs/OPRS.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPRS.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPRS.Tpo -c -o pdftoopvp-OPRS.o `test -f 'filter/pdftoopvp/oprs/OPRS.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPRS.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPRS.Tpo $(DEPDIR)/pdftoopvp-OPRS.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPRS.cxx' object='pdftoopvp-OPRS.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPRS.o `test -f 'filter/pdftoopvp/oprs/OPRS.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPRS.cxx
+
+pdftoopvp-OPRS.obj: filter/pdftoopvp/oprs/OPRS.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPRS.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPRS.Tpo -c -o pdftoopvp-OPRS.obj `if test -f 'filter/pdftoopvp/oprs/OPRS.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPRS.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPRS.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPRS.Tpo $(DEPDIR)/pdftoopvp-OPRS.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPRS.cxx' object='pdftoopvp-OPRS.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPRS.obj `if test -f 'filter/pdftoopvp/oprs/OPRS.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPRS.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPRS.cxx'; fi`
+
+pdftoopvp-OPVPSplashClip.o: filter/pdftoopvp/oprs/OPVPSplashClip.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashClip.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo -c -o pdftoopvp-OPVPSplashClip.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashClip.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashClip.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashClip.cxx' object='pdftoopvp-OPVPSplashClip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashClip.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashClip.cxx
+
+pdftoopvp-OPVPSplashClip.obj: filter/pdftoopvp/oprs/OPVPSplashClip.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashClip.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo -c -o pdftoopvp-OPVPSplashClip.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashClip.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashClip.cxx' object='pdftoopvp-OPVPSplashClip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashClip.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; fi`
+
+pdftoopvp-OPVPSplash.o: filter/pdftoopvp/oprs/OPVPSplash.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplash.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo -c -o pdftoopvp-OPVPSplash.o `test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplash.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo $(DEPDIR)/pdftoopvp-OPVPSplash.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplash.cxx' object='pdftoopvp-OPVPSplash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplash.o `test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplash.cxx
+
+pdftoopvp-OPVPSplash.obj: filter/pdftoopvp/oprs/OPVPSplash.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplash.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo -c -o pdftoopvp-OPVPSplash.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplash.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo $(DEPDIR)/pdftoopvp-OPVPSplash.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplash.cxx' object='pdftoopvp-OPVPSplash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplash.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplash.cxx'; fi`
+
+pdftoopvp-OPVPSplashPath.o: filter/pdftoopvp/oprs/OPVPSplashPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashPath.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo -c -o pdftoopvp-OPVPSplashPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashPath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashPath.cxx' object='pdftoopvp-OPVPSplashPath.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashPath.cxx
+
+pdftoopvp-OPVPSplashPath.obj: filter/pdftoopvp/oprs/OPVPSplashPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashPath.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo -c -o pdftoopvp-OPVPSplashPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashPath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashPath.cxx' object='pdftoopvp-OPVPSplashPath.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; fi`
+
+pdftoopvp-OPVPSplashState.o: filter/pdftoopvp/oprs/OPVPSplashState.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashState.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo -c -o pdftoopvp-OPVPSplashState.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashState.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashState.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashState.cxx' object='pdftoopvp-OPVPSplashState.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashState.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashState.cxx
+
+pdftoopvp-OPVPSplashState.obj: filter/pdftoopvp/oprs/OPVPSplashState.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashState.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo -c -o pdftoopvp-OPVPSplashState.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashState.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashState.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashState.cxx' object='pdftoopvp-OPVPSplashState.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashState.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashState.cxx'; fi`
+
+pdftoopvp-OPVPSplashXPath.o: filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashXPath.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo -c -o pdftoopvp-OPVPSplashXPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' object='pdftoopvp-OPVPSplashXPath.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashXPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
+
+pdftoopvp-OPVPSplashXPath.obj: filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashXPath.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo -c -o pdftoopvp-OPVPSplashXPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' object='pdftoopvp-OPVPSplashXPath.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashXPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; fi`
+
+pdftoopvp-OPVPWrapper.o: filter/pdftoopvp/oprs/OPVPWrapper.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo -c -o pdftoopvp-OPVPWrapper.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper.cxx' object='pdftoopvp-OPVPWrapper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper.cxx
+
+pdftoopvp-OPVPWrapper.obj: filter/pdftoopvp/oprs/OPVPWrapper.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo -c -o pdftoopvp-OPVPWrapper.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper.cxx' object='pdftoopvp-OPVPWrapper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper.cxx'; fi`
+
+pdftoopvp-OPVPWrapper_0_2.o: filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper_0_2.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo -c -o pdftoopvp-OPVPWrapper_0_2.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' object='pdftoopvp-OPVPWrapper_0_2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper_0_2.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
+
+pdftoopvp-OPVPWrapper_0_2.obj: filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper_0_2.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo -c -o pdftoopvp-OPVPWrapper_0_2.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' object='pdftoopvp-OPVPWrapper_0_2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper_0_2.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; fi`
+
+pdftoopvp-OPVPOutputDev.o: filter/pdftoopvp/OPVPOutputDev.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPOutputDev.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo -c -o pdftoopvp-OPVPOutputDev.o `test -f 'filter/pdftoopvp/OPVPOutputDev.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/OPVPOutputDev.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo $(DEPDIR)/pdftoopvp-OPVPOutputDev.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/OPVPOutputDev.cxx' object='pdftoopvp-OPVPOutputDev.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPOutputDev.o `test -f 'filter/pdftoopvp/OPVPOutputDev.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/OPVPOutputDev.cxx
+
+pdftoopvp-OPVPOutputDev.obj: filter/pdftoopvp/OPVPOutputDev.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPOutputDev.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo -c -o pdftoopvp-OPVPOutputDev.obj `if test -f 'filter/pdftoopvp/OPVPOutputDev.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/OPVPOutputDev.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/OPVPOutputDev.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo $(DEPDIR)/pdftoopvp-OPVPOutputDev.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/OPVPOutputDev.cxx' object='pdftoopvp-OPVPOutputDev.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPOutputDev.obj `if test -f 'filter/pdftoopvp/OPVPOutputDev.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/OPVPOutputDev.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/OPVPOutputDev.cxx'; fi`
+
+pdftoopvp-pdftoopvp.o: filter/pdftoopvp/pdftoopvp.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-pdftoopvp.o -MD -MP -MF $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo -c -o pdftoopvp-pdftoopvp.o `test -f 'filter/pdftoopvp/pdftoopvp.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/pdftoopvp.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo $(DEPDIR)/pdftoopvp-pdftoopvp.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/pdftoopvp.cxx' object='pdftoopvp-pdftoopvp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-pdftoopvp.o `test -f 'filter/pdftoopvp/pdftoopvp.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/pdftoopvp.cxx
+
+pdftoopvp-pdftoopvp.obj: filter/pdftoopvp/pdftoopvp.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-pdftoopvp.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo -c -o pdftoopvp-pdftoopvp.obj `if test -f 'filter/pdftoopvp/pdftoopvp.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/pdftoopvp.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/pdftoopvp.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo $(DEPDIR)/pdftoopvp-pdftoopvp.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/pdftoopvp.cxx' object='pdftoopvp-pdftoopvp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-pdftoopvp.obj `if test -f 'filter/pdftoopvp/pdftoopvp.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/pdftoopvp.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/pdftoopvp.cxx'; fi`
+
+pdftopdf-pdftopdf.o: filter/pdftopdf/pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf.o -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf.Tpo -c -o pdftopdf-pdftopdf.o `test -f 'filter/pdftopdf/pdftopdf.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf.Tpo $(DEPDIR)/pdftopdf-pdftopdf.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf.cc' object='pdftopdf-pdftopdf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf.o `test -f 'filter/pdftopdf/pdftopdf.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf.cc
+
+pdftopdf-pdftopdf.obj: filter/pdftopdf/pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf.obj -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf.Tpo -c -o pdftopdf-pdftopdf.obj `if test -f 'filter/pdftopdf/pdftopdf.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf.Tpo $(DEPDIR)/pdftopdf-pdftopdf.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf.cc' object='pdftopdf-pdftopdf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf.obj `if test -f 'filter/pdftopdf/pdftopdf.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf.cc'; fi`
+
+pdftopdf-pdftopdf_jcl.o: filter/pdftopdf/pdftopdf_jcl.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf_jcl.o -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf_jcl.Tpo -c -o pdftopdf-pdftopdf_jcl.o `test -f 'filter/pdftopdf/pdftopdf_jcl.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf_jcl.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf_jcl.Tpo $(DEPDIR)/pdftopdf-pdftopdf_jcl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf_jcl.cc' object='pdftopdf-pdftopdf_jcl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf_jcl.o `test -f 'filter/pdftopdf/pdftopdf_jcl.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf_jcl.cc
+
+pdftopdf-pdftopdf_jcl.obj: filter/pdftopdf/pdftopdf_jcl.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf_jcl.obj -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf_jcl.Tpo -c -o pdftopdf-pdftopdf_jcl.obj `if test -f 'filter/pdftopdf/pdftopdf_jcl.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf_jcl.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf_jcl.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf_jcl.Tpo $(DEPDIR)/pdftopdf-pdftopdf_jcl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf_jcl.cc' object='pdftopdf-pdftopdf_jcl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf_jcl.obj `if test -f 'filter/pdftopdf/pdftopdf_jcl.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf_jcl.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf_jcl.cc'; fi`
+
+pdftopdf-pdftopdf_processor.o: filter/pdftopdf/pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf_processor.o -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf_processor.Tpo -c -o pdftopdf-pdftopdf_processor.o `test -f 'filter/pdftopdf/pdftopdf_processor.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf_processor.Tpo $(DEPDIR)/pdftopdf-pdftopdf_processor.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf_processor.cc' object='pdftopdf-pdftopdf_processor.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf_processor.o `test -f 'filter/pdftopdf/pdftopdf_processor.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf_processor.cc
+
+pdftopdf-pdftopdf_processor.obj: filter/pdftopdf/pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf_processor.obj -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf_processor.Tpo -c -o pdftopdf-pdftopdf_processor.obj `if test -f 'filter/pdftopdf/pdftopdf_processor.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf_processor.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf_processor.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf_processor.Tpo $(DEPDIR)/pdftopdf-pdftopdf_processor.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pdftopdf_processor.cc' object='pdftopdf-pdftopdf_processor.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pdftopdf_processor.obj `if test -f 'filter/pdftopdf/pdftopdf_processor.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pdftopdf_processor.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pdftopdf_processor.cc'; fi`
+
+pdftopdf-qpdf_pdftopdf_processor.o: filter/pdftopdf/qpdf_pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_pdftopdf_processor.o -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Tpo -c -o pdftopdf-qpdf_pdftopdf_processor.o `test -f 'filter/pdftopdf/qpdf_pdftopdf_processor.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Tpo $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_pdftopdf_processor.cc' object='pdftopdf-qpdf_pdftopdf_processor.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_pdftopdf_processor.o `test -f 'filter/pdftopdf/qpdf_pdftopdf_processor.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_pdftopdf_processor.cc
+
+pdftopdf-qpdf_pdftopdf_processor.obj: filter/pdftopdf/qpdf_pdftopdf_processor.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_pdftopdf_processor.obj -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Tpo -c -o pdftopdf-qpdf_pdftopdf_processor.obj `if test -f 'filter/pdftopdf/qpdf_pdftopdf_processor.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_pdftopdf_processor.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_pdftopdf_processor.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Tpo $(DEPDIR)/pdftopdf-qpdf_pdftopdf_processor.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_pdftopdf_processor.cc' object='pdftopdf-qpdf_pdftopdf_processor.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_pdftopdf_processor.obj `if test -f 'filter/pdftopdf/qpdf_pdftopdf_processor.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_pdftopdf_processor.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_pdftopdf_processor.cc'; fi`
+
+pdftopdf-pptypes.o: filter/pdftopdf/pptypes.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pptypes.o -MD -MP -MF $(DEPDIR)/pdftopdf-pptypes.Tpo -c -o pdftopdf-pptypes.o `test -f 'filter/pdftopdf/pptypes.cc' || echo '$(srcdir)/'`filter/pdftopdf/pptypes.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pptypes.Tpo $(DEPDIR)/pdftopdf-pptypes.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pptypes.cc' object='pdftopdf-pptypes.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pptypes.o `test -f 'filter/pdftopdf/pptypes.cc' || echo '$(srcdir)/'`filter/pdftopdf/pptypes.cc
+
+pdftopdf-pptypes.obj: filter/pdftopdf/pptypes.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pptypes.obj -MD -MP -MF $(DEPDIR)/pdftopdf-pptypes.Tpo -c -o pdftopdf-pptypes.obj `if test -f 'filter/pdftopdf/pptypes.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pptypes.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pptypes.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pptypes.Tpo $(DEPDIR)/pdftopdf-pptypes.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/pptypes.cc' object='pdftopdf-pptypes.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-pptypes.obj `if test -f 'filter/pdftopdf/pptypes.cc'; then $(CYGPATH_W) 'filter/pdftopdf/pptypes.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/pptypes.cc'; fi`
+
+pdftopdf-nup.o: filter/pdftopdf/nup.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-nup.o -MD -MP -MF $(DEPDIR)/pdftopdf-nup.Tpo -c -o pdftopdf-nup.o `test -f 'filter/pdftopdf/nup.cc' || echo '$(srcdir)/'`filter/pdftopdf/nup.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-nup.Tpo $(DEPDIR)/pdftopdf-nup.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/nup.cc' object='pdftopdf-nup.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-nup.o `test -f 'filter/pdftopdf/nup.cc' || echo '$(srcdir)/'`filter/pdftopdf/nup.cc
+
+pdftopdf-nup.obj: filter/pdftopdf/nup.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-nup.obj -MD -MP -MF $(DEPDIR)/pdftopdf-nup.Tpo -c -o pdftopdf-nup.obj `if test -f 'filter/pdftopdf/nup.cc'; then $(CYGPATH_W) 'filter/pdftopdf/nup.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/nup.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-nup.Tpo $(DEPDIR)/pdftopdf-nup.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/nup.cc' object='pdftopdf-nup.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-nup.obj `if test -f 'filter/pdftopdf/nup.cc'; then $(CYGPATH_W) 'filter/pdftopdf/nup.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/nup.cc'; fi`
+
+pdftopdf-intervalset.o: filter/pdftopdf/intervalset.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-intervalset.o -MD -MP -MF $(DEPDIR)/pdftopdf-intervalset.Tpo -c -o pdftopdf-intervalset.o `test -f 'filter/pdftopdf/intervalset.cc' || echo '$(srcdir)/'`filter/pdftopdf/intervalset.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-intervalset.Tpo $(DEPDIR)/pdftopdf-intervalset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/intervalset.cc' object='pdftopdf-intervalset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-intervalset.o `test -f 'filter/pdftopdf/intervalset.cc' || echo '$(srcdir)/'`filter/pdftopdf/intervalset.cc
+
+pdftopdf-intervalset.obj: filter/pdftopdf/intervalset.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-intervalset.obj -MD -MP -MF $(DEPDIR)/pdftopdf-intervalset.Tpo -c -o pdftopdf-intervalset.obj `if test -f 'filter/pdftopdf/intervalset.cc'; then $(CYGPATH_W) 'filter/pdftopdf/intervalset.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/intervalset.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-intervalset.Tpo $(DEPDIR)/pdftopdf-intervalset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/intervalset.cc' object='pdftopdf-intervalset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-intervalset.obj `if test -f 'filter/pdftopdf/intervalset.cc'; then $(CYGPATH_W) 'filter/pdftopdf/intervalset.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/intervalset.cc'; fi`
+
+pdftopdf-qpdf_tools.o: filter/pdftopdf/qpdf_tools.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_tools.o -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_tools.Tpo -c -o pdftopdf-qpdf_tools.o `test -f 'filter/pdftopdf/qpdf_tools.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_tools.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_tools.Tpo $(DEPDIR)/pdftopdf-qpdf_tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_tools.cc' object='pdftopdf-qpdf_tools.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_tools.o `test -f 'filter/pdftopdf/qpdf_tools.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_tools.cc
+
+pdftopdf-qpdf_tools.obj: filter/pdftopdf/qpdf_tools.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_tools.obj -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_tools.Tpo -c -o pdftopdf-qpdf_tools.obj `if test -f 'filter/pdftopdf/qpdf_tools.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_tools.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_tools.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_tools.Tpo $(DEPDIR)/pdftopdf-qpdf_tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_tools.cc' object='pdftopdf-qpdf_tools.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_tools.obj `if test -f 'filter/pdftopdf/qpdf_tools.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_tools.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_tools.cc'; fi`
+
+pdftopdf-qpdf_xobject.o: filter/pdftopdf/qpdf_xobject.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_xobject.o -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_xobject.Tpo -c -o pdftopdf-qpdf_xobject.o `test -f 'filter/pdftopdf/qpdf_xobject.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_xobject.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_xobject.Tpo $(DEPDIR)/pdftopdf-qpdf_xobject.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_xobject.cc' object='pdftopdf-qpdf_xobject.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_xobject.o `test -f 'filter/pdftopdf/qpdf_xobject.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_xobject.cc
+
+pdftopdf-qpdf_xobject.obj: filter/pdftopdf/qpdf_xobject.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_xobject.obj -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_xobject.Tpo -c -o pdftopdf-qpdf_xobject.obj `if test -f 'filter/pdftopdf/qpdf_xobject.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_xobject.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_xobject.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_xobject.Tpo $(DEPDIR)/pdftopdf-qpdf_xobject.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_xobject.cc' object='pdftopdf-qpdf_xobject.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_xobject.obj `if test -f 'filter/pdftopdf/qpdf_xobject.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_xobject.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_xobject.cc'; fi`
+
+pdftopdf-qpdf_pdftopdf.o: filter/pdftopdf/qpdf_pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_pdftopdf.o -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Tpo -c -o pdftopdf-qpdf_pdftopdf.o `test -f 'filter/pdftopdf/qpdf_pdftopdf.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Tpo $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_pdftopdf.cc' object='pdftopdf-qpdf_pdftopdf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_pdftopdf.o `test -f 'filter/pdftopdf/qpdf_pdftopdf.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_pdftopdf.cc
+
+pdftopdf-qpdf_pdftopdf.obj: filter/pdftopdf/qpdf_pdftopdf.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_pdftopdf.obj -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Tpo -c -o pdftopdf-qpdf_pdftopdf.obj `if test -f 'filter/pdftopdf/qpdf_pdftopdf.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_pdftopdf.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_pdftopdf.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Tpo $(DEPDIR)/pdftopdf-qpdf_pdftopdf.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_pdftopdf.cc' object='pdftopdf-qpdf_pdftopdf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_pdftopdf.obj `if test -f 'filter/pdftopdf/qpdf_pdftopdf.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_pdftopdf.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_pdftopdf.cc'; fi`
+
+pdftopdf-qpdf_cm.o: filter/pdftopdf/qpdf_cm.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_cm.o -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_cm.Tpo -c -o pdftopdf-qpdf_cm.o `test -f 'filter/pdftopdf/qpdf_cm.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_cm.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_cm.Tpo $(DEPDIR)/pdftopdf-qpdf_cm.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_cm.cc' object='pdftopdf-qpdf_cm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_cm.o `test -f 'filter/pdftopdf/qpdf_cm.cc' || echo '$(srcdir)/'`filter/pdftopdf/qpdf_cm.cc
+
+pdftopdf-qpdf_cm.obj: filter/pdftopdf/qpdf_cm.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-qpdf_cm.obj -MD -MP -MF $(DEPDIR)/pdftopdf-qpdf_cm.Tpo -c -o pdftopdf-qpdf_cm.obj `if test -f 'filter/pdftopdf/qpdf_cm.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_cm.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_cm.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-qpdf_cm.Tpo $(DEPDIR)/pdftopdf-qpdf_cm.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftopdf/qpdf_cm.cc' object='pdftopdf-qpdf_cm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -c -o pdftopdf-qpdf_cm.obj `if test -f 'filter/pdftopdf/qpdf_cm.cc'; then $(CYGPATH_W) 'filter/pdftopdf/qpdf_cm.cc'; else $(CYGPATH_W) '$(srcdir)/filter/pdftopdf/qpdf_cm.cc'; fi`
+
+pdftoraster-pdftoraster.o: filter/pdftoraster.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoraster_CXXFLAGS) $(CXXFLAGS) -MT pdftoraster-pdftoraster.o -MD -MP -MF $(DEPDIR)/pdftoraster-pdftoraster.Tpo -c -o pdftoraster-pdftoraster.o `test -f 'filter/pdftoraster.cxx' || echo '$(srcdir)/'`filter/pdftoraster.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoraster-pdftoraster.Tpo $(DEPDIR)/pdftoraster-pdftoraster.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoraster.cxx' object='pdftoraster-pdftoraster.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoraster_CXXFLAGS) $(CXXFLAGS) -c -o pdftoraster-pdftoraster.o `test -f 'filter/pdftoraster.cxx' || echo '$(srcdir)/'`filter/pdftoraster.cxx
+
+pdftoraster-pdftoraster.obj: filter/pdftoraster.cxx
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoraster_CXXFLAGS) $(CXXFLAGS) -MT pdftoraster-pdftoraster.obj -MD -MP -MF $(DEPDIR)/pdftoraster-pdftoraster.Tpo -c -o pdftoraster-pdftoraster.obj `if test -f 'filter/pdftoraster.cxx'; then $(CYGPATH_W) 'filter/pdftoraster.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoraster.cxx'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoraster-pdftoraster.Tpo $(DEPDIR)/pdftoraster-pdftoraster.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoraster.cxx' object='pdftoraster-pdftoraster.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoraster_CXXFLAGS) $(CXXFLAGS) -c -o pdftoraster-pdftoraster.obj `if test -f 'filter/pdftoraster.cxx'; then $(CYGPATH_W) 'filter/pdftoraster.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoraster.cxx'; fi`
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+.cxx.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cxx.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cxx.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-docDATA: $(doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+
+install-pkgconfDATA: $(pkgconf_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgconf_DATA)'; test -n "$(pkgconfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgconfdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfdir)" || exit $$?; \
+ done
+
+uninstall-pkgconfDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconf_DATA)'; test -n "$(pkgconfdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgconfdir)'; $(am__uninstall_files_from_dir)
+
+install-pkgfiltersincludeDATA: $(pkgfiltersinclude_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgfiltersinclude_DATA)'; test -n "$(pkgfiltersincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgfiltersincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgfiltersincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgfiltersincludedir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgfiltersincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgfiltersincludeDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgfiltersinclude_DATA)'; test -n "$(pkgfiltersincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgfiltersincludedir)'; $(am__uninstall_files_from_dir)
+install-pkgfontconfigDATA: $(pkgfontconfig_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgfontconfig_DATA)'; test -n "$(pkgfontconfigdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgfontconfigdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgfontconfigdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgfontconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgfontconfigdir)" || exit $$?; \
+ done
+
+uninstall-pkgfontconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgfontconfig_DATA)'; test -n "$(pkgfontconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgfontconfigdir)'; $(am__uninstall_files_from_dir)
+install-pkgfontembedincludeDATA: $(pkgfontembedinclude_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgfontembedinclude_DATA)'; test -n "$(pkgfontembedincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgfontembedincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgfontembedincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgfontembedincludedir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgfontembedincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgfontembedincludeDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgfontembedinclude_DATA)'; test -n "$(pkgfontembedincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgfontembedincludedir)'; $(am__uninstall_files_from_dir)
+install-pkgmimeDATA: $(pkgmime_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgmime_DATA)'; test -n "$(pkgmimedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgmimedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgmimedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgmimedir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgmimedir)" || exit $$?; \
+ done
+
+uninstall-pkgmimeDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgmime_DATA)'; test -n "$(pkgmimedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgmimedir)'; $(am__uninstall_files_from_dir)
+install-ppdDATA: $(ppd_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(ppd_DATA)'; test -n "$(ppddir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(ppddir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(ppddir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(ppddir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(ppddir)" || exit $$?; \
+ done
+
+uninstall-ppdDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(ppd_DATA)'; test -n "$(ppddir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(ppddir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \
+ config.h
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgfiltersincludedir)" "$(DESTDIR)$(pkgfontconfigdir)" "$(DESTDIR)$(pkgfontembedincludedir)" "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(ppddir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool \
+ clean-phpextensionLTLIBRARIES clean-pkgbackendPROGRAMS \
+ clean-pkgfilterPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-docDATA install-phpextensionLTLIBRARIES \
+ install-pkgbackendPROGRAMS \
+ install-pkgconfDATA \
+ install-pkgfilterPROGRAMS install-pkgfilterSCRIPTS \
+ install-pkgfiltersincludeDATA install-pkgfontconfigDATA \
+ install-pkgfontembedincludeDATA install-pkgmimeDATA \
+ install-ppdDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \
+ uninstall-libLTLIBRARIES uninstall-phpextensionLTLIBRARIES \
+ uninstall-pkgbackendPROGRAMS \
+ uninstall-pkgconfDATA \
+ uninstall-pkgfilterPROGRAMS uninstall-pkgfilterSCRIPTS \
+ uninstall-pkgfiltersincludeDATA uninstall-pkgfontconfigDATA \
+ uninstall-pkgfontembedincludeDATA uninstall-pkgmimeDATA \
+ uninstall-ppdDATA
+
+.MAKE: all check-am install-am install-data-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool \
+ clean-phpextensionLTLIBRARIES clean-pkgbackendPROGRAMS \
+ clean-pkgfilterPROGRAMS ctags dist dist-all dist-bzip2 \
+ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-local distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-data-hook install-docDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-phpextensionLTLIBRARIES install-pkgbackendPROGRAMS \
+ \
+ install-pkgconfDATA \
+ install-pkgfilterPROGRAMS \
+ install-pkgfilterSCRIPTS install-pkgfiltersincludeDATA \
+ install-pkgfontconfigDATA install-pkgfontembedincludeDATA \
+ install-pkgmimeDATA install-ppdDATA install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-docDATA \
+ uninstall-libLTLIBRARIES uninstall-phpextensionLTLIBRARIES \
+ uninstall-pkgbackendPROGRAMS \
+ uninstall-pkgconfDATA \
+ uninstall-pkgfilterPROGRAMS uninstall-pkgfilterSCRIPTS \
+ uninstall-pkgfiltersincludeDATA uninstall-pkgfontconfigDATA \
+ uninstall-pkgfontembedincludeDATA uninstall-pkgmimeDATA \
+ uninstall-ppdDATA
+
+ $(DLOPEN_LIBS)
+
+distclean-local:
+ rm -rf *.cache *~
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+NEWS - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+-----------------------------------------------------
+
+CHANGES IN V1.0.25
+
+ - urftopdf: Newly added filter to convert the URF format which (at
+ least some) iOS apps send when printing via AirPrint (Bug #1076).
+ - pdftopdf: pdfautorotate functionality has been patched directly
+ into pdftopdf (Bug #1080).
+ - pdftopdf: "mirror" produced only empty pages (XObjects not there).
+ - pdftopdf: Fixed segfault on "page-ranges=1-2147483647" (from cups).
+ - pdftopdf: Fixed collate filler insertion.
+ - texttopdf: Fixed deficient string escaping (Bug #1071).
+ - pdftoopvp: Get correct byte order definition when building under
+ OpenBSD (Bug #1070).
+ - serial backend: Added check for sys/ioctl.h to configure.ac (Bug
+ #1069).
+ - pdftopdf: Made code building under OpenBSD (Bug #1068).
+ - pdftopdf: Don't expect too much C++11 support for now (Bug #1067).
+
+CHANGES IN V1.0.24
+
+ - pdftopdf now generates the necessary pdf comments to disable
+ duplicate number-up when pdftops is also applied (Bug #1063).
+ - pdftops: Added support for using Adobe Reader (acroread) in command
+ line mode for turning PDF to PostScript (Bug #1065).
+ - pdftopdf: Fix build on OpenBSD (Bug #1062).
+ - pdftops: Fix stripping of page management options from the pstops
+ command line which got already applied by pdftopdf. If the name
+ of the option to be removed is contained in the name of a option
+ in the command line (like "number-up" in "number-up-layout" or
+ "scaling" in "Natural-scaling"), this option gets stripped instead
+ of the correct option (Bug #1064).
+
+CHANGES IN V1.0.23
+
+ - Removed filter/pdftopdf.old
+ - Fixed the requires.private for cupsfilters lib
+
+CHANGES IN V1.0.22
+
+ - Added missing *.h files of filter/pdftopdf/ to source file list so
+ that "make dist" builds correct upstream tarballs.
+
+CHANGES IN V1.0.21
+
+ - bannertopdf: Page duplication routine fixed.
+ - bannertopdf: Fixed invalid output of a direct stream object.
+ - pdftopdf filter replaced by new QPDF-based filter from Tobias
+ Hoffmann's Google Summer of Code project. The former Poppler-based
+ pdftopdf duplicated a lot of Poppler's code. The old filter is
+ still in the package as pdftopdf.old with source code in
+ filter/pdftopdf.old. It will be removed in a later release.
+ - Added most recent contributors to AUTHORS and COPYING files.
+
+CHANGES IN V1.0.20
+
+ - pdftops: Added another workaround for Kyocera printers: Some
+ models get very slow on images which request interpolation,
+ so now we remove the image interpolation requests by additional
+ PostScript code only inserted for Kyocera printers (Ubuntu bug
+ #1026974).
+ - pdftops: The build system only configured the default renderer
+ (Ghostscript OR Poppler), not the other renderer, but as we support
+ switching on runtime both need to get configured.
+ - Improved portability of the package to non-Linux systems (Bug #1056).
+ - Made the Poppler-based filters pdftopdf and pdftoopvp build with
+ both Poppler 0.18.x and 0.20.x (Bug #1055).
+ - Let build system check for dlopen.
+
+CHANGES IN V1.0.19
+
+ - Fixes according to Coverity scan results (Bug #1054).
+ - Added distribution packaging instructions to INSTALL.
+ - Switched build system to autotools. This especially fixes several
+ build problems in Gentoo. Also build-tested with CUPS 1.6.0b1.
+ - Fixes for compatibility with clang/gcc-4.7.
+ - textonly: Filter did not work as a pipe with copies=1 (Bug #1032).
+ - texttopdf: Avoid trimming the results of FcFontSort(), as this may
+ miss some reasonable candidates under certain circumstances. BTW,
+ fix passing a non-pointer as a pointer to "result" (Debian bug
+ #670055),
+ - Corrected documentation. The option for the maximum image rendering
+ resolution in pdftops is "pdftops-max-image-resolution", not
+ "pdftops-max-image-resolution-default".
+
+CHANGES IN V1.0.18
+
+ - Modified "./configure" options related to the pdftops filter to
+ allow changing the defaults for the renderer being used by default
+ (Ghostscript or Poppler) and the maximum image rendering resolution
+ and to supply paths for both Ghostscript's gs and Poppler's pdftops.
+ - pdftops: Allow selection whether Ghostscript or Poppler is used
+ at runtime, setting the "pdftops-renderer" option to "gs" or
+ "pdftops".
+ - pdftops: Allow setting an upper limit for the image rendering
+ resolution, also at runtime, setting the option
+ "pdftops-max-image-resolution" to the desired limit in dpi.
+ "0" means no limit.
+ - pdftops: Fixed crash by wrong usage of sizeof() function when adding
+ "Collate" to the fifth command line argument for the "pstops" CUPS
+ filter call (Ubuntu bug #982675).
+ - pdftops: Removed newline from copies value when reading it from
+ the "%%PDFTOPDFNumCopies" entry of the incoming PDF file.
+ - pdftops: Silenced compiler warning about ignoring the return
+ value of the write() function.
+ - pdftops: Added a crash guard.
+ - pdftops: Start determining the printing resolution with
+ cupsRasterInterpretPPD(), this is the most reliable as often
+ the choice names of the "Resolution" option are marketing names
+ with higher numerical values than the actual resolution. Also
+ ignore error exit values of cupsRasterInterpretPPD() as the
+ function can error out after having found the resolution.
+ - pdftops: If printing resolution is determined by
+ cupsRasterInterpretPPD() do not stick on 100 dpi if the
+ resolution cannot be determined (Ubuntu bug #984082).
+
+CHANGES IN V1.0.17
+
+ - pdftopdf: Fixed segmentation fault when printing selected pages
+ ("page-ranges" option, Ubuntu bug #980673).
+
+CHANGES IN V1.0.16
+
+ - pdftopdf: Fixed segmentation faults when using N-up with certain PDF
+ files (Ubuntu bug #980673) and when calling pdftopdf manually without
+ specifyting a PPD file.
+
+CHANGES IN V1.0.15
+
+ - pdftops: Suppress image compression only for Brother printers as they
+ really need this measure to print at all. This accelerates printer-
+ internal job processing on most other printers (tested on HP and
+ Kyocera). Also suppress page compression on Kyocera printers, this
+ works around a bug in Kyocera's PostScript interpreters which makes
+ printing pages with images very slow (Ubuntu bug #977912).
+
+CHANGES IN V1.0.14
+
+ - pdftops: Determine printing resolution from the PPD file and supply
+ it on the Ghostscript or pdftops (Poppler) command line, so that
+ the renderer does the image rendering with a resolution matching the
+ printer's resolution. This avoids too slow processing of the jobs
+ by the printer's built-in PostScript interpreter. In addition
+ a default resolution of 300 dpi is used for PPDs without any hint
+ of the printer's resolution, as most PostScript lasers use multiples
+ of 300 dpi as resolution (Ubuntu bug #977912).
+
+CHANGES IN V1.0.13
+
+ - bannertopdf: Fix display of the job dates on the test page and on
+ banner pages (Ubuntu bug #975064).
+
+CHANGES IN V1.0.12
+
+ - Fixed crash of imagetopdf filter when it is called manually
+ without supplying a valid PPD file (Ubuntu bug #973564).
+
+CHANGES IN V1.0.11
+
+ - Actually install the Generic PDF printer PPD file.
+ - Really introduce a Generic PDF printer PPD file.
+
+CHANGES IN V1.0.10
+
+ - Added Generic PPD file for native PDF printers.
+ - Updated all code copied from Poppler to the current state of Poppler.
+ - Made Poppler-based PDF filters building with various versions of
+ Poppler.
+
+CHANGES IN V1.0.9
+
+ - Deactivated NIME conversion rules which are not used by the PDF-
+ based printing workflow.
+ - Cleaned up sample PPD file HP-Color_LaserJet_CM3530_MFP-PDF.ppd.
+ - imagetopdf: Added support for native PDF printers.
+ - imagetopdf, imagetoraster: Let image input "scale to fit"
+ by default. This makes photo printing via AirPrint work,
+ as the iOS devices send JPEG but do not allow setting options.
+
+CHANGES IN V1.0.8
+
+ - pdftops: Generally do not compress fonts and images, and
+ also do not do CCITT compression for bitmap glyphs to make
+ the PostScript output more compatible with buggy PostScript
+ interpreters. The output gets 30-50% longer but will work on
+ many more different printer models. Problems were also
+ discovered on HP and not only on Brother (Ubuntu bug
+ #960666).
+
+CHANGES IN V1.0.7
+
+ - pdftops: Added PostScript debug mode. For jobs sent with "-o psdebug"
+ the PostScript output by Ghostscript does not have compression of
+ pages and fonts, so that one can analyse the PostScript code,
+ especially in cases of incompatibilities and bugs of the built-in
+ PostScript interpreters of printers. Thanks to the Ghostscript
+ upstream developers for this hint.
+
+CHANGES IN V1.0.6
+
+ - texttopdf: Fixed minor miscalculation of /AvgWidth.
+ - texttopdf: Added support for direct file references in pdf.utf-8.
+ - pdftops: Added another workaround for a bug in Brother's PostScript
+ interpreter: Suppress CCITT compression for bitmap glyphs and
+ images on Brother printers (Ubuntu bug #955553).
+ - texttopdf: Fixed typo in pdf font descriptor dictionary keys.
+ - Fixed ColorDevice definition in cupsfilters.drv for HP DesignJet
+ printers.
+ - Put ModelNumber entries in cupsfilters.drv at the right place to
+ get correct "*cupsModelNumber:" entries in the PPDs for the HP
+ DesignJet printers.
+ - rastertopclx: Code of JCL options did not get inserted into the JCL
+ header.
+ - parallel backend: Use the same way as CUPS does to prevent an
+ infinite loop on side channel errors (CUPS STR #4044).
+ - pdftopdf: Added support for native PDF printers, add JCL (PJL)
+ options and send page_log entries only if the PDF has the
+ "*JCLToPDFInterpreter:" keyword.
+ - Updated README.txt for the new native PDF printer support.
+ - Added a sample PPD file for a native PDF printer,
+ HP-Color_LaserJet_CM3530_MFP-PDF.ppd.
+ - texttopdf: A lot of internal rework; also split up into more files
+ - texttopdf: Fixed many bugs on the way
+ - texttopdf: Added support for CFF-flavoured OTFs; for these
+ subsetting is not yet implemented, full embedding is done instead
+ - texttopdf: Adapted and improved fontconfig font selection
+ - Make sure that "make clean" and "make distclean" also work if
+ Makedefs does not exist (Debian bug #663564).
+
+CHANGES IN V1.0.5
+
+ - pdftops: Added insertion of workaround PostScript code for printers
+ with bugs in their PS interpreters (Ubuntu bugs #950713, #951627).
+ - parallel backend: Break infinite loop (Ubuntu bug #936647).
+ - texttopdf: Complete the implementation of fontconfig-based font
+ selection (Debian bug #663070).
+
+CHANGES IN V1.0.4
+
+ - texttopdf: Fall back to altermative fonts via fontconfig if the
+ FreeMono TrueType fonts are not installed (Debian bugs #495598
+ and #662660).
+ - bannertopdf: Fix off-by-one error in page duplication
+ - bannertopdf: Put indirect references to streams into the page's
+ contents
+ - bannertopdf: Let byte offsets for the Xref table of the PDF output
+ being determined correctly also when the output goes to stdout
+ (Ubuntu bug #939735).
+ - bannertopdf: Output multiple copies of the test page if duplex
+ and/or N-up is chosen, to let the test page appear on all possible
+ positions of the sheet (Ubuntu bug #939530).
+
+CHANGES IN V1.0.3
+
+ - bannertopdf: Draw the frame to mark the non-printable borders 1pt
+ smaller all around to assure that it is always visible, like it was
+ done in bannertops.
+ - bannertopdf: Scale the page to fit onto the desired output page.
+ - bannertopdf: Get and output the correct media limits.
+
+CHANGES IN V1.0.2
+
+ - bannertopdf: Fixed crash caused by wrong Poppler API use.
+ - bannertopdf: Info text on test page came out in gray and not in
+ black.
+
+CHANGES IN V1.0.1
+
+ - Added the textonly filter and its PPD file, a driver for text-only
+ printers.
+ - Install the pdftoijs sample PPD file
+ HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd
+ - Added cupsfilters.drv, centralized ppdc-based PPD generator for the
+ printer driver filters in this package. Current printers supported
+ are several HP DesignJet large format inkjet printers.
+ - Fixed "make uninstall". Now everything of this package gets removed.
+ - Added wrapper scripts texttops and imagetops for backward
+ compatibility to third-party PPD files or custom configurations
+ which refer to these filters explicitly (Debian bug #658258).
+
+CHANGES IN V1.0
+
+ - Built the pdftops filter based on Ghostscript by default, as
+ Ghostscript is better optimized for print output (Ubuntu bug
+ #926068).
+ - If the pdftops filter is built for using Poppler, let Poppler not
+ emit PostScript level 3, as this causes problems with some HP
+ printers (Ubuntu bug #277404, Freedesktop (Poppler) bug #19640).
+ - bannertopdf needs to be linked with C++ (bug #995)
+ - Added test.sh script for testing texttopdf
+ - Added original documentation of the PDF filters to README.txt
+ - Install C header files and the static library
+ - General clean-up of "make install" targets in Makefiles
+ - Raised MIME conversion cost factor of pdftoraster from 66 to 100 to
+ give priority to the gstoraster filter from Ghostscript, as this
+ filter supports ICC-profile-based color management.
+ - Documentation updated because libijs, liblcms, freetype, and
+ fontconfig are needed to build this package
+
+CHANGES IN V1.0b1
+
+ - Removed the bannertops, imagetops, and texttops filters, they are
+ not needed any more in the PDF-based printing workflow
+ - Added support for liblcms2
+ - Named the package "OpenPrinting CUPS Filters"
+ - Renamed libcupslegacy to libcupsfilters
+ - Joined pdftops and cpdftocps filters into one C program
+ - Added new bannertopdf filter from Lars Uebernickel:
+ https://launchpad.net/bannertopdf
+ - Added the filters for the PDF-based printing workflow, from
+ OpenPrinting: http://sourceforge.jp/projects/opfc/ and
+ http://www.openprinting.org/download/printing/pdf-printing/
+ - Initial packaging of files that are no longer included in CUPS 1.6
+ from CUPS upstream (http://www.cups.org/)
--- /dev/null
+README - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+-------------------------------------------------------
+
+Looking for compile instructions? Read the file "INSTALL.txt"
+instead...
+
+
+INTRODUCTION
+
+ CUPS is a standards-based, open source printing system developed by Apple
+ Inc. for Mac OS® X and other UNIX®-like operating systems. CUPS uses the
+ Internet Printing Protocol ("IPP") and provides System V and Berkeley
+ command-line interfaces, a web interface, and a C API to manage printers and
+ print jobs.
+
+ This distribution contains backends, filters, and other software that was
+ once part of the core CUPS distribution but is no longer maintained by
+ Apple Inc. In addition it contains additional filters developed
+ independently of Apple, especially filters for the PDF-centric printing
+ workflow introduced by OpenPrinting.
+
+ From CUPS 1.6.0 on, this package will be required for using printer drivers
+ with CUPS under Linux. With CUPS 1.5.x and earlier this package can be used
+ optionally to switch over to PDF-based printing. In that case some filters
+ are provided by both CUPS and this package. Then the filters of this package
+ should be used.
+
+ For compiling and using this package CUPS, Poppler, libjpeg, libpng,
+ libtiff, libijs, freetype, fontconfig, and liblcms (liblcms2 recommended)
+ are needed. It is highly recommended, especially if non-PostScript printers
+ are used, to have Ghostscript, foomatic-filters, and foomatic-db installed.
+
+ CUPS, this package, and Ghostscript contain some rudimentary printer
+ drivers, see http://www.openprinting.org/drivers/ for a more
+ comprehensive set of printer drivers for Linux.
+
+ See
+
+ http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf_as_standard_print_job_format
+
+ for information about the PDF-based printing workflow.
+
+ Report bugs to
+
+ https://bugs.linuxfoundation.org/
+
+ Choose "OpenPrinting" as the product and "cups-filters" as the component.
+
+ See the "LICENSE.txt" files for legal information.
+
+IMAGE PRINTING DEFAULT CHANGED TO "SCALE TO FIT"
+
+ Compared to the PostScript-based original CUPS filters there is a
+ change of deafults: The imagetopdf and imagetoraster filters print
+ in "scale-to-fit" mode (image is scaled to fill one page but
+ nothing of the image being cut off) by default.
+
+ This is done to support photo printing via AirPrint. The photo
+ apps on Apple's iOS devices send print jobs as JPEG images and do
+ not allow to set any options like "scaling" or the page size. With
+ "scale-to-fit" mode set by default, the iOS photos come out on one
+ page, as expected.
+
+ To get back to the old behavior, supply one of the options
+ "nofitplot" "filplot=Off", "nofit-to-page", or "fit-to-page=Off".
+
+POSTSCRIPT PRINTING RENDERER AND RESOLUTION SELECTION
+
+ If you use CUPS with this package and a PostScript printer then
+ the included pdftops filter converts the print job data which is
+ in PDF format into PostScript. By default, the PostScript is
+ generated with Ghostscript's "ps2write" output device, which
+ generates a DSC-conforming PostScript with compressed embedded
+ fonts and compressed page content. This is resource-saving and
+ leads to fast wire transfer of print jobs to the printer.
+
+ Unfortunately, Ghostscript's PostScript output is not compatible
+ with some printers due to interpreter bugs in the printer and in
+ addition, processing (by Ghostscript or by the printer's
+ interpreter) can get very slow with high printing resolutions when
+ parts of the incoming PDF file are converted to bitmaps if they
+ contain graphical structures which are not supported by
+ PostScript. The bitmap problem especially occurs on input files
+ with transparency, especially also the ones produced by Cairo
+ (evince and many other GNOME/GTK applications) which unnecessarily
+ introduces transparency even if the input PDF has no transparency.
+
+ Therefore there are two possibilities to configure pdftops at
+ runtime:
+
+ 1. Selection of the renderer: Ghostscript, Poppler, or Adobe Reader
+
+ Ghostscript has better color management and is generally optimized
+ more for printing. Poppler produces a PostScript which is
+ compatible with more buggy built-in PostScript interpreters of
+ printers and it leads to a somewhat quicker workflow when
+ graphical structures of the input PDF has to be turned into
+ bitmaps. Adobe Reader is the PDF renderer from Adobe, the ones
+ who created PDF and PostScript.
+
+ The selection is done by the "pdftops-renderer" option, setting it
+ to "gs", "pdftops", or "acroread":
+
+ Per-job: lpr -o pdftops-renderer=pdftops ...
+ Per-queue default: lpadmin -p printer -o pdftops-renderer-default=gs
+ Remove default: lpadmin -p printer -R pdftops-renderer-default
+
+ By default, pdftops uses Ghostscript if this does not get changed
+ at compile time, for example by the Linux distribution vendor.
+
+ 2. Limitation of the image rendering resolution
+
+ If graphical structures of the incoming PDF file have to be
+ converted to bitmaps due to limitations of PostScript, the
+ conversion of the file by pdftops or the rendering by the printer
+ can get too slow if the bitmap resolution is too high or the
+ printout quality can degrade if the bitmap resolution is too low.
+
+ By default, pdftops tries to find out the actual printing
+ resolution and sets the resolution for bitmap generation to the
+ same value. If it cannot find the printing resolution, it uses 300
+ dpi. It never goes higher than a limit of 1440 dpi. Note that this
+ default limit can get changed at compile time, for example by the
+ Linux distribution vendor.
+
+ The resolution limit for bitmaps can be changed to a lower or
+ higher value, or be set to unlimited. This is done by the option
+ "pdftops-max-image-resolution", setting it to the desired value
+ (in dpi) or to zero for unlimited. It can be used per-job or as
+ per-queue default as the "pdftops-renderer" option described
+ above.
+
+ The "pdftops-max-image-resolution" option is ignored when Adobe
+ Reader is selected as PDF renderer.
+
+POSTSCRIPT PRINTING DEBUG MODE
+
+ Sometimes a PostScript printer's interpreter errors, crashes, or
+ somehow else misbehaves on Ghostscript's output. To find
+ workarounds (currently we have already workarounds for Brother and
+ Kyocera) it is much easier to work with uncompressed PostScript.
+ To get uncompressed PostScript as output, send a job with the
+ "psdebug" option, with commands like the following:
+
+ lpr -P <printer> -o psdebug <file>
+ lp -d <printer> -o psdebug <file>
+
+ If you want to send your job out of a desktop application, run
+
+ lpoptions -p <printer> -o psdebug
+
+ to make "psdebug" a personal default setting for you.
+
+ To extract the PostScript output for a developer to analyse it,
+ clone your print queue to a one which prints into a file:
+
+ cupsctl FileDevice=yes
+ lpadmin -p test -E -v file:/tmp/printout \
+ -P /etc/cups/ppd/<name of original queue>.ppd
+
+ and print into this queue as described above. The PostScript
+ output is in /tmp/printout after the job has completed.
+
+ This option does not change anything if Poppler's pdftops is used
+ as renderer.
+
+CUPS FILTERS FOR PDF AS STANDARD PRINT JOB FORMAT
+
+ Here is documentation from the former CUPS add-on tarball with the filters
+ for the PDF-based printing workflow: imagetopdf, texttopdf,
+ pdftopdf, pdftoraster, pdftoopvp, and pdftoijs
+
+ The original filters are from http://sourceforge.jp/projects/opfc/
+
+ NOTE: the texttops and imagetops filters shipping with this package
+ are simple wrapper scripts for backward compatibility with third-party
+ PPD files and custom configurations. There are not referred to in the
+ cupsfilters.convs file and therefore not used by the default
+ configuration. Direct conversion of text or images to PostScript is
+ deprecated in the PDF-based printing workflow. So do not use these
+ filters when creating new PPDs or custom configurations. The parameters
+ for these filters are the same as for texttopdf and imagetopdf (see
+ below) as the ...tops filter calls the ....topdf filter plus
+ Ghostscript's pdf2ps.
+
+IMAGETOPDF
+
+1. INTRODUCTION
+
+This program is "imagetopdf". "imagetopdf" is a CUPS filter which reads
+a single image file, converts it into a PDF file and outputs it to stdout.
+
+This program accepts the following image file format;
+
+ gif, png, jpeg, tiff, photocd, portable-anymap, portable-bitmap,
+ portable-graymap, portable-pixmap, sgi-rgb, sun-raster, xbitmap,
+ xpixmap, xwindowdump
+
+xbitmap, xpixmap and xwindowdump images are converted into png images by
+the "convert" command. Other kinds of image file format can be supported
+if the "convert" command support them.
+
+Output PDF file format conforms to PDF version 1.3 specification, and
+input image is converted and contained in the output PDF file as a binary
+format non-compression image.
+
+"imagetopdf" may outputs multiple pages if the input image exceeds page
+printable area.
+
+2. LICENSE
+
+"imagetopdf.c" is under the CUPS license. See the "LICENSE.txt" file.
+For other files, see the copyright notice and license of each file.
+
+3. COMMAND LINE
+
+"imagetopdf" is a CUPS filter, and the command line arguments, environment
+variables and configuration files are in accordance with the CUPS filter
+interface.
+
+imagetopdf <job> <user> <title> <num-copies> <options> [<filename>]
+
+"imagetopdf" ignores <job> and <user>.
+<title> is appended into the PDF dictionary as /Title.
+<num-copies> specifies the number of document copies.
+<options> is a CUPS option list.
+<filename> is an input image file name.
+
+When omit the <filename>, "imagetopdf" reads an image file from stdin.
+
+4. ENVIRONMENT VARIABLES
+
+This program refers the following environment variable;
+
+ PPD: PPD file name of the printer.
+
+5. COMMAND OPTIONS
+
+"imagetopdf" accepts the following CUPS standard options;
+
+fitplot
+mirror
+PageSize
+page-left, page-right, page-bottom, page-top
+OutputOrder
+Collate
+sides
+cupsEvenDuplex
+position
+scaling
+ppi
+natural-scaling
+landscape
+orientation-requested
+
+See the CUPS documents for details of these options.
+
+6. KNOWN PROBLEMS
+
+Problem:
+ PBM and SUN raster images can not be printed.
+Solution:
+ Due to the CUPS libcupsimage library's bug. Update the CUPS on your system.
+
+7. INFORMATION FOR DEVELOPERS
+
+Following information is for developers, not for driver users.
+
+7.1 Options handled by a printer or "imagetopdf"
+
+Following options are handled by a printer or "imagetopdf".
+ Collate, Copies, Duplex, OutputOrder
+
+Which handles these options depends on following options and attributes.
+ Collate, Copies, Duplex, OutputOrder, cupsEvenDuplex, cupsManualCopies
+
+"imagetopdf" judges whether a printer can handle these options according to
+the followings option settings in a PPD file.
+
+Collate:
+ If Collate is defined, "imagetopdf" judges the printer supports Collate.
+Copies:
+ If cupsManualCopies is defined as False, "imagetopdf" judges the printer
+ does not support Copies feature.
+ 
+Duplex:
+ If Duplex is defined, "imagetopdf" judges the printer supports Duplex.
+ If cupsEvenDuplex is True, Number of pages must be even.
+OutputOrder:
+ If OutputOrder is defined, "imagetopdf" judges the printer supports
+ OutputOrder.
+
+If the printer cannot handle these options, "imagetopdf" handles it.
+
+Following pseudo program describes how "imagetopdf" judges to handle
+these options.
+
+Variables
+
+Copies : specified Copies
+Duplex : specified Duplex
+Collate : specified Collate
+OutputOrder : specified OutputOrder
+EvenDuplex : specified cupsEvenDuplex
+pages : number of pages
+number_up : specified number-up
+
+device_copies : Copies passed to the printer
+device_duplex : Duplex passed to the printer
+device_collate : Collate passed to the printer
+device_outputorder : OutputOrder passed to the printer
+
+soft_copies : copies by imagetopdf
+
+
+device_copies = 1;
+device_duplex = False;
+device_collate = False;
+device_outputorder = False;
+
+if (Copies == 1) {
+ /* Collate is not needed. */
+ Collate = False;
+}
+
+if (!Duplex) {
+ /* EvenDuplex is not needed */
+ EvenDuplex = False;
+}
+
+
+if (Copies > 1 && the printer can handle Copies) device_copies = Copies;
+if (Duplex && the printer can handle Duplex) {
+ device_duplex = True;
+} else {
+ /* imagetopdf cannot handle Duplex */
+}
+if (Collate && the printer can handle Collate) device_collate = True;
+if (OutputOrder == Reverse && the printer can handle OutputOrder)
+ device_outputorder = True;
+
+if (Collate && !device_collate) {
+ /* The printer cannot handle Collate.
+ So imagetopdf handle Copies */
+ device_copies = 1;
+}
+
+if (device_copies != Copies /* imagetopdf handle Copies */ && Duplex)
+ /* Make imagetopdf handle Collate, otherwise both paper side may have
+ same page */
+ Collate = True;
+ device_collate = False;
+}
+
+if (Duplex && Collate && !device_collate) {
+ /* Handle EvenDuplex, otherwise the last page has
+ the next copy's first page in the other side of the paper. */
+ EvenDuplex = True;
+}
+
+if (Duplex && OutputOrder == Reverse && !device_outputorder) {
+ /* Handle EvenDuplex, otherwise the first page's other side of paper
+ is empty. */
+ EvenDuplex = True;
+}
+
+soft_copies = device_copies > 1 ? 1 : Copies;
+
+7.2 JCL
+
+When you print PDF files to a PostScript(PS) printer, you can specify
+device options in PS. In this case, you can write PS commands in a PPD file
+like as follows.
+
+*OpenUI *Resolution/Resolution : PickOne
+*DefaultResolution: 600
+*Resolution 300/300 dpi: "<</HWResolution[300 300]>>setpagedevice"
+*Resolution 600/600 dpi: "<</HWResolution[600 600]>>setpagedevice"
+*CloseUI: *Resolution
+
+However, if options cannot be described in PS file, you can write JCLs
+as follows;
+
+*JCLOpenUI *JCLFrameBufferSize/Frame Buffer Size: PickOne
+*DefaultJCLFrameBufferSize: Letter
+*OrderDependency: 20 JCLSetup *JCLFrameBufferSize
+*JCLFrameBufferSize Off: '@PJL SET PAGEPROTECT = OFF<0A>'
+*JCLFrameBufferSize Letter: '@PJL SET PAGEPROTECT = LTR<0A>'
+*JCLFrameBufferSize Legal: '@PJL SET PAGEPROTECT = LGL<0A>'
+*JCLCloseUI: *JCLFrameBufferSize
+
+Because PDF cannot specify device options in a PDF file, you have to define
+all the device options as JCLs.
+
+When a printer does not support PS nor PDF, you can use Ghostscript (GS).
+In this case, you can specify device options like a PS printer.
+If you want to use the same printer and same PPD file for both PDF and PS
+printing, when you print a PS file, you can specify that GS handles it,
+and when you print a PDF file, you can also specify that PDF filters handle
+it in the same PPD file. However in this case, previous methods is not
+appropriate to specify device options.
+
+So, "imagetopdf" handles this case as follows;
+(In following pseudo program, JCL option is an option specified with JCLOpenUI)
+
+if (Both JCLBegin and JCLToPSInterpreter are specified in the PPD file) {
+ output JCLs that marked JCL options.
+}
+
+if (pdftopdfJCLBegin attribute is specified in the PPD file) {
+ output it's value
+}
+
+if (Copies option is specified in the PPD file) {
+ mark Number of copies specified
+} else if (pdftopdfJCLCopies is specified in the PPD file) {
+ output JCL specified with JCLCopies
+}
+
+for (each marked options) {
+ if (pdftopdfJCL<marked option's name> is specified in the PPD file) {
+ output it's value as a JCL
+ } else if (pdftopdfJCLBegin attributes is specified in the PPD file) {
+ output "<option's name>=<marked choice>;" as a JCL
+ }
+}
+output NEWLINE
+
+Thus, if you want to use both PDF filters and GS by single PPD file,
+what you should do is to add the following line in the PPD file;
+
+*pdftopdfJCLBegin: "pdftoopvp jobInfo:"
+
+Note:
+ If you specify JCLBegin, you have to specify JCLToPSInterpreter as well.
+
+Note:
+ When you need to specify the value which is different from the choosen
+ value based on the PPD into the jobInfo, you have to specify the values
+ with the key started by "pdftopdfJCL" string.
+
+ For example, if the page size is defined in a PPD file as following;
+
+ *OpenUI *PageSize/Page Size: PickOne
+ *DefaultPageSize: A4
+ *PageSize A4/A4:
+ *PageSize Letter/US Letter:
+ *CloseUI: *PageSize
+
+ if you choose the page size "Letter", the string "PageSize=Letter;" is
+ added to jobInfo. On the other hand, if the driver requires the different
+ value for the "Letter" size, for instance driver requires "PS=LT;"
+ instead of "PageSize=Letter;" as the jobInfo value, the PPD file has to
+ be defined as following;
+
+ *OpenUI *PageSize/Page Size: PickOne
+ *DefaultPageSize: A4
+ *PageSize A4/A4:
+ *pdftopdfJCLPageSize A4/A4: "PS=A4;"
+ *PageSize Letter/US Letter:
+ *pdftopdfJCLPageSize Letter/US Letter: "PS=LT;"
+ *CloseUI: *PageSize
+
+7.3 Temporally files location
+
+"imagetopdf" creates temporally files if needed. Temporary files are created
+in the location specified by TMPDIR environment variable. Default location
+is "/tmp".
+
+
+PDFTOPDF.OLD
+
+0. DEPRECATION NOTICE
+This filter is being replaced by a new implementation that does not
+depend on poppler. Therefore it has been renamed "pdftopdf.old",
+but the references in the following sections have not been updated.
+
+1. INTRODUCTION
+
+There are two executable programs, "pdftopdf" and "pdf2pdf", in this package.
+"pdftopdf" is a filter for CUPS. It reads PDF files, changes page layout
+and output a new PDF file. "pdf2pdf" is a user command version of "pdftopdf".
+This document describes about only "pdftopdf". See man/pdf2pdf.1 for "pdf2pdf".
+
+When a input PDF file which is given to "pdftopdf" does not include some
+required fonts, and if you set the font embedding option, "pdftopdf" embed
+fonts in the new PDF file
+
+"pdftopdf" finds fonts to embed by fontconfig library.
+"pdftopdf" now embed only TrueType format fonts.
+PDF Standard fonts are not embedded.
+
+Note: Do not embed fonts that the font licenses inhibit embedding.
+
+"pdftopdf" does not support functions that are not related to printing
+features, including interactive features and document interchange features.
+Many of these operators and sections are just ignored.
+Some of these may be output, but those functions are not assured.
+Encryption feature is not supported.
+
+2. NATIVE PDF PRINTER SUPPORT
+
+pdftopdf introduces native PDF printer support to CUPS for the first
+time. PPD files must have a line
+
+*cupsFilter: "application/vnd.cups-pdf 0 -"
+
+and use the "*JCLToPDFInterpreter:" keyword, for example:
+
+*JCLBegin: "<1B>%-12345X@PJL JOB<0A>"
+*JCLToPDFInterpreter: "@PJL ENTER LANGUAGE = PDF <0A>"
+*JCLEnd: "<1B>%-12345X@PJL EOJ <0A><1B>%-12345X"
+
+They MUST NOT accept PostScript as input data format and will not work
+with stock CUPS. They will need cups-filters (which implements the PDF-
+based printing workflow) to work.
+
+Options must not be implemented by specifying PostScript code to
+inject. They must be injecting JCL code ("*JCLOpenUI:
+... ... *JCLCloseUI: ...").
+
+A sample PPD file, HP-Color_LaserJet_CM3530_MFP-PDF.ppd is included.
+
+3. LICENSE
+
+Almost all source files are under MIT like license. However,
+"pdftopdf" links some "poppler" libraries, and these files are under
+GNU public license. See copyright notice of each file for details.
+
+4. COMMAND LINE
+
+"pdftopdf" is a CUPS filter, and the command line arguments, environment
+variables and configuration files are in accordance with the CUPS filter
+interface.
+
+pdftopdf <job> <user> <title> <num-copies> <options> [<filename>]
+
+"pdftopdf" ignores <job> and <user>.
+<title> is appended into the PDF dictionary as /Title.
+<num-copies> specifies the number of document copies.
+<options> is a CUPS option list.
+<filename> is an input PDF file name.
+
+When omit the <filename>, "pdftopdf" reads a PDF file from stdin,
+and save it as a temporary file.
+
+
+CUPS options defined in <options> are delimited by space. Boolean
+type CUPS option is defined only by the option key, and other type
+CUPS option are defined by pairs of key and value, <key>=<value>.
+
+5. COMMAND OPTIONS
+
+"pdftopdf" accepts the following CUPS standard options;
+
+fiplot
+mirror
+PageSize
+page-left, page-right, page-bottom, page-top
+number-up
+number-up-layout
+page-border
+OutputOrder
+page-set
+page-ranges
+Collate
+sides
+cupsEvenDuplex
+
+See the CUPS documents for details of these options.
+
+Margin given by the page-left, page-right, page-bottom and page-top is
+valid when fiplot or number-up option is set.
+
+"pdftopdf" accepts the following original options;
+
+pdftopdfFontEmbedding
+ Boolean option.
+ Force "pdftopdf" to embed fonts. "pdftopdf" does not embed fonts by default.
+
+pdftopdfFontEmbeddingWhole
+ Boolean option.
+ Force "pdftopdf" to embed whole fonts.
+ "pdftopdf" does not embed whole fonts by default.
+ If this option is false, "pdftopdf" embed subset of the fonts.
+ This option is valid only when the pdftopdfFontEmbedding option is true.
+
+pdftopdfFontEmbeddingPreLoad
+ Boolean option.
+ Force "pdftopdf" to embed fonts specified as pre-loaded fonts in a PPD file.
+ "pdftopdf" does not embed pre-loaded fonts by default.
+ If this option is false, pdftopdf does not embed pre-loaded fonts.
+ This option is valid only when the pdftopdfFontEmbedding option is true.
+
+pdftopdfFontCompress
+ Boolean option.
+ Force "pdftopdf" to compress embed fonts.
+ "pdftopdf" does not compress embed fonts by default.
+ This option is valid only when the pdftopdfFontEmbedding option is true.
+
+pdftopdfContentsCompress
+ Boolean option.
+ Force "pdftopdf" to compress page contents.
+ "pdftopdf" does not compress page contents by default.
+
+pdftopdfJCLBegin
+ Boolean option.
+ Force "pdftopdf" to create JCL info for the following PDF filter
+ "pdftoopvp".
+
+6. INFORMATION FOR DEVELOPERS
+
+Following information is for developers, not for driver users.
+
+6.1 Options handled by a printer or "pdftopdf"
+
+Following options are handled by a printer or "pdftopdf".
+ Collate, Copies, Duplex, OutputOrder
+
+Which handles these options depends on following options and attributes.
+ Collate, Copies, Duplex, OutputOrder, cupsEvenDuplex, cupsManualCopies
+
+"pdftopdf" judges whether a printer can handle these options according to
+the followings option settings in a PPD file.
+
+Collate:
+ If Collate is defined, "pdftopdf" judges the printer supports Collate.
+Copies:
+ If cupsManualCopies is defined as False, "pdftopdf" judges the printer
+ does not support Copies feature.
+Duplex:
+ If Duplex is defined, "pdftopdf" judges the printer supports Duplex.
+ If cupsEvenDuplex is True, Number of pages must be even.
+OutputOrder:
+ If OutputOrder is defined, "pdftopdf" judges the printer supports
+ OutputOrder.
+
+If the printer cannot handle these options, "pdftopdf" handles it.
+
+Following pseudo program describes how "pdftopdf" judges to handle
+these options.
+
+Variables
+
+Copies : specified Copies
+Duplex : specified Duplex
+Collate : specified Collate
+OutputOrder : specified OutputOrder
+EvenDuplex : specified cupsEvenDuplex
+pages : number of pages
+number_up : specified number-up
+
+device_copies : Copies passed to the printer
+device_duplex : Duplex passed to the printer
+device_collate : Collate passed to the printer
+device_outputorder : OutputOrder passed to the printer
+
+soft_copies : copies by pdftopdf
+
+
+device_copies = 1;
+device_duplex = False;
+device_collate = False;
+device_outputorder = False;
+
+if (Copies == 1) {
+ /* Collate is not needed. */
+ Collate = False;
+}
+
+if (!Duplex) {
+ /* EvenDuplex is not needed */
+ EvenDuplex = False;
+}
+
+
+if (Copies > 1 && the printer can handle Copies) device_copies = Copies;
+if (Duplex && the printer can handle Duplex) {
+ device_duplex = True;
+} else {
+ /* pdftopdf cannot handle Duplex */
+}
+if (Collate && the printer can handle Collate) device_collate = True;
+if (OutputOrder == Reverse && the printer can handle OutputOrder)
+ device_outputorder = True;
+
+if (Collate && !device_collate) {
+ /* The printer cannot handle Collate.
+ So pdftopdf handle Copies */
+ device_copies = 1;
+}
+
+if (device_copies != Copies /* pdftopdf handle Copies */ && Duplex)
+ /* Make pdftopdf handle Collate, otherwise both paper side may have
+ same page */
+ Collate = True;
+ device_collate = False;
+}
+
+if (Duplex && Collate && !device_collate) {
+ /* Handle EvenDuplex, otherwise the last page has
+ the next copy's first page in the other side of the paper. */
+ EvenDuplex = True;
+}
+
+if (Duplex && OutputOrder == Reverse && !device_outputorder) {
+ /* Handle EvenDuplex, otherwise the first page's other side of paper
+ is empty. */
+ EvenDuplex = True;
+}
+
+soft_copies = device_copies > 1 ? 1 : Copies;
+
+6.2 JCL
+
+When you print PDF files to a PostScript(PS) printer, you can specify
+device options in PS. In this case, you can write PS commands in a PPD file
+like as follows.
+
+*OpenUI *Resolution/Resolution : PickOne
+*DefaultResolution: 600
+*Resolution 300/300 dpi: "<</HWResolution[300 300]>>setpagedevice"
+*Resolution 600/600 dpi: "<</HWResolution[600 600]>>setpagedevice"
+*CloseUI: *Resolution
+
+However, if options cannot be described in PS file, you can write JCLs
+as follows;
+
+*JCLOpenUI *JCLFrameBufferSize/Frame Buffer Size: PickOne
+*DefaultJCLFrameBufferSize: Letter
+*OrderDependency: 20 JCLSetup *JCLFrameBufferSize
+*JCLFrameBufferSize Off: '@PJL SET PAGEPROTECT = OFF<0A>'
+*JCLFrameBufferSize Letter: '@PJL SET PAGEPROTECT = LTR<0A>'
+*JCLFrameBufferSize Legal: '@PJL SET PAGEPROTECT = LGL<0A>'
+*JCLCloseUI: *JCLFrameBufferSize
+
+For PostScript printers all these options are handled by the pdftops
+filter which is the PostScript printer driver in the PDF-based
+printing workflow.
+
+If you have a native PDF printer you cannot use options which inject
+PostScript code into the data stream, you have to define all options
+with JCL. Only in this case pdftopdf adds the JCL header and trailer
+to the PDF job. Native PDF PPDs with JCL options are recognized by the
+"*JCLToPDFInterpreter:" keyword, for example with the following lines:
+
+*JCLBegin: "<1B>%-12345X@PJL JOB<0A>"
+*JCLToPDFInterpreter: "@PJL ENTER LANGUAGE = PDF <0A>"
+*JCLEnd: "<1B>%-12345X@PJL EOJ <0A><1B>%-12345X"
+
+To get the correct CUPS filter chain for them, they need the following
+line:
+
+*cupsFilter: "application/vnd.cups-pdf 0 -"
+
+and NO "*cupsFilter:" line which accepts PostScript input.
+
+A sample PPD file for a native PDF printer,
+HP-Color_LaserJet_CM3530_MFP-PDF.ppd is included.
+
+When a printer does not support PS nor PDF, you can use Ghostscript (GS).
+In this case, you can specify device options like a PS printer.
+If you want to use the same printer and same PPD file for both PDF and PS
+printing, when you print a PS file, you can specify that GS handles it,
+and when you print a PDF file, you can also specify that PDF filters handle
+it in the same PPD file. However in this case, previous methods is not
+appropriate to specify device options.
+
+So, "pdftopdf" handles this case as follows;
+(In following pseudo program, JCL option is a option specified with JCLOpenUI)
+
+if (Both JCLBegin and JCLToPDFInterpreter are specified in the PPD file) {
+ output JCLs that marked JCL options.
+}
+
+if (pdftopdfJCLBegin attribute is specified in the PPD file) {
+ output it's value
+}
+
+if (Copies option is specified in the PPD file) {
+ mark Number of copies specified
+} else if (pdftopdfJCLCopies is specified in the PPD file) {
+ output JCL specified with JCLCopies
+}
+
+for (each marked options) {
+ if (pdftopdfJCL<marked option's name> is specified in the PPD file) {
+ output it's value as a JCL
+ } else if (pdftopdfJCLBegin attributes is specified in the PPD file) {
+ output "<option's name>=<marked choice>;" as a JCL
+ }
+}
+output NEWLINE
+
+Thus, if you want to use both PDF filters and GS by single PPD file,
+what you should do is to add the following line in the PPD file;
+
+*pdftopdfJCLBegin: "pdftoopvp jobInfo:"
+
+Note:
+ If you specify JCLBegin, you have to specify JCLToPDFInterpreter as well.
+
+Note:
+ When you need to specify the value which is different from the choosen
+ value based on the PPD into the jobInfo, you have to specify the values
+ with the key started by "pdftopdfJCL" string.
+
+ For example, if the page size is defined in a PPD file as following;
+
+ *OpenUI *PageSize/Page Size: PickOne
+ *DefaultPageSize: A4
+ *PageSize A4/A4:
+ *PageSize Letter/US Letter:
+ *CloseUI: *PageSize
+
+ if you choose the page size "Letter", the string "PageSize=Letter;" is
+ added to jobInfo. On the other hand, if the driver requires the different
+ value for the "Letter" size, for instance driver requires "PS=LT;"
+ instead of "PageSize=Letter;" as the jobInfo value, the PPD file has to
+ be defined as following;
+
+ *OpenUI *PageSize/Page Size: PickOne
+ *DefaultPageSize: A4
+ *PageSize A4/A4:
+ *pdftopdfJCLPageSize A4/A4: "PS=A4;"
+ *PageSize Letter/US Letter:
+ *pdftopdfJCLPageSize Letter/US Letter: "PS=LT;"
+ *CloseUI: *PageSize
+
+6.3 Special PDF comment
+
+"pdftopdf" outputs the following special comments from the 4th line in the
+created PDF data.
+
+%%PDFTOPDFNumCopies : <copies> --- <copies> specified Number of Copies
+%%PDFTOPDFCollate : <collate> --- <collate> is true or false
+
+6.4 Temporally files location
+
+"pdftopdf" creates temporally files if needed. Temporary files are created
+in the location specified by TMPDIR environment variable. Default location
+is "/tmp".
+
+PDFTOPDF -- new implementation
+
+A new implementation of the pdftopdf filter is available.
+It depends on libqpdf to read/write pdf files.
+
+The aim is to replace and imitate the pstops filter in PDF-based workflows.
+A similar filter (which can serve as behavior reference)
+is called "cgpdftopdf" in OS X (not open source).
+
+Notable options
+---------------
+ booklet=Off/On/Shuffle-Only
+ On also tries to set DuplexTumble (two-sided-short-edge) and forces number-up=2
+ booklet-signature=(multiple of 4, or default: -1 to use "all pages")
+
+Known issues
+------------
+- Borders, esp. in the "number-up=1 fitplot=false"-case are sometimes drawn
+ at incorrect locations.
+- more testing needs to be done
+- documentation largely missing
+
+TEXTTOPDF
+
+This implements a texttopdf filter, and is derived from cups' texttops.
+
+To configure:
+-------------
+
+- texttopdf uses CUPS_DATADIR/charset/pdf.utf-8 for font configuration
+ (when utf-8 was requested as charset). The font names given there are
+ used as fontconfig selectors; the best matching font, that is both
+ monospaced and in a supported format (TTC, TTF or OTF) will then be used.
+
+- As a special exception, all fontnames that start with a '.' or '/' are
+ considered filenames, and fontconfig is skipped; the name is used directly
+ for loading the font file.
+
+- Implementation note: TrueType Collections (.TTC) are internally handled
+ by appending '/' and the index of the font inside the collection to
+ the filename (e.g. to use the second font of uming.ttc, the filename
+ uming.ttc/1 must be given to the fontembed-library).
+ By appending the index-field returned from fontconfig, this is completely
+ transparent to the user (but currently not widely tested).
+
+- You may look at the two examples: pdf.utf-8.simple and pdf.utf-8.heavy.
+
+To use:
+-------
+
+The filter is called just like any other cups filter. Have a
+look at test.sh for example.
+
+Known Issues
+------------
+
+ - Text extraction does not work (at least for pdftotext from xpdf)
+ for the resulting pdfs.
+
+ - OTF(CFF) embedding currently does not subset the fonts.
+
+ - Text wrapping in pretty-printing mode does not respect double-wide
+ characters (CJK), and thus produce wrong results (wrap too late)
+ for lines where they occur. The fix is not trivial, since all the
+ pretty-printing processing is done without knowledge of / prior to
+ the font configuration (which is where single or double width
+ code-ranges are specified).
+
+ - The hebrew example in test5.pdf shows one of our limitations:
+ Compose glyphs are not composed with the primary glyph but printed
+ as separate glyphs.
+
+Further Infos
+-------------
+
+Font embedding is handled by libfontembed in the filter/fontembed
+subdirectory.
+
+Please report all bugs to https://bugs.linuxfoundation.org/, product
+"OpenPrinting", component "cups-filters".
+
+
+PDFTORASTER
+
+1. INTRODUCTION
+
+"pdftoraster" is a filter for CUPS. It reads PDF files, convert it and
+output CUPS raster.
+
+"pdftoraster" does not support functions that are not related to printing
+features, including interactive features and document interchange features.
+Many of these operators and sections are just ignored.
+Some of these may be output, but those functions are not assured.
+Encryption feature is not supported.
+
+2. LICENSE
+
+Almost source files are under MIT like license. However, "pdftoraster" links
+some "poppler" libraries, and these files are under GNU public license.
+See copyright notice of each file for details.
+
+3. COMMAND LINE
+
+"pdftoraster" is a CUPS filter, and the command line arguments, environment
+variables and configuration files are in accordance with the CUPS filter
+interface.
+
+pdftoraster <job> <user> <title> <num-copies> <options> [<filename>]
+
+"pdftoraster" ignores <job> and <user>.
+<title> is appended into the PDF dictionary as /Title.
+<num-copies> specifies the number of document copies.
+<options> is a CUPS option list.
+<filename> is an input PDF file name.
+
+When omit the <filename>, "pdftoraster" reads a PDF file from the stdin,
+and save it as a temporary file.
+
+4. ENVIRONMENT VARIABLES
+
+This program refers the following environment variable;
+ PPD: PPD file name of the printer.
+
+5. COMMAND OPTIONS
+
+See CUPS documents for details.
+
+6. INFORMATION FOR DEVELOPERS
+
+Following information is for developers, not for driver users.
+
+6.1 Options handled by a printer or "pdftoraster"
+
+"pdftopdf" outputs the following special comments from the 4th line in the
+created PDF data.
+
+%%PDFTOPDFNumCopies : <copies> --- <copies> specified Number of Copies
+%%PDFTOPDFCollate : <collate> --- <collate> is true or false
+
+"pdftoraster" overrides the command line options by above two option's values.
+
+6.2 Temporally files location
+
+"pdftoraster" creates temporally files if needed. Temporary files are created
+in the location specified by TMPDIR environment variable. Default location
+is "/tmp".
+
+
+PDFTOIJS
+
+1. INTRODUCTION
+
+"pdftoijs" is a filter for CUPS. It reads PDF files, converts it
+and sends it to an IJS server.
+
+2. LICENSE
+
+Almost source files are under MIT like license. However, "pdftoijs" links
+some "poppler" libraries, and these files are under GNU public license.
+See copyright notice of each file for details.
+
+3. COMMAND LINE
+
+"pdftoijs" is a CUPS filter, and the command line arguments, environment
+variables and configuration files are in accordance with the CUPS filter
+interface.
+
+pdftoijs <job> <user> <title> <num-copies> <options> [<filename>]
+
+"pdftoijs" ignores <job> and <user>.
+<title> is appended into the PDF dictionary as /Title.
+<num-copies> specifies the number of document copies.
+<options> is a CUPS option list.
+<filename> is an input PDF file name.
+
+When omit the <filename>, "pdftoijs" reads a PDF file from the stdin,
+and save it as a temporary file.
+
+4. ENVIRONMENT VARIABLES
+
+This program refers the following environment variable;
+ PPD: PPD file name of the printer.
+
+5. NEW PPD KEYWORDS
+
+*ijsServer : the ijsserver executable
+*ijsManufacturer, *ijsModel : as used by the ijs server
+*ijsColorspace : the desired output colorspace, one of
+ 'rgb'
+ 'cmyk' (availability depending on poppler compile-options)
+ 'white1', 'black1': 1-bit normal/inverted
+ 'white8', 'black8': 8-bit greyscale normal/inverted
+*ijsResolution [option]=[choice]: the desired output resolution e.g. "600 600"
+*ijsParams [option]=[choice]: custom ijs parameters, separated by ','
+ (to escape: use \,)
+
+6. COMMAND OPTIONS
+
+(See CUPS documents for details.)
+
+ijsOutputFile : the destination file, stdout otherwise
+
+7. INFORMATION FOR DEVELOPERS
+
+Following information is for developers, not for driver users.
+
+7.1 Temporally files location
+
+"pdftoijs" creates temporally files if needed. Temporary files are created
+in the location specified by TMPDIR environment variable. Default location
+is "/tmp".
+
+
+PDFTOOPVP
+
+1. INTRODUCTION
+
+"pdftoopvp" is a CUPS filter which reads PDF file, renders pages and
+outputs PDL to a printer driver which is compliant with the OpenPrinting
+Vector Printer Driver Interface "opvp".
+
+2. CONFIGURATION
+
+"pdftoopvp" refers the poppler configuration file. Be aware that poppler
+uses "fontconfig" for its font configuration.
+
+3. JCL
+
+When "pdftoopvp" reads a PDF file from stdin, "pdftoopvp" handles the data
+prior to PDF header (%PDF ...) as JCL options. JCL options for "pdftoopvp"
+must begin with "pdftoopvp jobInfo:". "pdftoopvp" passes the option string
+just after ":" to the driver as the jobInfo option.
+
+4. COMMAND LINE
+
+"pdftoopvp" is a CUPS filter, and the command line arguments,
+environment variables and configuration files are in accordance with
+the CUPS filter interface.
+
+pdftoopvp <job> <user> <title> <num-copies> <options> [<filename>]
+
+"pdftoopvp" ignores <job>, <user>, <title> and <num-copies>.
+<options> is a CUPS option list.
+
+When omit the <filename>, "pdftoopvp" reads a PDF file from stdin,
+and save it as a temporary file.
+
+CUPS options defined in <options> are delimited by space. Boolean
+type CUPS option is defined only by the option key, and other type
+CUPS option are defined by pairs of key and value, <key>=<value>.
+
+5. COMMAND OPTIONS
+
+"pdftoopvp" accepts the following CUPS standard options;
+
+Resolution=<int>
+ Specifies a printer resolution in dpi.
+ When this option is omitted, the resolution is treated as 300dpi.
+ Horizontal and vertical resolution are treated as the same resolution.
+
+PageSize=<string>
+ Specifies a paper size by name defined in the PPD file.
+ This option is ignored when no PPD file is assigned for the printer
+ queue.
+
+"pdftoopvp" accepts the following original options;
+
+opvpDriver=<string>
+ Specifies a driver library name.
+
+opvpModel=<string>
+ Specifies a printer model name.
+
+opvpJobInfo=<string>
+ Specifies "jobInfo" printing options that are passed to the driver.
+ Printing options are overridden by JCL options.
+
+opvpDocInfo=<string>
+ Specifies "docInfo" document options that are passed to the driver.
+
+opvpPageInfo=<string>
+ Specifies "pageInfo" page options that are passed to the driver.
+
+pdftoopvpClipPathNotSaved (Boolean option)
+ Specifies that the driver cannot save clipping path operators in PDF.
+
+nopdftoopvpShearImage (Boolean option)
+ Specifies that the driver cannot rotate/shear images by CTM.
+
+nopdftoopvpMiterLimit (Boolean option)
+ Specifies that the driver does not support miter limit.
+ If the driver does not prepare the opvpSetMiterLimit function entry,
+ this option setting is ignored, and also miter limit is ignored.
+
+pdftoopvpIgnoreMiterLimit (Boolean option)
+ When nopdftoopvpMiterLimit option is set, pdftoopvp automatically
+ replace paths to multiple lines or drawing images. This option
+ specifies to avoid the path replacement even when nopdftoopvpMiterLimit
+ option is set.
+
+pdftoopvpMaxClipPathLength=<int>
+ Specifies the maximum number of clipping path points that the driver
+ supports. Default value is 2000 points.
+
+pdftoopvpMaxFillPathLength=<int>
+ Specifies the maximum number of fill path points that the driver supports.
+ Default value is 4000 points.
+
+nopdftoopvpLineStyle (Boolean option)
+ Specifies that the driver ignores the line style settings in PDF.
+ If the driver does not prepare the SetLineStyle , SetLineDash or
+ SetLineDashOffset function entry, this option setting is ignored, and
+ also line style, line dash and line dash offset are ignored.
+
+nopdftoopvpClipPath (Boolean option)
+ Specifies that the driver does not support clipping path.
+ If the driver does not prepare the opvpSetClipPath function entry, this
+ option is ignored, and also clip path setting is ignored.
+
+nopdftoopvpBitmapChar (Boolean option)
+ Specifies that the driver does not output characters as images.
+ Default setting is that "pdftoopvp" outputs small characters as images.
+
+pdftoopvpBitmapCharThreshold=<int>
+ Specifies the threshold value that "pdftoopvp" outputs characters as
+ images. Threshold value is defined as W x H where character's width
+ is given by W pixels and height is given by H pixels.
+ Default threshold value is 2000 points.
+
+nopdftoopvpImageMask (Boolean option)
+ Specifies that the driver does not support image mask.
+ If this option is set, "pdftoopvp" treats as the nopdftoopvpBitmapChar
+ option is given.
+
+6. PPD OPTIONS
+
+Following options can be defined in a PPD.
+
+Resolution=<int>
+PageSize=<string>
+opvpDriver=<string>
+opvpModel=<string>
+opvpJobInfo=<string>
+opvpDocInfo=<string>
+opvpPageInfo=<string>
+pdftoopvpClipPathNotSaved=True
+pdftoopvpShearImage=False
+pdftoopvpMiterLimit=False
+pdftoopvpIgnoreMiterLimit=True
+pdftoopvpMaxClipPathLength=<int>
+pdftoopvpMaxFillPathLength=<int>
+pdftoopvpLineStyle=False
+pdftoopvpClipPath=False
+pdftoopvpBitmapChar=False
+pdftoopvpBitmapCharThreshold=<int>
+pdftoopvpImageMask=False
+
+7. OPTIONS OVERRIDING RULE
+
+"jobInfo" printing options in a PPD is used as a initial "jobInfo" printing
+options. If opvpJobInfo option is given in the command line, precedent
+"jobInfo" printing options are overridden by the opvpJobInfo options.
+
+After the "jobInfo" printing options are overridden by the opvpJobInfo
+options, if JCL options are given, precedent "jobInfo" printing options are
+overridden by the options given by JCL options.
+
+8. INFORMATION FOR CUPS 1.1
+
+To use this program under CUPS 1.1, following lines must be defined
+in the CUPS's "mime.types" file.
+
+application/vnd.cups-pdf
+
+9. KNOWN PROBLEMS
+
+Problem:
+ When a page is rotated and a character is small, character might not be
+ rotated correctly. This problem is caused by free type library.
+Solution:
+ Define the nopdftoopvpBitmapChar to inhibit characters output as images.
+
+
+URFTOPDF
+
+"urftopdf" is a filter to convert Apple's proprietary URF raster
+format into PDF. URF raster is generated by some iOS applications when
+printing via Airprint, so this filter provides a more complete support
+for AirPrint clients. Note that it is not clear whether nowadays all
+iOS applications send PDF and not URF any more. Also the filter does
+not support all variants of URF format so the URF support is most
+probably incomplete.
+
+Apple does not provide any official documentation of the format but there is
+already some reverse engineering done. A description of the format as far as it
+got found out and two sample files can be found here:
+
+https://github.com/AlanQuatermain/unirast
+
+An actual implementation of an urftopdf filter is here:
+
+https://github.com/superna9999/urftopdf
+
+This original version uses libharu and to avoid an extra dependency
+the filter coming with this package is converted to use libqpdf
+instead (the same library as pdftopdf uses).
+
+License: GNU General Public License version 3 or any newer version
--- /dev/null
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 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(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+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'.])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# 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.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+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
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+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 delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable. If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins. After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script. The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_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
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # 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)
+
+ _LT_PROG_REPLACE_SHELLFNS
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Go], [_LT_LANG(GO)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_GO. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+ [LT_LANG(GO)],
+ [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+
+ AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+ [lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+ [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# 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.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+ lt_aix_libpath_sed='[
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }]'
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi],[])
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+ fi
+ ])
+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+case "$ECHO" in
+ printf*) AC_MSG_RESULT([printf]) ;;
+ print*) AC_MSG_RESULT([print -r]) ;;
+ *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test "X`printf %s $ECHO`" = "X$ECHO" \
+ || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[ --with-sysroot[=DIR] Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted. We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ AC_MSG_RESULT([${with_sysroot}])
+ AC_MSG_ERROR([The sysroot must be an absolute path.])
+ ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_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 '$LINENO' "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-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|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*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*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*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ 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_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[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
+ ;;
+*-*solaris*)
+ # 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
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+ [lt_cv_ar_at_file=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+ ])
+ ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+ [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+ [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $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 other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker 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
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# 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
+ teststring="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* | cegcc*)
+ # 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;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # 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"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # 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`
+ fi
+ ;;
+ 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
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_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 <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 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;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_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* | cegcc*)
+ 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="-ldld"],
+ [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="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ 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"
+ wl=$lt_prog_compiler_wl 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_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
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_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
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $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:$LINENO: \$? = $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
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_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
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_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
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_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_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; 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
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+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"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".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"
+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 # correct to gnu/linux during the next big refactor
+ 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'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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<name>.so
+ # instead of lib<name>.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*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ 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=`func_echo_all "$lib" | $SED '\''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'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ 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~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ 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}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH.
+ 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
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # 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
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # 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}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[23]].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ 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
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ 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_cmds='.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_cmds='.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_cmds='.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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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 glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+ [lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [lt_cv_shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+ ])
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # 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
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # 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'
+ ;;
+
+netbsdelf*-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='NetBSD ld.elf_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}${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 # correct to gnu/linux during the next big refactor
+ 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=qnx
+ 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='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ 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_cmds=".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"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ 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 # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[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]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+ [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_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="m4_if([$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 <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_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
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_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
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_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])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 variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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
+ ;;
+
+haiku*)
+ 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])(-bit)?( [LM]SB)? 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
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ 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=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ 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
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+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
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+ [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_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"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+ [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+ [lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-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_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+ esac
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# 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]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# 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
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT@&t@_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_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_globsym_save_LIBS
+ CFLAGS=$lt_globsym_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 -rf 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
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+ [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_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
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # 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).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd* | netbsdelf*-gnu)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_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_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+ if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_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_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Intel*\ [[CF]]*Compiler*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ *Portland\ Group*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ case $host_os in
+ aix[[4-9]]*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_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_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*)
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_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_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # 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.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ esac
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+ *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_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 $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ 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
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_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
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ 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='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $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_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ m4_if($1, [], [
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ _LT_LINKER_OPTION([if $CC understands -b],
+ _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+ [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+ [lt_cv_irix_exported_symbol],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+ [C++], [[int foo (void) { return 0; }]],
+ [Fortran 77], [[
+ subroutine foo
+ end]],
+ [Fortran], [[
+ subroutine foo
+ end]])])],
+ [lt_cv_irix_exported_symbol=yes],
+ [lt_cv_irix_exported_symbol=no])
+ LDFLAGS="$save_LDFLAGS"])
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_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 $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_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'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_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} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_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_CACHE_CHECK([whether -lc should be explicitly linked in],
+ [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+ [$RM conftest*
+ echo "$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_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ ])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+ [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+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_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will 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
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ 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
+ $as_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
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_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_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -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 -v "^Configured with:" | $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_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ 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='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ 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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_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_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_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ 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_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --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; func_echo_all "$list"'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_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_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_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::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | 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_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_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=`func_echo_all "$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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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 -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_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} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$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 -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$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 -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+ '"$_LT_TAGVAR(old_archive_cmds, $1)"
+ _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+ '"$_LT_TAGVAR(reload_cmds, $1)"
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_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...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ 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
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([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.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+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...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${F77-"f77"}
+ CFLAGS=$FFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ 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
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_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...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+ CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${FC-"f95"}
+ CFLAGS=$FCFLAGS
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ 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
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_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...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# 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. #
+
+m4_defun([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
+IFS=$as_save_IFS
+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 && continue
+ 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_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+ func_split_long_opt_name=${1%%=*}
+ func_split_long_opt_arg=${1#*=}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+ func_split_short_opt_arg=${1#??}
+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
+
+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
+
+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+ func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+ [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+ [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
+
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_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=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_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=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_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=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# 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.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# 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 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# 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.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 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 1
+
+# 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.11'
+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.11.6], [],
+ [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 AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005, 2011 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 1
+
+# 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, 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 9
+
+# 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
+m4_define([_AM_COND_VALUE_$1], [$2])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, 2009,
+# 2010, 2011 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 12
+
+# 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'.
+ rm -rf conftest.dir
+ 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
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ 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, 2009 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 16
+
+# 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.62])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)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+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
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# 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, 2008, 2011 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 1
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+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, 2009 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_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.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
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 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 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 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 6
+
+# 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
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# 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, 2011 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 1
+
+# 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, 2008, 2010 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_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],
+[m4_foreach_w([_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, 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 5
+
+# 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
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# 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) 2009, 2011 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_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# (`yes' being less verbose, `no' or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules],
+[ --enable-silent-rules less verbose build output (undo: `make V=1')
+ --disable-silent-rules verbose build output (undo: `make V=0')])
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no) AM_DEFAULT_VERBOSITY=1;;
+*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few `make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using `$V' instead of `$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001, 2003, 2005, 2011 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 1
+
+# 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, 2008, 2010 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_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005, 2012 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. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} 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 <conftest.tar])
+ grep GrepMe conftest.dir/file >/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
+
--- /dev/null
+#!/bin/sh
+TESTLIBTOOLIZE="glibtoolize libtoolize"
+
+LIBTOOLIZEFOUND="0"
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+olddir=`pwd`
+cd $srcdir
+
+aclocal --version > /dev/null 2> /dev/null || {
+ echo "error: aclocal not found"
+ exit 1
+}
+automake --version > /dev/null 2> /dev/null || {
+ echo "error: automake not found"
+ exit 1
+}
+
+for i in $TESTLIBTOOLIZE; do
+ if which $i > /dev/null 2>&1; then
+ LIBTOOLIZE=$i
+ LIBTOOLIZEFOUND="1"
+ break
+ fi
+done
+
+if [ "$LIBTOOLIZEFOUND" = "0" ]; then
+ echo "$0: need libtoolize tool to build cups-filters" >&2
+ exit 1
+fi
+
+amcheck=`automake --version | grep 'automake (GNU automake) 1.5'`
+if test "x$amcheck" = "xautomake (GNU automake) 1.5"; then
+ echo "warning: you appear to be using automake 1.5"
+ echo " this version has a bug - GNUmakefile.am dependencies are not generated"
+fi
+
+rm -rf autom4te*.cache
+
+$LIBTOOLIZE --force --copy || {
+ echo "error: libtoolize failed"
+ exit 1
+}
+aclocal $ACLOCAL_FLAGS || {
+ echo "error: aclocal $ACLOCAL_FLAGS failed"
+ exit 1
+}
+autoheader || {
+ echo "error: autoheader failed"
+ exit 1
+}
+automake -a -c --gnu --add-missing || {
+ echo "warning: automake failed"
+}
+autoconf || {
+ echo "error: autoconf failed"
+ exit 1
+}
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Backend support definitions for OpenPrinting CUPS Filters.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _CUPSFILTERS_BACKEND_PRIVATE_H_
+# define _CUPSFILTERS_BACKEND_PRIVATE_H_
+
+
+/*
+ * Include necessary headers.
+ */
+
+# include <config.h>
+# include <cups/cups.h>
+# include <cups/ppd.h>
+# include <cups/backend.h>
+# include <cups/sidechannel.h>
+# include <string.h>
+# include <stdlib.h>
+# include <errno.h>
+# include <signal.h>
+
+# ifdef __linux
+# include <sys/ioctl.h>
+# include <linux/lp.h>
+# define IOCNR_GET_DEVICE_ID 1
+# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
+# include <linux/parport.h>
+# include <linux/ppdev.h>
+# include <unistd.h>
+# include <fcntl.h>
+# endif /* __linux */
+
+# ifdef __sun
+# ifdef __sparc
+# include <sys/ecppio.h>
+# else
+# include <sys/ioccom.h>
+# include <sys/ecppsys.h>
+# endif /* __sparc */
+# endif /* __sun */
+
+
+/*
+ * C++ magic...
+ */
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+
+/*
+ * Prototypes...
+ */
+
+extern int backendDrainOutput(int print_fd, int device_fd);
+extern int backendGetDeviceID(int fd, char *device_id,
+ int device_id_size,
+ char *make_model,
+ int make_model_size,
+ const char *scheme, char *uri,
+ int uri_size);
+extern int backendGetMakeModel(const char *device_id,
+ char *make_model,
+ int make_model_size);
+
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+#endif /* !_CUPSFILTERS_BACKEND_PRIVATE_H_ */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * IEEE-1284 support functions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * backendGetDeviceID() - Get the IEEE-1284 device ID string and
+ * corresponding URI.
+ * backendGetMakeModel() - Get the make and model string from the device
+ * ID.
+ * get_1284_values() - Get 1284 device ID keys and values.
+ * normalize_make_and_model() - Normalize a product/make-and-model string.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "backend-private.h"
+#include <cups/cups.h>
+#include <string.h>
+#include <ctype.h>
+#define DEBUG_printf(x)
+#define DEBUG_puts(x)
+#define _cups_isspace(x) isspace((x) & 255)
+#define _cups_strcasecmp strcasecmp
+#define _cups_strncasecmp strncasecmp
+
+
+/*
+ * Local functions...
+ */
+
+static int get_1284_values(const char *device_id, cups_option_t **values);
+static char *normalize_make_and_model(const char *make_and_model,
+ char *buffer, size_t bufsize);
+
+
+/*
+ * 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
+ * corresponding URI.
+ */
+
+int /* O - 0 on success, -1 on failure */
+backendGetDeviceID(
+ int fd, /* I - File descriptor */
+ char *device_id, /* O - 1284 device ID */
+ int device_id_size, /* I - Size of buffer */
+ char *make_model, /* O - Make/model */
+ int make_model_size, /* I - Size of buffer */
+ const char *scheme, /* I - URI scheme */
+ char *uri, /* O - Device URI */
+ int uri_size) /* I - Size of buffer */
+{
+#ifdef __APPLE__ /* This function is a no-op */
+ (void)fd;
+ (void)device_id;
+ (void)device_id_size;
+ (void)make_model;
+ (void)make_model_size;
+ (void)scheme;
+ (void)uri;
+ (void)uri_size;
+
+ return (-1);
+
+#else /* Get the device ID from the specified file descriptor... */
+# ifdef __linux
+ int length; /* Length of device ID info */
+ int got_id = 0;
+# endif /* __linux */
+# if defined(__sun) && defined(ECPPIOC_GETDEVID)
+ struct ecpp_device_id did; /* Device ID buffer */
+# endif /* __sun && ECPPIOC_GETDEVID */
+ char *ptr; /* Pointer into device ID */
+
+
+ DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
+ "make_model=%p, make_model_size=%d, scheme=\"%s\", "
+ "uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
+ make_model, make_model_size, scheme ? scheme : "(null)",
+ uri, uri_size));
+
+ /*
+ * Range check input...
+ */
+
+ if (!device_id || device_id_size < 32)
+ {
+ DEBUG_puts("backendGetDeviceID: Bad args!");
+ return (-1);
+ }
+
+ if (make_model)
+ *make_model = '\0';
+
+ if (fd >= 0)
+ {
+ /*
+ * Get the device ID string...
+ */
+
+ *device_id = '\0';
+
+# ifdef __linux
+ if (ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_id))
+ {
+ /*
+ * Linux has to implement things differently for every device it seems.
+ * Since the standard parallel port driver does not provide a simple
+ * ioctl() to get the 1284 device ID, we have to open the "raw" parallel
+ * device corresponding to this port and do some negotiation trickery
+ * to get the current device ID.
+ */
+
+ if (uri && !strncmp(uri, "parallel:/dev/", 14))
+ {
+ char devparport[16]; /* /dev/parportN */
+ int devparportfd, /* File descriptor for raw device */
+ mode; /* Port mode */
+
+
+ /*
+ * Since the Linux parallel backend only supports 4 parallel port
+ * devices, just grab the trailing digit and use it to construct a
+ * /dev/parportN filename...
+ */
+
+ snprintf(devparport, sizeof(devparport), "/dev/parport%s",
+ uri + strlen(uri) - 1);
+
+ if ((devparportfd = open(devparport, O_RDWR | O_NOCTTY)) != -1)
+ {
+ /*
+ * Claim the device...
+ */
+
+ if (!ioctl(devparportfd, PPCLAIM))
+ {
+ fcntl(devparportfd, F_SETFL, fcntl(devparportfd, F_GETFL) | O_NONBLOCK);
+
+ mode = IEEE1284_MODE_COMPAT;
+
+ if (!ioctl(devparportfd, PPNEGOT, &mode))
+ {
+ /*
+ * Put the device into Device ID mode...
+ */
+
+ mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
+
+ if (!ioctl(devparportfd, PPNEGOT, &mode))
+ {
+ /*
+ * Read the 1284 device ID...
+ */
+
+ if ((length = read(devparportfd, device_id,
+ device_id_size - 1)) >= 2)
+ {
+ device_id[length] = '\0';
+ got_id = 1;
+ }
+ }
+ }
+
+ /*
+ * Release the device...
+ */
+
+ ioctl(devparportfd, PPRELEASE);
+ }
+
+ close(devparportfd);
+ }
+ }
+ }
+ else
+ got_id = 1;
+
+ if (got_id)
+ {
+ /*
+ * Extract the length of the device ID string from the first two
+ * bytes. The 1284 spec says the length is stored MSB first...
+ */
+
+ length = (((unsigned)device_id[0] & 255) << 8) +
+ ((unsigned)device_id[1] & 255);
+
+ /*
+ * Check to see if the length is larger than our buffer; first
+ * assume that the vendor incorrectly implemented the 1284 spec,
+ * and then limit the length to the size of our buffer...
+ */
+
+ if (length > device_id_size || length < 14)
+ length = (((unsigned)device_id[1] & 255) << 8) +
+ ((unsigned)device_id[0] & 255);
+
+ if (length > device_id_size)
+ length = device_id_size;
+
+ /*
+ * The length field counts the number of bytes in the string
+ * including the length field itself (2 bytes). The minimum
+ * length for a valid/usable device ID is 14 bytes:
+ *
+ * <LENGTH> MFG: <MFG> ;MDL: <MDL> ;
+ * 2 + 4 + 1 + 5 + 1 + 1
+ */
+
+ if (length < 14)
+ {
+ /*
+ * Can't use this device ID, so don't try to copy it...
+ */
+
+ device_id[0] = '\0';
+ got_id = 0;
+ }
+ else
+ {
+ /*
+ * Copy the device ID text to the beginning of the buffer and
+ * nul-terminate.
+ */
+
+ length -= 2;
+
+ memmove(device_id, device_id + 2, length);
+ device_id[length] = '\0';
+ }
+ }
+ else
+ {
+ DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
+ strerror(errno)));
+ *device_id = '\0';
+ }
+# endif /* __linux */
+
+# if defined(__sun) && defined(ECPPIOC_GETDEVID)
+ did.mode = ECPP_CENTRONICS;
+ did.len = device_id_size - 1;
+ did.rlen = 0;
+ did.addr = device_id;
+
+ if (!ioctl(fd, ECPPIOC_GETDEVID, &did))
+ {
+ /*
+ * Nul-terminate the device ID text.
+ */
+
+ if (did.rlen < (device_id_size - 1))
+ device_id[did.rlen] = '\0';
+ else
+ device_id[device_id_size - 1] = '\0';
+ }
+# ifdef DEBUG
+ else
+ DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
+ strerror(errno)));
+# endif /* DEBUG */
+# endif /* __sun && ECPPIOC_GETDEVID */
+ }
+
+ /*
+ * Check whether device ID is valid. Turn line breaks and tabs to spaces and
+ * reject device IDs with non-printable characters.
+ */
+
+ for (ptr = device_id; *ptr; ptr ++)
+ if (_cups_isspace(*ptr))
+ *ptr = ' ';
+ else if ((*ptr & 255) < ' ' || *ptr == 127)
+ {
+ DEBUG_printf(("backendGetDeviceID: Bad device_id character %d.",
+ *ptr & 255));
+ *device_id = '\0';
+ break;
+ }
+
+ DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
+
+ if (scheme && uri)
+ *uri = '\0';
+
+ if (!*device_id)
+ return (-1);
+
+ /*
+ * Get the make and model...
+ */
+
+ if (make_model)
+ backendGetMakeModel(device_id, make_model, make_model_size);
+
+ /*
+ * Then generate a device URI...
+ */
+
+ if (scheme && uri && uri_size > 32)
+ {
+ int num_values; /* Number of keys and values */
+ cups_option_t *values; /* Keys and values in device ID */
+ const char *mfg, /* Manufacturer */
+ *mdl, /* Model */
+ *sern; /* Serial number */
+ char temp[256], /* Temporary manufacturer string */
+ *tempptr; /* Pointer into temp string */
+
+
+ /*
+ * Get the make, model, and serial numbers...
+ */
+
+ num_values = get_1284_values(device_id, &values);
+
+ if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
+ if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
+ sern = cupsGetOption("SN", num_values, values);
+
+ if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
+ mfg = cupsGetOption("MFG", num_values, values);
+
+ if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
+ mdl = cupsGetOption("MDL", num_values, values);
+
+ if (mfg)
+ {
+ if (!_cups_strcasecmp(mfg, "Hewlett-Packard"))
+ mfg = "HP";
+ else if (!_cups_strcasecmp(mfg, "Lexmark International"))
+ mfg = "Lexmark";
+ }
+ else
+ {
+ strncpy(temp, make_model, sizeof(temp) - 1);
+ temp[sizeof(temp) - 1] = '\0';
+
+ if ((tempptr = strchr(temp, ' ')) != NULL)
+ *tempptr = '\0';
+
+ mfg = temp;
+ }
+
+ if (!mdl)
+ mdl = "";
+
+ if (!_cups_strncasecmp(mdl, mfg, strlen(mfg)))
+ {
+ mdl += strlen(mfg);
+
+ while (isspace(*mdl & 255))
+ mdl ++;
+ }
+
+ /*
+ * Generate the device URI from the manufacturer, make_model, and
+ * serial number strings.
+ */
+
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, scheme, NULL, mfg, 0,
+ "/%s%s%s", mdl, sern ? "?serial=" : "", sern ? sern : "");
+
+ cupsFreeOptions(num_values, values);
+ }
+
+ return (0);
+#endif /* __APPLE__ */
+}
+
+
+/*
+ * 'backendGetMakeModel()' - Get the make and model string from the device ID.
+ */
+
+int /* O - 0 on success, -1 on failure */
+backendGetMakeModel(
+ const char *device_id, /* O - 1284 device ID */
+ char *make_model, /* O - Make/model */
+ int make_model_size) /* I - Size of buffer */
+{
+ int num_values; /* Number of keys and values */
+ cups_option_t *values; /* Keys and values */
+ const char *mfg, /* Manufacturer string */
+ *mdl, /* Model string */
+ *des; /* Description string */
+
+
+ DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
+ "make_model=%p, make_model_size=%d)\n", device_id,
+ make_model, make_model_size));
+
+ /*
+ * Range check input...
+ */
+
+ if (!device_id || !*device_id || !make_model || make_model_size < 32)
+ {
+ DEBUG_puts("backendGetMakeModel: Bad args!");
+ return (-1);
+ }
+
+ *make_model = '\0';
+
+ /*
+ * Look for the description field...
+ */
+
+ num_values = get_1284_values(device_id, &values);
+
+ if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
+ mdl = cupsGetOption("MDL", num_values, values);
+
+ if (mdl)
+ {
+ /*
+ * Build a make-model string from the manufacturer and model attributes...
+ */
+
+ if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
+ mfg = cupsGetOption("MFG", num_values, values);
+
+ if (!mfg || !_cups_strncasecmp(mdl, mfg, strlen(mfg)))
+ {
+ /*
+ * Just copy the model string, since it has the manufacturer...
+ */
+
+ normalize_make_and_model(mdl, make_model, make_model_size);
+ }
+ else
+ {
+ /*
+ * Concatenate the make and model...
+ */
+
+ char temp[1024]; /* Temporary make and model */
+
+ snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
+
+ normalize_make_and_model(temp, make_model, make_model_size);
+ }
+ }
+ else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL ||
+ (des = cupsGetOption("DES", num_values, values)) != NULL)
+ {
+ /*
+ * Make sure the description contains something useful, since some
+ * printer manufacturers (HP) apparently don't follow the standards
+ * they helped to define...
+ *
+ * Here we require the description to be 8 or more characters in length,
+ * containing at least one space and one letter.
+ */
+
+ if (strlen(des) >= 8)
+ {
+ const char *ptr; /* Pointer into description */
+ int letters, /* Number of letters seen */
+ spaces; /* Number of spaces seen */
+
+
+ for (ptr = des, letters = 0, spaces = 0; *ptr; ptr ++)
+ {
+ if (isspace(*ptr & 255))
+ spaces ++;
+ else if (isalpha(*ptr & 255))
+ letters ++;
+
+ if (spaces && letters)
+ break;
+ }
+
+ if (spaces && letters)
+ normalize_make_and_model(des, make_model, make_model_size);
+ }
+ }
+
+ if (!make_model[0])
+ {
+ /*
+ * Use "Unknown" as the printer make and model...
+ */
+
+ strncpy(make_model, "Unknown", make_model_size - 1);
+ make_model[make_model_size - 1] = '\0';
+ }
+
+ cupsFreeOptions(num_values, values);
+
+ return (0);
+}
+
+
+/*
+ * 'get_1284_values()' - Get 1284 device ID keys and values.
+ *
+ * The returned dictionary is a CUPS option array that can be queried with
+ * cupsGetOption and freed with cupsFreeOptions.
+ */
+
+static int /* O - Number of key/value pairs */
+get_1284_values(
+ const char *device_id, /* I - IEEE-1284 device ID string */
+ cups_option_t **values) /* O - Array of key/value pairs */
+{
+ int num_values; /* Number of values */
+ char key[256], /* Key string */
+ value[256], /* Value string */
+ *ptr; /* Pointer into key/value */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (values)
+ *values = NULL;
+
+ if (!device_id || !values)
+ return (0);
+
+ /*
+ * Parse the 1284 device ID value into keys and values. The format is
+ * repeating sequences of:
+ *
+ * [whitespace]key:value[whitespace];
+ */
+
+ num_values = 0;
+ while (*device_id)
+ {
+ while (_cups_isspace(*device_id))
+ device_id ++;
+
+ if (!*device_id)
+ break;
+
+ for (ptr = key; *device_id && *device_id != ':'; device_id ++)
+ if (ptr < (key + sizeof(key) - 1))
+ *ptr++ = *device_id;
+
+ if (!*device_id)
+ break;
+
+ while (ptr > key && _cups_isspace(ptr[-1]))
+ ptr --;
+
+ *ptr = '\0';
+ device_id ++;
+
+ while (_cups_isspace(*device_id))
+ device_id ++;
+
+ if (!*device_id)
+ break;
+
+ for (ptr = value; *device_id && *device_id != ';'; device_id ++)
+ if (ptr < (value + sizeof(value) - 1))
+ *ptr++ = *device_id;
+
+ if (!*device_id)
+ break;
+
+ while (ptr > value && _cups_isspace(ptr[-1]))
+ ptr --;
+
+ *ptr = '\0';
+ device_id ++;
+
+ num_values = cupsAddOption(key, value, num_values, values);
+ }
+
+ return (num_values);
+}
+
+
+/*
+ * 'normalize_make_and_model()' - Normalize a product/make-and-model string.
+ *
+ * This function tries to undo the mistakes made by many printer manufacturers
+ * to produce a clean make-and-model string we can use.
+ */
+
+static char * /* O - Normalized make-and-model string or NULL on error */
+normalize_make_and_model(
+ const char *make_and_model, /* I - Original make-and-model string */
+ char *buffer, /* I - String buffer */
+ size_t bufsize) /* I - Size of string buffer */
+{
+ char *bufptr; /* Pointer into buffer */
+
+
+ if (!make_and_model || !buffer || bufsize < 1)
+ {
+ if (buffer)
+ *buffer = '\0';
+
+ return (NULL);
+ }
+
+ /*
+ * Skip leading whitespace...
+ */
+
+ while (_cups_isspace(*make_and_model))
+ make_and_model ++;
+
+ /*
+ * Remove parenthesis and add manufacturers as needed...
+ */
+
+ if (make_and_model[0] == '(')
+ {
+ strncpy(buffer, make_and_model + 1, bufsize - 1);
+ buffer[bufsize - 1] = '\0';
+
+ if ((bufptr = strrchr(buffer, ')')) != NULL)
+ *bufptr = '\0';
+ }
+ else if (!_cups_strncasecmp(make_and_model, "XPrint", 6))
+ {
+ /*
+ * Xerox XPrint...
+ */
+
+ snprintf(buffer, bufsize, "Xerox %s", make_and_model);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "Eastman", 7))
+ {
+ /*
+ * Kodak...
+ */
+
+ snprintf(buffer, bufsize, "Kodak %s", make_and_model + 7);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "laserwriter", 11))
+ {
+ /*
+ * Apple LaserWriter...
+ */
+
+ snprintf(buffer, bufsize, "Apple LaserWriter%s", make_and_model + 11);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "colorpoint", 10))
+ {
+ /*
+ * Seiko...
+ */
+
+ snprintf(buffer, bufsize, "Seiko %s", make_and_model);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "fiery", 5))
+ {
+ /*
+ * EFI...
+ */
+
+ snprintf(buffer, bufsize, "EFI %s", make_and_model);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "ps ", 3) ||
+ !_cups_strncasecmp(make_and_model, "colorpass", 9))
+ {
+ /*
+ * Canon...
+ */
+
+ snprintf(buffer, bufsize, "Canon %s", make_and_model);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "primera", 7))
+ {
+ /*
+ * Fargo...
+ */
+
+ snprintf(buffer, bufsize, "Fargo %s", make_and_model);
+ }
+ else if (!_cups_strncasecmp(make_and_model, "designjet", 9) ||
+ !_cups_strncasecmp(make_and_model, "deskjet", 7))
+ {
+ /*
+ * HP...
+ */
+
+ snprintf(buffer, bufsize, "HP %s", make_and_model);
+ }
+ else
+ {
+ strncpy(buffer, make_and_model, bufsize - 1);
+ buffer[bufsize - 1] = '\0';
+ }
+
+ /*
+ * Clean up the make...
+ */
+
+ if (!_cups_strncasecmp(buffer, "agfa", 4))
+ {
+ /*
+ * Replace with AGFA (all uppercase)...
+ */
+
+ buffer[0] = 'A';
+ buffer[1] = 'G';
+ buffer[2] = 'F';
+ buffer[3] = 'A';
+ }
+ else if (!_cups_strncasecmp(buffer, "Hewlett-Packard hp ", 19))
+ {
+ /*
+ * Just put "HP" on the front...
+ */
+
+ buffer[0] = 'H';
+ buffer[1] = 'P';
+ memmove(buffer + 2, buffer + 18, strlen(buffer + 18) + 1);
+ }
+ else if (!_cups_strncasecmp(buffer, "Hewlett-Packard ", 16))
+ {
+ /*
+ * Just put "HP" on the front...
+ */
+
+ buffer[0] = 'H';
+ buffer[1] = 'P';
+ memmove(buffer + 2, buffer + 15, strlen(buffer + 15) + 1);
+ }
+ else if (!_cups_strncasecmp(buffer, "Lexmark International", 21))
+ {
+ /*
+ * Strip "International"...
+ */
+
+ memmove(buffer + 8, buffer + 21, strlen(buffer + 21) + 1);
+ }
+ else if (!_cups_strncasecmp(buffer, "herk", 4))
+ {
+ /*
+ * Replace with LHAG...
+ */
+
+ buffer[0] = 'L';
+ buffer[1] = 'H';
+ buffer[2] = 'A';
+ buffer[3] = 'G';
+ }
+ else if (!_cups_strncasecmp(buffer, "linotype", 8))
+ {
+ /*
+ * Replace with LHAG...
+ */
+
+ buffer[0] = 'L';
+ buffer[1] = 'H';
+ buffer[2] = 'A';
+ buffer[3] = 'G';
+ memmove(buffer + 4, buffer + 8, strlen(buffer + 8) + 1);
+ }
+
+ /*
+ * Remove trailing whitespace and return...
+ */
+
+ for (bufptr = buffer + strlen(buffer) - 1;
+ bufptr >= buffer && _cups_isspace(*bufptr);
+ bufptr --);
+
+ bufptr[1] = '\0';
+
+ return (buffer[0] ? buffer : NULL);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Parallel port backend for OpenPrinting CUPS Filters.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Send a file to the specified parallel port.
+ * drain_output() - Drain pending print data to the device.
+ * list_devices() - List all parallel devices.
+ * run_loop() - Read and write print and back-channel data.
+ * side_cb() - Handle side-channel requests...
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "backend-private.h"
+#include <unistd.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <sys/socket.h>
+
+
+/*
+ * Local functions...
+ */
+
+static int drain_output(int print_fd, int device_fd);
+static void list_devices(void);
+static ssize_t run_loop(int print_fd, int device_fd, int use_bc,
+ int update_state);
+static int side_cb(int print_fd, int device_fd, int use_bc);
+
+
+/*
+ * 'main()' - Send a file to the specified parallel port.
+ *
+ * Usage:
+ *
+ * printer-uri job-id user title copies options [file]
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments (6 or 7) */
+ char *argv[]) /* I - Command-line arguments */
+{
+ char method[255], /* Method in URI */
+ hostname[1024], /* Hostname */
+ username[255], /* Username info (not used) */
+ resource[1024], /* Resource info (device and options) */
+ *options; /* Pointer to options */
+ int port; /* Port number (not used) */
+ int print_fd, /* Print file */
+ device_fd, /* Parallel device */
+ use_bc; /* Read back-channel data? */
+ int copies; /* Number of copies to print */
+ ssize_t tbytes; /* Total number of bytes written */
+ struct termios opts; /* Parallel port options */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Ignore SIGPIPE signals...
+ */
+
+#ifdef HAVE_SIGSET
+ sigset(SIGPIPE, SIG_IGN);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &action, NULL);
+#else
+ signal(SIGPIPE, SIG_IGN);
+#endif /* HAVE_SIGSET */
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc == 1)
+ {
+ list_devices();
+ return (CUPS_BACKEND_OK);
+ }
+ else if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]",
+ argv[0]);
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ /*
+ * If we have 7 arguments, print the file named on the command-line.
+ * Otherwise, send stdin instead...
+ */
+
+ if (argc == 6)
+ {
+ print_fd = 0;
+ copies = 1;
+ }
+ else
+ {
+ /*
+ * Try to open the print file...
+ */
+
+ if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+ {
+ perror("ERROR: Unable to open print file");
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ copies = atoi(argv[4]);
+ }
+
+ /*
+ * Extract the device name and options from the URI...
+ */
+
+ httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+ method, sizeof(method), username, sizeof(username),
+ hostname, sizeof(hostname), &port,
+ resource, sizeof(resource));
+
+ /*
+ * See if there are any options...
+ */
+
+ if ((options = strchr(resource, '?')) != NULL)
+ {
+ /*
+ * Yup, terminate the device name string and move to the first
+ * character of the options...
+ */
+
+ *options++ = '\0';
+ }
+
+ /*
+ * Open the parallel port device...
+ */
+
+ fputs("STATE: +connecting-to-device\n", stderr);
+
+ do
+ {
+#if defined(__linux) || defined(__FreeBSD__)
+ /*
+ * The Linux and FreeBSD parallel port drivers currently are broken WRT
+ * select() and bidirection I/O...
+ */
+
+ device_fd = open(resource, O_WRONLY | O_EXCL);
+ use_bc = 0;
+
+#else
+ if ((device_fd = open(resource, O_RDWR | O_EXCL)) < 0)
+ {
+ device_fd = open(resource, O_WRONLY | O_EXCL);
+ use_bc = 0;
+ }
+ else
+ use_bc = 1;
+#endif /* __linux || __FreeBSD__ */
+
+ if (device_fd == -1)
+ {
+ if (getenv("CLASS") != NULL)
+ {
+ /*
+ * If the CLASS environment variable is set, the job was submitted
+ * to a class and not to a specific queue. In this case, we want
+ * to abort immediately so that the job can be requeued on the next
+ * available printer in the class.
+ */
+
+ fputs("INFO: Unable to contact printer, queuing on next printer in "
+ "class.\n", stderr);
+
+ /*
+ * Sleep 5 seconds to keep the job from requeuing too rapidly...
+ */
+
+ sleep(5);
+
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ if (errno == EBUSY)
+ {
+ fputs("INFO: Printer busy; will retry in 30 seconds.\n", stderr);
+ sleep(30);
+ }
+ else if (errno == ENXIO || errno == EIO || errno == ENOENT)
+ {
+ fputs("INFO: Printer not connected; will retry in 30 seconds.\n",
+ stderr);
+ sleep(30);
+ }
+ else
+ {
+ perror("ERROR: Unable to open parallel port");
+ return (CUPS_BACKEND_FAILED);
+ }
+ }
+ }
+ while (device_fd < 0);
+
+ fputs("STATE: -connecting-to-device\n", stderr);
+
+ /*
+ * Set any options provided...
+ */
+
+ tcgetattr(device_fd, &opts);
+
+ opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
+
+ /**** No options supported yet ****/
+
+ tcsetattr(device_fd, TCSANOW, &opts);
+
+ /*
+ * Finally, send the print file...
+ */
+
+ tbytes = 0;
+
+ while (copies > 0 && tbytes >= 0)
+ {
+ copies --;
+
+ if (print_fd != 0)
+ {
+ fputs("PAGE: 1 1\n", stderr);
+ lseek(print_fd, 0, SEEK_SET);
+ }
+
+ tbytes = run_loop(print_fd, device_fd, use_bc, 1);
+
+ if (print_fd != 0 && tbytes >= 0)
+ fputs("INFO: Print file sent.\n", stderr);
+ }
+
+ /*
+ * Close the socket connection and input file and return...
+ */
+
+ close(device_fd);
+
+ if (print_fd != 0)
+ close(print_fd);
+
+ return (CUPS_BACKEND_OK);
+}
+
+
+/*
+ * 'drain_output()' - Drain pending print data to the device.
+ */
+
+static int /* O - 0 on success, -1 on error */
+drain_output(int print_fd, /* I - Print file descriptor */
+ int device_fd) /* I - Device file descriptor */
+{
+ int nfds; /* Maximum file descriptor value + 1 */
+ fd_set input; /* Input set for reading */
+ ssize_t print_bytes, /* Print bytes read */
+ bytes; /* Bytes written */
+ char print_buffer[8192], /* Print data buffer */
+ *print_ptr; /* Pointer into print data buffer */
+ struct timeval timeout; /* Timeout for read... */
+
+
+ /*
+ * Figure out the maximum file descriptor value to use with select()...
+ */
+
+ nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+
+ /*
+ * Now loop until we are out of data from print_fd...
+ */
+
+ for (;;)
+ {
+ /*
+ * Use select() to determine whether we have data to copy around...
+ */
+
+ FD_ZERO(&input);
+ FD_SET(print_fd, &input);
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+
+ if (select(nfds, &input, NULL, NULL, &timeout) < 0)
+ return (-1);
+
+ if (!FD_ISSET(print_fd, &input))
+ return (0);
+
+ if ((print_bytes = read(print_fd, print_buffer,
+ sizeof(print_buffer))) < 0)
+ {
+ /*
+ * Read error - bail if we don't see EAGAIN or EINTR...
+ */
+
+ if (errno != EAGAIN || errno != EINTR)
+ {
+ perror("ERROR: Unable to read print data");
+ return (-1);
+ }
+
+ print_bytes = 0;
+ }
+ else if (print_bytes == 0)
+ {
+ /*
+ * End of file, return...
+ */
+
+ return (0);
+ }
+
+ fprintf(stderr, "DEBUG: Read %d bytes of print data.\n",
+ (int)print_bytes);
+
+ for (print_ptr = print_buffer; print_bytes > 0;)
+ {
+ if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
+ {
+ /*
+ * Write error - bail if we don't see an error we can retry...
+ */
+
+ if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN &&
+ errno != EINTR && errno != ENOTTY)
+ {
+ perror("ERROR: Unable to write print data");
+ return (-1);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "DEBUG: Wrote %d bytes of print data.\n", (int)bytes);
+
+ print_bytes -= bytes;
+ print_ptr += bytes;
+ }
+ }
+ }
+}
+
+
+/*
+ * 'list_devices()' - List all parallel devices.
+ */
+
+static void
+list_devices(void)
+{
+#ifdef __sun
+ static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
+ /* Funky hex numbering used for some devices */
+#endif /* __sun */
+
+#ifdef __linux
+ int i; /* Looping var */
+ int fd; /* File descriptor */
+ char device[255], /* Device filename */
+ basedevice[255], /* Base device filename for ports */
+ device_id[1024], /* Device ID string */
+ make_model[1024], /* Make and model */
+ info[1024], /* Info string */
+ uri[1024]; /* Device URI */
+
+
+ if (!access("/dev/parallel/", 0))
+ strcpy(basedevice, "/dev/parallel/");
+ else if (!access("/dev/printers/", 0))
+ strcpy(basedevice, "/dev/printers/");
+ else
+ strcpy(basedevice, "/dev/lp");
+
+ for (i = 0; i < 4; i ++)
+ {
+ /*
+ * Open the port, if available...
+ */
+
+ sprintf(device, "%s%d", basedevice, i);
+ if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
+ fd = open(device, O_WRONLY);
+
+ if (fd >= 0)
+ {
+ /*
+ * Now grab the IEEE 1284 device ID string...
+ */
+
+ snprintf(uri, sizeof(uri), "parallel:%s", device);
+
+ if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
+ make_model, sizeof(make_model),
+ NULL, uri, sizeof(uri)))
+ {
+ snprintf(info, sizeof(info), "%s LPT #%d", make_model, i + 1);
+ cupsBackendReport("direct", uri, make_model, info, device_id, NULL);
+ }
+ else
+ {
+ snprintf(info, sizeof(info), "LPT #%d", i + 1);
+ cupsBackendReport("direct", uri, NULL, info, NULL, NULL);
+ }
+
+ close(fd);
+ }
+ }
+#elif defined(__sun)
+ int i, j, n; /* Looping vars */
+ char device[255]; /* Device filename */
+
+
+ /*
+ * Standard parallel ports...
+ */
+
+ for (i = 0; i < 10; i ++)
+ {
+ sprintf(device, "/dev/ecpp%d", i);
+ if (access(device, 0) == 0)
+ printf("direct parallel:%s \"Unknown\" \"Sun IEEE-1284 Parallel Port #%d\"\n",
+ device, i + 1);
+ }
+
+ for (i = 0; i < 10; i ++)
+ {
+ sprintf(device, "/dev/bpp%d", i);
+ if (access(device, 0) == 0)
+ printf("direct parallel:%s \"Unknown\" \"Sun Standard Parallel Port #%d\"\n",
+ device, i + 1);
+ }
+
+ for (i = 0; i < 3; i ++)
+ {
+ sprintf(device, "/dev/lp%d", i);
+
+ if (access(device, 0) == 0)
+ printf("direct parallel:%s \"Unknown\" \"PC Parallel Port #%d\"\n",
+ device, i + 1);
+ }
+
+ /*
+ * MAGMA parallel ports...
+ */
+
+ for (i = 0; i < 40; i ++)
+ {
+ sprintf(device, "/dev/pm%02d", i);
+ if (access(device, 0) == 0)
+ printf("direct parallel:%s \"Unknown\" \"MAGMA Parallel Board #%d Port #%d\"\n",
+ device, (i / 10) + 1, (i % 10) + 1);
+ }
+
+ /*
+ * Central Data parallel ports...
+ */
+
+ for (i = 0; i < 9; i ++)
+ for (j = 0; j < 8; j ++)
+ for (n = 0; n < 32; n ++)
+ {
+ if (i == 8) /* EtherLite */
+ sprintf(device, "/dev/sts/lpN%d%c", j, funky_hex[n]);
+ else
+ sprintf(device, "/dev/sts/lp%c%d%c", i + 'C', j,
+ funky_hex[n]);
+
+ if (access(device, 0) == 0)
+ {
+ if (i == 8)
+ printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
+ device, j, n);
+ else
+ printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
+ device, i, j, n);
+ }
+ }
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+ int i; /* Looping var */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+
+
+ for (i = 0; i < 3; i ++)
+ {
+ sprintf(device, "/dev/lpt%d", i);
+ if ((fd = open(device, O_WRONLY)) >= 0)
+ {
+ close(fd);
+ printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (interrupt-driven)\"\n", device, i + 1);
+ }
+
+ sprintf(device, "/dev/lpa%d", i);
+ if ((fd = open(device, O_WRONLY)) >= 0)
+ {
+ close(fd);
+ printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (polled)\"\n", device, i + 1);
+ }
+ }
+#endif
+}
+
+
+/*
+ * 'run_loop()' - Read and write print and back-channel data.
+ */
+
+static ssize_t /* O - Total bytes on success, -1 on error */
+run_loop(int print_fd, /* I - Print file descriptor */
+ int device_fd, /* I - Device file descriptor */
+ int use_bc, /* I - Use back-channel? */
+ int update_state) /* I - Update printer-state-reasons? */
+{
+ int nfds; /* Maximum file descriptor value + 1 */
+ fd_set input, /* Input set for reading */
+ output; /* Output set for writing */
+ ssize_t print_bytes, /* Print bytes read */
+ bc_bytes, /* Backchannel bytes read */
+ total_bytes, /* Total bytes written */
+ bytes; /* Bytes written */
+ int paperout; /* "Paper out" status */
+ int offline; /* "Off-line" status */
+ char print_buffer[8192], /* Print data buffer */
+ *print_ptr, /* Pointer into print data buffer */
+ bc_buffer[1024]; /* Back-channel data buffer */
+ struct timeval timeout; /* Timeout for select() */
+ int sc_ok; /* Flag a side channel error and
+ stop using the side channel
+ in such a case. */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * If we are printing data from a print driver on stdin, ignore SIGTERM
+ * so that the driver can finish out any page data, e.g. to eject the
+ * current page. We only do this for stdin printing as otherwise there
+ * is no way to cancel a raw print job...
+ */
+
+ if (!print_fd)
+ {
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, SIG_IGN);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGTERM, &action, NULL);
+#else
+ signal(SIGTERM, SIG_IGN);
+#endif /* HAVE_SIGSET */
+ }
+ else if (print_fd < 0)
+ {
+ /*
+ * Copy print data from stdin, but don't mess with the signal handlers...
+ */
+
+ print_fd = 0;
+ }
+
+ /*
+ * Figure out the maximum file descriptor value to use with select()...
+ */
+
+ nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+
+
+ /*
+ * Side channel is OK...
+ */
+
+ sc_ok = 1;
+
+ /*
+ * Now loop until we are out of data from print_fd...
+ */
+
+ for (print_bytes = 0, print_ptr = print_buffer, offline = -1,
+ paperout = -1, total_bytes = 0;;)
+ {
+ /*
+ * Use select() to determine whether we have data to copy around...
+ */
+
+ FD_ZERO(&input);
+ if (!print_bytes)
+ FD_SET(print_fd, &input);
+ if (use_bc)
+ FD_SET(device_fd, &input);
+ if (!print_bytes && sc_ok)
+ FD_SET(CUPS_SC_FD, &input);
+
+ FD_ZERO(&output);
+ if (print_bytes)
+ FD_SET(device_fd, &output);
+
+ timeout.tv_sec = 5;
+ timeout.tv_usec = 0;
+
+ if (select(nfds, &input, &output, NULL, &timeout) < 0)
+ {
+ /*
+ * Pause printing to clear any pending errors...
+ */
+
+ if (errno == ENXIO && offline != 1 && update_state)
+ {
+ fputs("STATE: +offline-report\n", stderr);
+ offline = 1;
+ }
+ else if (errno == EINTR && total_bytes == 0)
+ {
+ fputs("DEBUG: Received an interrupt before any bytes were "
+ "written, aborting.\n", stderr);
+ return (0);
+ }
+
+ sleep(1);
+ continue;
+ }
+
+ /*
+ * Check if we have a side-channel request ready...
+ */
+
+ if (sc_ok && FD_ISSET(CUPS_SC_FD, &input))
+ {
+ /*
+ * Do the side-channel request, then start back over in the select
+ * loop since it may have read from print_fd...
+ *
+ * If the side channel processing errors, go straight on to avoid
+ * blocking of the backend by side channel problems, deactivate the side
+ * channel.
+ */
+
+ if (side_cb(print_fd, device_fd, use_bc))
+ sc_ok = 0;
+ continue;
+ }
+
+ /*
+ * Check if we have back-channel data ready...
+ */
+
+ if (FD_ISSET(device_fd, &input))
+ {
+ if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
+ {
+ fprintf(stderr, "DEBUG: Received %d bytes of back-channel data.\n",
+ (int)bc_bytes);
+ cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
+ }
+ else if (bc_bytes < 0 && errno != EAGAIN && errno != EINTR)
+ {
+ perror("DEBUG: Error reading back-channel data");
+ use_bc = 0;
+ }
+ else if (bc_bytes == 0)
+ use_bc = 0;
+ }
+
+ /*
+ * Check if we have print data ready...
+ */
+
+ if (FD_ISSET(print_fd, &input))
+ {
+ if ((print_bytes = read(print_fd, print_buffer,
+ sizeof(print_buffer))) < 0)
+ {
+ /*
+ * Read error - bail if we don't see EAGAIN or EINTR...
+ */
+
+ if (errno != EAGAIN || errno != EINTR)
+ {
+ perror("ERROR: Unable to read print data");
+ return (-1);
+ }
+
+ print_bytes = 0;
+ }
+ else if (print_bytes == 0)
+ {
+ /*
+ * End of file, break out of the loop...
+ */
+
+ break;
+ }
+
+ print_ptr = print_buffer;
+
+ fprintf(stderr, "DEBUG: Read %d bytes of print data.\n",
+ (int)print_bytes);
+ }
+
+ /*
+ * Check if the device is ready to receive data and we have data to
+ * send...
+ */
+
+ if (print_bytes && FD_ISSET(device_fd, &output))
+ {
+ if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
+ {
+ /*
+ * Write error - bail if we don't see an error we can retry...
+ */
+
+ if (errno == ENOSPC)
+ {
+ if (paperout != 1 && update_state)
+ {
+ fputs("STATE: +media-empty-warning\n", stderr);
+ paperout = 1;
+ }
+ }
+ else if (errno == ENXIO)
+ {
+ if (offline != 1 && update_state)
+ {
+ fputs("STATE: +offline-report\n", stderr);
+ offline = 1;
+ }
+ }
+ else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
+ {
+ perror("ERROR: Unable to write print data");
+ return (-1);
+ }
+ }
+ else
+ {
+ if (paperout && update_state)
+ {
+ fputs("STATE: -media-empty-warning\n", stderr);
+ paperout = 0;
+ }
+
+ if (offline && update_state)
+ {
+ fputs("STATE: -offline-report\n", stderr);
+ offline = 0;
+ }
+
+ fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
+
+ print_bytes -= bytes;
+ print_ptr += bytes;
+ total_bytes += bytes;
+ }
+ }
+ }
+
+ /*
+ * Return with success...
+ */
+
+ return (total_bytes);
+}
+
+
+/*
+ * 'side_cb()' - Handle side-channel requests...
+ */
+
+static int /* O - 0 on success, -1 on error */
+side_cb(int print_fd, /* I - Print file */
+ int device_fd, /* I - Device file */
+ int use_bc) /* I - Using back-channel? */
+{
+ cups_sc_command_t command; /* Request command */
+ cups_sc_status_t status; /* Request/response status */
+ char data[2048]; /* Request/response data */
+ int datalen; /* Request/response data size */
+
+
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+ return (-1);
+
+ switch (command)
+ {
+ case CUPS_SC_CMD_DRAIN_OUTPUT :
+ if (drain_output(print_fd, device_fd))
+ status = CUPS_SC_STATUS_IO_ERROR;
+ else if (tcdrain(device_fd))
+ status = CUPS_SC_STATUS_IO_ERROR;
+ else
+ status = CUPS_SC_STATUS_OK;
+
+ datalen = 0;
+ break;
+
+ case CUPS_SC_CMD_GET_BIDI :
+ status = CUPS_SC_STATUS_OK;
+ data[0] = use_bc;
+ datalen = 1;
+ break;
+
+ case CUPS_SC_CMD_GET_DEVICE_ID :
+ memset(data, 0, sizeof(data));
+
+ if (backendGetDeviceID(device_fd, data, sizeof(data) - 1,
+ NULL, 0, NULL, NULL, 0))
+ {
+ status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
+ datalen = 0;
+ }
+ else
+ {
+ status = CUPS_SC_STATUS_OK;
+ datalen = strlen(data);
+ }
+ break;
+
+ default :
+ status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
+ datalen = 0;
+ break;
+ }
+
+ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Serial port backend for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Send a file to the printer or server.
+ * list_devices() - List all serial devices.
+ * side_cb() - Handle side-channel requests...
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "backend-private.h"
+#include <stdio.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <sys/select.h>
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
+
+#ifndef CRTSCTS
+# ifdef CNEW_RTSCTS
+# define CRTSCTS CNEW_RTSCTS
+# else
+# define CRTSCTS 0
+# endif /* CNEW_RTSCTS */
+#endif /* !CRTSCTS */
+
+#if defined(__APPLE__)
+# include <CoreFoundation/CoreFoundation.h>
+# include <IOKit/IOKitLib.h>
+# include <IOKit/serial/IOSerialKeys.h>
+# include <IOKit/IOBSD.h>
+#endif /* __APPLE__ */
+
+#if defined(__linux) && defined(TIOCGSERIAL)
+# include <linux/serial.h>
+# include <linux/ioctl.h>
+#endif /* __linux && TIOCGSERIAL */
+
+
+/*
+ * Local functions...
+ */
+
+static int drain_output(int print_fd, int device_fd);
+static void list_devices(void);
+static int side_cb(int print_fd, int device_fd, int use_bc);
+
+
+/*
+ * 'main()' - Send a file to the printer or server.
+ *
+ * Usage:
+ *
+ * printer-uri job-id user title copies options [file]
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments (6 or 7) */
+ char *argv[]) /* I - Command-line arguments */
+{
+ char method[255], /* Method in URI */
+ hostname[1024], /* Hostname */
+ username[255], /* Username info (not used) */
+ resource[1024], /* Resource info (device and options) */
+ *options, /* Pointer to options */
+ *name, /* Name of option */
+ *value, /* Value of option */
+ sep; /* Option separator */
+ int port; /* Port number (not used) */
+ int copies; /* Number of copies to print */
+ int side_eof = 0, /* Saw EOF on side-channel? */
+ print_fd, /* Print file */
+ device_fd; /* Serial device */
+ int nfds; /* Maximum file descriptor value + 1 */
+ fd_set input, /* Input set for reading */
+ output; /* Output set for writing */
+ ssize_t print_bytes, /* Print bytes read */
+ bc_bytes, /* Backchannel bytes read */
+ total_bytes, /* Total bytes written */
+ bytes; /* Bytes written */
+ int dtrdsr; /* Do dtr/dsr flow control? */
+ int print_size; /* Size of output buffer for writes */
+ char print_buffer[8192], /* Print data buffer */
+ *print_ptr, /* Pointer into print data buffer */
+ bc_buffer[1024]; /* Back-channel data buffer */
+ struct termios opts; /* Serial port options */
+ struct termios origopts; /* Original port options */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Ignore SIGPIPE signals...
+ */
+
+#ifdef HAVE_SIGSET
+ sigset(SIGPIPE, SIG_IGN);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &action, NULL);
+#else
+ signal(SIGPIPE, SIG_IGN);
+#endif /* HAVE_SIGSET */
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc == 1)
+ {
+ list_devices();
+ return (CUPS_BACKEND_OK);
+ }
+ else if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ argv[0]);
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ /*
+ * If we have 7 arguments, print the file named on the command-line.
+ * Otherwise, send stdin instead...
+ */
+
+ if (argc == 6)
+ {
+ print_fd = 0;
+ copies = 1;
+ }
+ else
+ {
+ /*
+ * Try to open the print file...
+ */
+
+ if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+ {
+ perror("ERROR: Unable to open print file");
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ copies = atoi(argv[4]);
+ }
+
+ /*
+ * Extract the device name and options from the URI...
+ */
+
+ httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+ method, sizeof(method), username, sizeof(username),
+ hostname, sizeof(hostname), &port,
+ resource, sizeof(resource));
+
+ /*
+ * See if there are any options...
+ */
+
+ if ((options = strchr(resource, '?')) != NULL)
+ {
+ /*
+ * Yup, terminate the device name string and move to the first
+ * character of the options...
+ */
+
+ *options++ = '\0';
+ }
+
+ /*
+ * Open the serial port device...
+ */
+
+ fputs("STATE: +connecting-to-device\n", stderr);
+
+ do
+ {
+ if ((device_fd = open(resource, O_RDWR | O_NOCTTY | O_EXCL |
+ O_NDELAY)) == -1)
+ {
+ if (getenv("CLASS") != NULL)
+ {
+ /*
+ * If the CLASS environment variable is set, the job was submitted
+ * to a class and not to a specific queue. In this case, we want
+ * to abort immediately so that the job can be requeued on the next
+ * available printer in the class.
+ */
+
+ fputs("INFO: Unable to contact printer, queuing on next printer in "
+ "class.\n", stderr);
+
+ /*
+ * Sleep 5 seconds to keep the job from requeuing too rapidly...
+ */
+
+ sleep(5);
+
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ if (errno == EBUSY)
+ {
+ fputs("INFO: Printer busy; will retry in 30 seconds.\n", stderr);
+ sleep(30);
+ }
+ else
+ {
+ perror("ERROR: Unable to open serial port");
+ return (CUPS_BACKEND_FAILED);
+ }
+ }
+ }
+ while (device_fd < 0);
+
+ fputs("STATE: -connecting-to-device\n", stderr);
+
+ /*
+ * Set any options provided...
+ */
+
+ tcgetattr(device_fd, &origopts);
+ tcgetattr(device_fd, &opts);
+
+ opts.c_lflag &= ~(ICANON | ECHO | ISIG);
+ /* Raw mode */
+ opts.c_oflag &= ~OPOST; /* Don't post-process */
+
+ print_size = 96; /* 9600 baud / 10 bits/char / 10Hz */
+ dtrdsr = 0; /* No dtr/dsr flow control */
+
+ if (options)
+ {
+ while (*options)
+ {
+ /*
+ * Get the name...
+ */
+
+ name = options;
+
+ while (*options && *options != '=' && *options != '+' && *options != '&')
+ options ++;
+
+ if ((sep = *options) != '\0')
+ *options++ = '\0';
+
+ if (sep == '=')
+ {
+ /*
+ * Get the value...
+ */
+
+ value = options;
+
+ while (*options && *options != '+' && *options != '&')
+ options ++;
+
+ if (*options)
+ *options++ = '\0';
+ }
+ else
+ value = (char *)"";
+
+ /*
+ * Process the option...
+ */
+
+ if (!strcasecmp(name, "baud"))
+ {
+ /*
+ * Set the baud rate...
+ */
+
+ print_size = atoi(value) / 100;
+
+#if B19200 == 19200
+ cfsetispeed(&opts, atoi(value));
+ cfsetospeed(&opts, atoi(value));
+#else
+ switch (atoi(value))
+ {
+ case 1200 :
+ cfsetispeed(&opts, B1200);
+ cfsetospeed(&opts, B1200);
+ break;
+ case 2400 :
+ cfsetispeed(&opts, B2400);
+ cfsetospeed(&opts, B2400);
+ break;
+ case 4800 :
+ cfsetispeed(&opts, B4800);
+ cfsetospeed(&opts, B4800);
+ break;
+ case 9600 :
+ cfsetispeed(&opts, B9600);
+ cfsetospeed(&opts, B9600);
+ break;
+ case 19200 :
+ cfsetispeed(&opts, B19200);
+ cfsetospeed(&opts, B19200);
+ break;
+ case 38400 :
+ cfsetispeed(&opts, B38400);
+ cfsetospeed(&opts, B38400);
+ break;
+# ifdef B57600
+ case 57600 :
+ cfsetispeed(&opts, B57600);
+ cfsetospeed(&opts, B57600);
+ break;
+# endif /* B57600 */
+# ifdef B115200
+ case 115200 :
+ cfsetispeed(&opts, B115200);
+ cfsetospeed(&opts, B115200);
+ break;
+# endif /* B115200 */
+# ifdef B230400
+ case 230400 :
+ cfsetispeed(&opts, B230400);
+ cfsetospeed(&opts, B230400);
+ break;
+# endif /* B230400 */
+ default :
+ fprintf(stderr, "WARNING: Unsupported baud rate: %s\n", value);
+ break;
+ }
+#endif /* B19200 == 19200 */
+ }
+ else if (!strcasecmp(name, "bits"))
+ {
+ /*
+ * Set number of data bits...
+ */
+
+ switch (atoi(value))
+ {
+ case 7 :
+ opts.c_cflag &= ~CSIZE;
+ opts.c_cflag |= CS7;
+ opts.c_cflag |= PARENB;
+ opts.c_cflag &= ~PARODD;
+ break;
+ case 8 :
+ opts.c_cflag &= ~CSIZE;
+ opts.c_cflag |= CS8;
+ opts.c_cflag &= ~PARENB;
+ break;
+ }
+ }
+ else if (!strcasecmp(name, "parity"))
+ {
+ /*
+ * Set parity checking...
+ */
+
+ if (!strcasecmp(value, "even"))
+ {
+ opts.c_cflag |= PARENB;
+ opts.c_cflag &= ~PARODD;
+ }
+ else if (!strcasecmp(value, "odd"))
+ {
+ opts.c_cflag |= PARENB;
+ opts.c_cflag |= PARODD;
+ }
+ else if (!strcasecmp(value, "none"))
+ opts.c_cflag &= ~PARENB;
+ else if (!strcasecmp(value, "space"))
+ {
+ /*
+ * Note: we only support space parity with 7 bits per character...
+ */
+
+ opts.c_cflag &= ~CSIZE;
+ opts.c_cflag |= CS8;
+ opts.c_cflag &= ~PARENB;
+ }
+ else if (!strcasecmp(value, "mark"))
+ {
+ /*
+ * Note: we only support mark parity with 7 bits per character
+ * and 1 stop bit...
+ */
+
+ opts.c_cflag &= ~CSIZE;
+ opts.c_cflag |= CS7;
+ opts.c_cflag &= ~PARENB;
+ opts.c_cflag |= CSTOPB;
+ }
+ }
+ else if (!strcasecmp(name, "flow"))
+ {
+ /*
+ * Set flow control...
+ */
+
+ if (!strcasecmp(value, "none"))
+ {
+ opts.c_iflag &= ~(IXON | IXOFF);
+ opts.c_cflag &= ~CRTSCTS;
+ }
+ else if (!strcasecmp(value, "soft"))
+ {
+ opts.c_iflag |= IXON | IXOFF;
+ opts.c_cflag &= ~CRTSCTS;
+ }
+ else if (!strcasecmp(value, "hard") ||
+ !strcasecmp(value, "rtscts"))
+ {
+ opts.c_iflag &= ~(IXON | IXOFF);
+ opts.c_cflag |= CRTSCTS;
+ }
+ else if (!strcasecmp(value, "dtrdsr"))
+ {
+ opts.c_iflag &= ~(IXON | IXOFF);
+ opts.c_cflag &= ~CRTSCTS;
+
+ dtrdsr = 1;
+ }
+ }
+ else if (!strcasecmp(name, "stop"))
+ {
+ switch (atoi(value))
+ {
+ case 1 :
+ opts.c_cflag &= ~CSTOPB;
+ break;
+
+ case 2 :
+ opts.c_cflag |= CSTOPB;
+ break;
+ }
+ }
+ }
+ }
+
+ tcsetattr(device_fd, TCSANOW, &opts);
+ fcntl(device_fd, F_SETFL, 0);
+
+ /*
+ * Now that we are "connected" to the port, ignore SIGTERM so that we
+ * can finish out any page data the driver sends (e.g. to eject the
+ * current page... Only ignore SIGTERM if we are printing data from
+ * stdin (otherwise you can't cancel raw jobs...)
+ */
+
+ if (!print_fd)
+ {
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, SIG_IGN);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGTERM, &action, NULL);
+#else
+ signal(SIGTERM, SIG_IGN);
+#endif /* HAVE_SIGSET */
+ }
+
+ /*
+ * Figure out the maximum file descriptor value to use with select()...
+ */
+
+ nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+
+ /*
+ * Finally, send the print file. Ordinarily we would just use the
+ * backendRunLoop() function, however since we need to use smaller
+ * writes and may need to do DSR/DTR flow control, we duplicate much
+ * of the code here instead...
+ */
+
+ if (print_size > sizeof(print_buffer))
+ print_size = sizeof(print_buffer);
+
+ total_bytes = 0;
+
+ while (copies > 0)
+ {
+ copies --;
+
+ if (print_fd != 0)
+ {
+ fputs("PAGE: 1 1\n", stderr);
+ lseek(print_fd, 0, SEEK_SET);
+ }
+
+ /*
+ * Now loop until we are out of data from print_fd...
+ */
+
+ for (print_bytes = 0, print_ptr = print_buffer;;)
+ {
+ /*
+ * Use select() to determine whether we have data to copy around...
+ */
+
+ FD_ZERO(&input);
+ if (!print_bytes)
+ FD_SET(print_fd, &input);
+ FD_SET(device_fd, &input);
+ if (!print_bytes && !side_eof)
+ FD_SET(CUPS_SC_FD, &input);
+
+ FD_ZERO(&output);
+ if (print_bytes)
+ FD_SET(device_fd, &output);
+
+ if (select(nfds, &input, &output, NULL, NULL) < 0)
+ continue; /* Ignore errors here */
+
+ /*
+ * Check if we have a side-channel request ready...
+ */
+
+ if (FD_ISSET(CUPS_SC_FD, &input))
+ {
+ /*
+ * Do the side-channel request, then start back over in the select
+ * loop since it may have read from print_fd...
+ */
+
+ if (side_cb(print_fd, device_fd, 1))
+ side_eof = 1;
+ continue;
+ }
+
+ /*
+ * Check if we have back-channel data ready...
+ */
+
+ if (FD_ISSET(device_fd, &input))
+ {
+ if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
+ {
+ fprintf(stderr, "DEBUG: Received %d bytes of back-channel data.\n",
+ (int)bc_bytes);
+ cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
+ }
+ }
+
+ /*
+ * Check if we have print data ready...
+ */
+
+ if (FD_ISSET(print_fd, &input))
+ {
+ if ((print_bytes = read(print_fd, print_buffer, print_size)) < 0)
+ {
+ /*
+ * Read error - bail if we don't see EAGAIN or EINTR...
+ */
+
+ if (errno != EAGAIN || errno != EINTR)
+ {
+ perror("DEBUG: Unable to read print data");
+
+ tcsetattr(device_fd, TCSADRAIN, &origopts);
+
+ close(device_fd);
+
+ if (print_fd != 0)
+ close(print_fd);
+
+ return (CUPS_BACKEND_FAILED);
+ }
+
+ print_bytes = 0;
+ }
+ else if (print_bytes == 0)
+ {
+ /*
+ * End of file, break out of the loop...
+ */
+
+ break;
+ }
+
+ print_ptr = print_buffer;
+ }
+
+ /*
+ * Check if the device is ready to receive data and we have data to
+ * send...
+ */
+
+ if (print_bytes && FD_ISSET(device_fd, &output))
+ {
+ if (dtrdsr)
+ {
+ /*
+ * Check the port and sleep until DSR is set...
+ */
+
+ int status;
+
+
+ if (!ioctl(device_fd, TIOCMGET, &status))
+ if (!(status & TIOCM_DSR))
+ {
+ /*
+ * Wait for DSR to go high...
+ */
+
+ fputs("DEBUG: DSR is low; waiting for device.\n", stderr);
+
+ do
+ {
+ /*
+ * Poll every 100ms...
+ */
+
+ usleep(100000);
+
+ if (ioctl(device_fd, TIOCMGET, &status))
+ break;
+ }
+ while (!(status & TIOCM_DSR));
+
+ fputs("DEBUG: DSR is high; writing to device.\n", stderr);
+ }
+ }
+
+ if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
+ {
+ /*
+ * Write error - bail if we don't see an error we can retry...
+ */
+
+ if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
+ {
+ perror("DEBUG: Unable to write print data");
+
+ tcsetattr(device_fd, TCSADRAIN, &origopts);
+
+ close(device_fd);
+
+ if (print_fd != 0)
+ close(print_fd);
+
+ return (CUPS_BACKEND_FAILED);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "DEBUG: Wrote %d bytes.\n", (int)bytes);
+
+ print_bytes -= bytes;
+ print_ptr += bytes;
+ total_bytes += bytes;
+ }
+ }
+ }
+ }
+
+ /*
+ * Close the serial port and input file and return...
+ */
+
+ tcsetattr(device_fd, TCSADRAIN, &origopts);
+
+ close(device_fd);
+
+ if (print_fd != 0)
+ close(print_fd);
+
+ return (CUPS_BACKEND_OK);
+}
+
+
+/*
+ * 'drain_output()' - Drain pending print data to the device.
+ */
+
+static int /* O - 0 on success, -1 on error */
+drain_output(int print_fd, /* I - Print file descriptor */
+ int device_fd) /* I - Device file descriptor */
+{
+ int nfds; /* Maximum file descriptor value + 1 */
+ fd_set input; /* Input set for reading */
+ ssize_t print_bytes, /* Print bytes read */
+ bytes; /* Bytes written */
+ char print_buffer[8192], /* Print data buffer */
+ *print_ptr; /* Pointer into print data buffer */
+ struct timeval timeout; /* Timeout for read... */
+
+
+ /*
+ * Figure out the maximum file descriptor value to use with select()...
+ */
+
+ nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+
+ /*
+ * Now loop until we are out of data from print_fd...
+ */
+
+ for (;;)
+ {
+ /*
+ * Use select() to determine whether we have data to copy around...
+ */
+
+ FD_ZERO(&input);
+ FD_SET(print_fd, &input);
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+
+ if (select(nfds, &input, NULL, NULL, &timeout) < 0)
+ return (-1);
+
+ if (!FD_ISSET(print_fd, &input))
+ return (0);
+
+ if ((print_bytes = read(print_fd, print_buffer,
+ sizeof(print_buffer))) < 0)
+ {
+ /*
+ * Read error - bail if we don't see EAGAIN or EINTR...
+ */
+
+ if (errno != EAGAIN || errno != EINTR)
+ {
+ perror("ERROR: Unable to read print data");
+ return (-1);
+ }
+
+ print_bytes = 0;
+ }
+ else if (print_bytes == 0)
+ {
+ /*
+ * End of file, return...
+ */
+
+ return (0);
+ }
+
+ fprintf(stderr, "DEBUG: Read %d bytes of print data.\n",
+ (int)print_bytes);
+
+ for (print_ptr = print_buffer; print_bytes > 0;)
+ {
+ if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
+ {
+ /*
+ * Write error - bail if we don't see an error we can retry...
+ */
+
+ if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN &&
+ errno != EINTR && errno != ENOTTY)
+ {
+ perror("ERROR: Unable to write print data");
+ return (-1);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "DEBUG: Wrote %d bytes of print data.\n", (int)bytes);
+
+ print_bytes -= bytes;
+ print_ptr += bytes;
+ }
+ }
+ }
+}
+
+
+/*
+ * 'list_devices()' - List all serial devices.
+ */
+
+static void
+list_devices(void)
+{
+#if defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+ static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
+ /* Funky hex numbering used for some *
+ * devices */
+#endif /* __sun || __FreeBSD__ || __OpenBSD__ || __FreeBSD_kernel__ */
+
+
+#ifdef __linux
+ int i, j; /* Looping vars */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+ char info[255]; /* Device info/description */
+# ifdef TIOCGSERIAL
+ struct serial_struct serinfo; /* serial port info */
+# endif /* TIOCGSERIAL */
+
+
+ for (i = 0; i < 100; i ++)
+ {
+ sprintf(device, "/dev/ttyS%d", i);
+
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+# ifdef TIOCGSERIAL
+ /*
+ * See if this port exists...
+ */
+
+ serinfo.reserved_char[0] = 0;
+
+ if (!ioctl(fd, TIOCGSERIAL, &serinfo))
+ {
+ if (serinfo.type == PORT_UNKNOWN)
+ {
+ /*
+ * Nope...
+ */
+
+ close(fd);
+ continue;
+ }
+ }
+# endif /* TIOCGSERIAL */
+
+ close(fd);
+
+ snprintf(info, sizeof(info), "Serial Port #%d", i + 1);
+
+# if defined(_ARCH_PPC) || defined(powerpc) || defined(__powerpc)
+ printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
+# else
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
+# endif /* _ARCH_PPC || powerpc || __powerpc */
+ }
+ }
+
+ for (i = 0; i < 16; i ++)
+ {
+ snprintf(info, sizeof(info), "USB Serial Port #%d", i + 1);
+
+ sprintf(device, "/dev/usb/ttyUSB%d", i);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
+ }
+
+ sprintf(device, "/dev/ttyUSB%d", i);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
+ }
+ }
+
+ for (i = 0; i < 64; i ++)
+ {
+ for (j = 0; j < 8; j ++)
+ {
+ sprintf(device, "/dev/ttyQ%02de%d", i, j);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+
+ printf("serial serial:%s?baud=115200 \"Unknown\" "
+ "\"Equinox ESP %d Port #%d\"\n", device, i, j + 1);
+ }
+ }
+ }
+#elif defined(__sun)
+ int i, j, n; /* Looping vars */
+ char device[255]; /* Device filename */
+ char info[255]; /* Device info/description */
+
+
+ /*
+ * Standard serial ports...
+ */
+
+ for (i = 0; i < 26; i ++)
+ {
+ sprintf(device, "/dev/cua/%c", 'a' + i);
+ if (!access(device, 0))
+ {
+ snprintf(info, sizeof(info), "Serial Port #%d", i + 1);
+
+# ifdef B115200
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
+# else
+ printf("serial serial:%s?baud=38400 \"Unknown\" \"%s\"\n", device, info);
+# endif /* B115200 */
+ }
+ }
+
+ /*
+ * MAGMA serial ports...
+ */
+
+ for (i = 0; i < 40; i ++)
+ {
+ sprintf(device, "/dev/term/%02d", i);
+ if (access(device, 0) == 0)
+ printf("serial serial:%s?baud=38400 \"Unknown\" \"MAGMA Serial Board #%d Port #%d\"\n",
+ device, (i / 10) + 1, (i % 10) + 1);
+ }
+
+ /*
+ * Central Data serial ports...
+ */
+
+ for (i = 0; i < 9; i ++)
+ for (j = 0; j < 8; j ++)
+ for (n = 0; n < 32; n ++)
+ {
+ if (i == 8) /* EtherLite */
+ sprintf(device, "/dev/sts/ttyN%d%c", j, funky_hex[n]);
+ else
+ sprintf(device, "/dev/sts/tty%c%d%c", i + 'C', j,
+ funky_hex[n]);
+
+ if (access(device, 0) == 0)
+ {
+ if (i == 8)
+ printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data EtherLite Serial Port, ID %d, port %d\"\n",
+ device, j, n);
+ else
+ printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data SCSI Serial Port, logical bus %d, ID %d, port %d\"\n",
+ device, i, j, n);
+ }
+ }
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+ int i, j; /* Looping vars */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+ char info[255]; /* Device info/description */
+
+
+ /*
+ * SIO ports...
+ */
+
+ for (i = 0; i < 32; i ++)
+ {
+ sprintf(device, "/dev/ttyd%c", funky_hex[i]);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+
+ snprintf(info, sizeof(info), "Serial Port #%d", i + 1);
+
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
+ }
+ }
+
+ /*
+ * Cyclades ports...
+ */
+
+ for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
+ for (j = 0; j < 32; j ++)
+ {
+ sprintf(device, "/dev/ttyc%d%c", i, funky_hex[j]);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Port #%d\"\n",
+ device, i, j + 1);
+ }
+
+ sprintf(device, "/dev/ttyC%d%c", i, funky_hex[j]);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Port #%d\"\n",
+ device, i, j + 1);
+ }
+ }
+
+ /*
+ * Digiboard ports...
+ */
+
+ for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
+ for (j = 0; j < 32; j ++)
+ {
+ sprintf(device, "/dev/ttyD%d%c", i, funky_hex[j]);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"Digiboard #%d Serial Port #%d\"\n",
+ device, i, j + 1);
+ }
+ }
+
+ /*
+ * Stallion ports...
+ */
+
+ for (i = 0; i < 32; i ++)
+ {
+ sprintf(device, "/dev/ttyE%c", funky_hex[i]);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"Stallion Serial Port #%d\"\n",
+ device, i + 1);
+ }
+ }
+
+ /*
+ * SX ports...
+ */
+
+ for (i = 0; i < 128; i ++)
+ {
+ sprintf(device, "/dev/ttyA%d", i + 1);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"SX Serial Port #%d\"\n",
+ device, i + 1);
+ }
+ }
+#elif defined(__NetBSD__)
+ int i, j; /* Looping vars */
+ int fd; /* File descriptor */
+ char device[255]; /* Device filename */
+ char info[255]; /* Device info/description */
+
+
+ /*
+ * Standard serial ports...
+ */
+
+ for (i = 0; i < 4; i ++)
+ {
+ sprintf(device, "/dev/tty%02d", i);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+
+ snprintf(info, sizeof(info), "Serial Port #%d", i + 1);
+
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
+ }
+ }
+
+ /*
+ * Cyclades-Z ports...
+ */
+
+ for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
+ for (j = 0; j < 64; j ++)
+ {
+ sprintf(device, "/dev/ttyCZ%02d%02d", i, j);
+ if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+ {
+ close(fd);
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Prt #%d\"\n",
+ device, i, j + 1);
+ }
+ }
+#elif defined(__APPLE__)
+ /*
+ * Standard serial ports on MacOS X...
+ */
+
+ kern_return_t kernResult;
+ mach_port_t masterPort;
+ io_iterator_t serialPortIterator;
+ CFMutableDictionaryRef classesToMatch;
+ io_object_t serialService;
+
+
+ kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
+ if (KERN_SUCCESS != kernResult)
+ return;
+
+ /*
+ * Serial devices are instances of class IOSerialBSDClient.
+ */
+
+ classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
+ if (classesToMatch != NULL)
+ {
+ CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey),
+ CFSTR(kIOSerialBSDRS232Type));
+
+ kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
+ &serialPortIterator);
+ if (kernResult == KERN_SUCCESS)
+ {
+ while ((serialService = IOIteratorNext(serialPortIterator)))
+ {
+ CFTypeRef serialNameAsCFString;
+ CFTypeRef bsdPathAsCFString;
+ CFTypeRef hiddenVal;
+ char serialName[128];
+ char bsdPath[1024];
+ Boolean result;
+
+
+ /* Check if hidden... */
+ hiddenVal = IORegistryEntrySearchCFProperty(serialService,
+ kIOServicePlane,
+ CFSTR("HiddenPort"),
+ kCFAllocatorDefault,
+ kIORegistryIterateRecursively |
+ kIORegistryIterateParents);
+ if (hiddenVal)
+ CFRelease(hiddenVal); /* This interface should not be used */
+ else
+ {
+ serialNameAsCFString =
+ IORegistryEntryCreateCFProperty(serialService,
+ CFSTR(kIOTTYDeviceKey),
+ kCFAllocatorDefault, 0);
+ if (serialNameAsCFString)
+ {
+ result = CFStringGetCString(serialNameAsCFString, serialName,
+ sizeof(serialName),
+ kCFStringEncodingASCII);
+ CFRelease(serialNameAsCFString);
+
+ if (result)
+ {
+ bsdPathAsCFString =
+ IORegistryEntryCreateCFProperty(serialService,
+ CFSTR(kIOCalloutDeviceKey),
+ kCFAllocatorDefault, 0);
+ if (bsdPathAsCFString)
+ {
+ result = CFStringGetCString(bsdPathAsCFString, bsdPath,
+ sizeof(bsdPath),
+ kCFStringEncodingASCII);
+ CFRelease(bsdPathAsCFString);
+
+ if (result)
+ printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
+ bsdPath, serialName);
+ }
+ }
+ }
+ }
+
+ IOObjectRelease(serialService);
+ }
+
+ /*
+ * Release the iterator.
+ */
+
+ IOObjectRelease(serialPortIterator);
+ }
+ }
+#endif
+}
+
+
+/*
+ * 'side_cb()' - Handle side-channel requests...
+ */
+
+static int /* O - 0 on success, -1 on error */
+side_cb(int print_fd, /* I - Print file */
+ int device_fd, /* I - Device file */
+ int use_bc) /* I - Using back-channel? */
+{
+ cups_sc_command_t command; /* Request command */
+ cups_sc_status_t status; /* Request/response status */
+ char data[2048]; /* Request/response data */
+ int datalen; /* Request/response data size */
+
+
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+ return (-1);
+
+ switch (command)
+ {
+ case CUPS_SC_CMD_DRAIN_OUTPUT :
+ if (drain_output(print_fd, device_fd))
+ status = CUPS_SC_STATUS_IO_ERROR;
+ else if (tcdrain(device_fd))
+ status = CUPS_SC_STATUS_IO_ERROR;
+ else
+ status = CUPS_SC_STATUS_OK;
+
+ datalen = 0;
+ break;
+
+ case CUPS_SC_CMD_GET_BIDI :
+ status = CUPS_SC_STATUS_OK;
+ data[0] = use_bc;
+ datalen = 1;
+ break;
+
+ default :
+ status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
+ datalen = 0;
+ break;
+ }
+
+ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * IEEE-1284 support functions test program for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * "LICENSE" which should have been included with this file. If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Test the device-ID functions.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef WIN32
+# include <io.h>
+#else
+# include <unistd.h>
+# include <fcntl.h>
+#endif /* WIN32 */
+
+#include "backend-private.h"
+
+
+/*
+ * 'main()' - Test the device-ID functions.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line args */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int i, /* Looping var */
+ fd; /* File descriptor */
+ char device_id[1024], /* 1284 device ID string */
+ make_model[1024], /* make-and-model string */
+ uri[1024]; /* URI string */
+
+
+ if (argc < 2)
+ {
+ puts("Usage: test1284 device-file [... device-file-N]");
+ exit(1);
+ }
+
+ for (i = 1; i < argc; i ++)
+ {
+ if ((fd = open(argv[i], O_RDWR)) < 0)
+ {
+ perror(argv[i]);
+ return (errno);
+ }
+
+ printf("%s:\n", argv[i]);
+
+ backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
+ sizeof(make_model), "test", uri, sizeof(uri));
+
+ printf(" device_id=\"%s\"\n", device_id);
+ printf(" make_model=\"%s\"\n", make_model);
+ printf(" uri=\"%s\"\n", uri);
+
+ close(fd);
+ }
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-03-05.13; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
+# Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# 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.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
--- /dev/null
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-02-10'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Directory where bannertopdf finds its data files (PDF templates) */
+#undef BANNERTOPDF_DATADIR
+
+/* CUPS Version is 1.4 or newer */
+#undef CUPS_1_4
+
+/* acroread binary to use. */
+#undef CUPS_ACROREAD
+
+/* CUPS datadir */
+#undef CUPS_DATADIR
+
+/* Path to CUPS fonts dir */
+#undef CUPS_FONTPATH
+
+/* gs binary to use */
+#undef CUPS_GHOSTSCRIPT
+
+/* max resolution used for pdftops when converting images */
+#undef CUPS_PDFTOPS_MAX_RESOLUTION
+
+/* Define default renderer */
+#undef CUPS_PDFTOPS_RENDERER
+
+/* pdftops binary to use. */
+#undef CUPS_POPPLER_PDFTOPS
+
+/* Path to CUPS binaries dir */
+#undef CUPS_SERVERBIN
+
+/* Define that we provide acroread. */
+#undef HAVE_ACROREAD
+
+/* Define if you have Poppler's "cpp/poppler-version.h" header file. */
+#undef HAVE_CPP_POPPLER_VERSION_H
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
+/* Have FreeType2 include files */
+#undef HAVE_FREETYPE_H
+
+/* Define to 1 if you have the `getline' function. */
+#undef HAVE_GETLINE
+
+/* Define that we provide ghostscript binary */
+#undef HAVE_GHOSTSCRIPT
+
+/* gs supports ps2write */
+#undef HAVE_GHOSTSCRIPT_PS2WRITE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <jpeglib.h> header file. */
+#undef HAVE_JPEGLIB_H
+
+/* Defines if we provide jpeg library. */
+#undef HAVE_LIBJPEG
+
+/* Defines if we provide png library. */
+#undef HAVE_LIBPNG
+
+/* Defines if we provide tiff library. */
+#undef HAVE_LIBTIFF
+
+/* Define that we use zlib */
+#undef HAVE_LIBZ
+
+/* Platform supports long long type */
+#undef HAVE_LONG_LONG
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `open_memstream' function. */
+#undef HAVE_OPEN_MEMSTREAM
+
+/* Define that we provide poppler pdftops. */
+#undef HAVE_POPPLER_PDFTOPS
+
+/* pdftops supports -origpagesizes. */
+#undef HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES
+
+/* pdftops supports -r argument. */
+#undef HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION
+
+/* Define to 1 if you have the `sigaction' function. */
+#undef HAVE_SIGACTION
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasestr' function. */
+#undef HAVE_STRCASESTR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <tiff.h> header file. */
+#undef HAVE_TIFF_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `wait3' function. */
+#undef HAVE_WAIT3
+
+/* Define to 1 if you have the `waitpid' function. */
+#undef HAVE_WAITPID
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* 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 home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Needed for pdftopdf filter compilation */
+#undef PDFTOPDF
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Path to font used in tests */
+#undef TESTFONT
+
+/* Defines if use lcms1 */
+#undef USE_LCMS1
+
+/* Version number of package */
+#undef VERSION
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+
+#ifdef HAVE_LONG_LONG
+# define CUPS_LLFMT "%lld"
+# define CUPS_LLCAST (long long)
+#else
+# define CUPS_LLFMT "%ld"
+# define CUPS_LLCAST (long)
+#endif /* HAVE_LONG_LONG */
+
+#ifdef HAVE_ARC4RANDOM
+# define CUPS_RAND() arc4random()
+# define CUPS_SRAND(v) arc4random_stir()
+#elif defined(HAVE_RANDOM)
+# define CUPS_RAND() random()
+# define CUPS_SRAND(v) srandom(v)
+#elif defined(HAVE_LRAND48)
+# define CUPS_RAND() lrand48()
+# define CUPS_SRAND(v) srand48(v)
+#else
+# define CUPS_RAND() rand()
+# define CUPS_SRAND(v) srand(v)
+#endif /* HAVE_ARC4RANDOM */
+
--- /dev/null
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-04-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | epiphany \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | open8 \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | we32k \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i386-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for cups-filters 1.0.25.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='cups-filters'
+PACKAGE_TARNAME='cups-filters'
+PACKAGE_VERSION='1.0.25'
+PACKAGE_STRING='cups-filters 1.0.25'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+PHPDIR
+PHPCONFIG
+WITH_PHP_FALSE
+WITH_PHP_TRUE
+CUPS_ACROREAD
+CUPS_PDFTOPS
+CUPS_GHOSTSCRIPT
+LARGEFILE
+LIBQPDF_LIBS
+LIBQPDF_CFLAGS
+ZLIB_LIBS
+ZLIB_CFLAGS
+POPPLER_LIBS
+POPPLER_CFLAGS
+IJS_LIBS
+IJS_CFLAGS
+FONTCONFIG_LIBS
+FONTCONFIG_CFLAGS
+FREETYPE_LIBS
+FREETYPE_CFLAGS
+LCMS_LIBS
+LCMS_CFLAGS
+LIBTIFF_LIBS
+LIBPNG_LIBS
+LIBPNG_CFLAGS
+LIBJPEG_LIBS
+ENABLE_IMAGEFILTERS_FALSE
+ENABLE_IMAGEFILTERS_TRUE
+STRCASESTR
+GETLINE
+DLOPEN_LIBS
+BANNERTOPDF_DATADIR
+CUPS_SERVERBIN
+CUPS_FONTPATH
+CUPS_DATADIR
+CUPS_LIBS
+CUPS_CFLAGS
+CUPSCONFIG
+FONTDIR
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+CXXCPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBTOOL
+LN_S
+CPP
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+with_fontdir
+with_cups_config
+enable_imagefilters
+with_jpeg
+with_png
+with_tiff
+enable_largefile
+with_pdftops
+with_gs_path
+with_pdftops_path
+with_acroread_path
+with_pdftops_maxres
+with_php
+with_php_config
+with_test_font_path
+enable_werror
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+LIBPNG_CFLAGS
+LIBPNG_LIBS
+LCMS_CFLAGS
+LCMS_LIBS
+FREETYPE_CFLAGS
+FREETYPE_LIBS
+FONTCONFIG_CFLAGS
+FONTCONFIG_LIBS
+IJS_CFLAGS
+IJS_LIBS
+POPPLER_CFLAGS
+POPPLER_LIBS
+ZLIB_CFLAGS
+ZLIB_LIBS
+LIBQPDF_CFLAGS
+LIBQPDF_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures cups-filters 1.0.25 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/cups-filters]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of cups-filters 1.0.25:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-silent-rules less verbose build output (undo: `make V=1')
+ --disable-silent-rules verbose build output (undo: `make V=0')
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --disable-imagefilters Build the image filters.
+ --disable-largefile omit support for large files
+ --enable-werror Treat all warnings as errors, useful for
+ development.
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+ --with-fontdir=path Specify path to font config directory ( default:
+ fonts/conf.d/).
+ --with-cups-config=path Specify path to cups-config executable.
+ --without-jpeg Disable jpeg support.
+ --without-png Disable png support.
+ --without-tiff Disable tiff support.
+ --with-pdftops=value Set which pdftops to use (gs,pdftops,acroread).
+ --with-gs-path=value Set path to ghostcript binary (default: system).
+ --with-pdftops-path=value
+ Set path to pdftops/ghostscript binary (default:
+ system).
+ --with-acroread-path=value
+ Set path to acroread binary (default: system).
+ --with-pdftops-maxres=value
+ Set maximum image rendering resolution for pdftops
+ filter (0, 75, 150, 300, 600, 1200, 2400, 4800, 90,
+ 180, 360, 720, 1440, 2880, 5760, unlimited).
+ Default: 1440
+ --with-php Determine whether to build php cups extension.
+ --with-php-config=path Specify path to php-config executable.
+ --with-test-font-path=value
+ Set path to pdftops/ghostscript binary (default:
+ /usr/share/fonts/dejavu/DejaVuSans.ttf).
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CPP C preprocessor
+ CXXCPP C++ preprocessor
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ LIBPNG_CFLAGS
+ C compiler flags for LIBPNG, overriding pkg-config
+ LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
+ LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config
+ LCMS_LIBS linker flags for LCMS, overriding pkg-config
+ FREETYPE_CFLAGS
+ C compiler flags for FREETYPE, overriding pkg-config
+ FREETYPE_LIBS
+ linker flags for FREETYPE, overriding pkg-config
+ FONTCONFIG_CFLAGS
+ C compiler flags for FONTCONFIG, overriding pkg-config
+ FONTCONFIG_LIBS
+ linker flags for FONTCONFIG, overriding pkg-config
+ IJS_CFLAGS C compiler flags for IJS, overriding pkg-config
+ IJS_LIBS linker flags for IJS, overriding pkg-config
+ POPPLER_CFLAGS
+ C compiler flags for POPPLER, overriding pkg-config
+ POPPLER_LIBS
+ linker flags for POPPLER, overriding pkg-config
+ ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config
+ ZLIB_LIBS linker flags for ZLIB, overriding pkg-config
+ LIBQPDF_CFLAGS
+ C compiler flags for LIBQPDF, overriding pkg-config
+ LIBQPDF_LIBS
+ linker flags for LIBQPDF, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+cups-filters configure 1.0.25
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_cxx_check_func LINENO FUNC VAR
+# ------------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_cxx_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_func
+
+# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_cxx_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_header_mongrel
+
+# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES
+# ---------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_cxx_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_type
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by cups-filters $as_me 1.0.25, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+# This macro compares two version strings. Due to the various number of
+# minor-version numbers that can exist, and the fact that string
+# comparisons are not compatible with numeric comparisons, this is not
+# necessarily trivial to do in a autoconf script. This macro makes doing
+# these comparisons easy.
+#
+# The six basic comparisons are available, as well as checking equality
+# limited to a certain number of minor-version levels.
+#
+# The operator OP determines what type of comparison to do, and can be one
+# of:
+#
+# eq - equal (test A == B)
+# ne - not equal (test A != B)
+# le - less than or equal (test A <= B)
+# ge - greater than or equal (test A >= B)
+# lt - less than (test A < B)
+# gt - greater than (test A > B)
+#
+# Additionally, the eq and ne operator can have a number after it to limit
+# the test to that number of minor versions.
+#
+# eq0 - equal up to the length of the shorter version
+# ne0 - not equal up to the length of the shorter version
+# eqN - equal up to N sub-version levels
+# neN - not equal up to N sub-version levels
+#
+# When the condition is true, shell commands ACTION-IF-TRUE are run,
+# otherwise shell commands ACTION-IF-FALSE are run. The environment
+# variable 'ax_compare_version' is always set to either 'true' or 'false'
+# as well.
+#
+# Examples:
+#
+# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+# would both be true.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+# would both be false.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+# would be true because it is only comparing two minor versions.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+# would be true because it is only comparing the lesser number of minor
+# versions of the two values.
+#
+# Note: The characters that separate the version numbers do not matter. An
+# empty string is the same as version 0. OP is evaluated by autoconf, not
+# configure, so must be a string, not a variable.
+#
+# The author would like to acknowledge Guido Draheim whose advice about
+# the m4_case and m4_ifvaln functions make this macro only include the
+# portions necessary to perform the specific comparison specified by the
+# OP argument in the final configure script.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+
+am__api_version='1.11'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='cups-filters'
+ VERSION='1.0.25'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no) AM_DEFAULT_VERBOSITY=1;;
+*) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ac_config_headers="$ac_config_headers config.h"
+
+# Extra defines for the config.h
+
+
+# ===========================
+# Find required base packages
+# ===========================
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+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 delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ 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 variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_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"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="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* | cegcc*)
+ # 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;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # 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"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # 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`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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
+ ;;
+
+haiku*)
+ 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])(-bit)?( [LM]SB)? 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
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ 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=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ 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
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# 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
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && 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 <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; 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 '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; 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-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*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*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ 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"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ 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
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ 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
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ 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
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ 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
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+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
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ 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
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ 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
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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 other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # 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_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-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_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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 other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker 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>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an 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'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # 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.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ link_all_deplibs=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${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
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='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 $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ 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
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ link_all_deplibs=no
+ 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='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${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.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker 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>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".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"
+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 # correct to gnu/linux during the next big refactor
+ 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'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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<name>.so
+ # instead of lib<name>.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*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ 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=`func_echo_all "$lib" | $SED '\''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'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ 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~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ 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="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ 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
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # 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
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # 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}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ 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
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ 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_cmds='.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_cmds='.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_cmds='.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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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 glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # 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
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # 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'
+ ;;
+
+netbsdelf*-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='NetBSD ld.elf_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}${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 # correct to gnu/linux during the next big refactor
+ 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=qnx
+ 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='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ 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_cmds=".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"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ 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 # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = 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
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; 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
+
+
+
+
+
+
+ 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* | cegcc*)
+ 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 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;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 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;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+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"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+CC="$lt_save_CC"
+
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+ if ${ac_cv_prog_CXXCPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+else
+ _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+ # save warnings/boilerplate of simple test code
+ ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ 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
+ $as_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
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ compiler_CXX=$CC
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+ else
+ lt_prog_compiler_no_builtin_flag_CXX=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ 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 variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_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
+ archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${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
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ 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.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -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 -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+ ld_shlibs_CXX=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ file_list_spec_CXX='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ hardcode_direct_CXX=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ 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='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec_CXX='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ always_export_symbols_CXX=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_CXX='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath__CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath__CXX"; then
+ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath__CXX"; then
+ lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath__CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath__CXX"; then
+ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath__CXX"; then
+ lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+ hardcode_libdir_flag_spec_CXX='${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.
+ no_undefined_flag_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ fi
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX=' '
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=yes
+ file_list_spec_CXX='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
+ enable_shared_with_static_runtimes_CXX=yes
+ # Don't use ranlib
+ old_postinstall_cmds_CXX='chmod 644 $oldlib'
+ postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_CXX='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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec_CXX=''
+ fi
+ link_all_deplibs_CXX=yes
+ allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+
+ else
+ ld_shlibs_CXX=no
+ fi
+
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs_CXX=yes
+ ;;
+
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=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
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_minus_L_CXX=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
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ 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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_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.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ inherit_rpath_CXX=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ 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.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --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; func_echo_all "$list"'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+ prelink_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ old_archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # 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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object_CXX=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # 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.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=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::"'
+ ;;
+
+ *nto* | *qnx*)
+ ld_shlibs_CXX=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ hardcode_direct_absolute_CXX=yes
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ osf3* | 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.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ ;;
+ esac
+
+ hardcode_libdir_separator_CXX=:
+
+ # 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=`func_echo_all "$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; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # 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 -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ link_all_deplibs_CXX=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # 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.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$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 -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$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 -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+ '"$old_archive_cmds_CXX"
+ reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+ '"$reload_cmds_CXX"
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+ test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+ GCC_CXX="$GXX"
+ LD_CXX="$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...
+ # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_path_CXX="${prev}${p}"
+ else
+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$postdeps_CXX"; then
+ postdeps_CXX="${prev}${p}"
+ else
+ postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+ predep_objects_CXX="$p"
+ else
+ predep_objects_CXX="$predep_objects_CXX $p"
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+ postdep_objects_CXX="$p"
+ else
+ postdep_objects_CXX="$postdep_objects_CXX $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ predep_objects_CXX=
+ postdep_objects_CXX=
+ postdeps_CXX=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ m68k)
+ # 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_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_CXX='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ lt_prog_compiler_pic_CXX=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static_CXX=
+ ;;
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_CXX=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[4-9]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ else
+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--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
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # 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_prog_compiler_pic_CXX='-DDLL_EXPORT'
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ lt_prog_compiler_pic_CXX='+Z'
+ fi
+ ;;
+ aCC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-qpic'
+ lt_prog_compiler_static_CXX='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ lt_prog_compiler_pic_CXX='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd* | netbsdelf*-gnu)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ lt_prog_compiler_pic_CXX='-pic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ lt_prog_compiler_can_build_shared_CXX=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+ # 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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 other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works_CXX=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+ case $lt_prog_compiler_pic_CXX in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+ esac
+else
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_CXX=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker 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>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+ :
+else
+ lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_CXX=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ 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
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_CXX=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ case $host_os in
+ aix[4-9]*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*)
+ exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ link_all_deplibs_CXX=no
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX 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.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc_CXX=no
+ else
+ lt_cv_archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+ archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".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"
+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 # correct to gnu/linux during the next big refactor
+ 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'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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<name>.so
+ # instead of lib<name>.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*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ 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=`func_echo_all "$lib" | $SED '\''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'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ 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~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ 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}'
+
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ 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
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # 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
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # 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}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ 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
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ 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_cmds='.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_cmds='.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_cmds='.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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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 glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # 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
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # 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'
+ ;;
+
+netbsdelf*-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='NetBSD ld.elf_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}${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 # correct to gnu/linux during the next big refactor
+ 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=qnx
+ 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='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ 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_cmds=".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"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+ 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 # correct to gnu/linux during the next big refactor
+ 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
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = 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
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+ test -n "$runpath_var_CXX" ||
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct_CXX" != 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_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+ test "$inherit_rpath_CXX" = yes; 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
+
+
+
+
+
+
+
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ 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
+fi # test "$_lt_caught_CXX_error" != yes
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.20
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+
+# ========================================
+# Specify the fontdir patch if not default
+# ========================================
+
+# Check whether --with-fontdir was given.
+if test "${with_fontdir+set}" = set; then :
+ withval=$with_fontdir; FONTDIR="$withval"
+else
+ FONTDIR="fonts/conf.d"
+
+fi
+
+
+
+# ================================
+# Find CUPS internals (no pc file)
+# ================================
+
+# Check whether --with-cups-config was given.
+if test "${with_cups_config+set}" = set; then :
+ withval=$with_cups_config; with_cups_config="$withval"
+else
+ with_cups_config=system
+
+fi
+
+
+if test "x$with_cups_config" != "xsystem"; then :
+
+ CUPSCONFIG=$with_cups_config
+
+else
+
+ # Extract the first word of "cups-config", so it can be a program name with args.
+set dummy cups-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CUPSCONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CUPSCONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPSCONFIG="$CUPSCONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CUPSCONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+CUPSCONFIG=$ac_cv_path_CUPSCONFIG
+if test -n "$CUPSCONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPSCONFIG" >&5
+$as_echo "$CUPSCONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -z "$CUPSCONFIG"; then :
+
+ as_fn_error $? "Required cups-config is missing. Please install CUPS developer packages." "$LINENO" 5
+
+fi
+
+fi
+CUPS_CFLAGS=`$CUPSCONFIG --cflags`
+CUPS_LIBS=`$CUPSCONFIG --image --libs`
+CUPS_VERSION=`$CUPSCONFIG --version`
+
+
+
+CUPS_DATADIR="`$CUPSCONFIG --datadir`"
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_DATADIR "$CUPS_DATADIR"
+_ACEOF
+
+
+
+CUPS_FONTPATH="$CUPS_DATADIR/fonts"
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_FONTPATH "$CUPS_FONTPATH"
+_ACEOF
+
+
+
+CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`"
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_SERVERBIN "$CUPS_SERVERBIN"
+_ACEOF
+
+
+
+
+
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+
+ ax_compare_version_A=`echo "$CUPS_VERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/[^0-9]//g'`
+
+
+ ax_compare_version_B=`echo "1.4" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/[^0-9]//g'`
+
+
+ ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+ if test "$ax_compare_version" = "true" ; then
+
+
+$as_echo "#define CUPS_1_4 1" >>confdefs.h
+
+
+ fi
+
+
+$as_echo "#define PDFTOPDF /**/" >>confdefs.h
+
+
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+ eval ac_define_dir="\"$"{CUPS_DATADIR}/data"\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ BANNERTOPDF_DATADIR="$ac_define_dir"
+
+
+cat >>confdefs.h <<_ACEOF
+#define BANNERTOPDF_DATADIR "$ac_define_dir"
+_ACEOF
+
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+$as_echo_n "checking for library containing dlopen... " >&6; }
+if ${ac_cv_search_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dl; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_search_dlopen=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_dlopen+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_dlopen+:} false; then :
+
+else
+ ac_cv_search_dlopen=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
+$as_echo "$ac_cv_search_dlopen" >&6; }
+ac_res=$ac_cv_search_dlopen
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ DLOPEN_LIBS="-ldl"
+else
+ as_fn_error $? "unable to find the dlopen() function" "$LINENO" 5
+
+fi
+
+
+
+# ======================
+# Check system functions
+# ======================
+for ac_func in sigaction
+do :
+ ac_fn_cxx_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction"
+if test "x$ac_cv_func_sigaction" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SIGACTION 1
+_ACEOF
+
+fi
+done
+
+for ac_func in waitpid wait3
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in strtoll
+do :
+ ac_fn_cxx_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll"
+if test "x$ac_cv_func_strtoll" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STRTOLL 1
+_ACEOF
+
+fi
+done
+
+for ac_func in open_memstream
+do :
+ ac_fn_cxx_check_func "$LINENO" "open_memstream" "ac_cv_func_open_memstream"
+if test "x$ac_cv_func_open_memstream" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OPEN_MEMSTREAM 1
+_ACEOF
+
+fi
+done
+
+for ac_func in getline
+do :
+ ac_fn_cxx_check_func "$LINENO" "getline" "ac_cv_func_getline"
+if test "x$ac_cv_func_getline" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETLINE 1
+_ACEOF
+
+else
+ GETLINE='bannertopdf-getline.$(OBJEXT)'
+
+fi
+done
+
+for ac_func in strcasestr
+do :
+ ac_fn_cxx_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr"
+if test "x$ac_cv_func_strcasestr" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STRCASESTR 1
+_ACEOF
+
+else
+ STRCASESTR='pdftops-strcasestr.$(OBJEXT)'
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5
+$as_echo_n "checking for library containing pow... " >&6; }
+if ${ac_cv_search_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_search_pow=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_pow+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_pow+:} false; then :
+
+else
+ ac_cv_search_pow=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5
+$as_echo "$ac_cv_search_pow" >&6; }
+ac_res=$ac_cv_search_pow
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
+# ========================
+# Check for system headers
+# ========================
+
+for ac_header in stdlib.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sys/stat.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_stat_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_STAT_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sys/types.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_types_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_TYPES_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in unistd.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in zlib.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in endian.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default"
+if test "x$ac_cv_header_endian_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ENDIAN_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in dirent.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "dirent.h" "ac_cv_header_dirent_h" "$ac_includes_default"
+if test "x$ac_cv_header_dirent_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DIRENT_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sys/ioctl.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_ioctl_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_IOCTL_H 1
+_ACEOF
+
+fi
+
+done
+
+
+# =============
+# Image options
+# =============
+# Check whether --enable-imagefilters was given.
+if test "${enable_imagefilters+set}" = set; then :
+ enableval=$enable_imagefilters; enable_imagefilters="$enableval"
+else
+ enable_imagefilters=yes
+
+fi
+
+ if test "x$enable_imagefilters" != "xno"; then
+ ENABLE_IMAGEFILTERS_TRUE=
+ ENABLE_IMAGEFILTERS_FALSE='#'
+else
+ ENABLE_IMAGEFILTERS_TRUE='#'
+ ENABLE_IMAGEFILTERS_FALSE=
+fi
+
+
+# Libraries
+
+# Check whether --with-jpeg was given.
+if test "${with_jpeg+set}" = set; then :
+ withval=$with_jpeg; with_jpeg="$withval"
+else
+ with_jpeg=yes
+
+fi
+
+if test x"$with_jpeg" != "xno"; then :
+
+
+$as_echo "#define HAVE_LIBJPEG /**/" >>confdefs.h
+
+ for ac_header in jpeglib.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_JPEGLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing jpeg_destroy_decompress" >&5
+$as_echo_n "checking for library containing jpeg_destroy_decompress... " >&6; }
+if ${ac_cv_search_jpeg_destroy_decompress+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_destroy_decompress ();
+int
+main ()
+{
+return jpeg_destroy_decompress ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' jpeg; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_search_jpeg_destroy_decompress=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_jpeg_destroy_decompress+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_jpeg_destroy_decompress+:} false; then :
+
+else
+ ac_cv_search_jpeg_destroy_decompress=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_jpeg_destroy_decompress" >&5
+$as_echo "$ac_cv_search_jpeg_destroy_decompress" >&6; }
+ac_res=$ac_cv_search_jpeg_destroy_decompress
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ LIBJPEG_LIBS="-ljpeg"
+else
+ as_fn_error $? "jpeg libraries not found." "$LINENO" 5
+
+fi
+
+
+
+fi
+
+
+# Check whether --with-png was given.
+if test "${with_png+set}" = set; then :
+ withval=$with_png; with_png="$withval"
+else
+ with_png=yes
+
+fi
+
+if test x"$with_png" != "xno"; then :
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBPNG" >&5
+$as_echo_n "checking for LIBPNG... " >&6; }
+
+if test -n "$LIBPNG_CFLAGS"; then
+ pkg_cv_LIBPNG_CFLAGS="$LIBPNG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$LIBPNG_LIBS"; then
+ pkg_cv_LIBPNG_LIBS="$LIBPNG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBPNG_LIBS=`$PKG_CONFIG --libs "libpng" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ LIBPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpng" 2>&1`
+ else
+ LIBPNG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpng" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$LIBPNG_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (libpng) were not met:
+
+$LIBPNG_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LIBPNG_CFLAGS
+and LIBPNG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LIBPNG_CFLAGS
+and LIBPNG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
+ LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define HAVE_LIBPNG /**/" >>confdefs.h
+
+
+fi
+
+
+# Check whether --with-tiff was given.
+if test "${with_tiff+set}" = set; then :
+ withval=$with_tiff; with_tiff="$withval"
+else
+ with_tiff=yes
+
+fi
+
+if test x"$with_tiff" != "xno"; then :
+
+
+$as_echo "#define HAVE_LIBTIFF /**/" >>confdefs.h
+
+ for ac_header in tiff.h
+do :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "tiff.h" "ac_cv_header_tiff_h" "$ac_includes_default"
+if test "x$ac_cv_header_tiff_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_TIFF_H 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing TIFFReadScanline" >&5
+$as_echo_n "checking for library containing TIFFReadScanline... " >&6; }
+if ${ac_cv_search_TIFFReadScanline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char TIFFReadScanline ();
+int
+main ()
+{
+return TIFFReadScanline ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' tiff; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_search_TIFFReadScanline=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_TIFFReadScanline+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_TIFFReadScanline+:} false; then :
+
+else
+ ac_cv_search_TIFFReadScanline=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_TIFFReadScanline" >&5
+$as_echo "$ac_cv_search_TIFFReadScanline" >&6; }
+ac_res=$ac_cv_search_TIFFReadScanline
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ LIBJPEG_LIBS="-ltiff"
+else
+ as_fn_error $? "tiff libraries not found." "$LINENO" 5
+
+fi
+
+
+
+fi
+
+# ======================================
+# Check for various pdf required modules
+# ======================================
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
+$as_echo_n "checking for LCMS... " >&6; }
+
+if test -n "$LCMS_CFLAGS"; then
+ pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$LCMS_LIBS"; then
+ pkg_cv_LCMS_LIBS="$LCMS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lcms2" 2>&1`
+ else
+ LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lcms2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$LCMS_PKG_ERRORS" >&5
+
+ lcms2=no
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ lcms2=no
+else
+ LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS
+ LCMS_LIBS=$pkg_cv_LCMS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ lcms2=yes
+fi
+if test x"$lcms2" = "xno"; then :
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
+$as_echo_n "checking for LCMS... " >&6; }
+
+if test -n "$LCMS_CFLAGS"; then
+ pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "lcms") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$LCMS_LIBS"; then
+ pkg_cv_LCMS_LIBS="$LCMS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "lcms") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lcms" 2>&1`
+ else
+ LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lcms" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$LCMS_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (lcms) were not met:
+
+$LCMS_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LCMS_CFLAGS
+and LCMS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LCMS_CFLAGS
+and LCMS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS
+ LCMS_LIBS=$pkg_cv_LCMS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define USE_LCMS1 1" >>confdefs.h
+
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE" >&5
+$as_echo_n "checking for FREETYPE... " >&6; }
+
+if test -n "$FREETYPE_CFLAGS"; then
+ pkg_cv_FREETYPE_CFLAGS="$FREETYPE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FREETYPE_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$FREETYPE_LIBS"; then
+ pkg_cv_FREETYPE_LIBS="$FREETYPE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FREETYPE_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ FREETYPE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "freetype2" 2>&1`
+ else
+ FREETYPE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "freetype2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$FREETYPE_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (freetype2) were not met:
+
+$FREETYPE_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables FREETYPE_CFLAGS
+and FREETYPE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables FREETYPE_CFLAGS
+and FREETYPE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
+ FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_FREETYPE_H 1" >>confdefs.h
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTCONFIG" >&5
+$as_echo_n "checking for FONTCONFIG... " >&6; }
+
+if test -n "$FONTCONFIG_CFLAGS"; then
+ pkg_cv_FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.0.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.0.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.0.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$FONTCONFIG_LIBS"; then
+ pkg_cv_FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.0.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.0.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.0.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fontconfig >= 2.0.0" 2>&1`
+ else
+ FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fontconfig >= 2.0.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$FONTCONFIG_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (fontconfig >= 2.0.0) were not met:
+
+$FONTCONFIG_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
+and FONTCONFIG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
+and FONTCONFIG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
+ FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IJS" >&5
+$as_echo_n "checking for IJS... " >&6; }
+
+if test -n "$IJS_CFLAGS"; then
+ pkg_cv_IJS_CFLAGS="$IJS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ijs\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "ijs") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_IJS_CFLAGS=`$PKG_CONFIG --cflags "ijs" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$IJS_LIBS"; then
+ pkg_cv_IJS_LIBS="$IJS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ijs\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "ijs") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_IJS_LIBS=`$PKG_CONFIG --libs "ijs" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ IJS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ijs" 2>&1`
+ else
+ IJS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ijs" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$IJS_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (ijs) were not met:
+
+$IJS_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables IJS_CFLAGS
+and IJS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables IJS_CFLAGS
+and IJS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ IJS_CFLAGS=$pkg_cv_IJS_CFLAGS
+ IJS_LIBS=$pkg_cv_IJS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POPPLER" >&5
+$as_echo_n "checking for POPPLER... " >&6; }
+
+if test -n "$POPPLER_CFLAGS"; then
+ pkg_cv_POPPLER_CFLAGS="$POPPLER_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"poppler >= 0.18\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "poppler >= 0.18") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_POPPLER_CFLAGS=`$PKG_CONFIG --cflags "poppler >= 0.18" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$POPPLER_LIBS"; then
+ pkg_cv_POPPLER_LIBS="$POPPLER_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"poppler >= 0.18\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "poppler >= 0.18") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_POPPLER_LIBS=`$PKG_CONFIG --libs "poppler >= 0.18" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ POPPLER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "poppler >= 0.18" 2>&1`
+ else
+ POPPLER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "poppler >= 0.18" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$POPPLER_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (poppler >= 0.18) were not met:
+
+$POPPLER_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables POPPLER_CFLAGS
+and POPPLER_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables POPPLER_CFLAGS
+and POPPLER_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ POPPLER_CFLAGS=$pkg_cv_POPPLER_CFLAGS
+ POPPLER_LIBS=$pkg_cv_POPPLER_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZLIB" >&5
+$as_echo_n "checking for ZLIB... " >&6; }
+
+if test -n "$ZLIB_CFLAGS"; then
+ pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$ZLIB_LIBS"; then
+ pkg_cv_ZLIB_LIBS="$ZLIB_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1`
+ else
+ ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$ZLIB_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (zlib) were not met:
+
+$ZLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables ZLIB_CFLAGS
+and ZLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables ZLIB_CFLAGS
+and ZLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ ZLIB_CFLAGS=$pkg_cv_ZLIB_CFLAGS
+ ZLIB_LIBS=$pkg_cv_ZLIB_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define HAVE_LIBZ /**/" >>confdefs.h
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBQPDF" >&5
+$as_echo_n "checking for LIBQPDF... " >&6; }
+
+if test -n "$LIBQPDF_CFLAGS"; then
+ pkg_cv_LIBQPDF_CFLAGS="$LIBQPDF_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libqpdf >= 3.0.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libqpdf >= 3.0.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBQPDF_CFLAGS=`$PKG_CONFIG --cflags "libqpdf >= 3.0.2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$LIBQPDF_LIBS"; then
+ pkg_cv_LIBQPDF_LIBS="$LIBQPDF_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libqpdf >= 3.0.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libqpdf >= 3.0.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_LIBQPDF_LIBS=`$PKG_CONFIG --libs "libqpdf >= 3.0.2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ LIBQPDF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libqpdf >= 3.0.2" 2>&1`
+ else
+ LIBQPDF_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libqpdf >= 3.0.2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$LIBQPDF_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (libqpdf >= 3.0.2) were not met:
+
+$LIBQPDF_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LIBQPDF_CFLAGS
+and LIBQPDF_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LIBQPDF_CFLAGS
+and LIBQPDF_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ LIBQPDF_CFLAGS=$pkg_cv_LIBQPDF_CFLAGS
+ LIBQPDF_LIBS=$pkg_cv_LIBQPDF_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+# ================
+# Poppler features
+# ================
+ac_fn_cxx_check_header_mongrel "$LINENO" "poppler/cpp/poppler-version.h" "ac_cv_header_poppler_cpp_poppler_version_h" "$ac_includes_default"
+if test "x$ac_cv_header_poppler_cpp_poppler_version_h" = xyes; then :
+
+$as_echo "#define HAVE_CPP_POPPLER_VERSION_H /**/" >>confdefs.h
+
+fi
+
+
+
+# ===================================
+# Check for large files and long long
+# ===================================
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ if ac_fn_cxx_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+
+
+fi
+
+LARGEFILE=""
+if test x"$enable_largefile" != "xno"; then :
+
+ LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ if test x"$ac_cv_sys_large_files" = "x1"; then :
+ LARGEFILE="$LARGEFILE -D_LARGE_FILES"
+fi
+ if test x"$ac_cv_sys_file_offset_bits" = "x64"; then :
+ LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
+fi
+
+fi
+
+
+ac_fn_cxx_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+ long_long_found=yes
+else
+ long_long_found=no
+fi
+
+if test x"$long_long_found" = "xyes"; then :
+
+
+$as_echo "#define HAVE_LONG_LONG /**/" >>confdefs.h
+
+
+fi
+
+# ================
+# Check for pdf2ps
+# ================
+
+# Check whether --with-pdftops was given.
+if test "${with_pdftops+set}" = set; then :
+ withval=$with_pdftops; with_pdftops="$withval"
+else
+ with_pdftops=gs
+
+fi
+
+case x$with_pdftops in #(
+ xgs|xpdftops|xacroread) :
+ ;; #(
+ *) :
+ as_fn_error $? "Unknown value of with-pdftops provided: $with_pdftops" "$LINENO" 5
+ ;;
+esac
+
+# Check whether --with-gs-path was given.
+if test "${with_gs_path+set}" = set; then :
+ withval=$with_gs_path; with_gs_path="$withval"
+else
+ with_gs_path=system
+
+fi
+
+
+# Check whether --with-pdftops-path was given.
+if test "${with_pdftops_path+set}" = set; then :
+ withval=$with_pdftops_path; with_pdftops_path="$withval"
+else
+ with_pdftops_path=system
+
+fi
+
+
+# Check whether --with-acroread-path was given.
+if test "${with_acroread_path+set}" = set; then :
+ withval=$with_acroread_path; with_acroread_path="$withval"
+else
+ with_acroread_path=system
+
+fi
+
+
+# Check whether --with-pdftops-maxres was given.
+if test "${with_pdftops_maxres+set}" = set; then :
+ withval=$with_pdftops_maxres; with_pdftops_maxres="$withval"
+else
+ with_pdftops_maxres=1440
+
+fi
+
+case x$with_pdftops_maxres in #(
+ x0|x75|x150|x300|x600|x1200|x2400|x4800|x90|x180|x360|x720|x1440|x2880|x5760) :
+ CUPS_PDFTOPS_MAXRES=$with_pdftops_maxres ;; #(
+ xunlimited) :
+ CUPS_PDFTOPS_MAXRES=0 ;; #(
+ *) :
+ as_fn_error $? "Unknown value of with-pdftops-maxres provided: $with_pdftops" "$LINENO" 5
+ ;;
+esac
+
+if test "x$with_gs_path" != "xsystem"; then :
+
+ CUPS_GHOSTSCRIPT="$with_gs_path"
+
+else
+
+ # Extract the first word of "gs", so it can be a program name with args.
+set dummy gs; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CUPS_GHOSTSCRIPT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CUPS_GHOSTSCRIPT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPS_GHOSTSCRIPT="$CUPS_GHOSTSCRIPT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CUPS_GHOSTSCRIPT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CUPS_GHOSTSCRIPT" && ac_cv_path_CUPS_GHOSTSCRIPT="as_fn_error $? "Required gs binary is missing. Please install ghostscript-gpl package." "$LINENO" 5"
+ ;;
+esac
+fi
+CUPS_GHOSTSCRIPT=$ac_cv_path_CUPS_GHOSTSCRIPT
+if test -n "$CUPS_GHOSTSCRIPT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_GHOSTSCRIPT" >&5
+$as_echo "$CUPS_GHOSTSCRIPT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+if test "x$CUPS_GHOSTSCRIPT" != "x"; then :
+
+
+$as_echo "#define HAVE_GHOSTSCRIPT /**/" >>confdefs.h
+
+ if test x"$with_pdftops" = xgs; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_PDFTOPS_RENDERER GS
+_ACEOF
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gs supports the ps2write device" >&5
+$as_echo_n "checking whether gs supports the ps2write device... " >&6; }
+ if `$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_GHOSTSCRIPT_PS2WRITE /**/" >>confdefs.h
+
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+
+fi
+
+if test "x$with_pdftops_path" != "xsystem"; then :
+
+ CUPS_PDFTOPS="$with_pdftops"
+
+else
+
+ # Extract the first word of "pdftops", so it can be a program name with args.
+set dummy pdftops; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CUPS_PDFTOPS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CUPS_PDFTOPS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPS_PDFTOPS="$CUPS_PDFTOPS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CUPS_PDFTOPS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CUPS_PDFTOPS" && ac_cv_path_CUPS_PDFTOPS="as_fn_error $? "Required pdftops is missing. Please install CUPS developer packages." "$LINENO" 5"
+ ;;
+esac
+fi
+CUPS_PDFTOPS=$ac_cv_path_CUPS_PDFTOPS
+if test -n "$CUPS_PDFTOPS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_PDFTOPS" >&5
+$as_echo "$CUPS_PDFTOPS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+if test "x$CUPS_PDFTOPS" != "x"; then :
+
+
+$as_echo "#define HAVE_POPPLER_PDFTOPS /**/" >>confdefs.h
+
+ if test x"$with_pdftops" = xpdftops; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_PDFTOPS_RENDERER PDFTOPS
+_ACEOF
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pdftops supports -origpagesizes" >&5
+$as_echo_n "checking whether pdftops supports -origpagesizes... " >&6; }
+ if `$CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes`; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES " >>confdefs.h
+
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pdftops supports -r" >&5
+$as_echo_n "checking whether pdftops supports -r... " >&6; }
+ if `$CUPS_PDFTOPS -h 2>&1 | grep -q -- '-r '`; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION " >>confdefs.h
+
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+
+fi
+if test "x$with_acroread_path" != "xsystem"; then :
+
+ CUPS_ACROREAD="$with_acroread_path"
+
+else
+
+ # Extract the first word of "acroread", so it can be a program name with args.
+set dummy acroread; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CUPS_ACROREAD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CUPS_ACROREAD in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPS_ACROREAD="$CUPS_ACROREAD" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CUPS_ACROREAD="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CUPS_ACROREAD" && ac_cv_path_CUPS_ACROREAD="as_fn_error $? "Required acroread binary is missing. Please install acroread package." "$LINENO" 5"
+ ;;
+esac
+fi
+CUPS_ACROREAD=$ac_cv_path_CUPS_ACROREAD
+if test -n "$CUPS_ACROREAD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_ACROREAD" >&5
+$as_echo "$CUPS_ACROREAD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+if test "x$CUPS_ACROREAD" != "x"; then :
+
+
+$as_echo "#define HAVE_ACROREAD /**/" >>confdefs.h
+
+ if test x"$with_pdftops" = xacroread; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_PDFTOPS_RENDERER ACROREAD
+_ACEOF
+
+fi
+
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_GHOSTSCRIPT "$CUPS_GHOSTSCRIPT"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_POPPLER_PDFTOPS "$CUPS_PDFTOPS"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_ACROREAD "$CUPS_ACROREAD"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_PDFTOPS_MAX_RESOLUTION $CUPS_PDFTOPS_MAXRES
+_ACEOF
+
+
+# =============
+# Check for php
+# =============
+# NOTE: This stuff is broken, requires internal cups headers.
+
+# Check whether --with-php was given.
+if test "${with_php+set}" = set; then :
+ withval=$with_php; with_php="$withval"
+else
+ with_php=no
+
+fi
+
+
+# Check whether --with-php-config was given.
+if test "${with_php_config+set}" = set; then :
+ withval=$with_php_config; with_php_config="$withval"
+else
+ with_php_config=system
+
+fi
+
+ if test "x$with_php" = "xyes"; then
+ WITH_PHP_TRUE=
+ WITH_PHP_FALSE='#'
+else
+ WITH_PHP_TRUE='#'
+ WITH_PHP_FALSE=
+fi
+
+if test x"$with_php" = "xyes"; then :
+
+ if test "x$with_php_config" != "xsystem"; then :
+
+ PHPCONFIG=$with_php_config
+
+else
+
+ # Extract the first word of "php-config", so it can be a program name with args.
+set dummy php-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PHPCONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PHPCONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PHPCONFIG="$PHPCONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PHPCONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PHPCONFIG=$ac_cv_path_PHPCONFIG
+if test -n "$PHPCONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHPCONFIG" >&5
+$as_echo "$PHPCONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -z "$PHPCONFIG"; then :
+
+ as_fn_error $? "Required php-config is missing. Please install PHP developer packages." "$LINENO" 5
+
+fi
+
+fi
+ PHPDIR="`$PHPCONFIG --extension-dir`"
+
+
+fi
+
+# =========
+# Test ARGS
+# =========
+
+# Check whether --with-test-font-path was given.
+if test "${with_test_font_path+set}" = set; then :
+ withval=$with_test_font_path; with_test_font_path="$withval"
+else
+ with_test_font_path="/usr/share/fonts/dejavu/DejaVuSans.ttf"
+
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define TESTFONT "$with_test_font_path"
+_ACEOF
+
+
+# ================
+# Check for cflags
+# ================
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+ enableval=$enable_werror; enable_werror="$enableval"
+else
+ enable_werror=no
+
+fi
+
+if test x"$enable_werror" = "xyes"; then :
+
+ CFLAGS="$CFLAGS -Werror"
+
+fi
+if test x"$GCC" = "xyes"; then :
+
+ # Be tough with warnings and produce less careless code
+ CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99"
+ CXXFLAGS="$CXXFLAGS -Wall -pedantic" # -Weffc++" # TODO: enable when it does not print 1MB of warnings
+
+fi
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
+
+# =====================
+# Prepare all .in files
+# =====================
+ac_config_files="$ac_config_files libcupsfilters.pc libfontembed.pc Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_IMAGEFILTERS_TRUE}" && test -z "${ENABLE_IMAGEFILTERS_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_IMAGEFILTERS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_PHP_TRUE}" && test -z "${WITH_PHP_FALSE}"; then
+ as_fn_error $? "conditional \"WITH_PHP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by cups-filters $as_me 1.0.25, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+cups-filters config.status 1.0.25
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_separator_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX \
+postlink_cmds_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "libcupsfilters.pc") CONFIG_FILES="$CONFIG_FILES libcupsfilters.pc" ;;
+ "libfontembed.pc") CONFIG_FILES="$CONFIG_FILES libfontembed.pc" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = "\a"
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# 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 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# 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
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# 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
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# 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
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# 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
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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
+
+# 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
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# 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=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_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
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # 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)
+
+ if test x"$xsi_shell" = xyes; then
+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\ # positional parameters, so assign one to ordinary parameter first.\
+\ func_stripname_result=${3}\
+\ func_stripname_result=${func_stripname_result#"${1}"}\
+\ func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\ func_split_long_opt_name=${1%%=*}\
+\ func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\ func_split_short_opt_arg=${1#??}\
+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\ case ${1} in\
+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\ *) func_lo2o_result=${1} ;;\
+\ esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+ func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+ func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+ func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+ eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\ func_quote_for_eval "${2}"\
+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+
+ cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# 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=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+# ==============================================
+# Display final informations about configuration
+# ==============================================
+{ $as_echo "$as_me:${as_lineno-$LINENO}:
+==============================================================================
+Environment settings:
+ CFLAGS: ${CFLAGS}
+ CXXFLAGS: ${CXXFLAGS}
+ LDFLAGS: ${LDFLAGS}
+Build configuration:
+ cups-config: ${with_cups_config}
+ font directory: ${sysconfdir}/${FONTDIR}
+ gs-path: ${with_gs_path}
+ imagefilters: ${enable_imagefilters}
+ jpeg: ${with_jpeg}
+ pdftops: ${with_pdftops}
+ pdftops-path: ${with_pdftops_path}
+ png: ${with_png}
+ php: ${with_php}
+ php-config: ${with_php_config}
+ test-font: ${with_test_font_path}
+ tiff: ${with_tiff}
+ werror: ${enable_werror}
+==============================================================================
+" >&5
+$as_echo "$as_me:
+==============================================================================
+Environment settings:
+ CFLAGS: ${CFLAGS}
+ CXXFLAGS: ${CXXFLAGS}
+ LDFLAGS: ${LDFLAGS}
+Build configuration:
+ cups-config: ${with_cups_config}
+ font directory: ${sysconfdir}/${FONTDIR}
+ gs-path: ${with_gs_path}
+ imagefilters: ${enable_imagefilters}
+ jpeg: ${with_jpeg}
+ pdftops: ${with_pdftops}
+ pdftops-path: ${with_pdftops_path}
+ png: ${with_png}
+ php: ${with_php}
+ php-config: ${with_php_config}
+ test-font: ${with_test_font_path}
+ tiff: ${with_tiff}
+ werror: ${enable_werror}
+==============================================================================
+" >&6;}
--- /dev/null
+# Process this file with autoconf to create configure.
+
+AC_PREREQ([2.65])
+
+# ====================
+# Version informations
+# ====================
+m4_define([cups_filters_version_major],[1])
+m4_define([cups_filters_version_minor],[0])
+m4_define([cups_filters_version_micro],[25])
+m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro])
+
+# =============
+# Automake init
+# =============
+AC_INIT([cups-filters],[cups_filters_version])
+AC_CONFIG_MACRO_DIR([m4])
+m4_include([m4/ac_define_dir.m4])
+m4_include([m4/ax_compare_version.m4])
+AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2])
+AM_SILENT_RULES([yes])
+AC_LANG([C++])
+AM_CONFIG_HEADER([config.h])
+# Extra defines for the config.h
+AH_BOTTOM([
+#ifdef HAVE_LONG_LONG
+# define CUPS_LLFMT "%lld"
+# define CUPS_LLCAST (long long)
+#else
+# define CUPS_LLFMT "%ld"
+# define CUPS_LLCAST (long)
+#endif /* HAVE_LONG_LONG */
+
+#ifdef HAVE_ARC4RANDOM
+# define CUPS_RAND() arc4random()
+# define CUPS_SRAND(v) arc4random_stir()
+#elif defined(HAVE_RANDOM)
+# define CUPS_RAND() random()
+# define CUPS_SRAND(v) srandom(v)
+#elif defined(HAVE_LRAND48)
+# define CUPS_RAND() lrand48()
+# define CUPS_SRAND(v) srand48(v)
+#else
+# define CUPS_RAND() rand()
+# define CUPS_SRAND(v) srand(v)
+#endif /* HAVE_ARC4RANDOM */
+])
+
+# ===========================
+# Find required base packages
+# ===========================
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_C_O
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG([0.20])
+
+# ========================================
+# Specify the fontdir patch if not default
+# ========================================
+AC_ARG_WITH([fontdir],
+ [AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory ( default: fonts/conf.d/).])],
+ [FONTDIR="$withval"],
+ [FONTDIR="fonts/conf.d"]
+)
+AC_SUBST(FONTDIR)
+
+# ================================
+# Find CUPS internals (no pc file)
+# ================================
+AC_ARG_WITH([cups-config],
+ [AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
+ [with_cups_config="$withval"],
+ [with_cups_config=system]
+)
+
+AS_IF([test "x$with_cups_config" != "xsystem"], [
+ CUPSCONFIG=$with_cups_config
+], [
+ AC_PATH_PROG(CUPSCONFIG, [cups-config])
+ AS_IF([test -z "$CUPSCONFIG"], [
+ AC_MSG_ERROR([Required cups-config is missing. Please install CUPS developer packages.])
+ ])
+])
+CUPS_CFLAGS=`$CUPSCONFIG --cflags`
+CUPS_LIBS=`$CUPSCONFIG --image --libs`
+CUPS_VERSION=`$CUPSCONFIG --version`
+AC_SUBST(CUPS_CFLAGS)
+AC_SUBST(CUPS_LIBS)
+
+CUPS_DATADIR="`$CUPSCONFIG --datadir`"
+AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir])
+AC_SUBST(CUPS_DATADIR)
+
+CUPS_FONTPATH="$CUPS_DATADIR/fonts"
+AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir])
+AC_SUBST(CUPS_FONTPATH)
+
+CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`"
+AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir])
+AC_SUBST(CUPS_SERVERBIN)
+
+AX_COMPARE_VERSION([$CUPS_VERSION],[gt],[1.4], [
+ AC_DEFINE(CUPS_1_4, 1, [CUPS Version is 1.4 or newer])
+])
+AC_DEFINE(PDFTOPDF, [], [Needed for pdftopdf filter compilation])
+AC_DEFINE_DIR(BANNERTOPDF_DATADIR, "{CUPS_DATADIR}/data", [Directory where bannertopdf finds its data files (PDF templates)])
+
+AC_SEARCH_LIBS([dlopen],
+ [dl],
+ DLOPEN_LIBS="-ldl",
+ AC_MSG_ERROR([unable to find the dlopen() function])
+)
+AC_SUBST(DLOPEN_LIBS)
+
+# ======================
+# Check system functions
+# ======================
+AC_CHECK_FUNCS(sigaction)
+AC_CHECK_FUNCS(waitpid wait3)
+AC_CHECK_FUNCS(strtoll)
+AC_CHECK_FUNCS(open_memstream)
+AC_CHECK_FUNCS(getline,[],AC_SUBST([GETLINE],['bannertopdf-getline.$(OBJEXT)']))
+AC_CHECK_FUNCS(strcasestr,[],AC_SUBST([STRCASESTR],['pdftops-strcasestr.$(OBJEXT)']))
+AC_SEARCH_LIBS(pow, m)
+
+# ========================
+# Check for system headers
+# ========================
+AC_CHECK_HEADERS([stdlib.h])
+AC_CHECK_HEADERS([sys/stat.h])
+AC_CHECK_HEADERS([sys/types.h])
+AC_CHECK_HEADERS([unistd.h])
+AC_CHECK_HEADERS([zlib.h])
+AC_CHECK_HEADERS([endian.h])
+AC_CHECK_HEADERS([dirent.h])
+AC_CHECK_HEADERS([sys/ioctl.h])
+
+# =============
+# Image options
+# =============
+AC_ARG_ENABLE([imagefilters],
+ [AS_HELP_STRING([--disable-imagefilters], [Build the image filters.])],
+ [enable_imagefilters="$enableval"],
+ [enable_imagefilters=yes]
+)
+AM_CONDITIONAL([ENABLE_IMAGEFILTERS], [test "x$enable_imagefilters" != "xno"])
+
+# Libraries
+AC_ARG_WITH([jpeg],
+ [AS_HELP_STRING([--without-jpeg], [Disable jpeg support.])],
+ [with_jpeg="$withval"],
+ [with_jpeg=yes]
+)
+AS_IF([test x"$with_jpeg" != "xno"], [
+ AC_DEFINE([HAVE_LIBJPEG], [], [Defines if we provide jpeg library.])
+ AC_CHECK_HEADERS([jpeglib.h])
+ AC_SEARCH_LIBS([jpeg_destroy_decompress],
+ [jpeg],
+ LIBJPEG_LIBS="-ljpeg",
+ AC_MSG_ERROR([jpeg libraries not found.])
+ )
+ AC_SUBST(LIBJPEG_LIBS)
+])
+
+AC_ARG_WITH([png],
+ [AS_HELP_STRING([--without-png], [Disable png support.])],
+ [with_png="$withval"],
+ [with_png=yes]
+)
+AS_IF([test x"$with_png" != "xno"], [
+ PKG_CHECK_MODULES([LIBPNG], [libpng])
+ AC_DEFINE([HAVE_LIBPNG], [], [Defines if we provide png library.])
+])
+
+AC_ARG_WITH([tiff],
+ [AS_HELP_STRING([--without-tiff], [Disable tiff support.])],
+ [with_tiff="$withval"],
+ [with_tiff=yes]
+)
+AS_IF([test x"$with_tiff" != "xno"], [
+ AC_DEFINE([HAVE_LIBTIFF], [], [Defines if we provide tiff library.])
+ AC_CHECK_HEADERS([tiff.h])
+ AC_SEARCH_LIBS([TIFFReadScanline],
+ [tiff],
+ LIBJPEG_LIBS="-ltiff",
+ AC_MSG_ERROR([tiff libraries not found.])
+ )
+ AC_SUBST(LIBTIFF_LIBS)
+])
+
+# ======================================
+# Check for various pdf required modules
+# ======================================
+PKG_CHECK_MODULES([LCMS], [lcms2], [lcms2=yes], [lcms2=no])
+AS_IF([test x"$lcms2" = "xno"], [
+ PKG_CHECK_MODULES([LCMS], [lcms])
+ AC_DEFINE([USE_LCMS1], [1], [Defines if use lcms1])
+])
+PKG_CHECK_MODULES([FREETYPE], [freetype2], [AC_DEFINE([HAVE_FREETYPE_H], [1], [Have FreeType2 include files])])
+PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.0.0])
+PKG_CHECK_MODULES([IJS], [ijs])
+PKG_CHECK_MODULES([POPPLER], [poppler >= 0.18])
+PKG_CHECK_MODULES([ZLIB], [zlib])
+AC_DEFINE([HAVE_LIBZ], [], [Define that we use zlib])
+PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 3.0.2])
+
+# ================
+# Poppler features
+# ================
+AC_CHECK_HEADER([poppler/cpp/poppler-version.h], [AC_DEFINE([HAVE_CPP_POPPLER_VERSION_H],,[Define if you have Poppler's "cpp/poppler-version.h" header file.])], [])
+
+# ===================================
+# Check for large files and long long
+# ===================================
+AC_SYS_LARGEFILE
+LARGEFILE=""
+AS_IF([test x"$enable_largefile" != "xno"], [
+ LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+ AS_IF([test x"$ac_cv_sys_large_files" = "x1"], [LARGEFILE="$LARGEFILE -D_LARGE_FILES"])
+ AS_IF([test x"$ac_cv_sys_file_offset_bits" = "x64"], [LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"])
+])
+AC_SUBST(LARGEFILE)
+
+AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
+AS_IF([test x"$long_long_found" = "xyes"], [
+ AC_DEFINE([HAVE_LONG_LONG], [], [Platform supports long long type])
+])
+
+# ================
+# Check for pdf2ps
+# ================
+AC_ARG_WITH([pdftops],
+ [AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,acroread).])],
+ [with_pdftops="$withval"],
+ [with_pdftops=gs]
+)
+AS_CASE([x$with_pdftops],
+ [xgs|xpdftops|xacroread], [],
+ [AC_MSG_ERROR([Unknown value of with-pdftops provided: $with_pdftops])]
+)
+AC_ARG_WITH([gs-path],
+ [AS_HELP_STRING([--with-gs-path=value], [Set path to ghostcript binary (default: system).])],
+ [with_gs_path="$withval"],
+ [with_gs_path=system]
+)
+AC_ARG_WITH([pdftops-path],
+ [AS_HELP_STRING([--with-pdftops-path=value], [Set path to pdftops/ghostscript binary (default: system).])],
+ [with_pdftops_path="$withval"],
+ [with_pdftops_path=system]
+)
+AC_ARG_WITH([acroread-path],
+ [AS_HELP_STRING([--with-acroread-path=value], [Set path to acroread binary (default: system).])],
+ [with_acroread_path="$withval"],
+ [with_acroread_path=system]
+)
+AC_ARG_WITH([pdftops-maxres],
+ [AS_HELP_STRING([--with-pdftops-maxres=value], [Set maximum image rendering resolution for pdftops filter (0, 75, 150, 300, 600, 1200, 2400, 4800, 90, 180, 360, 720, 1440, 2880, 5760, unlimited). Default: 1440])],
+ [with_pdftops_maxres="$withval"],
+ [with_pdftops_maxres=1440]
+)
+AS_CASE([x$with_pdftops_maxres],
+ [x0|x75|x150|x300|x600|x1200|x2400|x4800|x90|x180|x360|x720|x1440|x2880|x5760], [CUPS_PDFTOPS_MAXRES=$with_pdftops_maxres],
+ [xunlimited], [CUPS_PDFTOPS_MAXRES=0],
+ [AC_MSG_ERROR([Unknown value of with-pdftops-maxres provided: $with_pdftops])]
+)
+
+AS_IF([test "x$with_gs_path" != "xsystem"], [
+ CUPS_GHOSTSCRIPT="$with_gs_path"
+], [
+ AC_PATH_PROG(CUPS_GHOSTSCRIPT, [gs], [AC_MSG_ERROR([Required gs binary is missing. Please install ghostscript-gpl package.])])
+])
+AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [
+ AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide ghostscript binary])
+ AS_IF([test x"$with_pdftops" = xgs], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])])
+
+ AC_MSG_CHECKING(whether gs supports the ps2write device)
+ AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports ps2write])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+
+AS_IF([test "x$with_pdftops_path" != "xsystem"], [
+ CUPS_PDFTOPS="$with_pdftops"
+], [
+ AC_PATH_PROG(CUPS_PDFTOPS, [pdftops], [AC_MSG_ERROR([Required pdftops is missing. Please install CUPS developer packages.])])
+])
+AS_IF([test "x$CUPS_PDFTOPS" != "x"], [
+ AC_DEFINE([HAVE_POPPLER_PDFTOPS], [], [Define that we provide poppler pdftops.])
+ AS_IF([test x"$with_pdftops" = xpdftops], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOPS], [Define default renderer])])
+
+ AC_MSG_CHECKING([whether pdftops supports -origpagesizes])
+ AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes`], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES], [] , [pdftops supports -origpagesizes.])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ AC_MSG_CHECKING([whether pdftops supports -r])
+ AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- '-r '`], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION], [] , [pdftops supports -r argument.])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+AS_IF([test "x$with_acroread_path" != "xsystem"], [
+ CUPS_ACROREAD="$with_acroread_path"
+], [
+ AC_PATH_PROG(CUPS_ACROREAD, [acroread], [AC_MSG_ERROR([Required acroread binary is missing. Please install acroread package.])])
+])
+AS_IF([test "x$CUPS_ACROREAD" != "x"], [
+ AC_DEFINE([HAVE_ACROREAD], [], [Define that we provide acroread.])
+ AS_IF([test x"$with_pdftops" = xacroread], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [ACROREAD], [Define default renderer])])
+])
+
+AC_DEFINE_UNQUOTED([CUPS_GHOSTSCRIPT], "$CUPS_GHOSTSCRIPT", [gs binary to use])
+AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOPS], "$CUPS_PDFTOPS", [pdftops binary to use.])
+AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to use.])
+AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], [max resolution used for pdftops when converting images])
+
+# =============
+# Check for php
+# =============
+# NOTE: This stuff is broken, requires internal cups headers.
+AC_ARG_WITH([php],
+ [AS_HELP_STRING([--with-php], [Determine whether to build php cups extension.])],
+ [with_php="$withval"],
+ [with_php=no]
+)
+AC_ARG_WITH([php-config],
+ [AS_HELP_STRING([--with-php-config=path], [Specify path to php-config executable.])],
+ [with_php_config="$withval"],
+ [with_php_config=system]
+)
+AM_CONDITIONAL([WITH_PHP], [test "x$with_php" = "xyes"])
+AS_IF([test x"$with_php" = "xyes"], [
+ AS_IF([test "x$with_php_config" != "xsystem"], [
+ PHPCONFIG=$with_php_config
+ ], [
+ AC_PATH_PROG(PHPCONFIG, [php-config])
+ AS_IF([test -z "$PHPCONFIG"], [
+ AC_MSG_ERROR([Required php-config is missing. Please install PHP developer packages.])
+ ])
+ ])
+ PHPDIR="`$PHPCONFIG --extension-dir`"
+ AC_SUBST(PHPDIR)
+])
+
+# =========
+# Test ARGS
+# =========
+AC_ARG_WITH([test-font-path],
+ [AS_HELP_STRING([--with-test-font-path=value], [Set path to pdftops/ghostscript binary (default: /usr/share/fonts/dejavu/DejaVuSans.ttf).])],
+ [with_test_font_path="$withval"],
+ [with_test_font_path="/usr/share/fonts/dejavu/DejaVuSans.ttf"]
+)
+AC_DEFINE_UNQUOTED([TESTFONT], ["$with_test_font_path"], [Path to font used in tests])
+
+# ================
+# Check for cflags
+# ================
+AC_ARG_ENABLE([werror],
+ [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development.])],
+ [enable_werror="$enableval"],
+ [enable_werror=no]
+)
+AS_IF([test x"$enable_werror" = "xyes"], [
+ CFLAGS="$CFLAGS -Werror"
+])
+AS_IF([test x"$GCC" = "xyes"], [
+ # Be tough with warnings and produce less careless code
+ CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99"
+ CXXFLAGS="$CXXFLAGS -Wall -pedantic" # -Weffc++" # TODO: enable when it does not print 1MB of warnings
+])
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
+
+# =====================
+# Prepare all .in files
+# =====================
+AC_CONFIG_FILES([
+ libcupsfilters.pc
+ libfontembed.pc
+ Makefile
+])
+AC_OUTPUT
+
+# ==============================================
+# Display final informations about configuration
+# ==============================================
+AC_MSG_NOTICE([
+==============================================================================
+Environment settings:
+ CFLAGS: ${CFLAGS}
+ CXXFLAGS: ${CXXFLAGS}
+ LDFLAGS: ${LDFLAGS}
+Build configuration:
+ cups-config: ${with_cups_config}
+ font directory: ${sysconfdir}/${FONTDIR}
+ gs-path: ${with_gs_path}
+ imagefilters: ${enable_imagefilters}
+ jpeg: ${with_jpeg}
+ pdftops: ${with_pdftops}
+ pdftops-path: ${with_pdftops_path}
+ png: ${with_png}
+ php: ${with_php}
+ php-config: ${with_php_config}
+ test-font: ${with_test_font_path}
+ tiff: ${with_tiff}
+ werror: ${enable_werror}
+==============================================================================
+])
--- /dev/null
+<manifest>
+ <request>
+ <domain name="cups"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libcupsfilters.so.1" label="_" />
+ </assign>
+</manifest>
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * PPD attribute lookup routine for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsFindAttr() - Find a PPD attribute based on the colormodel,
+ * media, and resolution.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+
+
+/*
+ * 'cupsFindAttr()' - Find a PPD attribute based on the colormodel,
+ * media, and resolution.
+ */
+
+ppd_attr_t * /* O - Matching attribute or NULL */
+cupsFindAttr(ppd_file_t *ppd, /* I - PPD file */
+ const char *name, /* I - Attribute name */
+ const char *colormodel, /* I - Color model */
+ const char *media, /* I - Media type */
+ const char *resolution, /* I - Resolution */
+ char *spec, /* O - Final selection string */
+ int specsize) /* I - Size of string buffer */
+{
+ ppd_attr_t *attr; /* Attribute */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (!ppd || !name || !colormodel || !media || !resolution || !spec ||
+ specsize < PPD_MAX_NAME)
+ return (NULL);
+
+ /*
+ * Look for the attribute with the following keywords:
+ *
+ * ColorModel.MediaType.Resolution
+ * ColorModel.Resolution
+ * ColorModel
+ * MediaType.Resolution
+ * MediaType
+ * Resolution
+ * ""
+ */
+
+ snprintf(spec, specsize, "%s.%s.%s", colormodel, media, resolution);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ snprintf(spec, specsize, "%s.%s", colormodel, resolution);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ snprintf(spec, specsize, "%s", colormodel);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ snprintf(spec, specsize, "%s.%s", media, resolution);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ snprintf(spec, specsize, "%s", media);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ snprintf(spec, specsize, "%s", resolution);
+ fprintf(stderr, "DEBUG2: Looking for \"*%s %s\"...\n", name, spec);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ spec[0] = '\0';
+ fprintf(stderr, "DEBUG2: Looking for \"*%s\"...\n", name);
+ if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
+ return (attr);
+
+ fprintf(stderr, "DEBUG2: No instance of \"*%s\" found...\n", name);
+
+ return (NULL);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Byte checking routines for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsCheckBytes() - Check to see if all bytes are zero.
+ * cupsCheckValue() - Check to see if all bytes match the given value.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+
+
+/*
+ * 'cupsCheckBytes()' - Check to see if all bytes are zero.
+ */
+
+int /* O - 1 if they match */
+cupsCheckBytes(const unsigned char *bytes, /* I - Bytes to check */
+ int length) /* I - Number of bytes to check */
+{
+ while (length > 7)
+ {
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+ if (*bytes++)
+ return (0);
+
+ length -= 8;
+ }
+
+ while (length > 0)
+ if (*bytes++)
+ return (0);
+ else
+ length --;
+
+ return (1);
+}
+
+
+/*
+ * 'cupsCheckValue()' - Check to see if all bytes match the given value.
+ */
+
+int /* O - 1 if they match */
+cupsCheckValue(const unsigned char *bytes, /* I - Bytes to check */
+ int length, /* I - Number of bytes to check */
+ const unsigned char value) /* I - Value to check */
+{
+ while (length > 7)
+ {
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+ if (*bytes++ != value)
+ return (0);
+
+ length -= 8;
+ }
+
+ while (length > 0)
+ if (*bytes++ != value)
+ return (0);
+ else
+ length --;
+
+ return (1);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * CMYK color separation code for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsCMYKDelete() - Delete a color separation.
+ * cupsCMYKDoBlack() - Do a black separation...
+ * cupsCMYKDoCMYK() - Do a CMYK separation...
+ * cupsCMYKDoGray() - Do a grayscale separation...
+ * cupsCMYKDoRGB() - Do an sRGB separation...
+ * cupsCMYKLoad() - Load a CMYK color profile from PPD attributes.
+ * cupsCMYKNew() - Create a new CMYK color separation.
+ * cupsCMYKSetBlack() - Set the transition range for CMY to black.
+ * cupsCMYKSetCurve() - Set a color transform curve using points.
+ * cupsCMYKSetGamma() - Set a color transform curve using gamma and
+ * density.
+ * cupsCMYKSetInkLimit() - Set the limit on the amount of ink.
+ * cupsCMYKSetLtDk() - Set light/dark ink transforms.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+
+
+/*
+ * 'cupsCMYKDelete()' - Delete a color separation.
+ */
+
+void
+cupsCMYKDelete(cups_cmyk_t *cmyk) /* I - Color separation */
+{
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL)
+ return;
+
+ /*
+ * Free memory used...
+ */
+
+ free(cmyk->channels[0]);
+ free(cmyk);
+}
+
+
+/*
+ * 'cupsCMYKDoBlack()' - Do a black separation...
+ */
+
+void
+cupsCMYKDoBlack(const cups_cmyk_t *cmyk,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input grayscale pixels */
+ short *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int k; /* Current black value */
+ const short **channels; /* Copy of channel LUTs */
+ int ink, /* Amount of ink */
+ ink_limit; /* Ink limit from separation */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || input == NULL || output == NULL || num_pixels <= 0)
+ return;
+
+ /*
+ * Loop through it all...
+ */
+
+ channels = (const short **)cmyk->channels;
+ ink_limit = cmyk->ink_limit;
+
+ switch (cmyk->num_channels)
+ {
+ case 1 : /* Black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ *output++ = channels[0][k];
+
+ num_pixels --;
+ }
+ break;
+
+ case 2 : /* Black, light black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ }
+ }
+
+ output += 2;
+ num_pixels --;
+ }
+ break;
+
+ case 3 : /* CMY */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+ output[2] = channels[2][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ }
+ }
+
+ output += 3;
+ num_pixels --;
+ }
+ break;
+
+ case 4 : /* CMYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = channels[3][k];
+
+ num_pixels --;
+ }
+ break;
+
+ case 6 : /* CcMmYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = 0;
+ *output++ = channels[5][k];
+
+ num_pixels --;
+ }
+ break;
+
+ case 7 : /* CcMmYKk */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = *input++;
+ output[0] = 0;
+ output[1] = 0;
+ output[2] = 0;
+ output[3] = 0;
+ output[4] = 0;
+ output[5] = channels[5][k];
+ output[6] = channels[6][k];
+
+ if (ink_limit)
+ {
+ ink = output[5] + output[6];
+
+ if (ink > ink_limit)
+ {
+ output[5] = ink_limit * output[5] / ink;
+ output[6] = ink_limit * output[6] / ink;
+ }
+ }
+
+ output += 7;
+ num_pixels --;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'cupsCMYKDoCMYK()' - Do a CMYK separation...
+ */
+
+void
+cupsCMYKDoCMYK(const cups_cmyk_t *cmyk,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input grayscale pixels */
+ short *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int c, /* Current cyan value */
+ m, /* Current magenta value */
+ y, /* Current yellow value */
+ k; /* Current black value */
+ const short **channels; /* Copy of channel LUTs */
+ int ink, /* Amount of ink */
+ ink_limit; /* Ink limit from separation */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || input == NULL || output == NULL || num_pixels <= 0)
+ return;
+
+ /*
+ * Loop through it all...
+ */
+
+ channels = (const short **)cmyk->channels;
+ ink_limit = cmyk->ink_limit;
+
+ switch (cmyk->num_channels)
+ {
+ case 1 : /* Black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++ + (c * 31 + m * 61 + y * 8) / 100;
+
+ if (k < 255)
+ *output++ = channels[0][k];
+ else
+ *output++ = channels[0][255];
+
+ num_pixels --;
+ }
+ break;
+
+ case 2 : /* Black, light black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++ + (c * 31 + m * 61 + y * 8) / 100;
+
+ if (k < 255)
+ {
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+ }
+ else
+ {
+ output[0] = channels[0][255];
+ output[1] = channels[1][255];
+ }
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ }
+ }
+
+ output += 2;
+ num_pixels --;
+ }
+ break;
+
+ case 3 : /* CMY */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++;
+ c += k;
+ m += k;
+ y += k;
+
+ if (c < 255)
+ output[0] = channels[0][c];
+ else
+ output[0] = channels[0][255];
+
+ if (m < 255)
+ output[1] = channels[1][m];
+ else
+ output[1] = channels[1][255];
+
+ if (y < 255)
+ output[2] = channels[2][y];
+ else
+ output[2] = channels[2][255];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ }
+ }
+
+ output += 3;
+ num_pixels --;
+ }
+ break;
+
+ case 4 : /* CMYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][m];
+ output[2] = channels[2][y];
+ output[3] = channels[3][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ }
+ }
+
+ output += 4;
+ num_pixels --;
+ }
+ break;
+
+ case 6 : /* CcMmYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][c];
+ output[2] = channels[2][m];
+ output[3] = channels[3][m];
+ output[4] = channels[4][y];
+ output[5] = channels[5][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ }
+ }
+
+ output += 6;
+ num_pixels --;
+ }
+ break;
+
+ case 7 : /* CcMmYKk */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = *input++;
+ m = *input++;
+ y = *input++;
+ k = *input++;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][c];
+ output[2] = channels[2][m];
+ output[3] = channels[3][m];
+ output[4] = channels[4][y];
+ output[5] = channels[5][k];
+ output[6] = channels[6][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5] + output[6];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ output[6] = ink_limit * output[6] / ink;
+ }
+ }
+
+ output += 7;
+ num_pixels --;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'cupsCMYKDoGray()' - Do a grayscale separation...
+ */
+
+void
+cupsCMYKDoGray(const cups_cmyk_t *cmyk,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input grayscale pixels */
+ short *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int k, /* Current black value */
+ kc; /* Current black color value */
+ const short **channels; /* Copy of channel LUTs */
+ int ink, /* Amount of ink */
+ ink_limit; /* Ink limit from separation */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || input == NULL || output == NULL || num_pixels <= 0)
+ return;
+
+ /*
+ * Loop through it all...
+ */
+
+ channels = (const short **)cmyk->channels;
+ ink_limit = cmyk->ink_limit;
+
+ switch (cmyk->num_channels)
+ {
+ case 1 : /* Black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ *output++ = channels[0][k];
+
+ num_pixels --;
+ }
+ break;
+
+ case 2 : /* Black, light black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ }
+ }
+
+ output += 2;
+ num_pixels --;
+ }
+ break;
+
+ case 3 : /* CMY */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+ output[2] = channels[2][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ }
+ }
+
+ output += 3;
+ num_pixels --;
+ }
+ break;
+
+ case 4 : /* CMYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ kc = cmyk->color_lut[k];
+ k = cmyk->black_lut[k];
+ output[0] = channels[0][kc];
+ output[1] = channels[1][kc];
+ output[2] = channels[2][kc];
+ output[3] = channels[3][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ }
+ }
+
+ output += 4;
+ num_pixels --;
+ }
+ break;
+
+ case 6 : /* CcMmYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ kc = cmyk->color_lut[k];
+ k = cmyk->black_lut[k];
+ output[0] = channels[0][kc];
+ output[1] = channels[1][kc];
+ output[2] = channels[2][kc];
+ output[3] = channels[3][kc];
+ output[4] = channels[4][kc];
+ output[5] = channels[5][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ }
+ }
+
+ output += 6;
+ num_pixels --;
+ }
+ break;
+
+ case 7 : /* CcMmYKk */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ k = cups_scmy_lut[*input++];
+ kc = cmyk->color_lut[k];
+ k = cmyk->black_lut[k];
+ output[0] = channels[0][kc];
+ output[1] = channels[1][kc];
+ output[2] = channels[2][kc];
+ output[3] = channels[3][kc];
+ output[4] = channels[4][kc];
+ output[5] = channels[5][k];
+ output[6] = channels[6][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5] + output[6];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ output[6] = ink_limit * output[6] / ink;
+ }
+ }
+
+ output += 7;
+ num_pixels --;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'cupsCMYKDoRGB()' - Do an sRGB separation...
+ */
+
+void
+cupsCMYKDoRGB(const cups_cmyk_t *cmyk,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input grayscale pixels */
+ short *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int c, /* Current cyan value */
+ m, /* Current magenta value */
+ y, /* Current yellow value */
+ k, /* Current black value */
+ kc, /* Current black color value */
+ km; /* Maximum black value */
+ const short **channels; /* Copy of channel LUTs */
+ int ink, /* Amount of ink */
+ ink_limit; /* Ink limit from separation */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || input == NULL || output == NULL || num_pixels <= 0)
+ return;
+
+ /*
+ * Loop through it all...
+ */
+
+ channels = (const short **)cmyk->channels;
+ ink_limit = cmyk->ink_limit;
+
+ switch (cmyk->num_channels)
+ {
+ case 1 : /* Black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+ k = (c * 31 + m * 61 + y * 8) / 100;
+
+ *output++ = channels[0][k];
+
+ num_pixels --;
+ }
+ break;
+
+ case 2 : /* Black, light black */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+ k = (c * 31 + m * 61 + y * 8) / 100;
+
+ output[0] = channels[0][k];
+ output[1] = channels[1][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ }
+ }
+
+ output += 2;
+ num_pixels --;
+ }
+ break;
+
+ case 3 : /* CMY */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][m];
+ output[2] = channels[2][y];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ }
+ }
+
+ output += 3;
+ num_pixels --;
+ }
+ break;
+
+ case 4 : /* CMYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+ k = min(c, min(m, y));
+
+ if ((km = max(c, max(m, y))) > k)
+ k = k * k * k / (km * km);
+
+ kc = cmyk->color_lut[k] - k;
+ k = cmyk->black_lut[k];
+ c += kc;
+ m += kc;
+ y += kc;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][m];
+ output[2] = channels[2][y];
+ output[3] = channels[3][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ }
+ }
+
+ output += 4;
+ num_pixels --;
+ }
+ break;
+
+ case 6 : /* CcMmYK */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+ k = min(c, min(m, y));
+
+ if ((km = max(c, max(m, y))) > k)
+ k = k * k * k / (km * km);
+
+ kc = cmyk->color_lut[k] - k;
+ k = cmyk->black_lut[k];
+ c += kc;
+ m += kc;
+ y += kc;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][c];
+ output[2] = channels[2][m];
+ output[3] = channels[3][m];
+ output[4] = channels[4][y];
+ output[5] = channels[5][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ }
+ }
+
+ output += 6;
+ num_pixels --;
+ }
+ break;
+
+ case 7 : /* CcMmYKk */
+ while (num_pixels > 0)
+ {
+ /*
+ * Get the input black value and then set the corresponding color
+ * channel values...
+ */
+
+ c = cups_scmy_lut[*input++];
+ m = cups_scmy_lut[*input++];
+ y = cups_scmy_lut[*input++];
+ k = min(c, min(m, y));
+
+ if ((km = max(c, max(m, y))) > k)
+ k = k * k * k / (km * km);
+
+ kc = cmyk->color_lut[k] - k;
+ k = cmyk->black_lut[k];
+ c += kc;
+ m += kc;
+ y += kc;
+
+ output[0] = channels[0][c];
+ output[1] = channels[1][c];
+ output[2] = channels[2][m];
+ output[3] = channels[3][m];
+ output[4] = channels[4][y];
+ output[5] = channels[5][k];
+ output[6] = channels[6][k];
+
+ if (ink_limit)
+ {
+ ink = output[0] + output[1] + output[2] + output[3] +
+ output[4] + output[5] + output[6];
+
+ if (ink > ink_limit)
+ {
+ output[0] = ink_limit * output[0] / ink;
+ output[1] = ink_limit * output[1] / ink;
+ output[2] = ink_limit * output[2] / ink;
+ output[3] = ink_limit * output[3] / ink;
+ output[4] = ink_limit * output[4] / ink;
+ output[5] = ink_limit * output[5] / ink;
+ output[6] = ink_limit * output[6] / ink;
+ }
+ }
+
+ output += 7;
+ num_pixels --;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'cupsCMYKLoad()' - Load a CMYK color profile from PPD attributes.
+ */
+
+cups_cmyk_t * /* O - CMYK color separation */
+cupsCMYKLoad(ppd_file_t *ppd, /* I - PPD file */
+ const char *colormodel, /* I - ColorModel value */
+ const char *media, /* I - MediaType value */
+ const char *resolution) /* I - Resolution value */
+{
+ cups_cmyk_t *cmyk; /* CMYK color separation */
+ char spec[PPD_MAX_NAME]; /* Profile name */
+ ppd_attr_t *attr; /* Attribute from PPD file */
+ int num_channels; /* Number of color components */
+ float gamval, /* Gamma correction value */
+ density, /* Density value */
+ light, /* Light ink limit */
+ dark, /* Light ink cut-off */
+ lower, /* Start of black ink */
+ upper; /* End of color ink */
+ int num_xypoints; /* Number of X,Y points */
+ float xypoints[100 * 2], /* X,Y points */
+ *xyptr; /* Current X,Y point */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (ppd == NULL || colormodel == NULL || resolution == NULL || media == NULL)
+ return (NULL);
+
+ /*
+ * Find the following attributes:
+ *
+ * cupsAllGamma - Set default curve using gamma + density
+ * cupsAllXY - Set default curve using XY points
+ * cupsBlackGamma - Set black curve using gamma + density
+ * cupsBlackGeneration - Set black generation
+ * cupsBlackLightDark - Set black light/dark transition
+ * cupsBlackXY - Set black curve using XY points
+ * cupsCyanGamma - Set cyan curve using gamma + density
+ * cupsCyanLightDark - Set cyan light/dark transition
+ * cupsCyanXY - Set cyan curve using XY points
+ * cupsInkChannels - Set number of color channels
+ * cupsInkLimit - Set total ink limit
+ * cupsLightBlackGamma - Set light black curve using gamma + density
+ * cupsLightBlackXY - Set light black curve using XY points
+ * cupsLightCyanGamma - Set light cyan curve using gamma + density
+ * cupsLightCyanXY - Set light cyan curve using XY points
+ * cupsLightMagentaGamma - Set light magenta curve using gamma + density
+ * cupsLightMagentaXY - Set light magenta curve using XY points
+ * cupsMagentaGamma - Set magenta curve using gamma + density
+ * cupsMagentaLightDark - Set magenta light/dark transition
+ * cupsMagentaXY - Set magenta curve using XY points
+ * cupsYellowGamma - Set yellow curve using gamma + density
+ * cupsYellowXY - Set yellow curve using XY points
+ *
+ * The only required attribute is cupsInkChannels.
+ *
+ * The *XY attributes have precedence over the *Gamma attributes, and
+ * the *Light* attributes have precedence over the corresponding
+ * *LightDark* attributes.
+ */
+
+ /*
+ * Get the required cupsInkChannels attribute...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsInkChannels", colormodel, media,
+ resolution, spec, sizeof(spec))) == NULL)
+ return (NULL);
+
+ num_channels = atoi(attr->value);
+
+ if (num_channels < 1 || num_channels > 7 || num_channels == 5)
+ return (NULL);
+
+ if ((cmyk = cupsCMYKNew(num_channels)) == NULL)
+ return (NULL);
+
+ /*
+ * Get the optional cupsInkLimit attribute...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsInkLimit", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ cupsCMYKSetInkLimit(cmyk, atof(attr->value));
+
+ /*
+ * Get the optional cupsBlackGeneration attribute...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsBlackGeneration", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &lower, &upper) == 2)
+ cupsCMYKSetBlack(cmyk, lower, upper);
+ }
+
+ /*
+ * Get the optional cupsBlackXY or cupsBlackGamma attributes...
+ */
+
+ if (num_channels != 3)
+ {
+ if ((attr = cupsFindAttr(ppd, "cupsBlackXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsBlackXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 1 :
+ case 2 :
+ cupsCMYKSetCurve(cmyk, 0, num_xypoints, xypoints);
+ break;
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 3, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 5, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsBlackGamma", colormodel,
+ media, resolution, spec,
+ sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 1 :
+ case 2 :
+ cupsCMYKSetGamma(cmyk, 0, gamval, density);
+ break;
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 3, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 5, gamval, density);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsAllXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 1 :
+ case 2 :
+ cupsCMYKSetCurve(cmyk, 0, num_xypoints, xypoints);
+ break;
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 3, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 5, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllGamma", colormodel,
+ media, resolution, spec,
+ sizeof(spec))) != NULL &&
+ num_channels != 3)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 1 :
+ case 2 :
+ cupsCMYKSetGamma(cmyk, 0, gamval, density);
+ break;
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 3, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 5, gamval, density);
+ break;
+ }
+ }
+ }
+
+ if (num_channels > 2)
+ {
+ /*
+ * Get the optional cupsCyanXY or cupsCyanGamma attributes...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsCyanXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsCyanXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ cupsCMYKSetCurve(cmyk, 0, num_xypoints, xypoints);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsCyanGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ cupsCMYKSetGamma(cmyk, 0, gamval, density);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsAllXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ cupsCMYKSetCurve(cmyk, 0, num_xypoints, xypoints);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ cupsCMYKSetGamma(cmyk, 0, gamval, density);
+ }
+
+ /*
+ * Get the optional cupsMagentaXY or cupsMagentaGamma attributes...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsMagentaXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsMagentaXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 1, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 2, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsMagentaGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 1, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 2, gamval, density);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsAllXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 1, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 2, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 1, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 2, gamval, density);
+ break;
+ }
+ }
+
+ /*
+ * Get the optional cupsYellowXY or cupsYellowGamma attributes...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsYellowXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsYellowXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 2, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 4, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsYellowGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 2, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 4, gamval, density);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsAllXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetCurve(cmyk, 2, num_xypoints, xypoints);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 4, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsAllGamma", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 3 :
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 2, gamval, density);
+ break;
+ case 6 :
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 4, gamval, density);
+ break;
+ }
+ }
+ }
+
+ /*
+ * Get the optional cupsLightBlackXY, cupsLightBlackGamma, or
+ * cupsBlackLtDk attributes...
+ */
+
+ if (num_channels == 2 || num_channels == 7)
+ {
+ if ((attr = cupsFindAttr(ppd, "cupsLightBlackXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsLightBlackXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ switch (num_channels)
+ {
+ case 2 :
+ cupsCMYKSetCurve(cmyk, 1, num_xypoints, xypoints);
+ break;
+ case 7 :
+ cupsCMYKSetCurve(cmyk, 6, num_xypoints, xypoints);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsLightBlackGamma", colormodel,
+ media, resolution, spec,
+ sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ switch (num_channels)
+ {
+ case 2 :
+ cupsCMYKSetGamma(cmyk, 1, gamval, density);
+ break;
+ case 7 :
+ cupsCMYKSetGamma(cmyk, 6, gamval, density);
+ break;
+ }
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsBlackLtDk", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &light, &dark) == 2)
+ switch (num_channels)
+ {
+ case 2 :
+ cupsCMYKSetLtDk(cmyk, 0, light, dark);
+ break;
+ case 7 :
+ cupsCMYKSetLtDk(cmyk, 5, light, dark);
+ break;
+ }
+ else
+ fprintf(stderr, "ERROR: Bad cupsBlackLtDk value \"%s\"!\n",
+ attr->value);
+ }
+ else
+ fprintf(stderr, "WARNING: No light black attribute found for %s!\n",
+ spec);
+ }
+
+ if (num_channels >= 6)
+ {
+ /*
+ * Get the optional cupsLightCyanXY, cupsLightCyanGamma, or
+ * cupsCyanLtDk attributes...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsLightCyanXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsLightCyanXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ cupsCMYKSetCurve(cmyk, 1, num_xypoints, xypoints);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsLightCyanGamma", colormodel,
+ media, resolution, spec,
+ sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ cupsCMYKSetGamma(cmyk, 1, gamval, density);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsCyanLtDk", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &light, &dark) == 2)
+ cupsCMYKSetLtDk(cmyk, 0, light, dark);
+ else
+ fprintf(stderr, "ERROR: Bad cupsCyanLtDk value \"%s\"!\n",
+ attr->value);
+ }
+ else
+ fprintf(stderr, "WARNING: No light cyan attribute found for %s!\n",
+ spec);
+
+ /*
+ * Get the optional cupsLightMagentaXY, cupsLightMagentaGamma, or
+ * cupsMagentaLtDk attributes...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsLightMagentaXY", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ for (num_xypoints = 0, xyptr = xypoints;
+ attr != NULL && attr->value != NULL && num_xypoints < 100;
+ attr = ppdFindNextAttr(ppd, "cupsLightMagentaXY", spec))
+ if (sscanf(attr->value, "%f%f", xyptr, xyptr + 1) == 2)
+ {
+ num_xypoints ++;
+ xyptr += 2;
+ }
+
+ cupsCMYKSetCurve(cmyk, 3, num_xypoints, xypoints);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsLightMagentaGamma", colormodel,
+ media, resolution, spec,
+ sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &gamval, &density) == 2)
+ cupsCMYKSetGamma(cmyk, 3, gamval, density);
+ }
+ else if ((attr = cupsFindAttr(ppd, "cupsMagentaLtDk", colormodel, media,
+ resolution, spec, sizeof(spec))) != NULL)
+ {
+ if (sscanf(attr->value, "%f%f", &light, &dark) == 2)
+ cupsCMYKSetLtDk(cmyk, 2, light, dark);
+ else
+ fprintf(stderr, "ERROR: Bad cupsMagentaLtDk value \"%s\"!\n",
+ attr->value);
+ }
+ else
+ fprintf(stderr, "WARNING: No light magenta attribute found for %s!\n",
+ spec);
+ }
+
+ /*
+ * Return the new profile...
+ */
+
+ return (cmyk);
+}
+
+
+/*
+ * 'cupsCMYKNew()' - Create a new CMYK color separation.
+ */
+
+cups_cmyk_t * /* O - New CMYK separation or NULL */
+cupsCMYKNew(int num_channels) /* I - Number of color components */
+{
+ cups_cmyk_t *cmyk; /* New color separation */
+ int i; /* Looping var */
+
+
+ /*
+ * Range-check the input...
+ */
+
+ if (num_channels < 1)
+ return (NULL);
+
+ /*
+ * Allocate memory for the separation...
+ */
+
+ if ((cmyk = calloc(1, sizeof(cups_cmyk_t))) == NULL)
+ return (NULL);
+
+ /*
+ * Allocate memory for the LUTs...
+ */
+
+ cmyk->num_channels = num_channels;
+
+ if ((cmyk->channels[0] = calloc(num_channels * 256, sizeof(short))) == NULL)
+ {
+ free(cmyk);
+ return (NULL);
+ }
+
+ for (i = 1; i < num_channels; i ++)
+ cmyk->channels[i] = cmyk->channels[0] + i * 256;
+
+ /*
+ * Fill in the LUTs with unity transitions...
+ */
+
+ for (i = 0; i < 256; i ++)
+ cmyk->black_lut[i] = i;
+
+ switch (num_channels)
+ {
+ case 1 : /* K */
+ case 2 : /* Kk */
+ for (i = 0; i < 256; i ++)
+ {
+ cmyk->channels[0][i] = CUPS_MAX_LUT * i / 255;
+ }
+ break;
+ case 3 : /* CMY */
+ for (i = 0; i < 256; i ++)
+ {
+ cmyk->channels[0][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[1][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[2][i] = CUPS_MAX_LUT * i / 255;
+ }
+ break;
+ case 4 : /* CMYK */
+ for (i = 0; i < 256; i ++)
+ {
+ cmyk->channels[0][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[1][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[2][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[3][i] = CUPS_MAX_LUT * i / 255;
+ }
+ break;
+ case 6 : /* CcMmYK */
+ case 7 : /* CcMmYKk */
+ for (i = 0; i < 256; i ++)
+ {
+ cmyk->channels[0][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[2][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[4][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[5][i] = CUPS_MAX_LUT * i / 255;
+ }
+ break;
+ }
+
+ /*
+ * Return the separation...
+ */
+
+ return (cmyk);
+}
+
+
+/*
+ * 'cupsCMYKSetBlack()' - Set the transition range for CMY to black.
+ */
+
+void
+cupsCMYKSetBlack(cups_cmyk_t *cmyk, /* I - CMYK color separation */
+ float lower, /* I - No black ink */
+ float upper) /* I - Only black ink */
+{
+ int i, /* Looping var */
+ delta, /* Difference between lower and upper */
+ ilower, /* Lower level from 0 to 255 */
+ iupper; /* Upper level from 0 to 255 */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || lower < 0.0 || lower > 1.0 || upper < 0.0 || upper > 1.0 ||
+ lower > upper)
+ return;
+
+ /*
+ * Convert lower and upper to integers from 0 to 255...
+ */
+
+ ilower = (int)(255.0 * lower + 0.5);
+ iupper = (int)(255.0 * upper + 0.5);
+ delta = iupper - ilower;
+
+ /*
+ * Generate the CMY-only data...
+ */
+
+ for (i = 0; i < ilower; i ++)
+ {
+ cmyk->black_lut[i] = 0;
+ cmyk->color_lut[i] = i;
+ }
+
+ /*
+ * Then the transition data...
+ */
+
+ for (; i < iupper; i ++)
+ {
+ cmyk->black_lut[i] = iupper * (i - ilower) / delta;
+ cmyk->color_lut[i] = ilower - ilower * (i - ilower) / delta;
+ }
+
+ /*
+ * Then the K-only data...
+ */
+
+ for (; i < 256; i ++)
+ {
+ cmyk->black_lut[i] = i;
+ cmyk->color_lut[i] = 0;
+ }
+
+ fprintf(stderr, "DEBUG: cupsCMYKSetBlack(cmyk, lower=%.3f, upper=%.3f)\n", lower, upper);
+
+ for (i = 0; i < 256; i += 17)
+ fprintf(stderr, "DEBUG: %3d = %3dk + %3dc\n", i,
+ cmyk->black_lut[i], cmyk->color_lut[i]);
+}
+
+
+/*
+ * 'cupsCMYKSetCurve()' - Set a color transform curve using points.
+ */
+
+void
+cupsCMYKSetCurve(cups_cmyk_t *cmyk, /* I - CMYK color separation */
+ int channel, /* I - Color channel */
+ int num_xypoints,
+ /* I - Number of X,Y points */
+ const float *xypoints) /* I - X,Y points */
+{
+ int i; /* Looping var */
+ int xstart; /* Start position */
+ int xend; /* End position */
+ int xdelta; /* Difference in position */
+ int ystart; /* Start value */
+ int yend; /* End value */
+ int ydelta; /* Difference in value */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || channel < 0 || channel >= cmyk->num_channels ||
+ num_xypoints < 1 || xypoints == NULL)
+ return;
+
+ /*
+ * Initialize the lookup table for the specified channel...
+ */
+
+ for (xstart = xend = 0, ystart = yend = 0;
+ num_xypoints > 0;
+ num_xypoints --, xypoints += 2, xstart = xend, ystart = yend)
+ {
+ xend = (int)(255.0 * xypoints[1] + 0.5);
+ yend = (int)(CUPS_MAX_LUT * xypoints[0] + 0.5);
+ xdelta = xend - xstart;
+ ydelta = yend - ystart;
+
+ for (i = xstart; i < xend; i ++)
+ cmyk->channels[channel][i] = ystart + ydelta * (i - xstart) / xdelta;
+ }
+
+ /*
+ * Initialize any trailing values to the maximum of the last data point...
+ */
+
+ for (i = xend; i < 256; i ++)
+ cmyk->channels[channel][i] = yend;
+
+ fprintf(stderr, "DEBUG: cupsCMYKSetXY(cmyk, channel=%d, num_xypoints=%d, "
+ "xypoints=[%.3f %.3f %.3f %.3f ...])\n", channel,
+ num_xypoints, xypoints[0], xypoints[1], xypoints[2], xypoints[3]);
+
+ for (i = 0; i < 256; i += 17)
+ fprintf(stderr, "DEBUG: %3d = %4d\n", i,
+ cmyk->channels[channel + 0][i]);
+}
+
+
+/*
+ * 'cupsCMYKSetGamma()' - Set a color transform curve using gamma and density.
+ */
+
+void
+cupsCMYKSetGamma(cups_cmyk_t *cmyk, /* I - CMYK color separation */
+ int channel, /* I - Ink channel */
+ float gamval, /* I - Gamma correction */
+ float density) /* I - Maximum density */
+{
+ int i; /* Looping var */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || channel < 0 || channel >= cmyk->num_channels ||
+ gamval <= 0.0 || density <= 0.0 || density > 1.0)
+ return;
+
+ /*
+ * Initialize the lookup table for the specified channel...
+ */
+
+ for (i = 0; i < 256; i ++)
+ cmyk->channels[channel][i] = (int)(density * CUPS_MAX_LUT *
+ pow((float)i / 255.0, gamval) + 0.5);
+
+ fprintf(stderr, "DEBUG: cupsCMYKSetGamma(cmyk, channel=%d, gamval=%.3f, "
+ "density=%.3f)\n", channel, gamval, density);
+
+ for (i = 0; i < 256; i += 17)
+ fprintf(stderr, "DEBUG: %3d = %4d\n", i,
+ cmyk->channels[channel + 0][i]);
+}
+
+
+/*
+ * 'cupsCMYKSetInkLimit()' - Set the limit on the amount of ink.
+ */
+
+void
+cupsCMYKSetInkLimit(cups_cmyk_t *cmyk, /* I - CMYK color separation */
+ float limit) /* I - Limit of ink */
+{
+ if (!cmyk || limit < 0.0)
+ return;
+
+ cmyk->ink_limit = limit * CUPS_MAX_LUT;
+}
+
+
+/*
+ * 'cupsCMYKSetLtDk()' - Set light/dark ink transforms.
+ */
+
+void
+cupsCMYKSetLtDk(cups_cmyk_t *cmyk, /* I - CMYK color separation */
+ int channel, /* I - Dark ink channel (+1 for light) */
+ float light, /* I - Light ink only level */
+ float dark) /* I - Dark ink only level */
+{
+ int i, /* Looping var */
+ delta, /* Difference between lower and upper */
+ ilight, /* Light level from 0 to 255 */
+ idark; /* Dark level from 0 to 255 */
+ short lut[256]; /* Original LUT data */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (cmyk == NULL || light < 0.0 || light > 1.0 || dark < 0.0 || dark > 1.0 ||
+ light > dark || channel < 0 || channel > (cmyk->num_channels - 2))
+ return;
+
+ /*
+ * Convert lower and upper to integers from 0 to 255...
+ */
+
+ ilight = (int)(255.0 * light + 0.5);
+ idark = (int)(255.0 * dark + 0.5);
+ delta = idark - ilight;
+
+ /*
+ * Copy the dark ink LUT...
+ */
+
+ memcpy(lut, cmyk->channels[channel], sizeof(lut));
+
+ /*
+ * Generate the light-only data...
+ */
+
+ for (i = 0; i < ilight; i ++)
+ {
+ cmyk->channels[channel + 0][i] = 0;
+ cmyk->channels[channel + 1][i] = CUPS_MAX_LUT * i / ilight;
+ }
+
+ /*
+ * Then the transition data...
+ */
+
+ for (; i < idark; i ++)
+ {
+ cmyk->channels[channel + 0][i] = CUPS_MAX_LUT * idark * (i - ilight) /
+ delta / 255;
+ cmyk->channels[channel + 1][i] = CUPS_MAX_LUT - CUPS_MAX_LUT *
+ (i - ilight) / delta;
+ }
+
+ /*
+ * Then the K-only data...
+ */
+
+ for (; i < 256; i ++)
+ {
+ cmyk->channels[channel + 0][i] = CUPS_MAX_LUT * i / 255;
+ cmyk->channels[channel + 1][i] = 0;
+ }
+
+ fprintf(stderr, "DEBUG: cupsCMYKSetLtDk(cmyk, channel=%d, light=%.3f, "
+ "dark=%.3f)\n", channel, light, dark);
+
+ for (i = 0; i < 256; i += 17)
+ fprintf(stderr, "DEBUG: %3d = %4dlt + %4ddk\n", i,
+ cmyk->channels[channel + 0][i], cmyk->channels[channel + 1][i]);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Dithering routines for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsDitherDelete() - Free a dithering buffer.
+ * cupsDitherLine() - Dither a line of pixels...
+ * cupsDitherNew() - Create a dithering buffer.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <config.h>
+
+
+/*
+ * 'cupsDitherDelete()' - Free a dithering buffer.
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+
+void
+cupsDitherDelete(cups_dither_t *d) /* I - Dithering buffer */
+{
+ if (d != NULL)
+ free(d);
+}
+
+
+/*
+ * 'cupsDitherLine()' - Dither a line of pixels...
+ */
+
+void
+cupsDitherLine(cups_dither_t *d, /* I - Dither data */
+ const cups_lut_t *lut, /* I - Lookup table */
+ const short *data, /* I - Separation data */
+ int num_channels,
+ /* I - Number of components */
+ unsigned char *p) /* O - Pixels */
+{
+ register int x, /* Horizontal position in line... */
+ pixel, /* Current adjusted pixel... */
+ e, /* Current error */
+ e0,e1,e2; /* Error values */
+ register int errval0, /* First half of error value */
+ errval1, /* Second half of error value */
+ errbase, /* Base multiplier */
+ errbase0, /* Base multiplier for large values */
+ errbase1, /* Base multiplier for small values */
+ errrange; /* Range of random multiplier */
+ register int *p0, /* Error buffer pointers... */
+ *p1;
+ static char logtable[16384]; /* Error magnitude for randomness */
+ static char loginit = 0; /* Has the table been initialized? */
+
+
+ if (!loginit)
+ {
+ /*
+ * Initialize a logarithmic table for the magnitude of randomness
+ * that is introduced.
+ */
+
+ loginit = 1;
+
+ logtable[0] = 0;
+ for (x = 1; x < 2049; x ++)
+ logtable[x] = (int)(log(x / 16.0) / log(2.0) + 1.0);
+ for (; x < 16384; x ++)
+ logtable[x] = logtable[2049];
+ }
+
+ if (d->row == 0)
+ {
+ /*
+ * Dither from left to right:
+ *
+ * e0 == p0[0]
+ * e1 e2 == p1[-1] p1[0]
+ */
+
+ p0 = d->errors + 2;
+ p1 = d->errors + 2 + d->width + 4;
+ e0 = p0[0];
+ e1 = 0;
+ e2 = 0;
+
+ /*
+ * Error diffuse each output pixel...
+ */
+
+ for (x = d->width;
+ x > 0;
+ x --, p0 ++, p1 ++, p ++, data += num_channels)
+ {
+ /*
+ * Skip blank pixels...
+ */
+
+ if (*data == 0)
+ {
+ *p = 0;
+ e0 = p0[1];
+ p1[-1] = e1;
+ e1 = e2;
+ e2 = 0;
+ continue;
+ }
+
+ /*
+ * Compute the net pixel brightness and brightness error. Set a dot
+ * if necessary...
+ */
+
+ pixel = lut[*data].intensity + e0 / 128;
+
+ if (pixel > CUPS_MAX_LUT)
+ pixel = CUPS_MAX_LUT;
+ else if (pixel < 0)
+ pixel = 0;
+
+ *p = lut[pixel].pixel;
+ e = lut[pixel].error;
+
+ /*
+ * Set the randomness factor...
+ */
+
+ if (e > 0)
+ errrange = logtable[e];
+ else
+ errrange = logtable[-e];
+
+ errbase = 8 - errrange;
+ errrange = errrange * 2 + 1;
+
+ /*
+ * Randomize the error value.
+ */
+
+ if (errrange > 1)
+ {
+ errbase0 = errbase + (CUPS_RAND() % errrange);
+ errbase1 = errbase + (CUPS_RAND() % errrange);
+ }
+ else
+ errbase0 = errbase1 = errbase;
+
+ /*
+ * X 7/16 = X e0
+ * 3/16 5/16 1/16 = e1 e2
+ */
+
+ errval0 = errbase0 * e;
+ errval1 = (16 - errbase0) * e;
+ e0 = p0[1] + 7 * errval0;
+ e1 = e2 + 5 * errval1;
+
+ errval0 = errbase1 * e;
+ errval1 = (16 - errbase1) * e;
+ e2 = errval0;
+ p1[-1] = e1 + 3 * errval1;
+ }
+ }
+ else
+ {
+ /*
+ * Dither from right to left:
+ *
+ * e0 == p0[0]
+ * e2 e1 == p1[0] p1[1]
+ */
+
+ p0 = d->errors + d->width + 1 + d->width + 4;
+ p1 = d->errors + d->width + 1;
+ p += d->width - 1;
+ data += num_channels * (d->width - 1);
+ e0 = p0[0];
+ e1 = 0;
+ e2 = 0;
+
+ /*
+ * Error diffuse each output pixel...
+ */
+
+ for (x = d->width;
+ x > 0;
+ x --, p0 --, p1 --, p --, data -= num_channels)
+ {
+ /*
+ * Skip blank pixels...
+ */
+
+ if (*data == 0)
+ {
+ *p = 0;
+ e0 = p0[-1];
+ p1[1] = e1;
+ e1 = e2;
+ e2 = 0;
+ continue;
+ }
+
+ /*
+ * Compute the net pixel brightness and brightness error. Set a dot
+ * if necessary...
+ */
+
+ pixel = lut[*data].intensity + e0 / 128;
+
+ if (pixel > CUPS_MAX_LUT)
+ pixel = CUPS_MAX_LUT;
+ else if (pixel < 0)
+ pixel = 0;
+
+ *p = lut[pixel].pixel;
+ e = lut[pixel].error;
+
+ /*
+ * Set the randomness factor...
+ */
+
+ if (e > 0)
+ errrange = logtable[e];
+ else
+ errrange = logtable[-e];
+
+ errbase = 8 - errrange;
+ errrange = errrange * 2 + 1;
+
+ /*
+ * Randomize the error value.
+ */
+
+ if (errrange > 1)
+ {
+ errbase0 = errbase + (CUPS_RAND() % errrange);
+ errbase1 = errbase + (CUPS_RAND() % errrange);
+ }
+ else
+ errbase0 = errbase1 = errbase;
+
+ /*
+ * X 7/16 = X e0
+ * 3/16 5/16 1/16 = e1 e2
+ */
+
+ errval0 = errbase0 * e;
+ errval1 = (16 - errbase0) * e;
+ e0 = p0[-1] + 7 * errval0;
+ e1 = e2 + 5 * errval1;
+
+ errval0 = errbase1 * e;
+ errval1 = (16 - errbase1) * e;
+ e2 = errval0;
+ p1[1] = e1 + 3 * errval1;
+ }
+ }
+
+ /*
+ * Update to the next row...
+ */
+
+ d->row = 1 - d->row;
+}
+
+
+/*
+ * 'cupsDitherNew()' - Create an error-diffusion dithering buffer.
+ */
+
+cups_dither_t * /* O - New state array */
+cupsDitherNew(int width) /* I - Width of output in pixels */
+{
+ cups_dither_t *d; /* New dithering buffer */
+
+
+ if ((d = (cups_dither_t *)calloc(1, sizeof(cups_dither_t) +
+ 2 * (width + 4) *
+ sizeof(int))) == NULL)
+ return (NULL);
+
+ d->width = width;
+
+ return (d);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Printer driver utilities header file for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+#ifndef _CUPS_DRIVER_H_
+# define _CUPS_DRIVER_H_
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+/*
+ * Include necessary headers...
+ */
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <time.h>
+# include <math.h>
+
+# if defined(WIN32) || defined(__EMX__)
+# include <io.h>
+# else
+# include <unistd.h>
+# include <fcntl.h>
+# endif /* WIN32 || __EMX__ */
+
+# include <cups/cups.h>
+# include <cups/raster.h>
+
+
+/*
+ * Common macros...
+ */
+
+# ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+# define max(a,b) ((a) > (b) ? (a) : (b))
+# endif /* !min */
+
+
+/*
+ * Constants...
+ */
+
+#define CUPS_MAX_CHAN 15 /* Maximum number of color components */
+#define CUPS_MAX_LUT 4095 /* Maximum LUT value */
+#define CUPS_MAX_RGB 4 /* Maximum number of sRGB components */
+
+
+/*
+ * Types/structures for the various routines.
+ */
+
+typedef struct cups_lut_s /**** Lookup Table for Dithering ****/
+{
+ short intensity; /* Adjusted intensity */
+ short pixel; /* Output pixel value */
+ int error; /* Error from desired value */
+} cups_lut_t;
+
+typedef struct cups_dither_s /**** Dithering State ****/
+{
+ int width; /* Width of buffer */
+ int row; /* Current row */
+ int errors[96]; /* Error values */
+} cups_dither_t;
+
+typedef struct cups_sample_s /**** Color sample point ****/
+{
+ unsigned char rgb[3]; /* sRGB values */
+ unsigned char colors[CUPS_MAX_RGB]; /* Color values */
+} cups_sample_t;
+
+typedef struct cups_rgb_s /**** Color separation lookup table ****/
+{
+ int cube_size; /* Size of color cube (2-N) on a side */
+ int num_channels; /* Number of colors per sample */
+ unsigned char ****colors; /* 4-D array of sample values */
+ int cube_index[256]; /* Index into cube for a given sRGB value */
+ int cube_mult[256]; /* Multiplier value for a given sRGB value */
+ int cache_init; /* Are cached values initialized? */
+ unsigned char black[CUPS_MAX_RGB]; /* Cached black (sRGB = 0,0,0) */
+ unsigned char white[CUPS_MAX_RGB]; /* Cached white (sRGB = 255,255,255) */
+} cups_rgb_t;
+
+typedef struct cups_cmyk_s /**** Simple CMYK lookup table ****/
+{
+ unsigned char black_lut[256]; /* Black generation LUT */
+ unsigned char color_lut[256]; /* Color removal LUT */
+ int ink_limit; /* Ink limit */
+ int num_channels; /* Number of components */
+ short *channels[CUPS_MAX_CHAN];
+ /* Lookup tables */
+} cups_cmyk_t;
+
+
+/*
+ * Globals...
+ */
+
+extern const unsigned char
+ cups_srgb_lut[256];
+ /* sRGB gamma lookup table */
+extern const unsigned char
+ cups_scmy_lut[256];
+ /* sRGB gamma lookup table (inverted) */
+
+
+/*
+ * Prototypes...
+ */
+
+/*
+ * Attribute function...
+ */
+
+extern ppd_attr_t *cupsFindAttr(ppd_file_t *ppd, const char *name,
+ const char *colormodel,
+ const char *media,
+ const char *resolution,
+ char *spec, int specsize);
+
+/*
+ * Byte checking functions...
+ */
+
+extern int cupsCheckBytes(const unsigned char *, int);
+extern int cupsCheckValue(const unsigned char *, int,
+ const unsigned char);
+
+/*
+ * Dithering functions...
+ */
+
+extern void cupsDitherLine(cups_dither_t *d, const cups_lut_t *lut,
+ const short *data, int num_channels,
+ unsigned char *p);
+extern cups_dither_t *cupsDitherNew(int width);
+extern void cupsDitherDelete(cups_dither_t *);
+
+/*
+ * Lookup table functions for dithering...
+ */
+
+extern cups_lut_t *cupsLutNew(int num_vals, const float *vals);
+extern void cupsLutDelete(cups_lut_t *lut);
+extern cups_lut_t *cupsLutLoad(ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution,
+ const char *ink);
+
+
+/*
+ * Bit packing functions...
+ */
+
+extern void cupsPackHorizontal(const unsigned char *,
+ unsigned char *, int,
+ const unsigned char, const int);
+extern void cupsPackHorizontal2(const unsigned char *,
+ unsigned char *, int, const int);
+extern void cupsPackHorizontalBit(const unsigned char *,
+ unsigned char *, int,
+ const unsigned char,
+ const unsigned char);
+extern void cupsPackVertical(const unsigned char *, unsigned char *,
+ int, const unsigned char, const int);
+
+/*
+ * Color separation functions...
+ */
+
+extern void cupsRGBDelete(cups_rgb_t *rgb);
+extern void cupsRGBDoGray(cups_rgb_t *rgb,
+ const unsigned char *input,
+ unsigned char *output, int num_pixels);
+extern void cupsRGBDoRGB(cups_rgb_t *rgb,
+ const unsigned char *input,
+ unsigned char *output, int num_pixels);
+extern cups_rgb_t *cupsRGBLoad(ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution);
+extern cups_rgb_t *cupsRGBNew(int num_samples, cups_sample_t *samples,
+ int cube_size, int num_channels);
+
+/*
+ * CMYK separation functions...
+ */
+
+extern cups_cmyk_t *cupsCMYKNew(int num_channels);
+extern void cupsCMYKDelete(cups_cmyk_t *cmyk);
+extern void cupsCMYKDoBlack(const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output, int num_pixels);
+extern void cupsCMYKDoCMYK(const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output, int num_pixels);
+extern void cupsCMYKDoGray(const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output, int num_pixels);
+extern void cupsCMYKDoRGB(const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output, int num_pixels);
+extern cups_cmyk_t *cupsCMYKLoad(ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution);
+extern void cupsCMYKSetBlack(cups_cmyk_t *cmyk,
+ float lower, float upper);
+extern void cupsCMYKSetCurve(cups_cmyk_t *cmyk, int channel,
+ int num_xypoints,
+ const float *xypoints);
+extern void cupsCMYKSetGamma(cups_cmyk_t *cmyk, int channel,
+ float gamval, float density);
+extern void cupsCMYKSetInkLimit(cups_cmyk_t *cmyk, float limit);
+extern void cupsCMYKSetLtDk(cups_cmyk_t *cmyk, int channel,
+ float light, float dark);
+
+
+/*
+ * Convenience macro for writing print data...
+ */
+
+# define cupsWritePrintData(s,n) fwrite((s), 1, (n), stdout)
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+
+#endif /* !_CUPS_DRIVER_H_ */
+
+/*
+ * End of "$Id$".
+ */
+
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * BMP image routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadBMP() - Read a BMP image file.
+ * read_word() - Read a 16-bit unsigned integer.
+ * read_dword() - Read a 32-bit unsigned integer.
+ * read_long() - Read a 32-bit signed integer.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * Constants for the bitmap compression...
+ */
+
+# define BI_RGB 0 /* No compression - straight BGR data */
+# define BI_RLE8 1 /* 8-bit run-length compression */
+# define BI_RLE4 2 /* 4-bit run-length compression */
+# define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */
+
+
+/*
+ * Local functions...
+ */
+
+static unsigned short read_word(FILE *fp);
+static unsigned int read_dword(FILE *fp);
+static int read_long(FILE *fp);
+
+
+/*
+ * '_cupsImageReadBMP()' - Read a BMP image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadBMP(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int offset, /* Offset to bitmap data */
+ info_size, /* Size of info header */
+ planes, /* Number of planes (always 1) */
+ depth, /* Depth of image (bits) */
+ compression, /* Type of compression */
+ image_size, /* Size of image in bytes */
+ colors_used, /* Number of colors used */
+ colors_important, /* Number of important colors */
+ bpp, /* Bytes per pixel */
+ x, y, /* Looping vars */
+ color, /* Color of RLE pixel */
+ count, /* Number of times to repeat */
+ temp, /* Temporary color */
+ align; /* Alignment bytes */
+ cups_ib_t bit, /* Bit in image */
+ byte; /* Byte in image */
+ cups_ib_t *in, /* Input pixels */
+ *out, /* Output pixels */
+ *ptr; /* Pointer into pixels */
+ cups_ib_t colormap[256][4]; /* Colormap */
+
+
+ (void)secondary;
+
+ /*
+ * Get the header...
+ */
+
+ getc(fp); /* Skip "BM" sync chars */
+ getc(fp);
+ read_dword(fp); /* Skip size */
+ read_word(fp); /* Skip reserved stuff */
+ read_word(fp);
+ offset = read_dword(fp);
+
+ fprintf(stderr, "DEBUG: offset = %d\n", offset);
+
+ if (offset < 0)
+ {
+ fprintf(stderr, "DEBUG: Bad BMP offset %d\n", offset);
+ fclose(fp);
+ return (1);
+ }
+
+ /*
+ * Then the bitmap information...
+ */
+
+ info_size = read_dword(fp);
+ img->xsize = read_long(fp);
+ img->ysize = read_long(fp);
+ planes = read_word(fp);
+ depth = read_word(fp);
+ compression = read_dword(fp);
+ image_size = read_dword(fp);
+ img->xppi = read_long(fp) * 0.0254 + 0.5;
+ img->yppi = read_long(fp) * 0.0254 + 0.5;
+ colors_used = read_dword(fp);
+ colors_important = read_dword(fp);
+
+ if (img->xsize == 0 || img->xsize > CUPS_IMAGE_MAX_WIDTH ||
+ img->ysize == 0 || img->ysize > CUPS_IMAGE_MAX_HEIGHT ||
+ (depth != 1 && depth != 4 && depth != 8 && depth != 24))
+ {
+ fprintf(stderr, "DEBUG: Bad BMP dimensions %ux%ux%d\n",
+ img->xsize, img->ysize, depth);
+ fclose(fp);
+ return (1);
+ }
+
+ if (colors_used < 0 || colors_used > 256)
+ {
+ fprintf(stderr, "DEBUG: Bad BMP colormap size %d\n", colors_used);
+ fclose(fp);
+ return (1);
+ }
+
+ if (img->xppi == 0 || img->yppi == 0)
+ {
+ fprintf(stderr, "DEBUG: Bad BMP resolution %dx%d PPI.\n",
+ img->xppi, img->yppi);
+ img->xppi = img->yppi = 128;
+ }
+
+ /*
+ * Make sure the resolution info is valid...
+ */
+
+ fprintf(stderr, "info_size = %d, xsize = %d, ysize = %d, planes = %d, depth = %d\n",
+ info_size, img->xsize, img->ysize, planes, depth);
+ fprintf(stderr, "compression = %d, image_size = %d, xppi = %d, yppi = %d\n",
+ compression, image_size, img->xppi, img->yppi);
+ fprintf(stderr, "colors_used = %d, colors_important = %d\n", colors_used,
+ colors_important);
+
+ if (info_size > 40)
+ for (info_size -= 40; info_size > 0; info_size --)
+ getc(fp);
+
+ /*
+ * Get colormap...
+ */
+
+ if (colors_used == 0 && depth <= 8)
+ colors_used = 1 << depth;
+
+ if (colors_used > 0)
+ fread(colormap, colors_used, 4, fp);
+ else
+ memset(colormap, 0, sizeof(colormap));
+
+ /*
+ * Setup image and buffers...
+ */
+
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+
+ cupsImageSetMaxTiles(img, 0);
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((in = malloc(img->xsize * 3)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ free(in);
+ fclose(fp);
+ return (1);
+ }
+
+ /*
+ * Read the image data...
+ */
+
+ color = 0;
+ count = 0;
+ align = 0;
+
+ for (y = img->ysize - 1; y >= 0; y --)
+ {
+ ptr = in;
+
+ switch (depth)
+ {
+ case 1 : /* Bitmap */
+ for (x = img->xsize, bit = 128, byte = 0; x > 0; x --)
+ {
+ if (bit == 128)
+ byte = getc(fp);
+
+ if (byte & bit)
+ {
+ *ptr++ = colormap[1][2];
+ *ptr++ = colormap[1][1];
+ *ptr++ = colormap[1][0];
+ }
+ else
+ {
+ *ptr++ = colormap[0][2];
+ *ptr++ = colormap[0][1];
+ *ptr++ = colormap[0][0];
+ }
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ bit = 128;
+ }
+
+ /*
+ * Read remaining bytes to align to 32 bits...
+ */
+
+ for (temp = (img->xsize + 7) / 8; temp & 3; temp ++)
+ getc(fp);
+ break;
+
+ case 4 : /* 16-color */
+ for (x = img->xsize, bit = 0xf0, temp = 0; x > 0; x --)
+ {
+ /*
+ * Get a new count as needed...
+ */
+
+ if (compression != BI_RLE4 && count == 0)
+ {
+ count = 2;
+ color = -1;
+ }
+
+ if (count == 0)
+ {
+ while (align > 0)
+ {
+ align --;
+ getc(fp);
+ }
+
+ if ((count = getc(fp)) == 0)
+ {
+ if ((count = getc(fp)) == 0)
+ {
+ /*
+ * End of line...
+ */
+
+ x ++;
+ continue;
+ }
+ else if (count == 1)
+ {
+ /*
+ * End of image...
+ */
+
+ break;
+ }
+ else if (count == 2)
+ {
+ /*
+ * Delta...
+ */
+
+ count = getc(fp) * getc(fp) * img->xsize;
+ color = 0;
+ }
+ else
+ {
+ /*
+ * Absolute...
+ */
+
+ color = -1;
+ align = ((4 - (count & 3)) / 2) & 1;
+ }
+ }
+ else
+ color = getc(fp);
+ }
+
+ /*
+ * Get a new color as needed...
+ */
+
+ count --;
+
+ if (bit == 0xf0)
+ {
+ if (color < 0)
+ temp = getc(fp);
+ else
+ temp = color;
+
+ /*
+ * Copy the color value...
+ */
+
+ *ptr++ = colormap[temp >> 4][2];
+ *ptr++ = colormap[temp >> 4][1];
+ *ptr++ = colormap[temp >> 4][0];
+ bit = 0x0f;
+ }
+ else
+ {
+ /*
+ * Copy the color value...
+ */
+
+ *ptr++ = colormap[temp & 15][2];
+ *ptr++ = colormap[temp & 15][1];
+ *ptr++ = colormap[temp & 15][0];
+ bit = 0xf0;
+ }
+ }
+ break;
+
+ case 8 : /* 256-color */
+ for (x = img->xsize; x > 0; x --)
+ {
+ /*
+ * Get a new count as needed...
+ */
+
+ if (compression != BI_RLE8)
+ {
+ count = 1;
+ color = -1;
+ }
+
+ if (count == 0)
+ {
+ while (align > 0)
+ {
+ align --;
+ getc(fp);
+ }
+
+ if ((count = getc(fp)) == 0)
+ {
+ if ((count = getc(fp)) == 0)
+ {
+ /*
+ * End of line...
+ */
+
+ x ++;
+ continue;
+ }
+ else if (count == 1)
+ {
+ /*
+ * End of image...
+ */
+
+ break;
+ }
+ else if (count == 2)
+ {
+ /*
+ * Delta...
+ */
+
+ count = getc(fp) * getc(fp) * img->xsize;
+ color = 0;
+ }
+ else
+ {
+ /*
+ * Absolute...
+ */
+
+ color = -1;
+ align = (2 - (count & 1)) & 1;
+ }
+ }
+ else
+ color = getc(fp);
+ }
+
+ /*
+ * Get a new color as needed...
+ */
+
+ if (color < 0)
+ temp = getc(fp);
+ else
+ temp = color;
+
+ count --;
+
+ /*
+ * Copy the color value...
+ */
+
+ *ptr++ = colormap[temp][2];
+ *ptr++ = colormap[temp][1];
+ *ptr++ = colormap[temp][0];
+ }
+ break;
+
+ case 24 : /* 24-bit RGB */
+ for (x = img->xsize; x > 0; x --, ptr += 3)
+ {
+ ptr[2] = getc(fp);
+ ptr[1] = getc(fp);
+ ptr[0] = getc(fp);
+ }
+
+ /*
+ * Read remaining bytes to align to 32 bits...
+ */
+
+ for (temp = img->xsize * 3; temp & 3; temp ++)
+ getc(fp);
+ break;
+ }
+
+ if (saturation != 100 || hue != 0)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+
+ fclose(fp);
+ free(in);
+ free(out);
+
+ return (0);
+}
+
+
+/*
+ * 'read_word()' - Read a 16-bit unsigned integer.
+ */
+
+static unsigned short /* O - 16-bit unsigned integer */
+read_word(FILE *fp) /* I - File to read from */
+{
+ unsigned char b0, b1; /* Bytes from file */
+
+ b0 = getc(fp);
+ b1 = getc(fp);
+
+ return ((b1 << 8) | b0);
+}
+
+
+/*
+ * 'read_dword()' - Read a 32-bit unsigned integer.
+ */
+
+static unsigned int /* O - 32-bit unsigned integer */
+read_dword(FILE *fp) /* I - File to read from */
+{
+ unsigned char b0, b1, b2, b3; /* Bytes from file */
+
+ b0 = getc(fp);
+ b1 = getc(fp);
+ b2 = getc(fp);
+ b3 = getc(fp);
+
+ return ((((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
+}
+
+
+/*
+ * 'read_long()' - Read a 32-bit signed integer.
+ */
+
+static int /* O - 32-bit signed integer */
+read_long(FILE *fp) /* I - File to read from */
+{
+ unsigned char b0, b1, b2, b3; /* Bytes from file */
+
+ b0 = getc(fp);
+ b1 = getc(fp);
+ b2 = getc(fp);
+ b3 = getc(fp);
+
+ return ((int)(((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Colorspace conversions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * The color saturation/hue matrix stuff is provided thanks to Mr. Paul
+ * Haeberli at "http://www.sgi.com/grafica/matrix/index.html".
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * cupsImageCMYKToBlack() - Convert CMYK data to black.
+ * cupsImageCMYKToCMY() - Convert CMYK colors to CMY.
+ * cupsImageCMYKToCMYK() - Convert CMYK colors to CMYK.
+ * cupsImageCMYKToRGB() - Convert CMYK colors to device-dependent
+ * RGB.
+ * cupsImageCMYKToWhite() - Convert CMYK colors to luminance.
+ * cupsImageLut() - Adjust all pixel values with the given
+ * LUT.
+ * cupsImageRGBAdjust() - Adjust the hue and saturation of the
+ * given RGB colors.
+ * cupsImageRGBToBlack() - Convert RGB data to black.
+ * cupsImageRGBToCMY() - Convert RGB colors to CMY.
+ * cupsImageRGBToCMYK() - Convert RGB colors to CMYK.
+ * cupsImageRGBToRGB() - Convert RGB colors to device-dependent
+ * RGB.
+ * cupsImageRGBToWhite() - Convert RGB colors to luminance.
+ * cupsImageSetProfile() - Set the device color profile.
+ * cupsImageSetRasterColorSpace() - Set the destination colorspace.
+ * cupsImageWhiteToBlack() - Convert luminance colors to black.
+ * cupsImageWhiteToCMY() - Convert luminance colors to CMY.
+ * cupsImageWhiteToCMYK() - Convert luminance colors to CMYK.
+ * cupsImageWhiteToRGB() - Convert luminance data to RGB.
+ * cupsImageWhiteToWhite() - Convert luminance colors to device-
+ * dependent luminance.
+ * cielab() - Map CIE Lab transformation...
+ * huerotate() - Rotate the hue, maintaining luminance.
+ * ident() - Make an identity matrix.
+ * mult() - Multiply two matrices.
+ * rgb_to_lab() - Convert an RGB color to CIE Lab.
+ * rgb_to_xyz() - Convert an RGB color to CIE XYZ.
+ * saturate() - Make a saturation matrix.
+ * xform() - Transform a 3D point using a matrix...
+ * xrotate() - Rotate about the x (red) axis...
+ * yrotate() - Rotate about the y (green) axis...
+ * zrotate() - Rotate about the z (blue) axis...
+ * zshear() - Shear z using x and y...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * Define some math constants that are required...
+ */
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif /* !M_PI */
+
+#ifndef M_SQRT2
+# define M_SQRT2 1.41421356237309504880
+#endif /* !M_SQRT2 */
+
+#ifndef M_SQRT1_2
+# define M_SQRT1_2 0.70710678118654752440
+#endif /* !M_SQRT1_2 */
+
+/*
+ * CIE XYZ whitepoint...
+ */
+
+#define D65_X (0.412453 + 0.357580 + 0.180423)
+#define D65_Y (0.212671 + 0.715160 + 0.072169)
+#define D65_Z (0.019334 + 0.119193 + 0.950227)
+
+
+/*
+ * Lookup table structure...
+ */
+
+typedef int cups_clut_t[3][256];
+
+
+/*
+ * Local globals...
+ */
+
+static int cupsImageHaveProfile = 0;
+ /* Do we have a color profile? */
+static int *cupsImageDensity;
+ /* Ink/marker density LUT */
+static cups_clut_t *cupsImageMatrix;
+ /* Color transform matrix LUT */
+static cups_cspace_t cupsImageColorSpace = CUPS_CSPACE_RGB;
+ /* Destination colorspace */
+
+
+/*
+ * Local functions...
+ */
+
+static float cielab(float x, float xn);
+static void huerotate(float [3][3], float);
+static void ident(float [3][3]);
+static void mult(float [3][3], float [3][3], float [3][3]);
+static void rgb_to_lab(cups_ib_t *val);
+static void rgb_to_xyz(cups_ib_t *val);
+static void saturate(float [3][3], float);
+static void xform(float [3][3], float, float, float, float *, float *, float *);
+static void xrotate(float [3][3], float, float);
+static void yrotate(float [3][3], float, float);
+static void zrotate(float [3][3], float, float);
+static void zshear(float [3][3], float, float);
+
+
+/*
+ * 'cupsImageCMYKToBlack()' - Convert CMYK data to black.
+ */
+
+void
+cupsImageCMYKToBlack(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int k; /* Black value */
+
+
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ k = (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100 + in[3];
+
+ if (k < 255)
+ *out++ = cupsImageDensity[k];
+ else
+ *out++ = cupsImageDensity[255];
+
+ in += 4;
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ k = (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100 + in[3];
+
+ if (k < 255)
+ *out++ = k;
+ else
+ *out++ = 255;
+
+ in += 4;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageCMYKToCMY()' - Convert CMYK colors to CMY.
+ */
+
+void
+cupsImageCMYKToCMY(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k; /* CMYK values */
+ int cc, cm, cy; /* Calibrated CMY values */
+
+
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ c = *in++;
+ m = *in++;
+ y = *in++;
+ k = *in++;
+
+ cc = cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y] + k;
+ cm = cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y] + k;
+ cy = cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y] + k;
+
+ if (cc < 0)
+ *out++ = 0;
+ else if (cc > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cc];
+
+ if (cm < 0)
+ *out++ = 0;
+ else if (cm > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cm];
+
+ if (cy < 0)
+ *out++ = 0;
+ else if (cy > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cy];
+
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ c = *in++;
+ m = *in++;
+ y = *in++;
+ k = *in++;
+
+ c += k;
+ m += k;
+ y += k;
+
+ if (c < 255)
+ *out++ = c;
+ else
+ *out++ = 255;
+
+ if (m < 255)
+ *out++ = y;
+ else
+ *out++ = 255;
+
+ if (y < 255)
+ *out++ = y;
+ else
+ *out++ = 255;
+
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageCMYKToCMYK()' - Convert CMYK colors to CMYK.
+ */
+
+void
+cupsImageCMYKToCMYK(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k; /* CMYK values */
+ int cc, cm, cy; /* Calibrated CMY values */
+
+
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ c = *in++;
+ m = *in++;
+ y = *in++;
+ k = *in++;
+
+ cc = (cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y]);
+ cm = (cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y]);
+ cy = (cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y]);
+
+ if (cc < 0)
+ *out++ = 0;
+ else if (cc > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cc];
+
+ if (cm < 0)
+ *out++ = 0;
+ else if (cm > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cm];
+
+ if (cy < 0)
+ *out++ = 0;
+ else if (cy > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cy];
+
+ *out++ = cupsImageDensity[k];
+
+ count --;
+ }
+ else if (in != out)
+ {
+ while (count > 0)
+ {
+ *out++ = *in++;
+ *out++ = *in++;
+ *out++ = *in++;
+ *out++ = *in++;
+
+ count --;
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageCMYKToRGB()' - Convert CMYK colors to device-dependent RGB.
+ */
+
+void
+cupsImageCMYKToRGB(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k; /* CMYK values */
+ int cr, cg, cb; /* Calibrated RGB values */
+
+
+ if (cupsImageHaveProfile)
+ {
+ while (count > 0)
+ {
+ c = *in++;
+ m = *in++;
+ y = *in++;
+ k = *in++;
+
+ cr = cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y] + k;
+ cg = cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y] + k;
+ cb = cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y] + k;
+
+ if (cr < 0)
+ *out++ = 255;
+ else if (cr > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cr];
+
+ if (cg < 0)
+ *out++ = 255;
+ else if (cg > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cg];
+
+ if (cb < 0)
+ *out++ = 255;
+ else if (cb > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cb];
+
+ count --;
+ }
+ }
+ else
+ {
+ while (count > 0)
+ {
+ c = 255 - *in++;
+ m = 255 - *in++;
+ y = 255 - *in++;
+ k = *in++;
+
+ c -= k;
+ m -= k;
+ y -= k;
+
+ if (c > 0)
+ *out++ = c;
+ else
+ *out++ = 0;
+
+ if (m > 0)
+ *out++ = m;
+ else
+ *out++ = 0;
+
+ if (y > 0)
+ *out++ = y;
+ else
+ *out++ = 0;
+
+ if (cupsImageColorSpace == CUPS_CSPACE_CIELab ||
+ cupsImageColorSpace >= CUPS_CSPACE_ICC1)
+ rgb_to_lab(out - 3);
+ else if (cupsImageColorSpace == CUPS_CSPACE_CIEXYZ)
+ rgb_to_xyz(out - 3);
+
+ count --;
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageCMYKToWhite()' - Convert CMYK colors to luminance.
+ */
+
+void
+cupsImageCMYKToWhite(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int w; /* White value */
+
+
+ if (cupsImageHaveProfile)
+ {
+ while (count > 0)
+ {
+ w = 255 - (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100 - in[3];
+
+ if (w > 0)
+ *out++ = cupsImageDensity[w];
+ else
+ *out++ = cupsImageDensity[0];
+
+ in += 4;
+ count --;
+ }
+ }
+ else
+ {
+ while (count > 0)
+ {
+ w = 255 - (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100 - in[3];
+
+ if (w > 0)
+ *out++ = w;
+ else
+ *out++ = 0;
+
+ in += 4;
+ count --;
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageLut()' - Adjust all pixel values with the given LUT.
+ */
+
+void
+cupsImageLut(cups_ib_t *pixels, /* IO - Input/output pixels */
+ int count, /* I - Number of pixels/bytes to adjust */
+ const cups_ib_t *lut) /* I - Lookup table */
+{
+ while (count > 0)
+ {
+ *pixels = lut[*pixels];
+ pixels ++;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageRGBAdjust()' - Adjust the hue and saturation of the given RGB colors.
+ */
+
+void
+cupsImageRGBAdjust(cups_ib_t *pixels, /* IO - Input/output pixels */
+ int count, /* I - Number of pixels to adjust */
+ int saturation,/* I - Color saturation (%) */
+ int hue) /* I - Color hue (degrees) */
+{
+ int i, j, k; /* Looping vars */
+ float mat[3][3]; /* Color adjustment matrix */
+ static int last_sat = 100, /* Last saturation used */
+ last_hue = 0; /* Last hue used */
+ static cups_clut_t *lut = NULL; /* Lookup table for matrix */
+
+
+ if (saturation != last_sat || hue != last_hue || !lut)
+ {
+ /*
+ * Build the color adjustment matrix...
+ */
+
+ ident(mat);
+ saturate(mat, saturation * 0.01);
+ huerotate(mat, (float)hue);
+
+ /*
+ * Allocate memory for the lookup table...
+ */
+
+ if (lut == NULL)
+ lut = calloc(3, sizeof(cups_clut_t));
+
+ if (lut == NULL)
+ return;
+
+ /*
+ * Convert the matrix into a 3x3 array of lookup tables...
+ */
+
+ for (i = 0; i < 3; i ++)
+ for (j = 0; j < 3; j ++)
+ for (k = 0; k < 256; k ++)
+ lut[i][j][k] = mat[i][j] * k + 0.5;
+
+ /*
+ * Save the saturation and hue to compare later...
+ */
+
+ last_sat = saturation;
+ last_hue = hue;
+ }
+
+ /*
+ * Adjust each pixel in the given buffer.
+ */
+
+ while (count > 0)
+ {
+ i = lut[0][0][pixels[0]] +
+ lut[1][0][pixels[1]] +
+ lut[2][0][pixels[2]];
+ if (i < 0)
+ pixels[0] = 0;
+ else if (i > 255)
+ pixels[0] = 255;
+ else
+ pixels[0] = i;
+
+ i = lut[0][1][pixels[0]] +
+ lut[1][1][pixels[1]] +
+ lut[2][1][pixels[2]];
+ if (i < 0)
+ pixels[1] = 0;
+ else if (i > 255)
+ pixels[1] = 255;
+ else
+ pixels[1] = i;
+
+ i = lut[0][2][pixels[0]] +
+ lut[1][2][pixels[1]] +
+ lut[2][2][pixels[2]];
+ if (i < 0)
+ pixels[2] = 0;
+ else if (i > 255)
+ pixels[2] = 255;
+ else
+ pixels[2] = i;
+
+ count --;
+ pixels += 3;
+ }
+}
+
+
+/*
+ * 'cupsImageRGBToBlack()' - Convert RGB data to black.
+ */
+
+void
+cupsImageRGBToBlack(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ *out++ = cupsImageDensity[255 - (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100];
+ in += 3;
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ *out++ = 255 - (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100;
+ in += 3;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageRGBToCMY()' - Convert RGB colors to CMY.
+ */
+
+void
+cupsImageRGBToCMY(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k; /* CMYK values */
+ int cc, cm, cy; /* Calibrated CMY values */
+
+
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ c = 255 - *in++;
+ m = 255 - *in++;
+ y = 255 - *in++;
+ k = min(c, min(m, y));
+ c -= k;
+ m -= k;
+ y -= k;
+
+ cc = cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y] + k;
+ cm = cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y] + k;
+ cy = cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y] + k;
+
+ if (cc < 0)
+ *out++ = 0;
+ else if (cc > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cc];
+
+ if (cm < 0)
+ *out++ = 0;
+ else if (cm > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cm];
+
+ if (cy < 0)
+ *out++ = 0;
+ else if (cy > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cy];
+
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ c = 255 - in[0];
+ m = 255 - in[1];
+ y = 255 - in[2];
+ k = min(c, min(m, y));
+
+ *out++ = (255 - in[1] / 4) * (c - k) / 255 + k;
+ *out++ = (255 - in[2] / 4) * (m - k) / 255 + k;
+ *out++ = (255 - in[0] / 4) * (y - k) / 255 + k;
+ in += 3;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageRGBToCMYK()' - Convert RGB colors to CMYK.
+ */
+
+void
+cupsImageRGBToCMYK(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k, /* CMYK values */
+ km; /* Maximum K value */
+ int cc, cm, cy; /* Calibrated CMY values */
+
+
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ c = 255 - *in++;
+ m = 255 - *in++;
+ y = 255 - *in++;
+ k = min(c, min(m, y));
+
+ if ((km = max(c, max(m, y))) > k)
+ k = k * k * k / (km * km);
+
+ c -= k;
+ m -= k;
+ y -= k;
+
+ cc = (cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y]);
+ cm = (cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y]);
+ cy = (cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y]);
+
+ if (cc < 0)
+ *out++ = 0;
+ else if (cc > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cc];
+
+ if (cm < 0)
+ *out++ = 0;
+ else if (cm > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cm];
+
+ if (cy < 0)
+ *out++ = 0;
+ else if (cy > 255)
+ *out++ = cupsImageDensity[255];
+ else
+ *out++ = cupsImageDensity[cy];
+
+ *out++ = cupsImageDensity[k];
+
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ c = 255 - *in++;
+ m = 255 - *in++;
+ y = 255 - *in++;
+ k = min(c, min(m, y));
+
+ if ((km = max(c, max(m, y))) > k)
+ k = k * k * k / (km * km);
+
+ c -= k;
+ m -= k;
+ y -= k;
+
+ *out++ = c;
+ *out++ = m;
+ *out++ = y;
+ *out++ = k;
+
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageRGBToRGB()' - Convert RGB colors to device-dependent RGB.
+ */
+
+void
+cupsImageRGBToRGB(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ int c, m, y, k; /* CMYK values */
+ int cr, cg, cb; /* Calibrated RGB values */
+
+
+ if (cupsImageHaveProfile)
+ {
+ while (count > 0)
+ {
+ c = 255 - *in++;
+ m = 255 - *in++;
+ y = 255 - *in++;
+ k = min(c, min(m, y));
+ c -= k;
+ m -= k;
+ y -= k;
+
+ cr = cupsImageMatrix[0][0][c] +
+ cupsImageMatrix[0][1][m] +
+ cupsImageMatrix[0][2][y] + k;
+ cg = cupsImageMatrix[1][0][c] +
+ cupsImageMatrix[1][1][m] +
+ cupsImageMatrix[1][2][y] + k;
+ cb = cupsImageMatrix[2][0][c] +
+ cupsImageMatrix[2][1][m] +
+ cupsImageMatrix[2][2][y] + k;
+
+ if (cr < 0)
+ *out++ = 255;
+ else if (cr > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cr];
+
+ if (cg < 0)
+ *out++ = 255;
+ else if (cg > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cg];
+
+ if (cb < 0)
+ *out++ = 255;
+ else if (cb > 255)
+ *out++ = 255 - cupsImageDensity[255];
+ else
+ *out++ = 255 - cupsImageDensity[cb];
+
+ count --;
+ }
+ }
+ else
+ {
+ if (in != out)
+ memcpy(out, in, count * 3);
+
+ if (cupsImageColorSpace == CUPS_CSPACE_CIELab ||
+ cupsImageColorSpace >= CUPS_CSPACE_ICC1)
+ {
+ while (count > 0)
+ {
+ rgb_to_lab(out);
+
+ out += 3;
+ count --;
+ }
+ }
+ else if (cupsImageColorSpace == CUPS_CSPACE_CIEXYZ)
+ {
+ while (count > 0)
+ {
+ rgb_to_xyz(out);
+
+ out += 3;
+ count --;
+ }
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageRGBToWhite()' - Convert RGB colors to luminance.
+ */
+
+void
+cupsImageRGBToWhite(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ {
+ while (count > 0)
+ {
+ *out++ = 255 - cupsImageDensity[255 - (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100];
+ in += 3;
+ count --;
+ }
+ }
+ else
+ {
+ while (count > 0)
+ {
+ *out++ = (31 * in[0] + 61 * in[1] + 8 * in[2]) / 100;
+ in += 3;
+ count --;
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageSetProfile()' - Set the device color profile.
+ */
+
+void
+cupsImageSetProfile(float d, /* I - Ink/marker density */
+ float g, /* I - Ink/marker gamma */
+ float matrix[3][3]) /* I - Color transform matrix */
+{
+ int i, j, k; /* Looping vars */
+ float m; /* Current matrix value */
+ int *im; /* Pointer into cupsImageMatrix */
+
+
+ /*
+ * Allocate memory for the profile data...
+ */
+
+ if (cupsImageMatrix == NULL)
+ cupsImageMatrix = calloc(3, sizeof(cups_clut_t));
+
+ if (cupsImageMatrix == NULL)
+ return;
+
+ if (cupsImageDensity == NULL)
+ cupsImageDensity = calloc(256, sizeof(int));
+
+ if (cupsImageDensity == NULL)
+ return;
+
+ /*
+ * Populate the profile lookup tables...
+ */
+
+ cupsImageHaveProfile = 1;
+
+ for (i = 0, im = cupsImageMatrix[0][0]; i < 3; i ++)
+ for (j = 0; j < 3; j ++)
+ for (k = 0, m = matrix[i][j]; k < 256; k ++)
+ *im++ = (int)(k * m + 0.5);
+
+ for (k = 0, im = cupsImageDensity; k < 256; k ++)
+ *im++ = 255.0 * d * pow((float)k / 255.0, g) + 0.5;
+}
+
+
+/*
+ * 'cupsImageSetRasterColorSpace()' - Set the destination colorspace.
+ */
+
+void
+cupsImageSetRasterColorSpace(
+ cups_cspace_t cs) /* I - Destination colorspace */
+{
+ /*
+ * Set the destination colorspace...
+ */
+
+ cupsImageColorSpace = cs;
+
+ /*
+ * Don't use color profiles in colorimetric colorspaces...
+ */
+
+ if (cs == CUPS_CSPACE_CIEXYZ ||
+ cs == CUPS_CSPACE_CIELab ||
+ cs >= CUPS_CSPACE_ICC1)
+ cupsImageHaveProfile = 0;
+}
+
+
+/*
+ * 'cupsImageWhiteToBlack()' - Convert luminance colors to black.
+ */
+
+void
+cupsImageWhiteToBlack(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ *out++ = cupsImageDensity[255 - *in++];
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ *out++ = 255 - *in++;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageWhiteToCMY()' - Convert luminance colors to CMY.
+ */
+
+void
+cupsImageWhiteToCMY(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ out[0] = cupsImageDensity[255 - *in++];
+ out[1] = out[0];
+ out[2] = out[0];
+ out += 3;
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ *out++ = 255 - *in;
+ *out++ = 255 - *in;
+ *out++ = 255 - *in++;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageWhiteToCMYK()' - Convert luminance colors to CMYK.
+ */
+
+void
+cupsImageWhiteToCMYK(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ *out++ = 0;
+ *out++ = 0;
+ *out++ = 0;
+ *out++ = cupsImageDensity[255 - *in++];
+ count --;
+ }
+ else
+ while (count > 0)
+ {
+ *out++ = 0;
+ *out++ = 0;
+ *out++ = 0;
+ *out++ = 255 - *in++;
+ count --;
+ }
+}
+
+
+/*
+ * 'cupsImageWhiteToRGB()' - Convert luminance data to RGB.
+ */
+
+void
+cupsImageWhiteToRGB(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ {
+ while (count > 0)
+ {
+ out[0] = 255 - cupsImageDensity[255 - *in++];
+ out[1] = out[0];
+ out[2] = out[0];
+ out += 3;
+ count --;
+ }
+ }
+ else
+ {
+ while (count > 0)
+ {
+ *out++ = *in;
+ *out++ = *in;
+ *out++ = *in++;
+
+ if (cupsImageColorSpace == CUPS_CSPACE_CIELab ||
+ cupsImageColorSpace >= CUPS_CSPACE_ICC1)
+ rgb_to_lab(out - 3);
+ else if (cupsImageColorSpace == CUPS_CSPACE_CIEXYZ)
+ rgb_to_xyz(out - 3);
+
+ count --;
+ }
+ }
+}
+
+
+/*
+ * 'cupsImageWhiteToWhite()' - Convert luminance colors to device-dependent
+ * luminance.
+ */
+
+void
+cupsImageWhiteToWhite(
+ const cups_ib_t *in, /* I - Input pixels */
+ cups_ib_t *out, /* I - Output pixels */
+ int count) /* I - Number of pixels */
+{
+ if (cupsImageHaveProfile)
+ while (count > 0)
+ {
+ *out++ = 255 - cupsImageDensity[255 - *in++];
+ count --;
+ }
+ else if (in != out)
+ memcpy(out, in, count);
+}
+
+
+/*
+ * 'cielab()' - Map CIE Lab transformation...
+ */
+
+static float /* O - Adjusted color value */
+cielab(float x, /* I - Raw color value */
+ float xn) /* I - Whitepoint color value */
+{
+ float x_xn; /* Fraction of whitepoint */
+
+
+ x_xn = x / xn;
+
+ if (x_xn > 0.008856)
+ return (cbrt(x_xn));
+ else
+ return (7.787 * x_xn + 16.0 / 116.0);
+}
+
+
+/*
+ * 'huerotate()' - Rotate the hue, maintaining luminance.
+ */
+
+static void
+huerotate(float mat[3][3], /* I - Matrix to append to */
+ float rot) /* I - Hue rotation in degrees */
+{
+ float hmat[3][3]; /* Hue matrix */
+ float lx, ly, lz; /* Luminance vector */
+ float xrs, xrc; /* X rotation sine/cosine */
+ float yrs, yrc; /* Y rotation sine/cosine */
+ float zrs, zrc; /* Z rotation sine/cosine */
+ float zsx, zsy; /* Z shear x/y */
+
+
+ /*
+ * Load the identity matrix...
+ */
+
+ ident(hmat);
+
+ /*
+ * Rotate the grey vector into positive Z...
+ */
+
+ xrs = M_SQRT1_2;
+ xrc = M_SQRT1_2;
+ xrotate(hmat,xrs,xrc);
+
+ yrs = -1.0 / sqrt(3.0);
+ yrc = -M_SQRT2 * yrs;
+ yrotate(hmat,yrs,yrc);
+
+ /*
+ * Shear the space to make the luminance plane horizontal...
+ */
+
+ xform(hmat, 0.3086, 0.6094, 0.0820, &lx, &ly, &lz);
+ zsx = lx / lz;
+ zsy = ly / lz;
+ zshear(hmat, zsx, zsy);
+
+ /*
+ * Rotate the hue...
+ */
+
+ zrs = sin(rot * M_PI / 180.0);
+ zrc = cos(rot * M_PI / 180.0);
+
+ zrotate(hmat, zrs, zrc);
+
+ /*
+ * Unshear the space to put the luminance plane back...
+ */
+
+ zshear(hmat, -zsx, -zsy);
+
+ /*
+ * Rotate the grey vector back into place...
+ */
+
+ yrotate(hmat, -yrs, yrc);
+ xrotate(hmat, -xrs, xrc);
+
+ /*
+ * Append it to the current matrix...
+ */
+
+ mult(hmat, mat, mat);
+}
+
+
+/*
+ * 'ident()' - Make an identity matrix.
+ */
+
+static void
+ident(float mat[3][3]) /* I - Matrix to identify */
+{
+ mat[0][0] = 1.0;
+ mat[0][1] = 0.0;
+ mat[0][2] = 0.0;
+ mat[1][0] = 0.0;
+ mat[1][1] = 1.0;
+ mat[1][2] = 0.0;
+ mat[2][0] = 0.0;
+ mat[2][1] = 0.0;
+ mat[2][2] = 1.0;
+}
+
+
+/*
+ * 'mult()' - Multiply two matrices.
+ */
+
+static void
+mult(float a[3][3], /* I - First matrix */
+ float b[3][3], /* I - Second matrix */
+ float c[3][3]) /* I - Destination matrix */
+{
+ int x, y; /* Looping vars */
+ float temp[3][3]; /* Temporary matrix */
+
+
+ /*
+ * Multiply a and b, putting the result in temp...
+ */
+
+ for (y = 0; y < 3; y ++)
+ for (x = 0; x < 3; x ++)
+ temp[y][x] = b[y][0] * a[0][x] +
+ b[y][1] * a[1][x] +
+ b[y][2] * a[2][x];
+
+ /*
+ * Copy temp to c (that way c can be a pointer to a or b).
+ */
+
+ memcpy(c, temp, sizeof(temp));
+}
+
+
+/*
+ * 'rgb_to_lab()' - Convert an RGB color to CIE Lab.
+ */
+
+static void
+rgb_to_lab(cups_ib_t *val) /* IO - Color value */
+{
+ float r, /* Red value */
+ g, /* Green value */
+ b, /* Blue value */
+ ciex, /* CIE X value */
+ ciey, /* CIE Y value */
+ ciez, /* CIE Z value */
+ ciey_yn, /* Normalized luminance */
+ ciel, /* CIE L value */
+ ciea, /* CIE a value */
+ cieb; /* CIE b value */
+
+
+ /*
+ * Convert sRGB to linear RGB...
+ */
+
+ r = pow((val[0] / 255.0 + 0.055) / 1.055, 2.4);
+ g = pow((val[1] / 255.0 + 0.055) / 1.055, 2.4);
+ b = pow((val[2] / 255.0 + 0.055) / 1.055, 2.4);
+
+ /*
+ * Convert to CIE XYZ...
+ */
+
+ ciex = 0.412453 * r + 0.357580 * g + 0.180423 * b;
+ ciey = 0.212671 * r + 0.715160 * g + 0.072169 * b;
+ ciez = 0.019334 * r + 0.119193 * g + 0.950227 * b;
+
+ /*
+ * Normalize and convert to CIE Lab...
+ */
+
+ ciey_yn = ciey / D65_Y;
+
+ if (ciey_yn > 0.008856)
+ ciel = 116 * cbrt(ciey_yn) - 16;
+ else
+ ciel = 903.3 * ciey_yn;
+
+/*ciel = ciel;*/
+ ciea = 500 * (cielab(ciex, D65_X) - cielab(ciey, D65_Y));
+ cieb = 200 * (cielab(ciey, D65_Y) - cielab(ciez, D65_Z));
+
+ /*
+ * Scale the L value and bias the a and b values by 128 so that all
+ * numbers are from 0 to 255.
+ */
+
+ ciel = ciel * 2.55 + 0.5;
+ ciea += 128.5;
+ cieb += 128.5;
+
+ /*
+ * Output 8-bit values...
+ */
+
+ if (ciel < 0.0)
+ val[0] = 0;
+ else if (ciel < 255.0)
+ val[0] = (int)ciel;
+ else
+ val[0] = 255;
+
+ if (ciea < 0.0)
+ val[1] = 0;
+ else if (ciea < 255.0)
+ val[1] = (int)ciea;
+ else
+ val[1] = 255;
+
+ if (cieb < 0.0)
+ val[2] = 0;
+ else if (cieb < 255.0)
+ val[2] = (int)cieb;
+ else
+ val[2] = 255;
+}
+
+
+/*
+ * 'rgb_to_xyz()' - Convert an RGB color to CIE XYZ.
+ */
+
+static void
+rgb_to_xyz(cups_ib_t *val) /* IO - Color value */
+{
+ float r, /* Red value */
+ g, /* Green value */
+ b, /* Blue value */
+ ciex, /* CIE X value */
+ ciey, /* CIE Y value */
+ ciez; /* CIE Z value */
+
+
+ /*
+ * Convert sRGB to linear RGB...
+ */
+
+ r = pow((val[0] / 255.0 + 0.055) / 1.055, 2.4);
+ g = pow((val[1] / 255.0 + 0.055) / 1.055, 2.4);
+ b = pow((val[2] / 255.0 + 0.055) / 1.055, 2.4);
+
+ /*
+ * Convert to CIE XYZ...
+ */
+
+ ciex = 0.412453 * r + 0.357580 * g + 0.180423 * b;
+ ciey = 0.212671 * r + 0.715160 * g + 0.072169 * b;
+ ciez = 0.019334 * r + 0.119193 * g + 0.950227 * b;
+
+ /*
+ * Encode as 8-bit XYZ...
+ */
+
+ if (ciex < 0.0f)
+ val[0] = 0;
+ else if (ciex < 1.1f)
+ val[0] = (int)(231.8181f * ciex + 0.5);
+ else
+ val[0] = 255;
+
+ if (ciey < 0.0f)
+ val[1] = 0;
+ else if (ciey < 1.1f)
+ val[1] = (int)(231.8181f * ciey + 0.5);
+ else
+ val[1] = 255;
+
+ if (ciez < 0.0f)
+ val[2] = 0;
+ else if (ciez < 1.1f)
+ val[2] = (int)(231.8181f * ciez + 0.5);
+ else
+ val[2] = 255;
+}
+
+
+/*
+ * 'saturate()' - Make a saturation matrix.
+ */
+
+static void
+saturate(float mat[3][3], /* I - Matrix to append to */
+ float sat) /* I - Desired color saturation */
+{
+ float smat[3][3]; /* Saturation matrix */
+
+
+ smat[0][0] = (1.0 - sat) * 0.3086 + sat;
+ smat[0][1] = (1.0 - sat) * 0.3086;
+ smat[0][2] = (1.0 - sat) * 0.3086;
+ smat[1][0] = (1.0 - sat) * 0.6094;
+ smat[1][1] = (1.0 - sat) * 0.6094 + sat;
+ smat[1][2] = (1.0 - sat) * 0.6094;
+ smat[2][0] = (1.0 - sat) * 0.0820;
+ smat[2][1] = (1.0 - sat) * 0.0820;
+ smat[2][2] = (1.0 - sat) * 0.0820 + sat;
+
+ mult(smat, mat, mat);
+}
+
+
+/*
+ * 'xform()' - Transform a 3D point using a matrix...
+ */
+
+static void
+xform(float mat[3][3], /* I - Matrix */
+ float x, /* I - Input X coordinate */
+ float y, /* I - Input Y coordinate */
+ float z, /* I - Input Z coordinate */
+ float *tx, /* O - Output X coordinate */
+ float *ty, /* O - Output Y coordinate */
+ float *tz) /* O - Output Z coordinate */
+{
+ *tx = x * mat[0][0] + y * mat[1][0] + z * mat[2][0];
+ *ty = x * mat[0][1] + y * mat[1][1] + z * mat[2][1];
+ *tz = x * mat[0][2] + y * mat[1][2] + z * mat[2][2];
+}
+
+
+/*
+ * 'xrotate()' - Rotate about the x (red) axis...
+ */
+
+static void
+xrotate(float mat[3][3], /* I - Matrix */
+ float rs, /* I - Rotation angle sine */
+ float rc) /* I - Rotation angle cosine */
+{
+ float rmat[3][3]; /* I - Rotation matrix */
+
+
+ rmat[0][0] = 1.0;
+ rmat[0][1] = 0.0;
+ rmat[0][2] = 0.0;
+
+ rmat[1][0] = 0.0;
+ rmat[1][1] = rc;
+ rmat[1][2] = rs;
+
+ rmat[2][0] = 0.0;
+ rmat[2][1] = -rs;
+ rmat[2][2] = rc;
+
+ mult(rmat, mat, mat);
+}
+
+
+/*
+ * 'yrotate()' - Rotate about the y (green) axis...
+ */
+
+static void
+yrotate(float mat[3][3], /* I - Matrix */
+ float rs, /* I - Rotation angle sine */
+ float rc) /* I - Rotation angle cosine */
+{
+ float rmat[3][3]; /* I - Rotation matrix */
+
+
+ rmat[0][0] = rc;
+ rmat[0][1] = 0.0;
+ rmat[0][2] = -rs;
+
+ rmat[1][0] = 0.0;
+ rmat[1][1] = 1.0;
+ rmat[1][2] = 0.0;
+
+ rmat[2][0] = rs;
+ rmat[2][1] = 0.0;
+ rmat[2][2] = rc;
+
+ mult(rmat,mat,mat);
+}
+
+
+/*
+ * 'zrotate()' - Rotate about the z (blue) axis...
+ */
+
+static void
+zrotate(float mat[3][3], /* I - Matrix */
+ float rs, /* I - Rotation angle sine */
+ float rc) /* I - Rotation angle cosine */
+{
+ float rmat[3][3]; /* I - Rotation matrix */
+
+
+ rmat[0][0] = rc;
+ rmat[0][1] = rs;
+ rmat[0][2] = 0.0;
+
+ rmat[1][0] = -rs;
+ rmat[1][1] = rc;
+ rmat[1][2] = 0.0;
+
+ rmat[2][0] = 0.0;
+ rmat[2][1] = 0.0;
+ rmat[2][2] = 1.0;
+
+ mult(rmat,mat,mat);
+}
+
+
+/*
+ * 'zshear()' - Shear z using x and y...
+ */
+
+static void
+zshear(float mat[3][3], /* I - Matrix */
+ float dx, /* I - X shear */
+ float dy) /* I - Y shear */
+{
+ float smat[3][3]; /* Shear matrix */
+
+
+ smat[0][0] = 1.0;
+ smat[0][1] = 0.0;
+ smat[0][2] = dx;
+
+ smat[1][0] = 0.0;
+ smat[1][1] = 1.0;
+ smat[1][2] = dy;
+
+ smat[2][0] = 0.0;
+ smat[2][1] = 0.0;
+ smat[2][2] = 1.0;
+
+ mult(smat, mat, mat);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * GIF image routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadGIF() - Read a GIF image file.
+ * gif_get_block() - Read a GIF data block...
+ * gif_get_code() - Get a LZW code from the file...
+ * gif_read_cmap() - Read the colormap from a GIF file...
+ * gif_read_image() - Read a GIF image stream...
+ * gif_read_lzw() - Read a byte from the LZW stream...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * GIF definitions...
+ */
+
+#define GIF_INTERLACE 0x40
+#define GIF_COLORMAP 0x80
+#define GIF_MAX_BITS 12
+
+typedef cups_ib_t gif_cmap_t[256][4];
+typedef short gif_table_t[4096];
+
+
+/*
+ * Local globals...
+ */
+
+static int gif_eof = 0; /* Did we hit EOF? */
+
+
+/*
+ * Local functions...
+ */
+
+static int gif_get_block(FILE *fp, unsigned char *buffer);
+static int gif_get_code (FILE *fp, int code_size, int first_time);
+static int gif_read_cmap(FILE *fp, int ncolors, gif_cmap_t cmap,
+ int *gray);
+static int gif_read_image(FILE *fp, cups_image_t *img, gif_cmap_t cmap,
+ int interlace);
+static int gif_read_lzw(FILE *fp, int first_time, int input_code_size);
+
+
+/*
+ * '_cupsImageReadGIF()' - Read a GIF image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadGIF(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ unsigned char buf[1024]; /* Input buffer */
+ gif_cmap_t cmap; /* Colormap */
+ int i, /* Looping var */
+ bpp, /* Bytes per pixel */
+ gray, /* Grayscale image? */
+ ncolors, /* Bits per pixel */
+ transparent; /* Transparent color index */
+
+
+ /*
+ * GIF files are either grayscale or RGB - no CMYK...
+ */
+
+ if (primary == CUPS_IMAGE_RGB_CMYK)
+ primary = CUPS_IMAGE_RGB;
+
+ /*
+ * Read the header; we already know it is a GIF file...
+ */
+
+ fread(buf, 13, 1, fp);
+
+ img->xsize = (buf[7] << 8) | buf[6];
+ img->ysize = (buf[9] << 8) | buf[8];
+ ncolors = 2 << (buf[10] & 0x07);
+ gray = primary == CUPS_IMAGE_BLACK || primary == CUPS_IMAGE_WHITE;
+
+ if (buf[10] & GIF_COLORMAP)
+ if (gif_read_cmap(fp, ncolors, cmap, &gray))
+ {
+ fclose(fp);
+ return (-1);
+ }
+
+ transparent = -1;
+
+ for (;;)
+ {
+ switch (getc(fp))
+ {
+ case ';' : /* End of image */
+ fclose(fp);
+ return (-1); /* Early end of file */
+
+ case '!' : /* Extension record */
+ buf[0] = getc(fp);
+ if (buf[0] == 0xf9) /* Graphic Control Extension */
+ {
+ gif_get_block(fp, buf);
+ if (buf[0] & 1) /* Get transparent color index */
+ transparent = buf[3];
+ }
+
+ while (gif_get_block(fp, buf) != 0);
+ break;
+
+ case ',' : /* cupsImage data */
+ fread(buf, 9, 1, fp);
+
+ if (buf[8] & GIF_COLORMAP)
+ {
+ ncolors = 2 << (buf[8] & 0x07);
+ gray = primary == CUPS_IMAGE_BLACK || primary == CUPS_IMAGE_WHITE;
+
+ if (gif_read_cmap(fp, ncolors, cmap, &gray))
+ {
+ fclose(fp);
+ return (-1);
+ }
+ }
+
+ if (transparent >= 0)
+ {
+ /*
+ * Make transparent color white...
+ */
+
+ cmap[transparent][0] = 255;
+ cmap[transparent][1] = 255;
+ cmap[transparent][2] = 255;
+ }
+
+ if (gray)
+ {
+ switch (secondary)
+ {
+ case CUPS_IMAGE_CMYK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageWhiteToCMYK(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_CMY :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageWhiteToCMY(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_BLACK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageWhiteToBlack(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_WHITE :
+ break;
+ case CUPS_IMAGE_RGB :
+ case CUPS_IMAGE_RGB_CMYK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageWhiteToRGB(cmap[i], cmap[i], 1);
+ break;
+ }
+
+ img->colorspace = secondary;
+ }
+ else
+ {
+ if (hue != 0 || saturation != 100)
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBAdjust(cmap[i], 1, saturation, hue);
+
+ switch (primary)
+ {
+ case CUPS_IMAGE_CMYK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBToCMYK(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_CMY :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBToCMY(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_BLACK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBToBlack(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_WHITE :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBToWhite(cmap[i], cmap[i], 1);
+ break;
+ case CUPS_IMAGE_RGB :
+ case CUPS_IMAGE_RGB_CMYK :
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageRGBToRGB(cmap[i], cmap[i], 1);
+ break;
+ }
+
+ img->colorspace = primary;
+ }
+
+ if (lut)
+ {
+ bpp = cupsImageGetDepth(img);
+
+ for (i = ncolors - 1; i >= 0; i --)
+ cupsImageLut(cmap[i], bpp, lut);
+ }
+
+ img->xsize = (buf[5] << 8) | buf[4];
+ img->ysize = (buf[7] << 8) | buf[6];
+
+ /*
+ * Check the dimensions of the image; since the dimensions are
+ * a 16-bit integer we just need to check for 0...
+ */
+
+ if (img->xsize == 0 || img->ysize == 0)
+ {
+ fprintf(stderr, "DEBUG: Bad GIF image dimensions: %dx%d\n",
+ img->xsize, img->ysize);
+ fclose(fp);
+ return (1);
+ }
+
+ i = gif_read_image(fp, img, cmap, buf[8] & GIF_INTERLACE);
+ fclose(fp);
+ return (i);
+ }
+ }
+}
+
+
+/*
+ * 'gif_get_block()' - Read a GIF data block...
+ */
+
+static int /* O - Number characters read */
+gif_get_block(FILE *fp, /* I - File to read from */
+ unsigned char *buf) /* I - Input buffer */
+{
+ int count; /* Number of character to read */
+
+
+ /*
+ * Read the count byte followed by the data from the file...
+ */
+
+ if ((count = getc(fp)) == EOF)
+ {
+ gif_eof = 1;
+ return (-1);
+ }
+ else if (count == 0)
+ gif_eof = 1;
+ else if (fread(buf, 1, count, fp) < count)
+ {
+ gif_eof = 1;
+ return (-1);
+ }
+ else
+ gif_eof = 0;
+
+ return (count);
+}
+
+
+/*
+ * 'gif_get_code()' - Get a LZW code from the file...
+ */
+
+static int /* O - LZW code */
+gif_get_code(FILE *fp, /* I - File to read from */
+ int code_size, /* I - Size of code in bits */
+ int first_time) /* I - 1 = first time, 0 = not first time */
+{
+ unsigned i, j, /* Looping vars */
+ ret; /* Return value */
+ int count; /* Number of bytes read */
+ static unsigned char buf[280]; /* Input buffer */
+ static unsigned curbit, /* Current bit */
+ lastbit, /* Last bit in buffer */
+ done, /* Done with this buffer? */
+ last_byte; /* Last byte in buffer */
+ static const unsigned char bits[8] = /* Bit masks for codes */
+ {
+ 0x01, 0x02, 0x04, 0x08,
+ 0x10, 0x20, 0x40, 0x80
+ };
+
+
+ if (first_time)
+ {
+ /*
+ * Just initialize the input buffer...
+ */
+
+ curbit = 0;
+ lastbit = 0;
+ last_byte = 0;
+ done = 0;
+
+ return (0);
+ }
+
+ if ((curbit + code_size) >= lastbit)
+ {
+ /*
+ * Don't have enough bits to hold the code...
+ */
+
+ if (done)
+ return (-1); /* Sorry, no more... */
+
+ /*
+ * Move last two bytes to front of buffer...
+ */
+
+ if (last_byte > 1)
+ {
+ buf[0] = buf[last_byte - 2];
+ buf[1] = buf[last_byte - 1];
+ last_byte = 2;
+ }
+ else if (last_byte == 1)
+ {
+ buf[0] = buf[last_byte - 1];
+ last_byte = 1;
+ }
+
+ /*
+ * Read in another buffer...
+ */
+
+ if ((count = gif_get_block(fp, buf + last_byte)) <= 0)
+ {
+ /*
+ * Whoops, no more data!
+ */
+
+ done = 1;
+ return (-1);
+ }
+
+ /*
+ * Update buffer state...
+ */
+
+ curbit = (curbit - lastbit) + 8 * last_byte;
+ last_byte += count;
+ lastbit = last_byte * 8;
+ }
+
+ for (ret = 0, i = curbit + code_size - 1, j = code_size;
+ j > 0;
+ i --, j --)
+ ret = (ret << 1) | ((buf[i / 8] & bits[i & 7]) != 0);
+
+ curbit += code_size;
+
+ return ret;
+}
+
+
+/*
+ * 'gif_read_cmap()' - Read the colormap from a GIF file...
+ */
+
+static int /* O - -1 on error, 0 on success */
+gif_read_cmap(FILE *fp, /* I - File to read from */
+ int ncolors, /* I - Number of colors in file */
+ gif_cmap_t cmap, /* O - Colormap information */
+ int *gray) /* IO - Is the image grayscale? */
+{
+ int i; /* Looping var */
+
+
+ /*
+ * Read the colormap...
+ */
+
+ for (i = 0; i < ncolors; i ++)
+ if (fread(cmap[i], 3, 1, fp) < 1)
+ return (-1);
+
+ /*
+ * Check to see if the colormap is a grayscale ramp...
+ */
+
+ for (i = 0; i < ncolors; i ++)
+ if (cmap[i][0] != cmap[i][1] || cmap[i][1] != cmap[i][2])
+ break;
+
+ if (i == ncolors)
+ {
+ *gray = 1;
+ return (0);
+ }
+
+ /*
+ * If this needs to be a grayscale image, convert the RGB values to
+ * luminance values...
+ */
+
+ if (*gray)
+ for (i = 0; i < ncolors; i ++)
+ cmap[i][0] = (cmap[i][0] * 31 + cmap[i][1] * 61 + cmap[i][2] * 8) / 100;
+
+ return (0);
+}
+
+
+/*
+ * 'gif_read_image()' - Read a GIF image stream...
+ */
+
+static int /* I - 0 = success, -1 = failure */
+gif_read_image(FILE *fp, /* I - Input file */
+ cups_image_t *img, /* I - cupsImage pointer */
+ gif_cmap_t cmap, /* I - Colormap */
+ int interlace) /* I - Non-zero = interlaced image */
+{
+ unsigned char code_size; /* Code size */
+ cups_ib_t *pixels, /* Pixel buffer */
+ *temp; /* Current pixel */
+ int xpos, /* Current X position */
+ ypos, /* Current Y position */
+ pass; /* Current pass */
+ int pixel; /* Current pixel */
+ int bpp; /* Bytes per pixel */
+ static const int xpasses[4] = /* X interleaving */
+ { 8, 8, 4, 2 },
+ ypasses[5] = /* Y interleaving */
+ { 0, 4, 2, 1, 999999 };
+
+
+ bpp = cupsImageGetDepth(img);
+ pixels = calloc(bpp, img->xsize);
+ xpos = 0;
+ ypos = 0;
+ pass = 0;
+ code_size = getc(fp);
+
+ if (!pixels)
+ return (-1);
+
+ if (code_size > GIF_MAX_BITS || gif_read_lzw(fp, 1, code_size) < 0)
+ {
+ free(pixels);
+ return (-1);
+ }
+
+ temp = pixels;
+ while ((pixel = gif_read_lzw(fp, 0, code_size)) >= 0)
+ {
+ switch (bpp)
+ {
+ case 4 :
+ temp[3] = cmap[pixel][3];
+ case 3 :
+ temp[2] = cmap[pixel][2];
+ case 2 :
+ temp[1] = cmap[pixel][1];
+ default :
+ temp[0] = cmap[pixel][0];
+ }
+
+ xpos ++;
+ temp += bpp;
+ if (xpos == img->xsize)
+ {
+ _cupsImagePutRow(img, 0, ypos, img->xsize, pixels);
+
+ xpos = 0;
+ temp = pixels;
+
+ if (interlace)
+ {
+ ypos += xpasses[pass];
+
+ if (ypos >= img->ysize)
+ {
+ pass ++;
+
+ ypos = ypasses[pass];
+ }
+ }
+ else
+ ypos ++;
+ }
+
+ if (ypos >= img->ysize)
+ break;
+ }
+
+ free(pixels);
+
+ return (0);
+}
+
+
+/*
+ * 'gif_read_lzw()' - Read a byte from the LZW stream...
+ */
+
+static int /* I - Byte from stream */
+gif_read_lzw(FILE *fp, /* I - File to read from */
+ int first_time, /* I - 1 = first time, 0 = not first time */
+ int input_code_size) /* I - Code size in bits */
+{
+ int i, /* Looping var */
+ code, /* Current code */
+ incode; /* Input code */
+ static short fresh = 0, /* 1 = empty buffers */
+ code_size, /* Current code size */
+ set_code_size, /* Initial code size set */
+ max_code, /* Maximum code used */
+ max_code_size, /* Maximum code size */
+ firstcode, /* First code read */
+ oldcode, /* Last code read */
+ clear_code, /* Clear code for LZW input */
+ end_code, /* End code for LZW input */
+ *stack = NULL, /* Output stack */
+ *sp; /* Current stack pointer */
+ static gif_table_t *table = NULL; /* String table */
+
+
+ if (first_time)
+ {
+ /*
+ * Setup LZW state...
+ */
+
+ set_code_size = input_code_size;
+ code_size = set_code_size + 1;
+ clear_code = 1 << set_code_size;
+ end_code = clear_code + 1;
+ max_code_size = 2 * clear_code;
+ max_code = clear_code + 2;
+
+ /*
+ * Allocate memory for buffers...
+ */
+
+ if (table == NULL)
+ table = calloc(2, sizeof(gif_table_t));
+
+ if (table == NULL)
+ return (-1);
+
+ if (stack == NULL)
+ stack = calloc(8192, sizeof(short));
+
+ if (stack == NULL)
+ return (-1);
+
+ /*
+ * Initialize input buffers...
+ */
+
+ gif_get_code(fp, 0, 1);
+
+ /*
+ * Wipe the decompressor table (already mostly 0 due to the calloc above...)
+ */
+
+ fresh = 1;
+
+ for (i = 1; i < clear_code; i ++)
+ table[1][i] = i;
+
+ sp = stack;
+
+ return (0);
+ }
+ else if (fresh)
+ {
+ fresh = 0;
+
+ do
+ {
+ firstcode = oldcode = gif_get_code(fp, code_size, 0);
+ }
+ while (firstcode == clear_code);
+
+ return (firstcode & 255);
+ }
+ else if (!table)
+ return (0);
+
+ if (sp > stack)
+ return ((*--sp) & 255);
+
+ while ((code = gif_get_code(fp, code_size, 0)) >= 0)
+ {
+ if (code == clear_code)
+ {
+ /*
+ * Clear/reset the compression table...
+ */
+
+ memset(table, 0, 2 * sizeof(gif_table_t));
+ for (i = 1; i < clear_code; i ++)
+ table[1][i] = i;
+
+ code_size = set_code_size + 1;
+ max_code_size = 2 * clear_code;
+ max_code = clear_code + 2;
+
+ sp = stack;
+
+ firstcode = oldcode = gif_get_code(fp, code_size, 0);
+
+ return (firstcode & 255);
+ }
+ else if (code == end_code || code > max_code)
+ {
+ unsigned char buf[260]; /* Block buffer */
+
+ if (!gif_eof)
+ while (gif_get_block(fp, buf) > 0);
+
+ return (-2);
+ }
+
+ incode = code;
+
+ if (code == max_code)
+ {
+ if (sp < (stack + 8192))
+ *sp++ = firstcode;
+
+ code = oldcode;
+ }
+
+ while (code >= clear_code && sp < (stack + 8192))
+ {
+ *sp++ = table[1][code];
+ if (code == table[0][code])
+ return (255);
+
+ code = table[0][code];
+ }
+
+ if (sp < (stack + 8192))
+ *sp++ = firstcode = table[1][code];
+
+ code = max_code;
+
+ if (code < 4096)
+ {
+ table[0][code] = oldcode;
+ table[1][code] = firstcode;
+ max_code ++;
+
+ if (max_code >= max_code_size && max_code_size < 4096)
+ {
+ max_code_size *= 2;
+ code_size ++;
+ }
+ }
+
+ oldcode = incode;
+
+ if (sp > stack)
+ return ((*--sp) & 255);
+ }
+
+ return (code & 255);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * JPEG image routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadJPEG() - Read a JPEG image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+#ifdef HAVE_LIBJPEG
+# include <jpeglib.h> /* JPEG/JFIF image definitions */
+
+
+/*
+ * '_cupsImageReadJPEG()' - Read a JPEG image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadJPEG(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ struct jpeg_decompress_struct cinfo; /* Decompressor info */
+ struct jpeg_error_mgr jerr; /* Error handler info */
+ cups_ib_t *in, /* Input pixels */
+ *out; /* Output pixels */
+ jpeg_saved_marker_ptr marker; /* Pointer to marker data */
+ int psjpeg = 0; /* Non-zero if Photoshop CMYK JPEG */
+ static const char *cspaces[] =
+ { /* JPEG colorspaces... */
+ "JCS_UNKNOWN",
+ "JCS_GRAYSCALE",
+ "JCS_RGB",
+ "JCS_YCbCr",
+ "JCS_CMYK",
+ "JCS_YCCK"
+ };
+
+
+ /*
+ * Read the JPEG header...
+ */
+
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_decompress(&cinfo);
+ jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 0xffff); /* Adobe JPEG */
+ jpeg_stdio_src(&cinfo, fp);
+ jpeg_read_header(&cinfo, 1);
+
+ /*
+ * Parse any Adobe APPE data embedded in the JPEG file. Since Adobe doesn't
+ * bother following standards, we have to invert the CMYK JPEG data written by
+ * Adobe apps...
+ */
+
+ for (marker = cinfo.marker_list; marker; marker = marker->next)
+ if (marker->marker == (JPEG_APP0 + 14) && marker->data_length >= 12 &&
+ !memcmp(marker->data, "Adobe", 5) && marker->data[11] == 2)
+ {
+ fputs("DEBUG: Adobe CMYK JPEG detected (inverting color values)\n",
+ stderr);
+ psjpeg = 1;
+ }
+
+ cinfo.quantize_colors = 0;
+
+ fprintf(stderr, "DEBUG: num_components = %d\n", cinfo.num_components);
+ fprintf(stderr, "DEBUG: jpeg_color_space = %s\n",
+ cspaces[cinfo.jpeg_color_space]);
+
+ if (cinfo.num_components == 1)
+ {
+ fputs("DEBUG: Converting image to grayscale...\n", stderr);
+
+ cinfo.out_color_space = JCS_GRAYSCALE;
+ cinfo.out_color_components = 1;
+ cinfo.output_components = 1;
+
+ img->colorspace = secondary;
+ }
+ else if (cinfo.num_components == 4)
+ {
+ fputs("DEBUG: Converting image to CMYK...\n", stderr);
+
+ cinfo.out_color_space = JCS_CMYK;
+ cinfo.out_color_components = 4;
+ cinfo.output_components = 4;
+
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_CMYK : primary;
+ }
+ else
+ {
+ fputs("DEBUG: Converting image to RGB...\n", stderr);
+
+ cinfo.out_color_space = JCS_RGB;
+ cinfo.out_color_components = 3;
+ cinfo.output_components = 3;
+
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+ }
+
+ jpeg_calc_output_dimensions(&cinfo);
+
+ if (cinfo.output_width <= 0 || cinfo.output_width > CUPS_IMAGE_MAX_WIDTH ||
+ cinfo.output_height <= 0 || cinfo.output_height > CUPS_IMAGE_MAX_HEIGHT)
+ {
+ fprintf(stderr, "DEBUG: Bad JPEG dimensions %dx%d!\n",
+ cinfo.output_width, cinfo.output_height);
+
+ jpeg_destroy_decompress(&cinfo);
+
+ fclose(fp);
+ return (1);
+ }
+
+ img->xsize = cinfo.output_width;
+ img->ysize = cinfo.output_height;
+
+ if (cinfo.X_density > 0 && cinfo.Y_density > 0 && cinfo.density_unit > 0)
+ {
+ if (cinfo.density_unit == 1)
+ {
+ img->xppi = cinfo.X_density;
+ img->yppi = cinfo.Y_density;
+ }
+ else
+ {
+ img->xppi = (int)((float)cinfo.X_density * 2.54);
+ img->yppi = (int)((float)cinfo.Y_density * 2.54);
+ }
+
+ if (img->xppi == 0 || img->yppi == 0)
+ {
+ fprintf(stderr, "DEBUG: Bad JPEG image resolution %dx%d PPI.\n",
+ img->xppi, img->yppi);
+ img->xppi = img->yppi = 128;
+ }
+ }
+
+ fprintf(stderr, "DEBUG: JPEG image %dx%dx%d, %dx%d PPI\n",
+ img->xsize, img->ysize, cinfo.output_components,
+ img->xppi, img->yppi);
+
+ cupsImageSetMaxTiles(img, 0);
+
+ in = malloc(img->xsize * cinfo.output_components);
+ out = malloc(img->xsize * cupsImageGetDepth(img));
+
+ jpeg_start_decompress(&cinfo);
+
+ while (cinfo.output_scanline < cinfo.output_height)
+ {
+ jpeg_read_scanlines(&cinfo, (JSAMPROW *)&in, (JDIMENSION)1);
+
+ if (psjpeg && cinfo.output_components == 4)
+ {
+ /*
+ * Invert CMYK data from Photoshop...
+ */
+
+ cups_ib_t *ptr; /* Pointer into buffer */
+ int i; /* Looping var */
+
+
+ for (ptr = in, i = img->xsize * 4; i > 0; i --, ptr ++)
+ *ptr = 255 - *ptr;
+ }
+
+ if ((saturation != 100 || hue != 0) && cinfo.output_components == 3)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ if ((img->colorspace == CUPS_IMAGE_WHITE && cinfo.out_color_space == JCS_GRAYSCALE) ||
+ (img->colorspace == CUPS_IMAGE_CMYK && cinfo.out_color_space == JCS_CMYK))
+ {
+#ifdef DEBUG
+ int i, j;
+ cups_ib_t *ptr;
+
+
+ fputs("DEBUG: Direct Data...\n", stderr);
+
+ fputs("DEBUG:", stderr);
+
+ for (i = 0, ptr = in; i < img->xsize; i ++)
+ {
+ putc(' ', stderr);
+ for (j = 0; j < cinfo.output_components; j ++, ptr ++)
+ fprintf(stderr, "%02X", *ptr & 255);
+ }
+
+ putc('\n', stderr);
+#endif /* DEBUG */
+
+ if (lut)
+ cupsImageLut(in, img->xsize * cupsImageGetDepth(img), lut);
+
+ _cupsImagePutRow(img, 0, cinfo.output_scanline - 1, img->xsize, in);
+ }
+ else if (cinfo.out_color_space == JCS_GRAYSCALE)
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * cupsImageGetDepth(img), lut);
+
+ _cupsImagePutRow(img, 0, cinfo.output_scanline - 1, img->xsize, out);
+ }
+ else if (cinfo.out_color_space == JCS_RGB)
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * cupsImageGetDepth(img), lut);
+
+ _cupsImagePutRow(img, 0, cinfo.output_scanline - 1, img->xsize, out);
+ }
+ else /* JCS_CMYK */
+ {
+ fputs("DEBUG: JCS_CMYK\n", stderr);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageCMYKToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageCMYKToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageCMYKToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageCMYKToRGB(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * cupsImageGetDepth(img), lut);
+
+ _cupsImagePutRow(img, 0, cinfo.output_scanline - 1, img->xsize, out);
+ }
+ }
+
+ free(in);
+ free(out);
+
+ jpeg_finish_decompress(&cinfo);
+ jpeg_destroy_decompress(&cinfo);
+
+ fclose(fp);
+
+ return (0);
+}
+#endif /* HAVE_LIBJPEG */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * PhotoCD routines for CUPS.
+ *
+ * PhotoCD support is currently limited to the 768x512 base image, which
+ * is only YCC encoded. Support for the higher resolution images will
+ * require a lot of extra code...
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadPhotoCD() - Read a PhotoCD image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * '_cupsImageReadPhotoCD()' - Read a PhotoCD image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadPhotoCD(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int x, y; /* Looping vars */
+ int xdir, /* X direction */
+ xstart; /* X starting point */
+ int bpp; /* Bytes per pixel */
+ int pass; /* Pass number */
+ int rotation; /* 0 for 768x512, 1 for 512x768 */
+ int temp, /* Adjusted luminance */
+ temp2, /* Red, green, and blue values */
+ cb, cr; /* Adjusted chroma values */
+ cups_ib_t *in, /* Input (YCC) pixels */
+ *iy, /* Luminance */
+ *icb, /* Blue chroma */
+ *icr, /* Red chroma */
+ *rgb, /* RGB */
+ *rgbptr, /* Pointer into RGB data */
+ *out; /* Output pixels */
+
+
+ (void)secondary;
+
+ /*
+ * Get the image orientation...
+ */
+
+ fseek(fp, 72, SEEK_SET);
+ rotation = (getc(fp) & 63) != 8;
+
+ /*
+ * Seek to the start of the base image...
+ */
+
+ fseek(fp, 0x30000, SEEK_SET);
+
+ /*
+ * Allocate and initialize...
+ */
+
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+ img->xppi = 128;
+ img->yppi = 128;
+
+ if (rotation)
+ {
+ img->xsize = 512;
+ img->ysize = 768;
+ }
+ else
+ {
+ img->xsize = 768;
+ img->ysize = 512;
+ }
+
+ cupsImageSetMaxTiles(img, 0);
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((in = malloc(768 * 3)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ if ((out = malloc(768 * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ if (bpp > 1)
+ {
+ if ((rgb = malloc(768 * 3)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ free(out);
+ return (1);
+ }
+ }
+ else
+ rgb = NULL;
+
+ if (rotation)
+ {
+ xstart = 767 * bpp;
+ xdir = -2 * bpp;
+ }
+ else
+ {
+ xstart = 0;
+ xdir = 0;
+ }
+
+ /*
+ * Read the image file...
+ */
+
+ for (y = 0; y < 512; y += 2)
+ {
+ /*
+ * Grab the next two scanlines:
+ *
+ * YYYYYYYYYYYYYYY...
+ * YYYYYYYYYYYYYYY...
+ * CbCbCb...CrCrCr...
+ */
+
+ if (fread(in, 1, 768 * 3, fp) < (768 * 3))
+ {
+ /*
+ * Couldn't read a row of data - return an error!
+ */
+
+ free(in);
+ free(out);
+
+ if (bpp > 1)
+ free(rgb);
+
+ return (-1);
+ }
+
+ /*
+ * Process the two scanlines...
+ */
+
+ for (pass = 0, iy = in; pass < 2; pass ++)
+ {
+ if (bpp == 1)
+ {
+ /*
+ * Just extract the luminance channel from the line and put it
+ * in the image...
+ */
+
+ if (primary == CUPS_IMAGE_BLACK)
+ {
+ if (rotation)
+ {
+ for (rgbptr = out + xstart, x = 0; x < 768; x ++)
+ *rgbptr-- = 255 - *iy++;
+
+ if (lut)
+ cupsImageLut(out, 768, lut);
+
+ _cupsImagePutCol(img, 511 - y - pass, 0, 768, out);
+ }
+ else
+ {
+ cupsImageWhiteToBlack(iy, out, 768);
+
+ if (lut)
+ cupsImageLut(out, 768, lut);
+
+ _cupsImagePutRow(img, 0, y + pass, 768, out);
+ iy += 768;
+ }
+ }
+ else if (rotation)
+ {
+ for (rgbptr = out + xstart, x = 0; x < 768; x ++)
+ *rgbptr-- = 255 - *iy++;
+
+ if (lut)
+ cupsImageLut(out, 768, lut);
+
+ _cupsImagePutCol(img, 511 - y - pass, 0, 768, out);
+ }
+ else
+ {
+ if (lut)
+ cupsImageLut(iy, 768, lut);
+
+ _cupsImagePutRow(img, 0, y + pass, 768, iy);
+ iy += 768;
+ }
+ }
+ else
+ {
+ /*
+ * Convert YCbCr to RGB... While every pixel gets a luminance
+ * value, adjacent pixels share chroma information.
+ */
+
+ cb = cr = 0.0f;
+
+ for (x = 0, rgbptr = rgb + xstart, icb = in + 1536, icr = in + 1920;
+ x < 768;
+ x ++, iy ++, rgbptr += xdir)
+ {
+ if (!(x & 1))
+ {
+ cb = (float)(*icb - 156);
+ cr = (float)(*icr - 137);
+ }
+
+ temp = 92241 * (*iy);
+
+ temp2 = (temp + 86706 * cr) / 65536;
+ if (temp2 < 0)
+ *rgbptr++ = 0;
+ else if (temp2 > 255)
+ *rgbptr++ = 255;
+ else
+ *rgbptr++ = temp2;
+
+ temp2 = (temp - 25914 * cb - 44166 * cr) / 65536;
+ if (temp2 < 0)
+ *rgbptr++ = 0;
+ else if (temp2 > 255)
+ *rgbptr++ = 255;
+ else
+ *rgbptr++ = temp2;
+
+ temp2 = (temp + 133434 * cb) / 65536;
+ if (temp2 < 0)
+ *rgbptr++ = 0;
+ else if (temp2 > 255)
+ *rgbptr++ = 255;
+ else
+ *rgbptr++ = temp2;
+
+ if (x & 1)
+ {
+ icb ++;
+ icr ++;
+ }
+ }
+
+ /*
+ * Adjust the hue and saturation if needed...
+ */
+
+ if (saturation != 100 || hue != 0)
+ cupsImageRGBAdjust(rgb, 768, saturation, hue);
+
+ /*
+ * Then convert the RGB data to the appropriate colorspace and
+ * put it in the image...
+ */
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(rgb, out, 768);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(rgb, out, 768);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(rgb, out, 768);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, 768 * bpp, lut);
+
+ if (rotation)
+ _cupsImagePutCol(img, 511 - y - pass, 0, 768, out);
+ else
+ _cupsImagePutRow(img, 0, y + pass, 768, out);
+ }
+ }
+ }
+
+ /*
+ * Free memory and return...
+ */
+
+ free(in);
+ free(out);
+ if (bpp > 1)
+ free(rgb);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Alias PIX image routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadPIX() - Read a PIX image file.
+ * read_short() - Read a 16-bit integer.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * Local functions...
+ */
+
+static short read_short(FILE *fp);
+
+
+/*
+ * '_cupsImageReadPIX()' - Read a PIX image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadPIX(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ short width, /* Width of image */
+ height, /* Height of image */
+ depth; /* Depth of image (bits) */
+ int count, /* Repetition count */
+ bpp, /* Bytes per pixel */
+ x, y; /* Looping vars */
+ cups_ib_t r, g, b; /* Red, green/gray, blue values */
+ cups_ib_t *in, /* Input pixels */
+ *out, /* Output pixels */
+ *ptr; /* Pointer into pixels */
+
+
+ /*
+ * Get the image dimensions and setup the image...
+ */
+
+ width = read_short(fp);
+ height = read_short(fp);
+ read_short(fp);
+ read_short(fp);
+ depth = read_short(fp);
+
+ /*
+ * Check the dimensions of the image. Since the short values used for the
+ * width and height cannot exceed CUPS_IMAGE_MAX_WIDTH or
+ * CUPS_IMAGE_MAX_HEIGHT, we just need to verify they are positive integers.
+ */
+
+ if (width <= 0 || height <= 0 ||
+ (depth != 8 && depth != 24))
+ {
+ fprintf(stderr, "DEBUG: Bad PIX image dimensions %dx%dx%d\n",
+ width, height, depth);
+ fclose(fp);
+ return (1);
+ }
+
+ if (depth == 8)
+ img->colorspace = secondary;
+ else
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+
+ img->xsize = width;
+ img->ysize = height;
+
+ cupsImageSetMaxTiles(img, 0);
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((in = malloc(img->xsize * (depth / 8))) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ /*
+ * Read the image data...
+ */
+
+ if (depth == 8)
+ {
+ for (count = 0, y = 0, g = 0; y < img->ysize; y ++)
+ {
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ ptr = out;
+ else
+ ptr = in;
+
+ for (x = img->xsize; x > 0; x --, count --)
+ {
+ if (count == 0)
+ {
+ count = getc(fp);
+ g = getc(fp);
+ }
+
+ *ptr++ = g;
+ }
+
+ if (img->colorspace != CUPS_IMAGE_WHITE)
+ switch (img->colorspace)
+ {
+ default :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ for (count = 0, y = 0, r = 0, g = 0, b = 0; y < img->ysize; y ++)
+ {
+ ptr = in;
+
+ for (x = img->xsize; x > 0; x --, count --)
+ {
+ if (count == 0)
+ {
+ count = getc(fp);
+ b = getc(fp);
+ g = getc(fp);
+ r = getc(fp);
+ }
+
+ *ptr++ = r;
+ *ptr++ = g;
+ *ptr++ = b;
+ }
+
+ if (saturation != 100 || hue != 0)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+
+ fclose(fp);
+ free(in);
+ free(out);
+
+ return (0);
+}
+
+
+/*
+ * 'read_short()' - Read a 16-bit integer.
+ */
+
+static short /* O - Value from file */
+read_short(FILE *fp) /* I - File to read from */
+{
+ int ch; /* Character from file */
+
+
+ ch = getc(fp);
+ return ((ch << 8) | getc(fp));
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * PNG image routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadPNG() - Read a PNG image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
+# include <png.h> /* Portable Network Graphics (PNG) definitions */
+
+
+/*
+ * '_cupsImageReadPNG()' - Read a PNG image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadPNG(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int y; /* Looping var */
+ png_structp pp; /* PNG read pointer */
+ png_infop info; /* PNG info pointers */
+ png_uint_32 width, /* Width of image */
+ height; /* Height of image */
+ int bit_depth, /* Bit depth */
+ color_type, /* Color type */
+ interlace_type, /* Interlace type */
+ compression_type, /* Compression type */
+ filter_type; /* Filter type */
+ png_uint_32 xppm, /* X pixels per meter */
+ yppm; /* Y pixels per meter */
+ int bpp; /* Bytes per pixel */
+ int pass, /* Current pass */
+ passes; /* Number of passes required */
+ cups_ib_t *in, /* Input pixels */
+ *inptr, /* Pointer into pixels */
+ *out; /* Output pixels */
+ png_color_16 bg; /* Background color */
+
+
+ /*
+ * Setup the PNG data structures...
+ */
+
+ pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ info = png_create_info_struct(pp);
+
+ /*
+ * Initialize the PNG read "engine"...
+ */
+
+ png_init_io(pp, fp);
+
+ /*
+ * Get the image dimensions and load the output image...
+ */
+
+ png_read_info(pp, info);
+
+ png_get_IHDR(pp, info, &width, &height, &bit_depth, &color_type,
+ &interlace_type, &compression_type, &filter_type);
+
+ fprintf(stderr, "DEBUG: PNG image: %dx%dx%d, color_type=%x (%s%s%s)\n",
+ (int)width, (int)height, bit_depth, color_type,
+ (color_type & PNG_COLOR_MASK_COLOR) ? "RGB" : "GRAYSCALE",
+ (color_type & PNG_COLOR_MASK_ALPHA) ? "+ALPHA" : "",
+ (color_type & PNG_COLOR_MASK_PALETTE) ? "+PALETTE" : "");
+
+ if (color_type & PNG_COLOR_MASK_PALETTE)
+ png_set_expand(pp);
+ else if (bit_depth < 8)
+ {
+ png_set_packing(pp);
+ png_set_expand(pp);
+ }
+ else if (bit_depth == 16)
+ png_set_strip_16(pp);
+
+ if (color_type & PNG_COLOR_MASK_COLOR)
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB :
+ primary;
+ else
+ img->colorspace = secondary;
+
+ if (width == 0 || width > CUPS_IMAGE_MAX_WIDTH ||
+ height == 0 || height > CUPS_IMAGE_MAX_HEIGHT)
+ {
+ fprintf(stderr, "DEBUG: PNG image has invalid dimensions %ux%u!\n",
+ (unsigned)width, (unsigned)height);
+ fclose(fp);
+ return (1);
+ }
+
+ img->xsize = width;
+ img->ysize = height;
+
+ if ((xppm = png_get_x_pixels_per_meter(pp, info)) != 0 &&
+ (yppm = png_get_y_pixels_per_meter(pp, info)) != 0)
+ {
+ img->xppi = (int)((float)xppm * 0.0254);
+ img->yppi = (int)((float)yppm * 0.0254);
+
+ if (img->xppi == 0 || img->yppi == 0)
+ {
+ fprintf(stderr, "DEBUG: PNG image has invalid resolution %dx%d PPI\n",
+ img->xppi, img->yppi);
+
+ img->xppi = img->yppi = 128;
+ }
+ }
+
+ cupsImageSetMaxTiles(img, 0);
+
+ passes = png_set_interlace_handling(pp);
+
+ /*
+ * Handle transparency...
+ */
+
+ if (png_get_valid(pp, info, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(pp);
+
+ bg.red = 65535;
+ bg.green = 65535;
+ bg.blue = 65535;
+
+ png_set_background(pp, &bg, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+
+ if (passes == 1)
+ {
+ /*
+ * Load one row at a time...
+ */
+
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ in = malloc(img->xsize);
+ else
+ in = malloc(img->xsize * 3);
+ }
+ else
+ {
+ /*
+ * Interlaced images must be loaded all at once...
+ */
+
+ size_t bufsize; /* Size of buffer */
+
+
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ {
+ bufsize = img->xsize * img->ysize;
+
+ if ((bufsize / img->xsize) != img->ysize)
+ {
+ fprintf(stderr, "DEBUG: PNG image dimensions (%ux%u) too large!\n",
+ (unsigned)width, (unsigned)height);
+ fclose(fp);
+ return (1);
+ }
+ }
+ else
+ {
+ bufsize = img->xsize * img->ysize * 3;
+
+ if ((bufsize / (img->xsize * 3)) != img->ysize)
+ {
+ fprintf(stderr, "DEBUG: PNG image dimensions (%ux%u) too large!\n",
+ (unsigned)width, (unsigned)height);
+ fclose(fp);
+ return (1);
+ }
+ }
+
+ in = malloc(bufsize);
+ }
+
+ bpp = cupsImageGetDepth(img);
+ out = malloc(img->xsize * bpp);
+
+ if (!in || !out)
+ {
+ fputs("DEBUG: Unable to allocate memory for PNG image!\n", stderr);
+
+ if (in)
+ free(in);
+
+ if (out)
+ free(out);
+
+ fclose(fp);
+
+ return (1);
+ }
+
+ /*
+ * Read the image, interlacing as needed...
+ */
+
+ for (pass = 1; pass <= passes; pass ++)
+ for (inptr = in, y = 0; y < img->ysize; y ++)
+ {
+ png_read_row(pp, (png_bytep)inptr, NULL);
+
+ if (pass == passes)
+ {
+ /*
+ * Output this row...
+ */
+
+ if (color_type & PNG_COLOR_MASK_COLOR)
+ {
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(inptr, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ case CUPS_IMAGE_RGB_CMYK :
+ cupsImageRGBToRGB(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(inptr, out, img->xsize);
+ break;
+ }
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ case CUPS_IMAGE_WHITE :
+ memcpy(out, inptr, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ case CUPS_IMAGE_RGB_CMYK :
+ cupsImageWhiteToRGB(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(inptr, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(inptr, out, img->xsize);
+ break;
+ }
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+
+ if (passes > 1)
+ {
+ if (color_type & PNG_COLOR_MASK_COLOR)
+ inptr += img->xsize * 3;
+ else
+ inptr += img->xsize;
+ }
+ }
+
+ png_read_end(pp, info);
+ png_destroy_read_struct(&pp, &info, NULL);
+
+ fclose(fp);
+ free(in);
+ free(out);
+
+ return (0);
+}
+#endif /* HAVE_LIBPNG && HAVE_LIBZ */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Portable Any Map file routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadPNM() - Read a PNM image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * '_cupsImageReadPNM()' - Read a PNM image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadPNM(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int x, y; /* Looping vars */
+ int bpp; /* Bytes per pixel */
+ cups_ib_t *in, /* Input pixels */
+ *inptr, /* Current input pixel */
+ *out, /* Output pixels */
+ *outptr, /* Current output pixel */
+ bit; /* Bit in input line */
+ char line[255], /* Input line */
+ *lineptr; /* Pointer in line */
+ int format, /* Format of PNM file */
+ val, /* Pixel value */
+ maxval; /* Maximum pixel value */
+
+
+ /*
+ * Read the file header in the format:
+ *
+ * Pformat
+ * # comment1
+ * # comment2
+ * ...
+ * # commentN
+ * width
+ * height
+ * max sample
+ */
+
+ if ((lineptr = fgets(line, sizeof(line), fp)) == NULL)
+ {
+ fputs("DEBUG: Bad PNM header!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ lineptr ++;
+
+ format = atoi(lineptr);
+ while (isdigit(*lineptr & 255))
+ lineptr ++;
+
+ while (lineptr != NULL && img->xsize == 0)
+ {
+ if (*lineptr == '\0' || *lineptr == '#')
+ lineptr = fgets(line, sizeof(line), fp);
+ else if (isdigit(*lineptr & 255))
+ {
+ img->xsize = atoi(lineptr);
+ while (isdigit(*lineptr & 255))
+ lineptr ++;
+ }
+ else
+ lineptr ++;
+ }
+
+ while (lineptr != NULL && img->ysize == 0)
+ {
+ if (*lineptr == '\0' || *lineptr == '#')
+ lineptr = fgets(line, sizeof(line), fp);
+ else if (isdigit(*lineptr & 255))
+ {
+ img->ysize = atoi(lineptr);
+ while (isdigit(*lineptr & 255))
+ lineptr ++;
+ }
+ else
+ lineptr ++;
+ }
+
+ if (format != 1 && format != 4)
+ {
+ maxval = 0;
+
+ while (lineptr != NULL && maxval == 0)
+ {
+ if (*lineptr == '\0' || *lineptr == '#')
+ lineptr = fgets(line, sizeof(line), fp);
+ else if (isdigit(*lineptr & 255))
+ {
+ maxval = atoi(lineptr);
+ while (isdigit(*lineptr & 255))
+ lineptr ++;
+ }
+ else
+ lineptr ++;
+ }
+ }
+ else
+ maxval = 1;
+
+ if (img->xsize == 0 || img->xsize > CUPS_IMAGE_MAX_WIDTH ||
+ img->ysize == 0 || img->ysize > CUPS_IMAGE_MAX_HEIGHT)
+ {
+ fprintf(stderr, "DEBUG: Bad PNM dimensions %dx%d!\n",
+ img->xsize, img->ysize);
+ fclose(fp);
+ return (1);
+ }
+
+ if (maxval == 0)
+ {
+ fprintf(stderr, "DEBUG: Bad PNM max value %d!\n", maxval);
+ fclose(fp);
+ return (1);
+ }
+
+ if (format == 1 || format == 2 || format == 4 || format == 5)
+ img->colorspace = secondary;
+ else
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+
+ cupsImageSetMaxTiles(img, 0);
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((in = malloc(img->xsize * 3)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ /*
+ * Read the image file...
+ */
+
+ for (y = 0; y < img->ysize; y ++)
+ {
+ switch (format)
+ {
+ case 1 :
+ for (x = img->xsize, inptr = in; x > 0; x --, inptr ++)
+ if (fscanf(fp, "%d", &val) == 1)
+ *inptr = val ? 0 : 255;
+ break;
+
+ case 2 :
+ for (x = img->xsize, inptr = in; x > 0; x --, inptr ++)
+ if (fscanf(fp, "%d", &val) == 1)
+ *inptr = 255 * val / maxval;
+ break;
+
+ case 3 :
+ for (x = img->xsize, inptr = in; x > 0; x --, inptr += 3)
+ {
+ if (fscanf(fp, "%d", &val) == 1)
+ inptr[0] = 255 * val / maxval;
+ if (fscanf(fp, "%d", &val) == 1)
+ inptr[1] = 255 * val / maxval;
+ if (fscanf(fp, "%d", &val) == 1)
+ inptr[2] = 255 * val / maxval;
+ }
+ break;
+
+ case 4 :
+ fread(out, (img->xsize + 7) / 8, 1, fp);
+ for (x = img->xsize, inptr = in, outptr = out, bit = 128;
+ x > 0;
+ x --, inptr ++)
+ {
+ if (*outptr & bit)
+ *inptr = 0;
+ else
+ *inptr = 255;
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ outptr ++;
+ }
+ }
+ break;
+
+ case 5 :
+ fread(in, img->xsize, 1, fp);
+ break;
+
+ case 6 :
+ fread(in, img->xsize, 3, fp);
+ break;
+ }
+
+ switch (format)
+ {
+ case 1 :
+ case 2 :
+ case 4 :
+ case 5 :
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ {
+ if (lut)
+ cupsImageLut(in, img->xsize, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, in);
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ break;
+
+ default :
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ break;
+ }
+ }
+
+ free(in);
+ free(out);
+
+ fclose(fp);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Private image library definitions for CUPS.
+ *
+ * Copyright 2007-2010 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _CUPS_IMAGE_PRIVATE_H_
+# define _CUPS_IMAGE_PRIVATE_H_
+
+/*
+ * Include necessary headers...
+ */
+
+# include "image.h"
+# include <cups/cups.h>
+# include <config.h>
+# define DEBUG_printf(x)
+# define DEBUG_puts(x)
+# include <stdlib.h>
+# include <string.h>
+# include <ctype.h>
+# ifdef WIN32
+# include <io.h>
+# else
+# include <unistd.h>
+# endif /* WIN32 */
+# include <errno.h>
+# include <math.h>
+
+
+/*
+ * Constants...
+ */
+
+# define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
+ /* 2^27-1 to allow for 15-channel data */
+# define CUPS_IMAGE_MAX_HEIGHT 0x3fffffff
+ /* 2^30-1 */
+
+# define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
+# define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
+
+
+/*
+ * min/max/abs macros...
+ */
+
+# ifndef max
+# define max(a,b) ((a) > (b) ? (a) : (b))
+# endif /* !max */
+# ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+# endif /* !min */
+# ifndef abs
+# define abs(a) ((a) < 0 ? -(a) : (a))
+# endif /* !abs */
+
+
+/*
+ * Types and structures...
+ */
+
+typedef enum cups_iztype_e /**** Image zoom type ****/
+{
+ CUPS_IZOOM_FAST, /* Use nearest-neighbor sampling */
+ CUPS_IZOOM_NORMAL, /* Use bilinear interpolation */
+ CUPS_IZOOM_BEST /* Use bicubic interpolation */
+} cups_iztype_t;
+
+struct cups_ic_s;
+
+typedef struct cups_itile_s /**** Image tile ****/
+{
+ int dirty; /* True if tile is dirty */
+ off_t pos; /* Position of tile on disk (-1 if not written) */
+ struct cups_ic_s *ic; /* Pixel data */
+} cups_itile_t;
+
+typedef struct cups_ic_s /**** Image tile cache ****/
+{
+ struct cups_ic_s *prev, /* Previous tile in cache */
+ *next; /* Next tile in cache */
+ cups_itile_t *tile; /* Tile this is attached to */
+ cups_ib_t *pixels; /* Pixel data */
+} cups_ic_t;
+
+struct cups_image_s /**** Image file data ****/
+{
+ cups_icspace_t colorspace; /* Colorspace of image */
+ unsigned xsize, /* Width of image in pixels */
+ ysize, /* Height of image in pixels */
+ xppi, /* X resolution in pixels-per-inch */
+ yppi, /* Y resolution in pixels-per-inch */
+ num_ics, /* Number of cached tiles */
+ max_ics; /* Maximum number of cached tiles */
+ cups_itile_t **tiles; /* Tiles in image */
+ cups_ic_t *first, /* First cached tile in image */
+ *last; /* Last cached tile in image */
+ int cachefile; /* Tile cache file */
+ char cachename[256]; /* Tile cache filename */
+};
+
+struct cups_izoom_s /**** Image zoom data ****/
+{
+ cups_image_t *img; /* Image to zoom */
+ cups_iztype_t type; /* Type of zooming */
+ unsigned xorig, /* X origin */
+ yorig, /* Y origin */
+ width, /* Width of input area */
+ height, /* Height of input area */
+ depth, /* Number of bytes per pixel */
+ rotated, /* Non-zero if image needs to be rotated */
+ xsize, /* Width of output image */
+ ysize, /* Height of output image */
+ xmax, /* Maximum input image X position */
+ ymax, /* Maximum input image Y position */
+ xmod, /* Threshold for Bresenheim rounding */
+ ymod; /* ... */
+ int xstep, /* Amount to step for each pixel along X */
+ xincr,
+ instep, /* Amount to step pixel pointer along X */
+ inincr,
+ ystep, /* Amount to step for each pixel along Y */
+ yincr,
+ row; /* Current row */
+ cups_ib_t *rows[2], /* Horizontally scaled pixel data */
+ *in; /* Unscaled input pixel data */
+};
+
+
+/*
+ * Prototypes...
+ */
+
+extern int _cupsImagePutCol(cups_image_t *img, int x, int y,
+ int height, const cups_ib_t *pixels);
+extern int _cupsImagePutRow(cups_image_t *img, int x, int y,
+ int width, const cups_ib_t *pixels);
+extern int _cupsImageReadBMP(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadFPX(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadGIF(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadJPEG(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadPIX(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadPNG(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadPNM(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadPhotoCD(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadSGI(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadSunRaster(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern int _cupsImageReadTIFF(cups_image_t *img, FILE *fp,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut);
+extern void _cupsImageZoomDelete(cups_izoom_t *z);
+extern void _cupsImageZoomFill(cups_izoom_t *z, int iy);
+extern cups_izoom_t *_cupsImageZoomNew(cups_image_t *img, int xc0, int yc0,
+ int xc1, int yc1, int xsize,
+ int ysize, int rotated,
+ cups_iztype_t type);
+
+extern int _cupsRasterExecPS(cups_page_header2_t *h,
+ int *preferred_bits,
+ const char *code);
+extern void _cupsRasterAddError(const char *f, ...);
+extern void _cupsRasterClearError(void);
+
+#endif /* !_CUPS_IMAGE_PRIVATE_H_ */
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * SGI image file routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadSGI() - Read a SGI image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+#include "image-sgi.h"
+
+
+/*
+ * '_cupsImageReadSGI()' - Read a SGI image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadSGI(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int i, y; /* Looping vars */
+ int bpp; /* Bytes per pixel */
+ sgi_t *sgip; /* SGI image file */
+ cups_ib_t *in, /* Input pixels */
+ *inptr, /* Current input pixel */
+ *out; /* Output pixels */
+ unsigned short *rows[4], /* Row pointers for image data */
+ *red,
+ *green,
+ *blue,
+ *gray,
+ *alpha;
+
+
+ /*
+ * Setup the SGI file...
+ */
+
+ sgip = sgiOpenFile(fp, SGI_READ, 0, 0, 0, 0, 0);
+
+ /*
+ * Get the image dimensions and load the output image...
+ */
+
+ /*
+ * Check the image dimensions; since xsize and ysize are unsigned shorts,
+ * just check if they are 0 since they can't exceed CUPS_IMAGE_MAX_WIDTH or
+ * CUPS_IMAGE_MAX_HEIGHT...
+ */
+
+ if (sgip->xsize == 0 || sgip->ysize == 0 ||
+ sgip->zsize == 0 || sgip->zsize > 4)
+ {
+ fprintf(stderr, "DEBUG: Bad SGI image dimensions %ux%ux%u!\n",
+ sgip->xsize, sgip->ysize, sgip->zsize);
+ sgiClose(sgip);
+ return (1);
+ }
+
+ if (sgip->zsize < 3)
+ img->colorspace = secondary;
+ else
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+
+ img->xsize = sgip->xsize;
+ img->ysize = sgip->ysize;
+
+ cupsImageSetMaxTiles(img, 0);
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((in = malloc(img->xsize * sgip->zsize)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ sgiClose(sgip);
+ return (1);
+ }
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ sgiClose(sgip);
+ free(in);
+ return (1);
+ }
+
+ if ((rows[0] = calloc(img->xsize * sgip->zsize,
+ sizeof(unsigned short))) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ sgiClose(sgip);
+ free(in);
+ free(out);
+ return (1);
+ }
+
+ for (i = 1; i < sgip->zsize; i ++)
+ rows[i] = rows[0] + i * img->xsize;
+
+ /*
+ * Read the SGI image file...
+ */
+
+ for (y = 0; y < img->ysize; y ++)
+ {
+ for (i = 0; i < sgip->zsize; i ++)
+ sgiGetRow(sgip, rows[i], img->ysize - 1 - y, i);
+
+ switch (sgip->zsize)
+ {
+ case 1 :
+ if (sgip->bpp == 1)
+ for (i = img->xsize - 1, gray = rows[0], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = *gray++;
+ }
+ else
+ for (i = img->xsize - 1, gray = rows[0], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = (*gray++) / 256 + 128;
+ }
+ break;
+ case 2 :
+ if (sgip->bpp == 1)
+ for (i = img->xsize - 1, gray = rows[0], alpha = rows[1], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = (*gray++) * (*alpha++) / 255;
+ }
+ else
+ for (i = img->xsize - 1, gray = rows[0], alpha = rows[1], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = ((*gray++) / 256 + 128) * (*alpha++) / 32767;
+ }
+ break;
+ case 3 :
+ if (sgip->bpp == 1)
+ for (i = img->xsize - 1, red = rows[0], green = rows[1],
+ blue = rows[2], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = *red++;
+ *inptr++ = *green++;
+ *inptr++ = *blue++;
+ }
+ else
+ for (i = img->xsize - 1, red = rows[0], green = rows[1],
+ blue = rows[2], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = (*red++) / 256 + 128;
+ *inptr++ = (*green++) / 256 + 128;
+ *inptr++ = (*blue++) / 256 + 128;
+ }
+ break;
+ case 4 :
+ if (sgip->bpp == 1)
+ for (i = img->xsize - 1, red = rows[0], green = rows[1],
+ blue = rows[2], alpha = rows[3], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = (*red++) * (*alpha) / 255;
+ *inptr++ = (*green++) * (*alpha) / 255;
+ *inptr++ = (*blue++) * (*alpha++) / 255;
+ }
+ else
+ for (i = img->xsize - 1, red = rows[0], green = rows[1],
+ blue = rows[2], alpha = rows[3], inptr = in;
+ i >= 0;
+ i --)
+ {
+ *inptr++ = ((*red++) / 256 + 128) * (*alpha) / 32767;
+ *inptr++ = ((*green++) / 256 + 128) * (*alpha) / 32767;
+ *inptr++ = ((*blue++) / 256 + 128) * (*alpha++) / 32767;
+ }
+ break;
+ }
+
+ if (sgip->zsize < 3)
+ {
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ {
+ if (lut)
+ cupsImageLut(in, img->xsize, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, in);
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ case CUPS_IMAGE_RGB_CMYK :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+
+ free(in);
+ free(out);
+ free(rows[0]);
+
+ sgiClose(sgip);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * SGI image file format library definitions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _SGI_H_
+# define _SGI_H_
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+
+/*
+ * Constants...
+ */
+
+# define SGI_MAGIC 474 /* Magic number in image file */
+
+# define SGI_READ 0 /* Read from an SGI image file */
+# define SGI_WRITE 1 /* Write to an SGI image file */
+
+# define SGI_COMP_NONE 0 /* No compression */
+# define SGI_COMP_RLE 1 /* Run-length encoding */
+# define SGI_COMP_ARLE 2 /* Agressive run-length encoding */
+
+
+/*
+ * Image structure...
+ */
+
+typedef struct
+{
+ FILE *file; /* Image file */
+ int mode, /* File open mode */
+ bpp, /* Bytes per pixel/channel */
+ comp; /* Compression */
+ unsigned short xsize, /* Width in pixels */
+ ysize, /* Height in pixels */
+ zsize; /* Number of channels */
+ long firstrow, /* File offset for first row */
+ nextrow, /* File offset for next row */
+ **table, /* Offset table for compression */
+ **length; /* Length table for compression */
+ unsigned short *arle_row; /* Advanced RLE compression buffer */
+ long arle_offset, /* Advanced RLE buffer offset */
+ arle_length; /* Advanced RLE buffer length */
+} sgi_t;
+
+
+/*
+ * Prototypes...
+ */
+
+extern int sgiClose(sgi_t *sgip);
+extern int sgiGetRow(sgi_t *sgip, unsigned short *row, int y, int z);
+extern sgi_t *sgiOpen(const char *filename, int mode, int comp, int bpp,
+ int xsize, int ysize, int zsize);
+extern sgi_t *sgiOpenFile(FILE *file, int mode, int comp, int bpp,
+ int xsize, int ysize, int zsize);
+extern int sgiPutRow(sgi_t *sgip, unsigned short *row, int y, int z);
+
+# ifdef __cplusplus
+}
+# endif
+#endif /* !_SGI_H_ */
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * SGI image file format library routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * sgiClose() - Close an SGI image file.
+ * sgiGetRow() - Get a row of image data from a file.
+ * sgiOpen() - Open an SGI image file for reading or writing.
+ * sgiOpenFile() - Open an SGI image file for reading or writing.
+ * sgiPutRow() - Put a row of image data to a file.
+ * getlong() - Get a 32-bit big-endian integer.
+ * getshort() - Get a 16-bit big-endian integer.
+ * putlong() - Put a 32-bit big-endian integer.
+ * putshort() - Put a 16-bit big-endian integer.
+ * read_rle8() - Read 8-bit RLE data.
+ * read_rle16() - Read 16-bit RLE data.
+ * write_rle8() - Write 8-bit RLE data.
+ * write_rle16() - Write 16-bit RLE data.
+ */
+
+#include "image-sgi.h"
+
+
+/*
+ * Local functions...
+ */
+
+static int getlong(FILE *);
+static int getshort(FILE *);
+static int putlong(long, FILE *);
+static int putshort(unsigned short, FILE *);
+static int read_rle8(FILE *, unsigned short *, int);
+static int read_rle16(FILE *, unsigned short *, int);
+static int write_rle8(FILE *, unsigned short *, int);
+static int write_rle16(FILE *, unsigned short *, int);
+
+
+/*
+ * 'sgiClose()' - Close an SGI image file.
+ */
+
+int /* O - 0 on success, -1 on error */
+sgiClose(sgi_t *sgip) /* I - SGI image */
+{
+ int i; /* Return status */
+ long *offset; /* Looping var for offset table */
+
+
+ if (sgip == NULL)
+ return (-1);
+
+ if (sgip->mode == SGI_WRITE && sgip->comp != SGI_COMP_NONE)
+ {
+ /*
+ * Write the scanline offset table to the file...
+ */
+
+ fseek(sgip->file, 512, SEEK_SET);
+
+ for (i = sgip->ysize * sgip->zsize, offset = sgip->table[0];
+ i > 0;
+ i --, offset ++)
+ if (putlong(offset[0], sgip->file) < 0)
+ return (-1);
+
+ for (i = sgip->ysize * sgip->zsize, offset = sgip->length[0];
+ i > 0;
+ i --, offset ++)
+ if (putlong(offset[0], sgip->file) < 0)
+ return (-1);
+ }
+
+ if (sgip->table != NULL)
+ {
+ free(sgip->table[0]);
+ free(sgip->table);
+ }
+
+ if (sgip->length != NULL)
+ {
+ free(sgip->length[0]);
+ free(sgip->length);
+ }
+
+ if (sgip->comp == SGI_COMP_ARLE)
+ free(sgip->arle_row);
+
+ i = fclose(sgip->file);
+ free(sgip);
+
+ return (i);
+}
+
+
+/*
+ * 'sgiGetRow()' - Get a row of image data from a file.
+ */
+
+int /* O - 0 on success, -1 on error */
+sgiGetRow(sgi_t *sgip, /* I - SGI image */
+ unsigned short *row, /* O - Row to read */
+ int y, /* I - Line to read */
+ int z) /* I - Channel to read */
+{
+ int x; /* X coordinate */
+ long offset; /* File offset */
+
+
+ if (sgip == NULL ||
+ row == NULL ||
+ y < 0 || y >= sgip->ysize ||
+ z < 0 || z >= sgip->zsize)
+ return (-1);
+
+ switch (sgip->comp)
+ {
+ case SGI_COMP_NONE :
+ /*
+ * Seek to the image row - optimize buffering by only seeking if
+ * necessary...
+ */
+
+ offset = 512 + (y + z * sgip->ysize) * sgip->xsize * sgip->bpp;
+ if (offset != ftell(sgip->file))
+ fseek(sgip->file, offset, SEEK_SET);
+
+ if (sgip->bpp == 1)
+ {
+ for (x = sgip->xsize; x > 0; x --, row ++)
+ *row = getc(sgip->file);
+ }
+ else
+ {
+ for (x = sgip->xsize; x > 0; x --, row ++)
+ *row = getshort(sgip->file);
+ }
+ break;
+
+ case SGI_COMP_RLE :
+ offset = sgip->table[z][y];
+ if (offset != ftell(sgip->file))
+ fseek(sgip->file, offset, SEEK_SET);
+
+ if (sgip->bpp == 1)
+ return (read_rle8(sgip->file, row, sgip->xsize));
+ else
+ return (read_rle16(sgip->file, row, sgip->xsize));
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'sgiOpen()' - Open an SGI image file for reading or writing.
+ */
+
+sgi_t * /* O - New image */
+sgiOpen(const char *filename, /* I - File to open */
+ int mode, /* I - Open mode (SGI_READ or SGI_WRITE) */
+ int comp, /* I - Type of compression */
+ int bpp, /* I - Bytes per pixel */
+ int xsize, /* I - Width of image in pixels */
+ int ysize, /* I - Height of image in pixels */
+ int zsize) /* I - Number of channels */
+{
+ sgi_t *sgip; /* New SGI image file */
+ FILE *file; /* Image file pointer */
+
+
+ if (mode == SGI_READ)
+ file = fopen(filename, "rb");
+ else
+ file = fopen(filename, "wb+");
+
+ if (file == NULL)
+ return (NULL);
+
+ if ((sgip = sgiOpenFile(file, mode, comp, bpp, xsize, ysize, zsize)) == NULL)
+ fclose(file);
+
+ return (sgip);
+}
+
+
+/*
+ * 'sgiOpenFile()' - Open an SGI image file for reading or writing.
+ */
+
+sgi_t * /* O - New image */
+sgiOpenFile(FILE *file, /* I - File to open */
+ int mode, /* I - Open mode (SGI_READ or SGI_WRITE) */
+ int comp, /* I - Type of compression */
+ int bpp, /* I - Bytes per pixel */
+ int xsize, /* I - Width of image in pixels */
+ int ysize, /* I - Height of image in pixels */
+ int zsize) /* I - Number of channels */
+{
+ int i, j; /* Looping var */
+ char name[80]; /* Name of file in image header */
+ short magic; /* Magic number */
+ sgi_t *sgip; /* New image pointer */
+
+
+ if ((sgip = calloc(sizeof(sgi_t), 1)) == NULL)
+ return (NULL);
+
+ sgip->file = file;
+
+ switch (mode)
+ {
+ case SGI_READ :
+ sgip->mode = SGI_READ;
+
+ magic = getshort(sgip->file);
+ if (magic != SGI_MAGIC)
+ {
+ free(sgip);
+ return (NULL);
+ }
+
+ sgip->comp = getc(sgip->file);
+ sgip->bpp = getc(sgip->file);
+ getshort(sgip->file); /* Dimensions */
+ sgip->xsize = getshort(sgip->file);
+ sgip->ysize = getshort(sgip->file);
+ sgip->zsize = getshort(sgip->file);
+ getlong(sgip->file); /* Minimum pixel */
+ getlong(sgip->file); /* Maximum pixel */
+
+ if (sgip->comp)
+ {
+ /*
+ * This file is compressed; read the scanline tables...
+ */
+
+ fseek(sgip->file, 512, SEEK_SET);
+
+ if ((sgip->table = calloc(sgip->zsize, sizeof(long *))) == NULL)
+ {
+ free(sgip);
+ return (NULL);
+ }
+
+ if ((sgip->table[0] = calloc(sgip->ysize * sgip->zsize,
+ sizeof(long))) == NULL)
+ {
+ free(sgip->table);
+ free(sgip);
+ return (NULL);
+ }
+
+ for (i = 1; i < sgip->zsize; i ++)
+ sgip->table[i] = sgip->table[0] + i * sgip->ysize;
+
+ for (i = 0; i < sgip->zsize; i ++)
+ for (j = 0; j < sgip->ysize; j ++)
+ sgip->table[i][j] = getlong(sgip->file);
+ }
+ break;
+
+ case SGI_WRITE :
+ if (xsize < 1 ||
+ ysize < 1 ||
+ zsize < 1 ||
+ bpp < 1 || bpp > 2 ||
+ comp < SGI_COMP_NONE || comp > SGI_COMP_ARLE)
+ {
+ free(sgip);
+ return (NULL);
+ }
+
+ sgip->mode = SGI_WRITE;
+
+ putshort(SGI_MAGIC, sgip->file);
+ putc((sgip->comp = comp) != 0, sgip->file);
+ putc(sgip->bpp = bpp, sgip->file);
+ putshort(3, sgip->file); /* Dimensions */
+ putshort(sgip->xsize = xsize, sgip->file);
+ putshort(sgip->ysize = ysize, sgip->file);
+ putshort(sgip->zsize = zsize, sgip->file);
+ if (bpp == 1)
+ {
+ putlong(0, sgip->file); /* Minimum pixel */
+ putlong(255, sgip->file); /* Maximum pixel */
+ }
+ else
+ {
+ putlong(-32768, sgip->file); /* Minimum pixel */
+ putlong(32767, sgip->file); /* Maximum pixel */
+ }
+ putlong(0, sgip->file); /* Reserved */
+
+ memset(name, 0, sizeof(name));
+ fwrite(name, sizeof(name), 1, sgip->file);
+
+ for (i = 0; i < 102; i ++)
+ putlong(0, sgip->file);
+
+ switch (comp)
+ {
+ case SGI_COMP_NONE : /* No compression */
+ /*
+ * This file is uncompressed. To avoid problems with sparse files,
+ * we need to write blank pixels for the entire image...
+ */
+
+ if (bpp == 1)
+ {
+ for (i = xsize * ysize * zsize; i > 0; i --)
+ putc(0, sgip->file);
+ }
+ else
+ {
+ for (i = xsize * ysize * zsize; i > 0; i --)
+ putshort(0, sgip->file);
+ }
+ break;
+
+ case SGI_COMP_ARLE : /* Aggressive RLE */
+ sgip->arle_row = calloc(xsize, sizeof(unsigned short));
+ sgip->arle_offset = 0;
+
+ case SGI_COMP_RLE : /* Run-Length Encoding */
+ /*
+ * This file is compressed; write the (blank) scanline tables...
+ */
+
+ for (i = 2 * ysize * zsize; i > 0; i --)
+ putlong(0, sgip->file);
+
+ sgip->firstrow = ftell(sgip->file);
+ sgip->nextrow = ftell(sgip->file);
+ if ((sgip->table = calloc(sgip->zsize, sizeof(long *))) == NULL)
+ {
+ free(sgip);
+ return (NULL);
+ }
+
+ if ((sgip->table[0] = calloc(sgip->ysize * sgip->zsize,
+ sizeof(long))) == NULL)
+ {
+ free(sgip->table);
+ free(sgip);
+ return (NULL);
+ }
+
+ for (i = 1; i < sgip->zsize; i ++)
+ sgip->table[i] = sgip->table[0] + i * sgip->ysize;
+
+ if ((sgip->length = calloc(sgip->zsize, sizeof(long *))) == NULL)
+ {
+ free(sgip->table);
+ free(sgip);
+ return (NULL);
+ }
+
+ if ((sgip->length[0] = calloc(sgip->ysize * sgip->zsize,
+ sizeof(long))) == NULL)
+ {
+ free(sgip->length);
+ free(sgip->table);
+ free(sgip);
+ return (NULL);
+ }
+
+ for (i = 1; i < sgip->zsize; i ++)
+ sgip->length[i] = sgip->length[0] + i * sgip->ysize;
+ break;
+ }
+ break;
+
+ default :
+ free(sgip);
+ return (NULL);
+ }
+
+ return (sgip);
+}
+
+
+/*
+ * 'sgiPutRow()' - Put a row of image data to a file.
+ */
+
+int /* O - 0 on success, -1 on error */
+sgiPutRow(sgi_t *sgip, /* I - SGI image */
+ unsigned short *row, /* I - Row to write */
+ int y, /* I - Line to write */
+ int z) /* I - Channel to write */
+{
+ int x; /* X coordinate */
+ long offset; /* File offset */
+
+
+ if (sgip == NULL ||
+ row == NULL ||
+ y < 0 || y >= sgip->ysize ||
+ z < 0 || z >= sgip->zsize)
+ return (-1);
+
+ switch (sgip->comp)
+ {
+ case SGI_COMP_NONE :
+ /*
+ * Seek to the image row - optimize buffering by only seeking if
+ * necessary...
+ */
+
+ offset = 512 + (y + z * sgip->ysize) * sgip->xsize * sgip->bpp;
+ if (offset != ftell(sgip->file))
+ fseek(sgip->file, offset, SEEK_SET);
+
+ if (sgip->bpp == 1)
+ {
+ for (x = sgip->xsize; x > 0; x --, row ++)
+ putc(*row, sgip->file);
+ }
+ else
+ {
+ for (x = sgip->xsize; x > 0; x --, row ++)
+ putshort(*row, sgip->file);
+ }
+ break;
+
+ case SGI_COMP_ARLE :
+ if (sgip->table[z][y] != 0)
+ return (-1);
+
+ /*
+ * First check the last row written...
+ */
+
+ if (sgip->arle_offset > 0)
+ {
+ for (x = 0; x < sgip->xsize; x ++)
+ if (row[x] != sgip->arle_row[x])
+ break;
+
+ if (x == sgip->xsize)
+ {
+ sgip->table[z][y] = sgip->arle_offset;
+ sgip->length[z][y] = sgip->arle_length;
+ return (0);
+ }
+ }
+
+ /*
+ * If that didn't match, search all the previous rows...
+ */
+
+ fseek(sgip->file, sgip->firstrow, SEEK_SET);
+
+ if (sgip->bpp == 1)
+ {
+ for (;;)
+ {
+ sgip->arle_offset = ftell(sgip->file);
+ if ((sgip->arle_length = read_rle8(sgip->file, sgip->arle_row, sgip->xsize)) < 0)
+ {
+ x = 0;
+ break;
+ }
+
+ if (memcmp(row, sgip->arle_row, sgip->xsize * sizeof(unsigned short)) == 0)
+ {
+ x = sgip->xsize;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (;;)
+ {
+ sgip->arle_offset = ftell(sgip->file);
+ if ((sgip->arle_length = read_rle16(sgip->file, sgip->arle_row, sgip->xsize)) < 0)
+ {
+ x = 0;
+ break;
+ }
+
+ if (memcmp(row, sgip->arle_row, sgip->xsize * sizeof(unsigned short)) == 0)
+ {
+ x = sgip->xsize;
+ break;
+ }
+ }
+ }
+
+ if (x == sgip->xsize)
+ {
+ sgip->table[z][y] = sgip->arle_offset;
+ sgip->length[z][y] = sgip->arle_length;
+ return (0);
+ }
+ else
+ fseek(sgip->file, 0, SEEK_END); /* Clear EOF */
+
+ case SGI_COMP_RLE :
+ if (sgip->table[z][y] != 0)
+ return (-1);
+
+ offset = sgip->table[z][y] = sgip->nextrow;
+
+ if (offset != ftell(sgip->file))
+ fseek(sgip->file, offset, SEEK_SET);
+
+ if (sgip->bpp == 1)
+ x = write_rle8(sgip->file, row, sgip->xsize);
+ else
+ x = write_rle16(sgip->file, row, sgip->xsize);
+
+ if (sgip->comp == SGI_COMP_ARLE)
+ {
+ sgip->arle_offset = offset;
+ sgip->arle_length = x;
+ memcpy(sgip->arle_row, row, sgip->xsize * sizeof(unsigned short));
+ }
+
+ sgip->nextrow = ftell(sgip->file);
+ sgip->length[z][y] = x;
+
+ return (x);
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'getlong()' - Get a 32-bit big-endian integer.
+ */
+
+static int /* O - Long value */
+getlong(FILE *fp) /* I - File to read from */
+{
+ unsigned char b[4]; /* Bytes from file */
+
+
+ fread(b, 4, 1, fp);
+ return ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]);
+}
+
+
+/*
+ * 'getshort()' - Get a 16-bit big-endian integer.
+ */
+
+static int /* O - Short value */
+getshort(FILE *fp) /* I - File to read from */
+{
+ unsigned char b[2]; /* Bytes from file */
+
+
+ fread(b, 2, 1, fp);
+ return ((b[0] << 8) | b[1]);
+}
+
+
+/*
+ * 'putlong()' - Put a 32-bit big-endian integer.
+ */
+
+static int /* O - 0 on success, -1 on error */
+putlong(long n, /* I - Long to write */
+ FILE *fp) /* I - File to write to */
+{
+ if (putc(n >> 24, fp) == EOF)
+ return (EOF);
+ if (putc(n >> 16, fp) == EOF)
+ return (EOF);
+ if (putc(n >> 8, fp) == EOF)
+ return (EOF);
+ if (putc(n, fp) == EOF)
+ return (EOF);
+ else
+ return (0);
+}
+
+
+/*
+ * 'putshort()' - Put a 16-bit big-endian integer.
+ */
+
+static int /* O - 0 on success, -1 on error */
+putshort(unsigned short n, /* I - Short to write */
+ FILE *fp) /* I - File to write to */
+{
+ if (putc(n >> 8, fp) == EOF)
+ return (EOF);
+ if (putc(n, fp) == EOF)
+ return (EOF);
+ else
+ return (0);
+}
+
+
+/*
+ * 'read_rle8()' - Read 8-bit RLE data.
+ */
+
+static int /* O - Value on success, -1 on error */
+read_rle8(FILE *fp, /* I - File to read from */
+ unsigned short *row, /* O - Data */
+ int xsize) /* I - Width of data in pixels */
+{
+ int i, /* Looping var */
+ ch, /* Current character */
+ count, /* RLE count */
+ length; /* Number of bytes read... */
+
+
+ length = 0;
+
+ while (xsize > 0)
+ {
+ if ((ch = getc(fp)) == EOF)
+ return (-1);
+ length ++;
+
+ count = ch & 127;
+ if (count == 0)
+ break;
+
+ if (ch & 128)
+ {
+ for (i = 0; i < count; i ++, row ++, xsize --, length ++)
+ if (xsize > 0)
+ *row = getc(fp);
+ }
+ else
+ {
+ ch = getc(fp);
+ length ++;
+ for (i = 0; i < count && xsize > 0; i ++, row ++, xsize --)
+ *row = ch;
+ }
+ }
+
+ return (xsize > 0 ? -1 : length);
+}
+
+
+/*
+ * 'read_rle16()' - Read 16-bit RLE data.
+ */
+
+static int /* O - Value on success, -1 on error */
+read_rle16(FILE *fp, /* I - File to read from */
+ unsigned short *row, /* O - Data */
+ int xsize) /* I - Width of data in pixels */
+{
+ int i, /* Looping var */
+ ch, /* Current character */
+ count, /* RLE count */
+ length; /* Number of bytes read... */
+
+
+ length = 0;
+
+ while (xsize > 0)
+ {
+ if ((ch = getshort(fp)) == EOF)
+ return (-1);
+ length ++;
+
+ count = ch & 127;
+ if (count == 0)
+ break;
+
+ if (ch & 128)
+ {
+ for (i = 0; i < count; i ++, row ++, xsize --, length ++)
+ if (xsize > 0)
+ *row = getshort(fp);
+ }
+ else
+ {
+ ch = getshort(fp);
+ length ++;
+ for (i = 0; i < count && xsize > 0; i ++, row ++, xsize --)
+ *row = ch;
+ }
+ }
+
+ return (xsize > 0 ? -1 : length * 2);
+}
+
+
+/*
+ * 'write_rle8()' - Write 8-bit RLE data.
+ */
+
+static int /* O - Length on success, -1 on error */
+write_rle8(FILE *fp, /* I - File to write to */
+ unsigned short *row, /* I - Data */
+ int xsize) /* I - Width of data in pixels */
+{
+ int length, /* Length in bytes */
+ count, /* Number of repeating pixels */
+ i, /* Looping var */
+ x; /* Current column */
+ unsigned short *start, /* Start of current sequence */
+ repeat; /* Repeated pixel */
+
+
+ for (x = xsize, length = 0; x > 0;)
+ {
+ start = row;
+ row += 2;
+ x -= 2;
+
+ while (x > 0 && (row[-2] != row[-1] || row[-1] != row[0]))
+ {
+ row ++;
+ x --;
+ }
+
+ row -= 2;
+ x += 2;
+
+ count = row - start;
+ while (count > 0)
+ {
+ i = count > 126 ? 126 : count;
+ count -= i;
+
+ if (putc(128 | i, fp) == EOF)
+ return (-1);
+ length ++;
+
+ while (i > 0)
+ {
+ if (putc(*start, fp) == EOF)
+ return (-1);
+ start ++;
+ i --;
+ length ++;
+ }
+ }
+
+ if (x <= 0)
+ break;
+
+ start = row;
+ repeat = row[0];
+
+ row ++;
+ x --;
+
+ while (x > 0 && *row == repeat)
+ {
+ row ++;
+ x --;
+ }
+
+ count = row - start;
+ while (count > 0)
+ {
+ i = count > 126 ? 126 : count;
+ count -= i;
+
+ if (putc(i, fp) == EOF)
+ return (-1);
+ length ++;
+
+ if (putc(repeat, fp) == EOF)
+ return (-1);
+ length ++;
+ }
+ }
+
+ length ++;
+
+ if (putc(0, fp) == EOF)
+ return (-1);
+ else
+ return (length);
+}
+
+
+/*
+ * 'write_rle16()' - Write 16-bit RLE data.
+ */
+
+static int /* O - Length in words */
+write_rle16(FILE *fp, /* I - File to write to */
+ unsigned short *row, /* I - Data */
+ int xsize) /* I - Width of data in pixels */
+{
+ int length, /* Length in words */
+ count, /* Number of repeating pixels */
+ i, /* Looping var */
+ x; /* Current column */
+ unsigned short *start, /* Start of current sequence */
+ repeat; /* Repeated pixel */
+
+
+ for (x = xsize, length = 0; x > 0;)
+ {
+ start = row;
+ row += 2;
+ x -= 2;
+
+ while (x > 0 && (row[-2] != row[-1] || row[-1] != row[0]))
+ {
+ row ++;
+ x --;
+ }
+
+ row -= 2;
+ x += 2;
+
+ count = row - start;
+ while (count > 0)
+ {
+ i = count > 126 ? 126 : count;
+ count -= i;
+
+ if (putshort(128 | i, fp) == EOF)
+ return (-1);
+ length ++;
+
+ while (i > 0)
+ {
+ if (putshort(*start, fp) == EOF)
+ return (-1);
+ start ++;
+ i --;
+ length ++;
+ }
+ }
+
+ if (x <= 0)
+ break;
+
+ start = row;
+ repeat = row[0];
+
+ row ++;
+ x --;
+
+ while (x > 0 && *row == repeat)
+ {
+ row ++;
+ x --;
+ }
+
+ count = row - start;
+ while (count > 0)
+ {
+ i = count > 126 ? 126 : count;
+ count -= i;
+
+ if (putshort(i, fp) == EOF)
+ return (-1);
+ length ++;
+
+ if (putshort(repeat, fp) == EOF)
+ return (-1);
+ length ++;
+ }
+ }
+
+ length ++;
+
+ if (putshort(0, fp) == EOF)
+ return (-1);
+ else
+ return (2 * length);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Sun Raster image file routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadSunRaster() - Read a SunRaster image file.
+ * read_unsigned() - Read a 32-bit unsigned integer.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+#define RAS_MAGIC 0x59a66a95
+
+ /* Sun supported ras_type's */
+#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */
+#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */
+#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */
+#define RT_FORMAT_RGB 3 /* XRGB or RGB instead of XBGR or BGR */
+#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */
+
+ /* Sun registered ras_maptype's */
+#define RMT_RAW 2
+ /* Sun supported ras_maptype's */
+#define RMT_NONE 0 /* ras_maplength is expected to be 0 */
+#define RMT_EQUAL_RGB 1 /* red[ras_maplength/3],green[],blue[] */
+
+#define RAS_RLE 0x80
+
+/*
+ * NOTES:
+ * Each line of the image is rounded out to a multiple of 16 bits.
+ * This corresponds to the rounding convention used by the memory pixrect
+ * package (/usr/include/pixrect/memvar.h) of the SunWindows system.
+ * The ras_encoding field (always set to 0 by Sun's supported software)
+ * was renamed to ras_length in release 2.0. As a result, rasterfiles
+ * of type 0 generated by the old software claim to have 0 length; for
+ * compatibility, code reading rasterfiles must be prepared to compute the
+ * true length from the width, height, and depth fields.
+ */
+
+/*
+ * Local functions...
+ */
+
+static unsigned read_unsigned(FILE *fp);
+
+
+/*
+ * '_cupsImageReadSunRaster()' - Read a SunRaster image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadSunRaster(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ int i, x, y,
+ bpp, /* Bytes per pixel */
+ scanwidth,
+ run_count,
+ run_value;
+ cups_ib_t *in,
+ *out,
+ *scanline,
+ *scanptr,
+ *p,
+ bit;
+ unsigned ras_depth, /* depth (1, 8, or 24 bits) of pixel */
+ ras_type, /* type of file; see RT_* below */
+ ras_maplength; /* length (bytes) of following map */
+ unsigned char cmap[3][256]; /* colormap */
+
+
+ /*
+ * Read the header; we already know that this is a raster file (cupsImageOpen
+ * checks this) so we don't need to check the magic number again.
+ */
+
+ fputs("DEBUG: Reading Sun Raster image...\n", stderr);
+
+ read_unsigned(fp); /* Skip magic */
+ img->xsize = read_unsigned(fp);
+ img->ysize = read_unsigned(fp);
+ ras_depth = read_unsigned(fp);
+ /* ras_length */read_unsigned(fp);
+ ras_type = read_unsigned(fp);
+ /* ras_maptype*/read_unsigned(fp);
+ ras_maplength = read_unsigned(fp);
+
+ fprintf(stderr, "DEBUG: ras_width=%d, ras_height=%d, ras_depth=%d, ras_type=%d, ras_maplength=%d\n",
+ img->xsize, img->ysize, ras_depth, ras_type, ras_maplength);
+
+ if (ras_maplength > 768 ||
+ img->xsize == 0 || img->xsize > CUPS_IMAGE_MAX_WIDTH ||
+ img->ysize == 0 || img->ysize > CUPS_IMAGE_MAX_HEIGHT ||
+ ras_depth == 0 || ras_depth > 32)
+ {
+ fputs("DEBUG: Raster image cannot be loaded!\n", stderr);
+ return (1);
+ }
+
+ if (ras_maplength > 0)
+ {
+ memset(cmap[0], 255, sizeof(cmap[0]));
+ memset(cmap[1], 0, sizeof(cmap[1]));
+ memset(cmap[2], 0, sizeof(cmap[2]));
+
+ fread(cmap[0], 1, ras_maplength / 3, fp);
+ fread(cmap[1], 1, ras_maplength / 3, fp);
+ fread(cmap[2], 1, ras_maplength / 3, fp);
+ }
+
+ /*
+ * Compute the width of each line and allocate memory as needed...
+ */
+
+ scanwidth = (img->xsize * ras_depth + 7) / 8;
+ if (scanwidth & 1)
+ scanwidth ++;
+
+ if (ras_depth < 24 && ras_maplength == 0)
+ {
+ img->colorspace = secondary;
+ in = malloc(img->xsize + 1);
+ }
+ else
+ {
+ img->colorspace = (primary == CUPS_IMAGE_RGB_CMYK) ? CUPS_IMAGE_RGB : primary;
+ in = malloc(img->xsize * 3 + 1);
+ }
+
+ if (!in)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ if ((scanline = malloc(scanwidth)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ free(out);
+ return (1);
+ }
+
+ run_count = 0;
+ run_value = 0;
+
+ fprintf(stderr, "DEBUG: bpp=%d, scanwidth=%d\n", bpp, scanwidth);
+
+ for (y = 0; y < img->ysize; y ++)
+ {
+ if ((ras_depth != 8 && ras_depth != 24) || ras_maplength > 0)
+ p = scanline;
+ else
+ p = in;
+
+ if (ras_type != RT_BYTE_ENCODED)
+ fread(p, scanwidth, 1, fp);
+ else
+ {
+ for (i = scanwidth; i > 0; i --, p ++)
+ {
+ if (run_count > 0)
+ {
+ *p = run_value;
+ run_count --;
+ }
+ else
+ {
+ run_value = getc(fp);
+
+ if (run_value == RAS_RLE)
+ {
+ run_count = getc(fp);
+ if (run_count == 0)
+ *p = RAS_RLE;
+ else
+ run_value = *p = getc(fp);
+ }
+ else
+ *p = run_value;
+ }
+ }
+ }
+
+ if (ras_depth == 1 && ras_maplength == 0)
+ {
+ /*
+ * 1-bit B&W image...
+ */
+
+ for (x = img->xsize, bit = 128, scanptr = scanline, p = in;
+ x > 0;
+ x --, p ++)
+ {
+ if (*scanptr & bit)
+ *p = 255;
+ else
+ *p = 0;
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (ras_depth == 1)
+ {
+ /*
+ * 1-bit colormapped image...
+ */
+
+ for (x = img->xsize, bit = 128, scanptr = scanline, p = in;
+ x > 0;
+ x --)
+ {
+ if (*scanptr & bit)
+ {
+ *p++ = cmap[0][1];
+ *p++ = cmap[1][1];
+ *p++ = cmap[2][1];
+ }
+ else
+ {
+ *p++ = cmap[0][0];
+ *p++ = cmap[1][0];
+ *p++ = cmap[2][0];
+ }
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (ras_depth == 8 && ras_maplength > 0)
+ {
+ /*
+ * 8-bit colormapped image.
+ */
+
+ for (x = img->xsize, scanptr = scanline, p = in;
+ x > 0;
+ x --)
+ {
+ *p++ = cmap[0][*scanptr];
+ *p++ = cmap[1][*scanptr];
+ *p++ = cmap[2][*scanptr++];
+ }
+ }
+ else if (ras_depth == 24 && ras_type != RT_FORMAT_RGB)
+ {
+ /*
+ * Convert BGR to RGB...
+ */
+
+ for (x = img->xsize, scanptr = scanline, p = in;
+ x > 0;
+ x --, scanptr += 3)
+ {
+ *p++ = scanptr[2];
+ *p++ = scanptr[1];
+ *p++ = scanptr[0];
+ }
+ }
+
+ if (ras_depth <= 8 && ras_maplength == 0)
+ {
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ {
+ if (lut)
+ cupsImageLut(in, img->xsize, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, in);
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+
+ free(scanline);
+ free(in);
+ free(out);
+
+ fclose(fp);
+
+ return (0);
+}
+
+
+/*
+ * 'read_unsigned()' - Read a 32-bit unsigned integer.
+ */
+
+static unsigned /* O - Integer from file */
+read_unsigned(FILE *fp) /* I - File to read from */
+{
+ unsigned v; /* Integer from file */
+
+
+ v = getc(fp);
+ v = (v << 8) | getc(fp);
+ v = (v << 8) | getc(fp);
+ v = (v << 8) | getc(fp);
+
+ return (v);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * TIFF file routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageReadTIFF() - Read a TIFF image file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+#ifdef HAVE_LIBTIFF
+# include <tiff.h> /* TIFF image definitions */
+# include <tiffio.h>
+# include <unistd.h>
+
+
+/*
+ * '_cupsImageReadTIFF()' - Read a TIFF image file.
+ */
+
+int /* O - Read status */
+_cupsImageReadTIFF(
+ cups_image_t *img, /* IO - cupsImage */
+ FILE *fp, /* I - cupsImage file */
+ cups_icspace_t primary, /* I - Primary choice for colorspace */
+ cups_icspace_t secondary, /* I - Secondary choice for colorspace */
+ int saturation, /* I - Color saturation (%) */
+ int hue, /* I - Color hue (degrees) */
+ const cups_ib_t *lut) /* I - Lookup table for gamma/brightness */
+{
+ TIFF *tif; /* TIFF file */
+ uint32 width, height; /* Size of image */
+ uint16 photometric, /* Colorspace */
+ compression, /* Type of compression */
+ orientation, /* Orientation */
+ resunit, /* Units for resolution */
+ samples, /* Number of samples/pixel */
+ bits, /* Number of bits/pixel */
+ inkset, /* Ink set for color separations */
+ numinks; /* Number of inks in set */
+ float xres, /* Horizontal resolution */
+ yres; /* Vertical resolution */
+ uint16 *redcmap, /* Red colormap information */
+ *greencmap, /* Green colormap information */
+ *bluecmap; /* Blue colormap information */
+ int c, /* Color index */
+ num_colors, /* Number of colors */
+ bpp, /* Bytes per pixel */
+ x, y, /* Current x & y */
+ row, /* Current row in image */
+ xstart, ystart, /* Starting x & y */
+ xdir, ydir, /* X & y direction */
+ xcount, ycount, /* X & Y counters */
+ pstep, /* Pixel step (= bpp or -2 * bpp) */
+ scanwidth, /* Width of scanline */
+ r, g, b, k, /* Red, green, blue, and black values */
+ alpha; /* cupsImage includes alpha? */
+ cups_ib_t *in, /* Input buffer */
+ *out, /* Output buffer */
+ *p, /* Pointer into buffer */
+ *scanline, /* Scanline buffer */
+ *scanptr, /* Pointer into scanline buffer */
+ bit, /* Current bit */
+ pixel, /* Current pixel */
+ zero, /* Zero value (bitmaps) */
+ one; /* One value (bitmaps) */
+
+
+ /*
+ * Open the TIFF file and get the required parameters...
+ */
+
+ lseek(fileno(fp), 0, SEEK_SET); /* Work around "feature" in some stdio's */
+
+ if ((tif = TIFFFdOpen(fileno(fp), "", "r")) == NULL)
+ {
+ fputs("DEBUG: TIFFFdOpen() failed!\n", stderr);
+ fclose(fp);
+ return (-1);
+ }
+
+ if (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width))
+ {
+ fputs("DEBUG: No image width tag in the file!\n", stderr);
+ TIFFClose(tif);
+ fclose(fp);
+ return (-1);
+ }
+
+ if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height))
+ {
+ fputs("DEBUG: No image height tag in the file!\n", stderr);
+ TIFFClose(tif);
+ fclose(fp);
+ return (-1);
+ }
+
+ if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric))
+ {
+ fputs("DEBUG: No photometric tag in the file!\n", stderr);
+ TIFFClose(tif);
+ fclose(fp);
+ return (-1);
+ }
+
+ if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression))
+ {
+ fputs("DEBUG: No compression tag in the file!\n", stderr);
+ TIFFClose(tif);
+ fclose(fp);
+ return (-1);
+ }
+
+ if (!TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samples))
+ samples = 1;
+
+ if (!TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bits))
+ bits = 1;
+
+ /*
+ * Get the image orientation...
+ */
+
+ if (!TIFFGetField(tif, TIFFTAG_ORIENTATION, &orientation))
+ orientation = 0;
+
+ /*
+ * Get the image resolution...
+ */
+
+ if (TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) &&
+ TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) &&
+ TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit))
+ {
+ if (resunit == RESUNIT_INCH)
+ {
+ img->xppi = xres;
+ img->yppi = yres;
+ }
+ else if (resunit == RESUNIT_CENTIMETER)
+ {
+ img->xppi = xres * 2.54;
+ img->yppi = yres * 2.54;
+ }
+ else
+ {
+ img->xppi = 128;
+ img->yppi = 128;
+ }
+
+ if (img->xppi == 0 || img->yppi == 0)
+ {
+ fputs("DEBUG: Bad TIFF resolution.\n", stderr);
+ img->xppi = img->yppi = 128;
+ }
+
+ fprintf(stderr, "DEBUG: TIFF resolution = %fx%f, units=%d\n",
+ xres, yres, resunit);
+ fprintf(stderr, "DEBUG: Stored resolution = %dx%d PPI\n",
+ img->xppi, img->yppi);
+ }
+
+ /*
+ * See if the image has an alpha channel...
+ */
+
+ if (samples == 2 || (samples == 4 && photometric == PHOTOMETRIC_RGB))
+ alpha = 1;
+ else
+ alpha = 0;
+
+ /*
+ * Check the size of the image...
+ */
+
+ if (width == 0 || width > CUPS_IMAGE_MAX_WIDTH ||
+ height == 0 || height > CUPS_IMAGE_MAX_HEIGHT ||
+ (bits != 1 && bits != 2 && bits != 4 && bits != 8) ||
+ samples < 1 || samples > 4)
+ {
+ fprintf(stderr, "DEBUG: Bad TIFF dimensions %ux%ux%ux%u!\n",
+ (unsigned)width, (unsigned)height, (unsigned)bits,
+ (unsigned)samples);
+ TIFFClose(tif);
+ fclose(fp);
+ return (1);
+ }
+
+ /*
+ * Setup the image size and colorspace...
+ */
+
+ img->xsize = width;
+ img->ysize = height;
+ if (photometric == PHOTOMETRIC_MINISBLACK ||
+ photometric == PHOTOMETRIC_MINISWHITE)
+ img->colorspace = secondary;
+ else if (photometric == PHOTOMETRIC_SEPARATED && primary == CUPS_IMAGE_RGB_CMYK)
+ img->colorspace = CUPS_IMAGE_CMYK;
+ else if (primary == CUPS_IMAGE_RGB_CMYK)
+ img->colorspace = CUPS_IMAGE_RGB;
+ else
+ img->colorspace = primary;
+
+ fprintf(stderr, "DEBUG: img->colorspace = %d\n", img->colorspace);
+
+ bpp = cupsImageGetDepth(img);
+
+ cupsImageSetMaxTiles(img, 0);
+
+ /*
+ * Set the X & Y start and direction according to the image orientation...
+ */
+
+ switch (orientation)
+ {
+ case ORIENTATION_TOPRIGHT :
+ fputs("DEBUG: orientation = top-right\n", stderr);
+ break;
+ case ORIENTATION_RIGHTTOP :
+ fputs("DEBUG: orientation = right-top\n", stderr);
+ break;
+ default :
+ case ORIENTATION_TOPLEFT :
+ fputs("DEBUG: orientation = top-left\n", stderr);
+ break;
+ case ORIENTATION_LEFTTOP :
+ fputs("DEBUG: orientation = left-top\n", stderr);
+ break;
+ case ORIENTATION_BOTLEFT :
+ fputs("DEBUG: orientation = bottom-left\n", stderr);
+ break;
+ case ORIENTATION_LEFTBOT :
+ fputs("DEBUG: orientation = left-bottom\n", stderr);
+ break;
+ case ORIENTATION_BOTRIGHT :
+ fputs("DEBUG: orientation = bottom-right\n", stderr);
+ break;
+ case ORIENTATION_RIGHTBOT :
+ fputs("DEBUG: orientation = right-bottom\n", stderr);
+ break;
+ }
+
+ switch (orientation)
+ {
+ case ORIENTATION_TOPRIGHT :
+ case ORIENTATION_RIGHTTOP :
+ xstart = img->xsize - 1;
+ xdir = -1;
+ ystart = 0;
+ ydir = 1;
+ break;
+ default :
+ case ORIENTATION_TOPLEFT :
+ case ORIENTATION_LEFTTOP :
+ xstart = 0;
+ xdir = 1;
+ ystart = 0;
+ ydir = 1;
+ break;
+ case ORIENTATION_BOTLEFT :
+ case ORIENTATION_LEFTBOT :
+ xstart = 0;
+ xdir = 1;
+ ystart = img->ysize - 1;
+ ydir = -1;
+ break;
+ case ORIENTATION_BOTRIGHT :
+ case ORIENTATION_RIGHTBOT :
+ xstart = img->xsize - 1;
+ xdir = -1;
+ ystart = img->ysize - 1;
+ ydir = -1;
+ break;
+ }
+
+ /*
+ * Allocate a scanline buffer...
+ */
+
+ scanwidth = TIFFScanlineSize(tif);
+ scanline = _TIFFmalloc(scanwidth);
+
+ /*
+ * Allocate input and output buffers...
+ */
+
+ if (orientation < ORIENTATION_LEFTTOP)
+ {
+ if (samples > 1 || photometric == PHOTOMETRIC_PALETTE)
+ pstep = xdir * 3;
+ else
+ pstep = xdir;
+
+ in = malloc(img->xsize * 3 + 3);
+ out = malloc(img->xsize * bpp);
+ }
+ else
+ {
+ if (samples > 1 || photometric == PHOTOMETRIC_PALETTE)
+ pstep = ydir * 3;
+ else
+ pstep = ydir;
+
+ in = malloc(img->ysize * 3 + 3);
+ out = malloc(img->ysize * bpp);
+ }
+
+ /*
+ * Read the image. This is greatly complicated by the fact that TIFF
+ * supports literally hundreds of different colorspaces and orientations,
+ * each which must be handled separately...
+ */
+
+ fprintf(stderr, "DEBUG: photometric = %d\n", photometric);
+ fprintf(stderr, "DEBUG: compression = %d\n", compression);
+
+ switch (photometric)
+ {
+ case PHOTOMETRIC_MINISWHITE :
+ case PHOTOMETRIC_MINISBLACK :
+ if (photometric == PHOTOMETRIC_MINISWHITE)
+ {
+ zero = 255;
+ one = 0;
+ }
+ else
+ {
+ zero = 0;
+ one = 255;
+ }
+
+ if (orientation < ORIENTATION_LEFTTOP)
+ {
+ /*
+ * Row major order...
+ */
+
+ for (y = ystart, ycount = img->ysize, row = 0;
+ ycount > 0;
+ ycount --, y += ydir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart, bit = 128;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (*scanptr & bit)
+ *p = one;
+ else
+ *p = zero;
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart, bit = 0xc0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ pixel = *scanptr & bit;
+ while (pixel > 3)
+ pixel >>= 2;
+ *p = (255 * pixel / 3) ^ zero;
+
+ if (bit > 3)
+ bit >>= 2;
+ else
+ {
+ bit = 0xc0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart, bit = 0xf0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (bit == 0xf0)
+ {
+ *p = (255 * ((*scanptr & 0xf0) >> 4) / 15) ^ zero;
+ bit = 0x0f;
+ }
+ else
+ {
+ *p = (255 * (*scanptr & 0x0f) / 15) ^ zero;
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (xdir < 0 || zero || alpha)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ if (alpha)
+ {
+ if (zero)
+ {
+ for (xcount = img->xsize, p = in + xstart, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 2)
+ *p = (scanptr[1] * (255 - scanptr[0]) +
+ (255 - scanptr[1]) * 255) / 255;
+ }
+ else
+ {
+ for (xcount = img->xsize, p = in + xstart, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 2)
+ *p = (scanptr[1] * scanptr[0] +
+ (255 - scanptr[1]) * 255) / 255;
+ }
+ }
+ else
+ {
+ if (zero)
+ {
+ for (xcount = img->xsize, p = in + xstart, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr ++)
+ *p = 255 - *scanptr;
+ }
+ else
+ {
+ for (xcount = img->xsize, p = in + xstart, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr ++)
+ *p = *scanptr;
+ }
+ }
+ }
+ else
+ TIFFReadScanline(tif, in, row, 0);
+
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ {
+ if (lut)
+ cupsImageLut(in, img->xsize, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, in);
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageWhiteToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Column major order...
+ */
+
+ for (x = xstart, xcount = img->xsize, row = 0;
+ xcount > 0;
+ xcount --, x += xdir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart, bit = 128;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ if (*scanptr & bit)
+ *p = one;
+ else
+ *p = zero;
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart, bit = 0xc0;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ pixel = *scanptr & 0xc0;
+ while (pixel > 3)
+ pixel >>= 2;
+
+ *p = (255 * pixel / 3) ^ zero;
+
+ if (bit > 3)
+ bit >>= 2;
+ else
+ {
+ bit = 0xc0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart, bit = 0xf0;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ if (bit == 0xf0)
+ {
+ *p = (255 * ((*scanptr & 0xf0) >> 4) / 15) ^ zero;
+ bit = 0x0f;
+ }
+ else
+ {
+ *p = (255 * (*scanptr & 0x0f) / 15) ^ zero;
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (ydir < 0 || zero || alpha)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ if (alpha)
+ {
+ if (zero)
+ {
+ for (ycount = img->ysize, p = in + ystart, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += ydir, scanptr += 2)
+ *p = (scanptr[1] * (255 - scanptr[0]) +
+ (255 - scanptr[1]) * 255) / 255;
+ }
+ else
+ {
+ for (ycount = img->ysize, p = in + ystart, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += ydir, scanptr += 2)
+ *p = (scanptr[1] * scanptr[0] +
+ (255 - scanptr[1]) * 255) / 255;
+ }
+ }
+ else
+ {
+ if (zero)
+ {
+ for (ycount = img->ysize, p = in + ystart, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += ydir, scanptr ++)
+ *p = 255 - *scanptr;
+ }
+ else
+ {
+ for (ycount = img->ysize, p = in + ystart, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += ydir, scanptr ++)
+ *p = *scanptr;
+ }
+ }
+ }
+ else
+ TIFFReadScanline(tif, in, row, 0);
+
+ if (img->colorspace == CUPS_IMAGE_WHITE)
+ {
+ if (lut)
+ cupsImageLut(in, img->ysize, lut);
+
+ _cupsImagePutCol(img, x, 0, img->ysize, in);
+ }
+ else
+ {
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_RGB :
+ cupsImageWhiteToRGB(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageWhiteToBlack(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageWhiteToCMY(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageWhiteToCMYK(in, out, img->ysize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->ysize * bpp, lut);
+
+ _cupsImagePutCol(img, x, 0, img->ysize, out);
+ }
+ }
+ }
+ break;
+
+ case PHOTOMETRIC_PALETTE :
+ if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &redcmap, &greencmap, &bluecmap))
+ {
+ fputs("DEBUG: No colormap tag in the file!\n", stderr);
+ fclose(fp);
+ return (-1);
+ }
+
+ num_colors = 1 << bits;
+
+ for (c = 0; c < num_colors; c ++)
+ {
+ redcmap[c] >>= 8;
+ greencmap[c] >>= 8;
+ bluecmap[c] >>= 8;
+ }
+
+ if (orientation < ORIENTATION_LEFTTOP)
+ {
+ /*
+ * Row major order...
+ */
+
+ for (y = ystart, ycount = img->ysize, row = 0;
+ ycount > 0;
+ ycount --, y += ydir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline,
+ p = in + xstart * 3, bit = 128;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (*scanptr & bit)
+ {
+ p[0] = redcmap[1];
+ p[1] = greencmap[1];
+ p[2] = bluecmap[1];
+ }
+ else
+ {
+ p[0] = redcmap[0];
+ p[1] = greencmap[0];
+ p[2] = bluecmap[0];
+ }
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline,
+ p = in + xstart * 3, bit = 0xc0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ pixel = *scanptr & bit;
+ while (pixel > 3)
+ pixel >>= 2;
+
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+
+ if (bit > 3)
+ bit >>= 2;
+ else
+ {
+ bit = 0xc0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline,
+ p = in + 3 * xstart, bit = 0xf0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (bit == 0xf0)
+ {
+ pixel = (*scanptr & 0xf0) >> 4;
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+ bit = 0x0f;
+ }
+ else
+ {
+ pixel = *scanptr++ & 0x0f;
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+ bit = 0xf0;
+ }
+ }
+ }
+ else
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ for (xcount = img->xsize, p = in + 3 * xstart, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ p[0] = redcmap[*scanptr];
+ p[1] = greencmap[*scanptr];
+ p[2] = bluecmap[*scanptr++];
+ }
+ }
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ /*
+ * Column major order...
+ */
+
+ for (x = xstart, xcount = img->xsize, row = 0;
+ xcount > 0;
+ xcount --, x += xdir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline,
+ p = in + 3 * ystart, bit = 128;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ if (*scanptr & bit)
+ {
+ p[0] = redcmap[1];
+ p[1] = greencmap[1];
+ p[2] = bluecmap[1];
+ }
+ else
+ {
+ p[0] = redcmap[0];
+ p[1] = greencmap[0];
+ p[2] = bluecmap[0];
+ }
+
+ if (bit > 1)
+ bit >>= 1;
+ else
+ {
+ bit = 128;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline,
+ p = in + 3 * ystart, bit = 0xc0;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ pixel = *scanptr & 0xc0;
+ while (pixel > 3)
+ pixel >>= 2;
+
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+
+ if (bit > 3)
+ bit >>= 2;
+ else
+ {
+ bit = 0xc0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline,
+ p = in + 3 * ystart, bit = 0xf0;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ if (bit == 0xf0)
+ {
+ pixel = (*scanptr & 0xf0) >> 4;
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+ bit = 0x0f;
+ }
+ else
+ {
+ pixel = *scanptr++ & 0x0f;
+ p[0] = redcmap[pixel];
+ p[1] = greencmap[pixel];
+ p[2] = bluecmap[pixel];
+ bit = 0xf0;
+ }
+ }
+ }
+ else
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ for (ycount = img->ysize, p = in + 3 * ystart, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += ydir)
+ {
+ p[0] = redcmap[*scanptr];
+ p[1] = greencmap[*scanptr];
+ p[2] = bluecmap[*scanptr++];
+ }
+ }
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->ysize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->ysize * bpp, lut);
+
+ _cupsImagePutCol(img, x, 0, img->ysize, out);
+ }
+ }
+ break;
+
+ case PHOTOMETRIC_RGB :
+ if (orientation < ORIENTATION_LEFTTOP)
+ {
+ /*
+ * Row major order...
+ */
+
+ for (y = ystart, ycount = img->ysize, row = 0;
+ ycount > 0;
+ ycount --, y += ydir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3, bit = 0xf0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (*scanptr & bit & 0x88)
+ p[0] = 255;
+ else
+ p[0] = 0;
+
+ if (*scanptr & bit & 0x44)
+ p[1] = 255;
+ else
+ p[1] = 0;
+
+ if (*scanptr & bit & 0x22)
+ p[2] = 255;
+ else
+ p[2] = 0;
+
+ if (bit == 0xf0)
+ bit = 0x0f;
+ else
+ {
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3;
+ xcount > 0;
+ xcount --, p += pstep, scanptr ++)
+ {
+ pixel = *scanptr >> 2;
+ p[0] = 255 * (pixel & 3) / 3;
+ pixel >>= 2;
+ p[1] = 255 * (pixel & 3) / 3;
+ pixel >>= 2;
+ p[2] = 255 * (pixel & 3) / 3;
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3;
+ xcount > 0;
+ xcount -= 2, p += 2 * pstep, scanptr += 3)
+ {
+ pixel = scanptr[0];
+ p[1] = 255 * (pixel & 15) / 15;
+ pixel >>= 4;
+ p[0] = 255 * (pixel & 15) / 15;
+ pixel = scanptr[1];
+ p[2] = 255 * ((pixel >> 4) & 15) / 15;
+
+ if (xcount > 1)
+ {
+ p[pstep + 0] = 255 * (pixel & 15) / 15;
+ pixel = scanptr[2];
+ p[pstep + 2] = 255 * (pixel & 15) / 15;
+ pixel >>= 4;
+ p[pstep + 1] = 255 * (pixel & 15) / 15;
+ }
+ }
+ }
+ else if (xdir < 0 || alpha)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ if (alpha)
+ {
+ for (xcount = img->xsize, p = in + xstart * 3, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 4)
+ {
+ p[0] = (scanptr[0] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ p[1] = (scanptr[1] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ p[2] = (scanptr[2] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ }
+ }
+ else
+ {
+ for (xcount = img->xsize, p = in + xstart * 3, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 3)
+ {
+ p[0] = scanptr[0];
+ p[1] = scanptr[1];
+ p[2] = scanptr[2];
+ }
+ }
+ }
+ else
+ TIFFReadScanline(tif, in, row, 0);
+
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * bpp, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ /*
+ * Column major order...
+ */
+
+ for (x = xstart, xcount = img->xsize, row = 0;
+ xcount > 0;
+ xcount --, x += xdir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart * 3, bit = 0xf0;
+ ycount > 0;
+ ycount --, p += pstep)
+ {
+ if (*scanptr & bit & 0x88)
+ p[0] = 255;
+ else
+ p[0] = 0;
+
+ if (*scanptr & bit & 0x44)
+ p[1] = 255;
+ else
+ p[1] = 0;
+
+ if (*scanptr & bit & 0x22)
+ p[2] = 255;
+ else
+ p[2] = 0;
+
+ if (bit == 0xf0)
+ bit = 0x0f;
+ else
+ {
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart * 3;
+ ycount > 0;
+ ycount --, p += pstep, scanptr ++)
+ {
+ pixel = *scanptr >> 2;
+ p[0] = 255 * (pixel & 3) / 3;
+ pixel >>= 2;
+ p[1] = 255 * (pixel & 3) / 3;
+ pixel >>= 2;
+ p[2] = 255 * (pixel & 3) / 3;
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + ystart * 3;
+ ycount > 0;
+ ycount -= 2, p += 2 * pstep, scanptr += 3)
+ {
+ pixel = scanptr[0];
+ p[1] = 255 * (pixel & 15) / 15;
+ pixel >>= 4;
+ p[0] = 255 * (pixel & 15) / 15;
+ pixel = scanptr[1];
+ p[2] = 255 * ((pixel >> 4) & 15) / 15;
+
+ if (ycount > 1)
+ {
+ p[pstep + 0] = 255 * (pixel & 15) / 15;
+ pixel = scanptr[2];
+ p[pstep + 2] = 255 * (pixel & 15) / 15;
+ pixel >>= 4;
+ p[pstep + 1] = 255 * (pixel & 15) / 15;
+ }
+ }
+ }
+ else if (ydir < 0 || alpha)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ if (alpha)
+ {
+ for (ycount = img->ysize, p = in + ystart * 3, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += pstep, scanptr += 4)
+ {
+ p[0] = (scanptr[0] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ p[1] = (scanptr[1] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ p[2] = (scanptr[2] * scanptr[3] + 255 * (255 - scanptr[3])) / 255;
+ }
+ }
+ else
+ {
+ for (ycount = img->ysize, p = in + ystart * 3, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += pstep, scanptr += 3)
+ {
+ p[0] = scanptr[0];
+ p[1] = scanptr[1];
+ p[2] = scanptr[2];
+ }
+ }
+ }
+ else
+ TIFFReadScanline(tif, in, row, 0);
+
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->ysize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->ysize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->ysize * bpp, lut);
+
+ _cupsImagePutCol(img, x, 0, img->ysize, out);
+ }
+ }
+ break;
+
+ case PHOTOMETRIC_SEPARATED :
+ inkset = INKSET_CMYK;
+ numinks = 4;
+
+#ifdef TIFFTAG_NUMBEROFINKS
+ if (!TIFFGetField(tif, TIFFTAG_INKSET, &inkset) &&
+ !TIFFGetField(tif, TIFFTAG_NUMBEROFINKS, &numinks))
+#else
+ if (!TIFFGetField(tif, TIFFTAG_INKSET, &inkset))
+#endif /* TIFFTAG_NUMBEROFINKS */
+ {
+ fputs("WARNING: No inkset or number-of-inks tag in the file!\n", stderr);
+ }
+
+ if (inkset == INKSET_CMYK || numinks == 4)
+ {
+ if (orientation < ORIENTATION_LEFTTOP)
+ {
+ /*
+ * Row major order...
+ */
+
+ for (y = ystart, ycount = img->ysize, row = 0;
+ ycount > 0;
+ ycount --, y += ydir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3, bit = 0xf0;
+ xcount > 0;
+ xcount --, p += pstep)
+ {
+ if (*scanptr & bit & 0x11)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ if (*scanptr & bit & 0x88)
+ p[0] = 0;
+ else
+ p[0] = 255;
+
+ if (*scanptr & bit & 0x44)
+ p[1] = 0;
+ else
+ p[1] = 255;
+
+ if (*scanptr & bit & 0x22)
+ p[2] = 0;
+ else
+ p[2] = 255;
+ }
+
+ if (bit == 0xf0)
+ bit = 0x0f;
+ else
+ {
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3;
+ xcount > 0;
+ xcount --, p += pstep, scanptr ++)
+ {
+ pixel = *scanptr;
+ k = 255 * (pixel & 3) / 3;
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ pixel >>= 2;
+ b = 255 - 255 * (pixel & 3) / 3 - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+
+ pixel >>= 2;
+ g = 255 - 255 * (pixel & 3) / 3 - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ pixel >>= 2;
+ r = 255 - 255 * (pixel & 3) / 3 - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (xcount = img->xsize, scanptr = scanline, p = in + xstart * 3;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 2)
+ {
+ pixel = scanptr[1];
+ k = 255 * (pixel & 15) / 15;
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ pixel >>= 4;
+ b = 255 - 255 * (pixel & 15) / 15 - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+
+ pixel = scanptr[0];
+ g = 255 - 255 * (pixel & 15) / 15 - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ pixel >>= 4;
+ r = 255 - 255 * (pixel & 15) / 15 - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+ }
+ }
+ }
+ else if (img->colorspace == CUPS_IMAGE_CMYK)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ _cupsImagePutRow(img, 0, y, img->xsize, scanline);
+ }
+ else
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ for (xcount = img->xsize, p = in + xstart * 3, scanptr = scanline;
+ xcount > 0;
+ xcount --, p += pstep, scanptr += 4)
+ {
+ k = scanptr[3];
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ r = 255 - scanptr[0] - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+
+ g = 255 - scanptr[1] - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ b = 255 - scanptr[2] - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+ }
+ }
+ }
+
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->xsize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->xsize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->xsize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->xsize * 3, lut);
+
+ _cupsImagePutRow(img, 0, y, img->xsize, out);
+ }
+ }
+ else
+ {
+ /*
+ * Column major order...
+ */
+
+ for (x = xstart, xcount = img->xsize, row = 0;
+ xcount > 0;
+ xcount --, x += xdir, row ++)
+ {
+ if (bits == 1)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + xstart * 3, bit = 0xf0;
+ ycount > 0;
+ ycount --, p += pstep)
+ {
+ if (*scanptr & bit & 0x11)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ if (*scanptr & bit & 0x88)
+ p[0] = 0;
+ else
+ p[0] = 255;
+
+ if (*scanptr & bit & 0x44)
+ p[1] = 0;
+ else
+ p[1] = 255;
+
+ if (*scanptr & bit & 0x22)
+ p[2] = 0;
+ else
+ p[2] = 255;
+ }
+
+ if (bit == 0xf0)
+ bit = 0x0f;
+ else
+ {
+ bit = 0xf0;
+ scanptr ++;
+ }
+ }
+ }
+ else if (bits == 2)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + xstart * 3;
+ ycount > 0;
+ ycount --, p += pstep, scanptr ++)
+ {
+ pixel = *scanptr;
+ k = 255 * (pixel & 3) / 3;
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ pixel >>= 2;
+ b = 255 - 255 * (pixel & 3) / 3 - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+
+ pixel >>= 2;
+ g = 255 - 255 * (pixel & 3) / 3 - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ pixel >>= 2;
+ r = 255 - 255 * (pixel & 3) / 3 - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+ }
+ }
+ }
+ else if (bits == 4)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ for (ycount = img->ysize, scanptr = scanline, p = in + xstart * 3;
+ ycount > 0;
+ ycount --, p += pstep, scanptr += 2)
+ {
+ pixel = scanptr[1];
+ k = 255 * (pixel & 15) / 15;
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ pixel >>= 4;
+ b = 255 - 255 * (pixel & 15) / 15 - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+
+ pixel = scanptr[0];
+ g = 255 - 255 * (pixel & 15) / 15 - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ pixel >>= 4;
+ r = 255 - 255 * (pixel & 15) / 15 - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+ }
+ }
+ }
+ else if (img->colorspace == CUPS_IMAGE_CMYK)
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+ _cupsImagePutCol(img, x, 0, img->ysize, scanline);
+ }
+ else
+ {
+ TIFFReadScanline(tif, scanline, row, 0);
+
+ for (ycount = img->ysize, p = in + xstart * 3, scanptr = scanline;
+ ycount > 0;
+ ycount --, p += pstep, scanptr += 4)
+ {
+ k = scanptr[3];
+ if (k == 255)
+ {
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ }
+ else
+ {
+ r = 255 - scanptr[0] - k;
+ if (r < 0)
+ p[0] = 0;
+ else if (r < 256)
+ p[0] = r;
+ else
+ p[0] = 255;
+
+ g = 255 - scanptr[1] - k;
+ if (g < 0)
+ p[1] = 0;
+ else if (g < 256)
+ p[1] = g;
+ else
+ p[1] = 255;
+
+ b = 255 - scanptr[2] - k;
+ if (b < 0)
+ p[2] = 0;
+ else if (b < 256)
+ p[2] = b;
+ else
+ p[2] = 255;
+ }
+ }
+ }
+
+ if ((saturation != 100 || hue != 0) && bpp > 1)
+ cupsImageRGBAdjust(in, img->ysize, saturation, hue);
+
+ switch (img->colorspace)
+ {
+ default :
+ break;
+
+ case CUPS_IMAGE_WHITE :
+ cupsImageRGBToWhite(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_RGB :
+ cupsImageRGBToRGB(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_BLACK :
+ cupsImageRGBToBlack(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMY :
+ cupsImageRGBToCMY(in, out, img->ysize);
+ break;
+ case CUPS_IMAGE_CMYK :
+ cupsImageRGBToCMYK(in, out, img->ysize);
+ break;
+ }
+
+ if (lut)
+ cupsImageLut(out, img->ysize * bpp, lut);
+
+ _cupsImagePutCol(img, x, 0, img->ysize, out);
+ }
+ }
+
+ break;
+ }
+
+ default :
+ _TIFFfree(scanline);
+ free(in);
+ free(out);
+
+ TIFFClose(tif);
+ fputs("DEBUG: Unknown TIFF photometric value!\n", stderr);
+ return (-1);
+ }
+
+ /*
+ * Free temporary buffers, close the TIFF file, and return.
+ */
+
+ _TIFFfree(scanline);
+ free(in);
+ free(out);
+
+ TIFFClose(tif);
+ return (0);
+}
+#endif /* HAVE_LIBTIFF */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * cupsImage zoom routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * _cupsImageZoomDelete() - Free a zoom record...
+ * _cupsImageZoomFill() - Fill a zoom record...
+ * _cupsImageZoomNew() - Allocate a pixel zoom record...
+ * zoom_bilinear() - Fill a zoom record with image data utilizing
+ * bilinear interpolation.
+ * zoom_nearest() - Fill a zoom record quickly using nearest-neighbor
+ * sampling.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * Local functions...
+ */
+
+static void zoom_bilinear(cups_izoom_t *z, int iy);
+static void zoom_nearest(cups_izoom_t *z, int iy);
+
+
+/*
+ * '_cupsImageZoomDelete()' - Free a zoom record...
+ */
+
+void
+_cupsImageZoomDelete(cups_izoom_t *z) /* I - Zoom record to free */
+{
+ free(z->rows[0]);
+ free(z->rows[1]);
+ free(z->in);
+ free(z);
+}
+
+
+/*
+ * '_cupsImageZoomFill()' - Fill a zoom record with image data utilizing bilinear
+ * interpolation.
+ */
+
+void
+_cupsImageZoomFill(cups_izoom_t *z, /* I - Zoom record to fill */
+ int iy) /* I - Zoom image row */
+{
+ switch (z->type)
+ {
+ case CUPS_IZOOM_FAST :
+ zoom_nearest(z, iy);
+ break;
+
+ default :
+ zoom_bilinear(z, iy);
+ break;
+ }
+}
+
+
+/*
+ * '_cupsImageZoomNew()' - Allocate a pixel zoom record...
+ */
+
+cups_izoom_t *
+_cupsImageZoomNew(
+ cups_image_t *img, /* I - cupsImage to zoom */
+ int xc0, /* I - Upper-lefthand corner */
+ int yc0, /* I - ... */
+ int xc1, /* I - Lower-righthand corner */
+ int yc1, /* I - ... */
+ int xsize, /* I - Final width of image */
+ int ysize, /* I - Final height of image */
+ int rotated, /* I - Non-zero if image is rotated 90 degs */
+ cups_iztype_t type) /* I - Zoom type */
+{
+ cups_izoom_t *z; /* New zoom record */
+ int flip; /* Flip on X axis? */
+
+
+ if (xsize > CUPS_IMAGE_MAX_WIDTH ||
+ ysize > CUPS_IMAGE_MAX_HEIGHT ||
+ (xc1 - xc0) > CUPS_IMAGE_MAX_WIDTH ||
+ (yc1 - yc0) > CUPS_IMAGE_MAX_HEIGHT)
+ return (NULL); /* Protect against integer overflow */
+
+ if ((z = (cups_izoom_t *)calloc(1, sizeof(cups_izoom_t))) == NULL)
+ return (NULL);
+
+ z->img = img;
+ z->row = 0;
+ z->depth = cupsImageGetDepth(img);
+ z->rotated = rotated;
+ z->type = type;
+
+ if (xsize < 0)
+ {
+ flip = 1;
+ xsize = -xsize;
+ }
+ else
+ {
+ flip = 0;
+ }
+
+ if (rotated)
+ {
+ z->xorig = xc1;
+ z->yorig = yc0;
+ z->width = yc1 - yc0 + 1;
+ z->height = xc1 - xc0 + 1;
+ z->xsize = xsize;
+ z->ysize = ysize;
+ z->xmod = z->width % z->xsize;
+ z->xstep = z->width / z->xsize;
+ z->xincr = 1;
+ z->ymod = z->height % z->ysize;
+ z->ystep = z->height / z->ysize;
+ z->yincr = 1;
+ z->instep = z->xstep * z->depth;
+ z->inincr = /* z->xincr * */ z->depth; /* z->xincr is always 1 */
+
+ if (z->width < img->ysize)
+ z->xmax = z->width;
+ else
+ z->xmax = z->width - 1;
+
+ if (z->height < img->xsize)
+ z->ymax = z->height;
+ else
+ z->ymax = z->height - 1;
+ }
+ else
+ {
+ z->xorig = xc0;
+ z->yorig = yc0;
+ z->width = xc1 - xc0 + 1;
+ z->height = yc1 - yc0 + 1;
+ z->xsize = xsize;
+ z->ysize = ysize;
+ z->xmod = z->width % z->xsize;
+ z->xstep = z->width / z->xsize;
+ z->xincr = 1;
+ z->ymod = z->height % z->ysize;
+ z->ystep = z->height / z->ysize;
+ z->yincr = 1;
+ z->instep = z->xstep * z->depth;
+ z->inincr = /* z->xincr * */ z->depth; /* z->xincr is always 1 */
+
+ if (z->width < img->xsize)
+ z->xmax = z->width;
+ else
+ z->xmax = z->width - 1;
+
+ if (z->height < img->ysize)
+ z->ymax = z->height;
+ else
+ z->ymax = z->height - 1;
+ }
+
+ if (flip)
+ {
+ z->instep = -z->instep;
+ z->inincr = -z->inincr;
+ }
+
+ if ((z->rows[0] = (cups_ib_t *)malloc(z->xsize * z->depth)) == NULL)
+ {
+ free(z);
+ return (NULL);
+ }
+
+ if ((z->rows[1] = (cups_ib_t *)malloc(z->xsize * z->depth)) == NULL)
+ {
+ free(z->rows[0]);
+ free(z);
+ return (NULL);
+ }
+
+ if ((z->in = (cups_ib_t *)malloc(z->width * z->depth)) == NULL)
+ {
+ free(z->rows[0]);
+ free(z->rows[1]);
+ free(z);
+ return (NULL);
+ }
+
+ return (z);
+}
+
+
+/*
+ * 'zoom_bilinear()' - Fill a zoom record with image data utilizing bilinear
+ * interpolation.
+ */
+
+static void
+zoom_bilinear(cups_izoom_t *z, /* I - Zoom record to fill */
+ int iy) /* I - Zoom image row */
+{
+ cups_ib_t *r, /* Row pointer */
+ *inptr; /* Pixel pointer */
+ int xerr0, /* X error counter */
+ xerr1; /* ... */
+ int ix,
+ x,
+ count,
+ z_depth,
+ z_xstep,
+ z_xincr,
+ z_instep,
+ z_inincr,
+ z_xmax,
+ z_xmod,
+ z_xsize;
+
+
+ if (iy > z->ymax)
+ iy = z->ymax;
+
+ z->row ^= 1;
+
+ z_depth = z->depth;
+ z_xsize = z->xsize;
+ z_xmax = z->xmax;
+ z_xmod = z->xmod;
+ z_xstep = z->xstep;
+ z_xincr = z->xincr;
+ z_instep = z->instep;
+ z_inincr = z->inincr;
+
+ if (z->rotated)
+ cupsImageGetCol(z->img, z->xorig - iy, z->yorig, z->width, z->in);
+ else
+ cupsImageGetRow(z->img, z->xorig, z->yorig + iy, z->width, z->in);
+
+ if (z_inincr < 0)
+ inptr = z->in + (z->width - 1) * z_depth;
+ else
+ inptr = z->in;
+
+ for (x = z_xsize, xerr0 = z_xsize, xerr1 = 0, ix = 0, r = z->rows[z->row];
+ x > 0;
+ x --)
+ {
+ if (ix < z_xmax)
+ {
+ for (count = 0; count < z_depth; count ++)
+ *r++ = (inptr[count] * xerr0 + inptr[z_depth + count] * xerr1) / z_xsize;
+ }
+ else
+ {
+ for (count = 0; count < z_depth; count ++)
+ *r++ = inptr[count];
+ }
+
+ ix += z_xstep;
+ inptr += z_instep;
+ xerr0 -= z_xmod;
+ xerr1 += z_xmod;
+
+ if (xerr0 <= 0)
+ {
+ xerr0 += z_xsize;
+ xerr1 -= z_xsize;
+ ix += z_xincr;
+ inptr += z_inincr;
+ }
+ }
+}
+
+
+/*
+ * 'zoom_nearest()' - Fill a zoom record quickly using nearest-neighbor
+ * sampling.
+ */
+
+static void
+zoom_nearest(cups_izoom_t *z, /* I - Zoom record to fill */
+ int iy) /* I - Zoom image row */
+{
+ cups_ib_t *r, /* Row pointer */
+ *inptr; /* Pixel pointer */
+ int xerr0; /* X error counter */
+ int ix,
+ x,
+ count,
+ z_depth,
+ z_xstep,
+ z_xincr,
+ z_instep,
+ z_inincr,
+ z_xmod,
+ z_xsize;
+
+
+ if (iy > z->ymax)
+ iy = z->ymax;
+
+ z->row ^= 1;
+
+ z_depth = z->depth;
+ z_xsize = z->xsize;
+ z_xmod = z->xmod;
+ z_xstep = z->xstep;
+ z_xincr = z->xincr;
+ z_instep = z->instep;
+ z_inincr = z->inincr;
+
+ if (z->rotated)
+ cupsImageGetCol(z->img, z->xorig - iy, z->yorig, z->width, z->in);
+ else
+ cupsImageGetRow(z->img, z->xorig, z->yorig + iy, z->width, z->in);
+
+ if (z_inincr < 0)
+ inptr = z->in + (z->width - 1) * z_depth;
+ else
+ inptr = z->in;
+
+ for (x = z_xsize, xerr0 = z_xsize, ix = 0, r = z->rows[z->row];
+ x > 0;
+ x --)
+ {
+ for (count = 0; count < z_depth; count ++)
+ *r++ = inptr[count];
+
+ ix += z_xstep;
+ inptr += z_instep;
+ xerr0 -= z_xmod;
+
+ if (xerr0 <= 0)
+ {
+ xerr0 += z_xsize;
+ ix += z_xincr;
+ inptr += z_inincr;
+ }
+ }
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Base image support for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * cupsImageClose() - Close an image file.
+ * cupsImageGetCol() - Get a column of pixels from an image.
+ * cupsImageGetColorSpace() - Get the image colorspace.
+ * cupsImageGetDepth() - Get the number of bytes per pixel.
+ * cupsImageGetHeight() - Get the height of an image.
+ * cupsImageGetRow() - Get a row of pixels from an image.
+ * cupsImageGetWidth() - Get the width of an image.
+ * cupsImageGetXPPI() - Get the horizontal resolution of an image.
+ * cupsImageGetYPPI() - Get the vertical resolution of an image.
+ * cupsImageOpen() - Open an image file and read it into memory.
+ * _cupsImagePutCol() - Put a column of pixels to an image.
+ * _cupsImagePutRow() - Put a row of pixels to an image.
+ * cupsImageSetMaxTiles() - Set the maximum number of tiles to cache.
+ * flush_tile() - Flush the least-recently-used tile in the cache.
+ * get_tile() - Get a cached tile.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image-private.h"
+
+
+/*
+ * Local functions...
+ */
+
+static void flush_tile(cups_image_t *img);
+static cups_ib_t *get_tile(cups_image_t *img, int x, int y);
+
+
+/*
+ * 'cupsImageClose()' - Close an image file.
+ */
+
+void
+cupsImageClose(cups_image_t *img) /* I - Image to close */
+{
+ cups_ic_t *current, /* Current cached tile */
+ *next; /* Next cached tile */
+
+
+ /*
+ * Wipe the tile cache file (if any)...
+ */
+
+ if (img->cachefile >= 0)
+ {
+ DEBUG_printf(("Closing/removing swap file \"%s\"...\n", img->cachename));
+
+ close(img->cachefile);
+ unlink(img->cachename);
+ }
+
+ /*
+ * Free the image cache...
+ */
+
+ DEBUG_puts("Freeing memory...");
+
+ for (current = img->first, next = NULL; current != NULL; current = next)
+ {
+ DEBUG_printf(("Freeing cache (%p, next = %p)...\n", current, next));
+
+ next = current->next;
+ free(current);
+ }
+
+ /*
+ * Free the rest of memory...
+ */
+
+ if (img->tiles != NULL)
+ {
+ DEBUG_printf(("Freeing tiles (%p)...\n", img->tiles[0]));
+
+ free(img->tiles[0]);
+
+ DEBUG_printf(("Freeing tile pointers (%p)...\n", img->tiles));
+
+ free(img->tiles);
+ }
+
+ free(img);
+}
+
+
+/*
+ * 'cupsImageGetCol()' - Get a column of pixels from an image.
+ */
+
+int /* O - -1 on error, 0 on success */
+cupsImageGetCol(cups_image_t *img, /* I - Image */
+ int x, /* I - Column */
+ int y, /* I - Start row */
+ int height, /* I - Column height */
+ cups_ib_t *pixels) /* O - Pixel data */
+{
+ int bpp, /* Bytes per pixel */
+ twidth, /* Tile width */
+ count; /* Number of pixels to get */
+ const cups_ib_t *ib; /* Pointer into tile */
+
+
+ if (img == NULL || x < 0 || x >= img->xsize || y >= img->ysize)
+ return (-1);
+
+ if (y < 0)
+ {
+ height += y;
+ y = 0;
+ }
+
+ if ((y + height) > img->ysize)
+ height = img->ysize - y;
+
+ if (height < 1)
+ return (-1);
+
+ bpp = cupsImageGetDepth(img);
+ twidth = bpp * (CUPS_TILE_SIZE - 1);
+
+ while (height > 0)
+ {
+ ib = get_tile(img, x, y);
+
+ if (ib == NULL)
+ return (-1);
+
+ count = CUPS_TILE_SIZE - (y & (CUPS_TILE_SIZE - 1));
+ if (count > height)
+ count = height;
+
+ y += count;
+ height -= count;
+
+ for (; count > 0; count --, ib += twidth)
+ switch (bpp)
+ {
+ case 4 :
+ *pixels++ = *ib++;
+ case 3 :
+ *pixels++ = *ib++;
+ *pixels++ = *ib++;
+ case 1 :
+ *pixels++ = *ib++;
+ break;
+ }
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'cupsImageGetColorSpace()' - Get the image colorspace.
+ */
+
+cups_icspace_t /* O - Colorspace */
+cupsImageGetColorSpace(
+ cups_image_t *img) /* I - Image */
+{
+ return (img->colorspace);
+}
+
+
+/*
+ * 'cupsImageGetDepth()' - Get the number of bytes per pixel.
+ */
+
+int /* O - Bytes per pixel */
+cupsImageGetDepth(cups_image_t *img) /* I - Image */
+{
+ return (abs(img->colorspace));
+}
+
+
+/*
+ * 'cupsImageGetHeight()' - Get the height of an image.
+ */
+
+unsigned /* O - Height in pixels */
+cupsImageGetHeight(cups_image_t *img) /* I - Image */
+{
+ return (img->ysize);
+}
+
+
+/*
+ * 'cupsImageGetRow()' - Get a row of pixels from an image.
+ */
+
+int /* O - -1 on error, 0 on success */
+cupsImageGetRow(cups_image_t *img, /* I - Image */
+ int x, /* I - Start column */
+ int y, /* I - Row */
+ int width, /* I - Width of row */
+ cups_ib_t *pixels) /* O - Pixel data */
+{
+ int bpp, /* Bytes per pixel */
+ count; /* Number of pixels to get */
+ const cups_ib_t *ib; /* Pointer to pixels */
+
+
+ if (img == NULL || y < 0 || y >= img->ysize || x >= img->xsize)
+ return (-1);
+
+ if (x < 0)
+ {
+ width += x;
+ x = 0;
+ }
+
+ if ((x + width) > img->xsize)
+ width = img->xsize - x;
+
+ if (width < 1)
+ return (-1);
+
+ bpp = img->colorspace < 0 ? -img->colorspace : img->colorspace;
+
+ while (width > 0)
+ {
+ ib = get_tile(img, x, y);
+
+ if (ib == NULL)
+ return (-1);
+
+ count = CUPS_TILE_SIZE - (x & (CUPS_TILE_SIZE - 1));
+ if (count > width)
+ count = width;
+ memcpy(pixels, ib, count * bpp);
+ pixels += count * bpp;
+ x += count;
+ width -= count;
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'cupsImageGetWidth()' - Get the width of an image.
+ */
+
+unsigned /* O - Width in pixels */
+cupsImageGetWidth(cups_image_t *img) /* I - Image */
+{
+ return (img->xsize);
+}
+
+
+/*
+ * 'cupsImageGetXPPI()' - Get the horizontal resolution of an image.
+ */
+
+unsigned /* O - Horizontal PPI */
+cupsImageGetXPPI(cups_image_t *img) /* I - Image */
+{
+ return (img->xppi);
+}
+
+
+/*
+ * 'cupsImageGetYPPI()' - Get the vertical resolution of an image.
+ */
+
+unsigned /* O - Vertical PPI */
+cupsImageGetYPPI(cups_image_t *img) /* I - Image */
+{
+ return (img->yppi);
+}
+
+
+/*
+ * 'cupsImageOpen()' - Open an image file and read it into memory.
+ */
+
+cups_image_t * /* O - New image */
+cupsImageOpen(
+ const char *filename, /* I - Filename of image */
+ cups_icspace_t primary, /* I - Primary colorspace needed */
+ cups_icspace_t secondary, /* I - Secondary colorspace if primary no good */
+ int saturation, /* I - Color saturation level */
+ int hue, /* I - Color hue adjustment */
+ const cups_ib_t *lut) /* I - RGB gamma/brightness LUT */
+{
+ FILE *fp; /* File pointer */
+ unsigned char header[16], /* First 16 bytes of file */
+ header2[16]; /* Bytes 2048-2064 (PhotoCD) */
+ cups_image_t *img; /* New image buffer */
+ int status; /* Status of load... */
+
+
+ DEBUG_printf(("cupsImageOpen(\"%s\", %d, %d, %d, %d, %p)\n",
+ filename ? filename : "(null)", primary, secondary,
+ saturation, hue, lut));
+
+ /*
+ * Figure out the file type...
+ */
+
+ if ((fp = fopen(filename, "r")) == NULL)
+ return (NULL);
+
+ if (fread(header, 1, sizeof(header), fp) == 0)
+ {
+ fclose(fp);
+ return (NULL);
+ }
+
+ fseek(fp, 2048, SEEK_SET);
+ memset(header2, 0, sizeof(header2));
+ fread(header2, 1, sizeof(header2), fp);
+ fseek(fp, 0, SEEK_SET);
+
+ /*
+ * Allocate memory...
+ */
+
+ img = calloc(sizeof(cups_image_t), 1);
+
+ if (img == NULL)
+ {
+ fclose(fp);
+ return (NULL);
+ }
+
+ /*
+ * Load the image as appropriate...
+ */
+
+ img->cachefile = -1;
+ img->max_ics = CUPS_TILE_MINIMUM;
+ img->xppi = 128;
+ img->yppi = 128;
+
+ if (!memcmp(header, "GIF87a", 6) || !memcmp(header, "GIF89a", 6))
+ status = _cupsImageReadGIF(img, fp, primary, secondary, saturation, hue,
+ lut);
+ else if (!memcmp(header, "BM", 2))
+ status = _cupsImageReadBMP(img, fp, primary, secondary, saturation, hue,
+ lut);
+ else if (header[0] == 0x01 && header[1] == 0xda)
+ status = _cupsImageReadSGI(img, fp, primary, secondary, saturation, hue,
+ lut);
+ else if (header[0] == 0x59 && header[1] == 0xa6 &&
+ header[2] == 0x6a && header[3] == 0x95)
+ status = _cupsImageReadSunRaster(img, fp, primary, secondary, saturation,
+ hue, lut);
+ else if (header[0] == 'P' && header[1] >= '1' && header[1] <= '6')
+ status = _cupsImageReadPNM(img, fp, primary, secondary, saturation, hue,
+ lut);
+ else if (!memcmp(header2, "PCD_IPI", 7))
+ status = _cupsImageReadPhotoCD(img, fp, primary, secondary, saturation,
+ hue, lut);
+ else if (!memcmp(header + 8, "\000\010", 2) ||
+ !memcmp(header + 8, "\000\030", 2))
+ status = _cupsImageReadPIX(img, fp, primary, secondary, saturation, hue,
+ lut);
+#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
+ else if (!memcmp(header, "\211PNG", 4))
+ status = _cupsImageReadPNG(img, fp, primary, secondary, saturation, hue,
+ lut);
+#endif /* HAVE_LIBPNG && HAVE_LIBZ */
+#ifdef HAVE_LIBJPEG
+ else if (!memcmp(header, "\377\330\377", 3) && /* Start-of-Image */
+ header[3] >= 0xe0 && header[3] <= 0xef) /* APPn */
+ status = _cupsImageReadJPEG(img, fp, primary, secondary, saturation, hue,
+ lut);
+#endif /* HAVE_LIBJPEG */
+#ifdef HAVE_LIBTIFF
+ else if (!memcmp(header, "MM\000\052", 4) ||
+ !memcmp(header, "II\052\000", 4))
+ status = _cupsImageReadTIFF(img, fp, primary, secondary, saturation, hue,
+ lut);
+#endif /* HAVE_LIBTIFF */
+ else
+ {
+ fclose(fp);
+ status = -1;
+ }
+
+ if (status)
+ {
+ free(img);
+ return (NULL);
+ }
+ else
+ return (img);
+}
+
+
+/*
+ * '_cupsImagePutCol()' - Put a column of pixels to an image.
+ */
+
+int /* O - -1 on error, 0 on success */
+_cupsImagePutCol(
+ cups_image_t *img, /* I - Image */
+ int x, /* I - Column */
+ int y, /* I - Start row */
+ int height, /* I - Column height */
+ const cups_ib_t *pixels) /* I - Pixels to put */
+{
+ int bpp, /* Bytes per pixel */
+ twidth, /* Width of tile */
+ count; /* Number of pixels to put */
+ int tilex, /* Column within tile */
+ tiley; /* Row within tile */
+ cups_ib_t *ib; /* Pointer to pixels in tile */
+
+
+ if (img == NULL || x < 0 || x >= img->xsize || y >= img->ysize)
+ return (-1);
+
+ if (y < 0)
+ {
+ height += y;
+ y = 0;
+ }
+
+ if ((y + height) > img->ysize)
+ height = img->ysize - y;
+
+ if (height < 1)
+ return (-1);
+
+ bpp = cupsImageGetDepth(img);
+ twidth = bpp * (CUPS_TILE_SIZE - 1);
+ tilex = x / CUPS_TILE_SIZE;
+ tiley = y / CUPS_TILE_SIZE;
+
+ while (height > 0)
+ {
+ ib = get_tile(img, x, y);
+
+ if (ib == NULL)
+ return (-1);
+
+ img->tiles[tiley][tilex].dirty = 1;
+ tiley ++;
+
+ count = CUPS_TILE_SIZE - (y & (CUPS_TILE_SIZE - 1));
+ if (count > height)
+ count = height;
+
+ y += count;
+ height -= count;
+
+ for (; count > 0; count --, ib += twidth)
+ switch (bpp)
+ {
+ case 4 :
+ *ib++ = *pixels++;
+ case 3 :
+ *ib++ = *pixels++;
+ *ib++ = *pixels++;
+ case 1 :
+ *ib++ = *pixels++;
+ break;
+ }
+ }
+
+ return (0);
+}
+
+
+/*
+ * '_cupsImagePutRow()' - Put a row of pixels to an image.
+ */
+
+int /* O - -1 on error, 0 on success */
+_cupsImagePutRow(
+ cups_image_t *img, /* I - Image */
+ int x, /* I - Start column */
+ int y, /* I - Row */
+ int width, /* I - Row width */
+ const cups_ib_t *pixels) /* I - Pixel data */
+{
+ int bpp, /* Bytes per pixel */
+ count; /* Number of pixels to put */
+ int tilex, /* Column within tile */
+ tiley; /* Row within tile */
+ cups_ib_t *ib; /* Pointer to pixels in tile */
+
+
+ if (img == NULL || y < 0 || y >= img->ysize || x >= img->xsize)
+ return (-1);
+
+ if (x < 0)
+ {
+ width += x;
+ x = 0;
+ }
+
+ if ((x + width) > img->xsize)
+ width = img->xsize - x;
+
+ if (width < 1)
+ return (-1);
+
+ bpp = img->colorspace < 0 ? -img->colorspace : img->colorspace;
+ tilex = x / CUPS_TILE_SIZE;
+ tiley = y / CUPS_TILE_SIZE;
+
+ while (width > 0)
+ {
+ ib = get_tile(img, x, y);
+
+ if (ib == NULL)
+ return (-1);
+
+ img->tiles[tiley][tilex].dirty = 1;
+
+ count = CUPS_TILE_SIZE - (x & (CUPS_TILE_SIZE - 1));
+ if (count > width)
+ count = width;
+ memcpy(ib, pixels, count * bpp);
+ pixels += count * bpp;
+ x += count;
+ width -= count;
+ tilex ++;
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'cupsImageSetMaxTiles()' - Set the maximum number of tiles to cache.
+ *
+ * If the "max_tiles" argument is 0 then the maximum number of tiles is
+ * computed from the image size or the RIP_CACHE environment variable.
+ */
+
+void
+cupsImageSetMaxTiles(
+ cups_image_t *img, /* I - Image to set */
+ int max_tiles) /* I - Number of tiles to cache */
+{
+ int cache_size, /* Size of tile cache in bytes */
+ min_tiles, /* Minimum number of tiles to cache */
+ max_size; /* Maximum cache size in bytes */
+ char *cache_env, /* Cache size environment variable */
+ cache_units[255]; /* Cache size units */
+
+
+ min_tiles = max(CUPS_TILE_MINIMUM,
+ 1 + max((img->xsize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE,
+ (img->ysize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE));
+
+ if (max_tiles == 0)
+ max_tiles = ((img->xsize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE) *
+ ((img->ysize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE);
+
+ cache_size = max_tiles * CUPS_TILE_SIZE * CUPS_TILE_SIZE *
+ cupsImageGetDepth(img);
+
+ if ((cache_env = getenv("RIP_MAX_CACHE")) != NULL)
+ {
+ switch (sscanf(cache_env, "%d%254s", &max_size, cache_units))
+ {
+ case 0 :
+ max_size = 32 * 1024 * 1024;
+ break;
+ case 1 :
+ max_size *= 4 * CUPS_TILE_SIZE * CUPS_TILE_SIZE;
+ break;
+ case 2 :
+ if (tolower(cache_units[0] & 255) == 'g')
+ max_size *= 1024 * 1024 * 1024;
+ else if (tolower(cache_units[0] & 255) == 'm')
+ max_size *= 1024 * 1024;
+ else if (tolower(cache_units[0] & 255) == 'k')
+ max_size *= 1024;
+ else if (tolower(cache_units[0] & 255) == 't')
+ max_size *= 4 * CUPS_TILE_SIZE * CUPS_TILE_SIZE;
+ break;
+ }
+ }
+ else
+ max_size = 32 * 1024 * 1024;
+
+ if (cache_size > max_size)
+ max_tiles = max_size / CUPS_TILE_SIZE / CUPS_TILE_SIZE /
+ cupsImageGetDepth(img);
+
+ if (max_tiles < min_tiles)
+ max_tiles = min_tiles;
+
+ img->max_ics = max_tiles;
+
+ DEBUG_printf(("max_ics=%d...\n", img->max_ics));
+}
+
+
+/*
+ * 'flush_tile()' - Flush the least-recently-used tile in the cache.
+ */
+
+static void
+flush_tile(cups_image_t *img) /* I - Image */
+{
+ int bpp; /* Bytes per pixel */
+ cups_itile_t *tile; /* Pointer to tile */
+
+
+ bpp = cupsImageGetDepth(img);
+ tile = img->first->tile;
+
+ if (!tile->dirty)
+ {
+ tile->ic = NULL;
+ return;
+ }
+
+ if (img->cachefile < 0)
+ {
+ if ((img->cachefile = cupsTempFd(img->cachename,
+ sizeof(img->cachename))) < 0)
+ {
+ tile->ic = NULL;
+ tile->dirty = 0;
+ return;
+ }
+
+ DEBUG_printf(("Created swap file \"%s\"...\n", img->cachename));
+ }
+
+ if (tile->pos >= 0)
+ {
+ if (lseek(img->cachefile, tile->pos, SEEK_SET) != tile->pos)
+ {
+ tile->ic = NULL;
+ tile->dirty = 0;
+ return;
+ }
+ }
+ else
+ {
+ if ((tile->pos = lseek(img->cachefile, 0, SEEK_END)) < 0)
+ {
+ tile->ic = NULL;
+ tile->dirty = 0;
+ return;
+ }
+ }
+
+ write(img->cachefile, tile->ic->pixels, bpp * CUPS_TILE_SIZE * CUPS_TILE_SIZE);
+
+ tile->ic = NULL;
+ tile->dirty = 0;
+}
+
+
+/*
+ * 'get_tile()' - Get a cached tile.
+ */
+
+static cups_ib_t * /* O - Pointer to tile or NULL */
+get_tile(cups_image_t *img, /* I - Image */
+ int x, /* I - Column in image */
+ int y) /* I - Row in image */
+{
+ int bpp, /* Bytes per pixel */
+ tilex, /* Column within tile */
+ tiley, /* Row within tile */
+ xtiles, /* Number of tiles horizontally */
+ ytiles; /* Number of tiles vertically */
+ cups_ic_t *ic; /* Cache pointer */
+ cups_itile_t *tile; /* Tile pointer */
+
+
+ if (img->tiles == NULL)
+ {
+ xtiles = (img->xsize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE;
+ ytiles = (img->ysize + CUPS_TILE_SIZE - 1) / CUPS_TILE_SIZE;
+
+ DEBUG_printf(("Creating tile array (%dx%d)\n", xtiles, ytiles));
+
+ if ((img->tiles = calloc(sizeof(cups_itile_t *), ytiles)) == NULL)
+ return (NULL);
+
+ if ((tile = calloc(xtiles * sizeof(cups_itile_t), ytiles)) == NULL)
+ return (NULL);
+
+ for (tiley = 0; tiley < ytiles; tiley ++)
+ {
+ img->tiles[tiley] = tile;
+ for (tilex = xtiles; tilex > 0; tilex --, tile ++)
+ tile->pos = -1;
+ }
+ }
+
+ bpp = cupsImageGetDepth(img);
+ tilex = x / CUPS_TILE_SIZE;
+ tiley = y / CUPS_TILE_SIZE;
+ tile = img->tiles[tiley] + tilex;
+ x &= (CUPS_TILE_SIZE - 1);
+ y &= (CUPS_TILE_SIZE - 1);
+
+ if ((ic = tile->ic) == NULL)
+ {
+ if (img->num_ics < img->max_ics)
+ {
+ if ((ic = calloc(sizeof(cups_ic_t) +
+ bpp * CUPS_TILE_SIZE * CUPS_TILE_SIZE, 1)) == NULL)
+ {
+ if (img->num_ics == 0)
+ return (NULL);
+
+ flush_tile(img);
+ ic = img->first;
+ }
+ else
+ {
+ ic->pixels = ((cups_ib_t *)ic) + sizeof(cups_ic_t);
+
+ img->num_ics ++;
+
+ DEBUG_printf(("Allocated cache tile %d (%p)...\n", img->num_ics, ic));
+ }
+ }
+ else
+ {
+ DEBUG_printf(("Flushing old cache tile (%p)...\n", img->first));
+
+ flush_tile(img);
+ ic = img->first;
+ }
+
+ ic->tile = tile;
+ tile->ic = ic;
+
+ if (tile->pos >= 0)
+ {
+ DEBUG_printf(("Loading cache tile from file position " CUPS_LLFMT "...\n",
+ CUPS_LLCAST tile->pos));
+
+ lseek(img->cachefile, tile->pos, SEEK_SET);
+ read(img->cachefile, ic->pixels, bpp * CUPS_TILE_SIZE * CUPS_TILE_SIZE);
+ }
+ else
+ {
+ DEBUG_puts("Clearing cache tile...");
+
+ memset(ic->pixels, 0, bpp * CUPS_TILE_SIZE * CUPS_TILE_SIZE);
+ }
+ }
+
+ if (ic == img->first)
+ {
+ if (ic->next != NULL)
+ ic->next->prev = NULL;
+
+ img->first = ic->next;
+ ic->next = NULL;
+ ic->prev = NULL;
+ }
+ else if (img->first == NULL)
+ img->first = ic;
+
+ if (ic != img->last)
+ {
+ /*
+ * Remove the cache entry from the list...
+ */
+
+ if (ic->prev != NULL)
+ ic->prev->next = ic->next;
+ if (ic->next != NULL)
+ ic->next->prev = ic->prev;
+
+ /*
+ * And add it to the end...
+ */
+
+ if (img->last != NULL)
+ img->last->next = ic;
+
+ ic->prev = img->last;
+ img->last = ic;
+ }
+
+ ic->next = NULL;
+
+ return (ic->pixels + bpp * (y * CUPS_TILE_SIZE + x));
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Image library definitions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _CUPS_IMAGE_H_
+# define _CUPS_IMAGE_H_
+
+/*
+ * Include necessary headers...
+ */
+
+# include <stdio.h>
+# include <cups/raster.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+/*
+ * Constants...
+ */
+
+typedef enum cups_icspace_e /**** Image colorspaces ****/
+{
+ CUPS_IMAGE_CMYK = -4, /* Cyan, magenta, yellow, and black */
+ CUPS_IMAGE_CMY = -3, /* Cyan, magenta, and yellow */
+ CUPS_IMAGE_BLACK = -1, /* Black */
+ CUPS_IMAGE_WHITE = 1, /* White (luminance) */
+ CUPS_IMAGE_RGB = 3, /* Red, green, and blue */
+ CUPS_IMAGE_RGB_CMYK = 4 /* Use RGB or CMYK */
+} cups_icspace_t;
+
+
+/*
+ * Types and structures...
+ */
+
+typedef unsigned char cups_ib_t; /**** Image byte ****/
+
+struct cups_image_s;
+typedef struct cups_image_s cups_image_t;
+ /**** Image file data ****/
+
+struct cups_izoom_s;
+typedef struct cups_izoom_s cups_izoom_t;
+ /**** Image zoom data ****/
+
+
+/*
+ * Prototypes...
+ */
+
+extern void cupsImageClose(cups_image_t *img) _CUPS_API_1_2;
+extern void cupsImageCMYKToBlack(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageCMYKToCMY(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageCMYKToCMYK(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageCMYKToRGB(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageCMYKToWhite(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern int cupsImageGetCol(cups_image_t *img, int x, int y,
+ int height, cups_ib_t *pixels) _CUPS_API_1_2;
+extern cups_icspace_t cupsImageGetColorSpace(cups_image_t *img) _CUPS_API_1_2;
+extern int cupsImageGetDepth(cups_image_t *img) _CUPS_API_1_2;
+extern unsigned cupsImageGetHeight(cups_image_t *img) _CUPS_API_1_2;
+extern int cupsImageGetRow(cups_image_t *img, int x, int y,
+ int width, cups_ib_t *pixels) _CUPS_API_1_2;
+extern unsigned cupsImageGetWidth(cups_image_t *img) _CUPS_API_1_2;
+extern unsigned cupsImageGetXPPI(cups_image_t *img) _CUPS_API_1_2;
+extern unsigned cupsImageGetYPPI(cups_image_t *img) _CUPS_API_1_2;
+extern void cupsImageLut(cups_ib_t *pixels, int count,
+ const cups_ib_t *lut) _CUPS_API_1_2;
+extern cups_image_t *cupsImageOpen(const char *filename,
+ cups_icspace_t primary,
+ cups_icspace_t secondary,
+ int saturation, int hue,
+ const cups_ib_t *lut) _CUPS_API_1_2;
+extern void cupsImageRGBAdjust(cups_ib_t *pixels, int count,
+ int saturation, int hue) _CUPS_API_1_2;
+extern void cupsImageRGBToBlack(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageRGBToCMY(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageRGBToCMYK(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageRGBToRGB(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageRGBToWhite(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageSetMaxTiles(cups_image_t *img, int max_tiles) _CUPS_API_1_2;
+extern void cupsImageSetProfile(float d, float g,
+ float matrix[3][3]) _CUPS_API_1_2;
+extern void cupsImageSetRasterColorSpace(cups_cspace_t cs) _CUPS_API_1_2;
+extern void cupsImageWhiteToBlack(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageWhiteToCMY(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageWhiteToCMYK(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageWhiteToRGB(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+extern void cupsImageWhiteToWhite(const cups_ib_t *in,
+ cups_ib_t *out, int count) _CUPS_API_1_2;
+
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+
+#endif /* !_CUPS_IMAGE_H_ */
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Lookup table routines for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsLutDelete() - Free the memory used by a lookup table.
+ * cupsLutLoad() - Load a LUT from a PPD file.
+ * cupsLutNew() - Make a lookup table from a list of pixel values.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <math.h>
+
+
+/*
+ * 'cupsLutDelete()' - Free the memory used by a lookup table.
+ */
+
+void
+cupsLutDelete(cups_lut_t *lut) /* I - Lookup table to free */
+{
+ if (lut != NULL)
+ free(lut);
+}
+
+
+/*
+ * 'cupsLutLoad()' - Load a LUT from a PPD file.
+ */
+
+cups_lut_t * /* O - New lookup table */
+cupsLutLoad(ppd_file_t *ppd, /* I - PPD file */
+ const char *colormodel, /* I - Color model */
+ const char *media, /* I - Media type */
+ const char *resolution, /* I - Resolution */
+ const char *ink) /* I - Ink name */
+{
+ char name[PPD_MAX_NAME], /* Attribute name */
+ spec[PPD_MAX_NAME]; /* Attribute spec */
+ ppd_attr_t *attr; /* Attribute */
+ int nvals; /* Number of values */
+ float vals[4]; /* Values */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (!ppd || !colormodel || !media || !resolution || !ink)
+ return (NULL);
+
+ /*
+ * Try to find the LUT values...
+ */
+
+ snprintf(name, sizeof(name), "cups%sDither", ink);
+
+ if ((attr = cupsFindAttr(ppd, name, colormodel, media, resolution, spec,
+ sizeof(spec))) == NULL)
+ attr = cupsFindAttr(ppd, "cupsAllDither", colormodel, media,
+ resolution, spec, sizeof(spec));
+
+ if (!attr)
+ return (NULL);
+
+ vals[0] = 0.0;
+ vals[1] = 0.0;
+ vals[2] = 0.0;
+ vals[3] = 0.0;
+ nvals = sscanf(attr->value, "%f%f%f", vals + 1, vals + 2, vals + 3) + 1;
+
+ fprintf(stderr, "DEBUG: Loaded LUT %s from PPD with values [%.3f %.3f %.3f %.3f]\n",
+ name, vals[0], vals[1], vals[2], vals[3]);
+
+ return (cupsLutNew(nvals, vals));
+}
+
+
+/*
+ * 'cupsLutNew()' - Make a lookup table from a list of pixel values.
+ *
+ * Returns a pointer to the lookup table on success, NULL on failure.
+ */
+
+cups_lut_t * /* O - New lookup table */
+cupsLutNew(int num_values, /* I - Number of values */
+ const float *values) /* I - Lookup table values */
+{
+ int pixel; /* Pixel value */
+ cups_lut_t *lut; /* Lookup table */
+ int start, /* Start value */
+ end, /* End value */
+ maxval; /* Maximum value */
+
+
+ /*
+ * Range check...
+ */
+
+ if (!num_values || !values)
+ return (NULL);
+
+ /*
+ * Allocate memory for the lookup table...
+ */
+
+ if ((lut = (cups_lut_t *)calloc((CUPS_MAX_LUT + 1),
+ sizeof(cups_lut_t))) == NULL)
+ return (NULL);
+
+ /*
+ * Generate the dither lookup table. The pixel values are roughly
+ * defined by a piecewise linear curve that has an intensity value
+ * at each output pixel. This isn't perfectly accurate, but it's
+ * close enough for jazz.
+ */
+
+ maxval = CUPS_MAX_LUT / values[num_values - 1];
+
+ for (start = 0; start <= CUPS_MAX_LUT; start ++)
+ lut[start].intensity = start * maxval / CUPS_MAX_LUT;
+
+ for (pixel = 0; pixel < num_values; pixel ++)
+ {
+ /*
+ * Select start and end values for this pixel...
+ */
+
+ if (pixel == 0)
+ start = 0;
+ else
+ start = (int)(0.5 * maxval * (values[pixel - 1] +
+ values[pixel])) + 1;
+
+ if (start < 0)
+ start = 0;
+ else if (start > CUPS_MAX_LUT)
+ start = CUPS_MAX_LUT;
+
+ if (pixel == (num_values - 1))
+ end = CUPS_MAX_LUT;
+ else
+ end = (int)(0.5 * maxval * (values[pixel] + values[pixel + 1]));
+
+ if (end < 0)
+ end = 0;
+ else if (end > CUPS_MAX_LUT)
+ end = CUPS_MAX_LUT;
+
+ if (start == end)
+ break;
+
+ /*
+ * Generate lookup values and errors for each pixel.
+ */
+
+ while (start <= end)
+ {
+ lut[start].pixel = pixel;
+ if (start == 0)
+ lut[0].error = 0;
+ else
+ lut[start].error = start - maxval * values[pixel];
+
+ start ++;
+ }
+ }
+
+ /*
+ * Show the lookup table...
+ */
+
+ for (start = 0; start <= CUPS_MAX_LUT; start += CUPS_MAX_LUT / 15)
+ fprintf(stderr, "DEBUG: %d = %d/%d/%d\n", start, lut[start].intensity,
+ lut[start].pixel, lut[start].error);
+
+ /*
+ * Return the lookup table...
+ */
+
+ return (lut);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Bit packing routines for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsPackHorizontal() - Pack pixels horizontally...
+ * cupsPackHorizontal2() - Pack 2-bit pixels horizontally...
+ * cupsPackHorizontalBit() - Pack pixels horizontally by bit...
+ * cupsPackVertical() - Pack pixels vertically...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "driver.h"
+
+
+/*
+ * 'cupsPackHorizontal()' - Pack pixels horizontally...
+ */
+
+void
+cupsPackHorizontal(const unsigned char *ipixels,/* I - Input pixels */
+ unsigned char *obytes, /* O - Output bytes */
+ int width, /* I - Number of pixels */
+ const unsigned char clearto, /* I - Initial value of bytes */
+ const int step) /* I - Step value between pixels */
+{
+ register unsigned char b; /* Current byte */
+
+
+ /*
+ * Do whole bytes first...
+ */
+
+ while (width > 7)
+ {
+ b = clearto;
+
+ if (*ipixels)
+ b ^= 0x80;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x40;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x20;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x10;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x08;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x04;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x02;
+ ipixels += step;
+ if (*ipixels)
+ b ^= 0x01;
+ ipixels += step;
+
+ *obytes++ = b;
+
+ width -= 8;
+ }
+
+ /*
+ * Then do the last N bytes (N < 8)...
+ */
+
+ b = clearto;
+
+ switch (width)
+ {
+ case 7 :
+ if (ipixels[6 * step])
+ b ^= 0x02;
+ case 6 :
+ if (ipixels[5 * step])
+ b ^= 0x04;
+ case 5 :
+ if (ipixels[4 * step])
+ b ^= 0x08;
+ case 4 :
+ if (ipixels[3 * step])
+ b ^= 0x10;
+ case 3 :
+ if (ipixels[2 * step])
+ b ^= 0x20;
+ case 2 :
+ if (ipixels[1 * step])
+ b ^= 0x40;
+ case 1 :
+ if (ipixels[0])
+ b ^= 0x80;
+ *obytes = b;
+ break;
+ }
+}
+
+
+/*
+ * 'cupsPackHorizontal2()' - Pack 2-bit pixels horizontally...
+ */
+
+void
+cupsPackHorizontal2(const unsigned char *ipixels, /* I - Input pixels */
+ unsigned char *obytes, /* O - Output bytes */
+ int width, /* I - Number of pixels */
+ const int step) /* I - Stepping value */
+{
+ register unsigned char b; /* Current byte */
+
+
+ /*
+ * Do whole bytes first...
+ */
+
+ while (width > 3)
+ {
+ b = *ipixels;
+ ipixels += step;
+ b = (b << 2) | *ipixels;
+ ipixels += step;
+ b = (b << 2) | *ipixels;
+ ipixels += step;
+ b = (b << 2) | *ipixels;
+ ipixels += step;
+
+ *obytes++ = b;
+
+ width -= 4;
+ }
+
+ /*
+ * Then do the last N bytes (N < 4)...
+ */
+
+ b = 0;
+
+ switch (width)
+ {
+ case 3 :
+ b = ipixels[2 * step];
+ case 2 :
+ b = (b << 2) | ipixels[step];
+ case 1 :
+ b = (b << 2) | ipixels[0];
+ *obytes = b << (8 - 2 * width);
+ break;
+ }
+}
+
+
+/*
+ * 'cupsPackHorizontalBit()' - Pack pixels horizontally by bit...
+ */
+
+void
+cupsPackHorizontalBit(const unsigned char *ipixels, /* I - Input pixels */
+ unsigned char *obytes, /* O - Output bytes */
+ int width, /* I - Number of pixels */
+ const unsigned char clearto, /* I - Initial value of bytes */
+ const unsigned char bit) /* I - Bit to check */
+{
+ register unsigned char b; /* Current byte */
+
+
+ /*
+ * Do whole bytes first...
+ */
+
+ while (width > 7)
+ {
+ b = clearto;
+
+ if (*ipixels++ & bit)
+ b ^= 0x80;
+ if (*ipixels++ & bit)
+ b ^= 0x40;
+ if (*ipixels++ & bit)
+ b ^= 0x20;
+ if (*ipixels++ & bit)
+ b ^= 0x10;
+ if (*ipixels++ & bit)
+ b ^= 0x08;
+ if (*ipixels++ & bit)
+ b ^= 0x04;
+ if (*ipixels++ & bit)
+ b ^= 0x02;
+ if (*ipixels++ & bit)
+ b ^= 0x01;
+
+ *obytes++ = b;
+
+ width -= 8;
+ }
+
+ /*
+ * Then do the last N bytes (N < 8)...
+ */
+
+ b = clearto;
+
+ switch (width)
+ {
+ case 7 :
+ if (ipixels[6] & bit)
+ b ^= 0x02;
+ case 6 :
+ if (ipixels[5] & bit)
+ b ^= 0x04;
+ case 5 :
+ if (ipixels[4] & bit)
+ b ^= 0x08;
+ case 4 :
+ if (ipixels[3] & bit)
+ b ^= 0x10;
+ case 3 :
+ if (ipixels[2] & bit)
+ b ^= 0x20;
+ case 2 :
+ if (ipixels[1] & bit)
+ b ^= 0x40;
+ case 1 :
+ if (ipixels[0] & bit)
+ b ^= 0x80;
+ *obytes = b;
+ break;
+ }
+}
+
+
+/*
+ * 'cupsPackVertical()' - Pack pixels vertically...
+ */
+
+void
+cupsPackVertical(const unsigned char *ipixels, /* I - Input pixels */
+ unsigned char *obytes, /* O - Output bytes */
+ int width, /* I - Number of input pixels */
+ const unsigned char bit, /* I - Output bit */
+ const int step) /* I - Number of bytes between columns */
+{
+ /*
+ * Loop through the entire array...
+ */
+
+ while (width > 7)
+ {
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+ if (*ipixels++)
+ *obytes ^= bit;
+ obytes += step;
+
+ width -= 8;
+ }
+
+ while (width > 0)
+ {
+ if (*ipixels++)
+ *obytes ^= bit;
+
+ obytes += step;
+ width --;
+ }
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * RGB color separation code for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cupsRGBDelete() - Delete a color separation.
+ * cupsRGBDoGray() - Do a grayscale separation...
+ * cupsRGBDoRGB() - Do a RGB separation...
+ * cupsRGBLoad() - Load a RGB color profile from a PPD file.
+ * cupsRGBNew() - Create a new RGB color separation.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+
+
+/*
+ * 'cupsRGBDelete()' - Delete a color separation.
+ */
+
+void
+cupsRGBDelete(cups_rgb_t *rgbptr) /* I - Color separation */
+{
+ if (rgbptr == NULL)
+ return;
+
+ free(rgbptr->colors[0][0][0]);
+ free(rgbptr->colors[0][0]);
+ free(rgbptr->colors[0]);
+ free(rgbptr->colors);
+ free(rgbptr);
+}
+
+
+/*
+ * 'cupsRGBDoGray()' - Do a grayscale separation...
+ */
+
+void
+cupsRGBDoGray(cups_rgb_t *rgbptr,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input grayscale pixels */
+ unsigned char *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int i; /* Looping var */
+ int lastgray; /* Previous grayscale */
+ int xs, ys, zs, /* Current RGB row offsets */
+ g, gi, gm0, gm1;/* Current gray index and multipliers ... */
+ const unsigned char *color; /* Current color data */
+ int tempg; /* Current separation color */
+ int rgbsize; /* Separation data size */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (!rgbptr || !input || !output || num_pixels <= 0)
+ return;
+
+ /*
+ * Initialize variables used for the duration of the separation...
+ */
+
+ lastgray = -1;
+ rgbsize = rgbptr->num_channels;
+ xs = rgbptr->cube_size * rgbptr->cube_size * rgbptr->num_channels;
+ ys = rgbptr->cube_size * rgbptr->num_channels;
+ zs = rgbptr->num_channels;
+
+ /*
+ * Loop through it all...
+ */
+
+ while (num_pixels > 0)
+ {
+ /*
+ * See if the next pixel is a cached value...
+ */
+
+ num_pixels --;
+
+ g = cups_srgb_lut[*input++];
+
+ if (g == lastgray)
+ {
+ /*
+ * Copy previous color and continue...
+ */
+
+ memcpy(output, output - rgbptr->num_channels, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+ else if (g == 0x00 && rgbptr->cache_init)
+ {
+ /*
+ * Copy black color and continue...
+ */
+
+ memcpy(output, rgbptr->black, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+ else if (g == 0xff && rgbptr->cache_init)
+ {
+ /*
+ * Copy white color and continue...
+ */
+
+ memcpy(output, rgbptr->white, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+
+ /*
+ * Nope, figure this one out on our own...
+ */
+
+ gi = rgbptr->cube_index[g];
+ gm0 = rgbptr->cube_mult[g];
+ gm1 = 256 - gm0;
+
+ color = rgbptr->colors[gi][gi][gi];
+
+ for (i = 0; i < rgbptr->num_channels; i ++, color ++)
+ {
+ tempg = (color[0] * gm0 + color[xs + ys + zs] * gm1) / 256;
+
+ if (tempg > 255)
+ *output++ = 255;
+ else if (tempg < 0)
+ *output++ = 0;
+ else
+ *output++ = tempg;
+ }
+ }
+}
+
+
+/*
+ * 'cupsRGBDoRGB()' - Do a RGB separation...
+ */
+
+void
+cupsRGBDoRGB(cups_rgb_t *rgbptr,
+ /* I - Color separation */
+ const unsigned char *input,
+ /* I - Input RGB pixels */
+ unsigned char *output,
+ /* O - Output Device-N pixels */
+ int num_pixels)
+ /* I - Number of pixels */
+{
+ int i; /* Looping var */
+ int rgb, /* Current RGB color */
+ lastrgb; /* Previous RGB color */
+ int r, ri, rm0, rm1, rs,
+ /* Current red index, multipliexs, and row offset */
+ g, gi, gm0, gm1, gs,
+ /* Current green ... */
+ b, bi, bm0, bm1, bs;
+ /* Current blue ... */
+ const unsigned char *color; /* Current color data */
+ int tempr, /* Current separation colors */
+ tempg, /* ... */
+ tempb ; /* ... */
+ int rgbsize; /* Separation data size */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (!rgbptr || !input || !output || num_pixels <= 0)
+ return;
+
+ /*
+ * Initialize variables used for the duration of the separation...
+ */
+
+ lastrgb = -1;
+ rgbsize = rgbptr->num_channels;
+ rs = rgbptr->cube_size * rgbptr->cube_size * rgbptr->num_channels;
+ gs = rgbptr->cube_size * rgbptr->num_channels;
+ bs = rgbptr->num_channels;
+
+ /*
+ * Loop through it all...
+ */
+
+ while (num_pixels > 0)
+ {
+ /*
+ * See if the next pixel is a cached value...
+ */
+
+ num_pixels --;
+
+ r = cups_srgb_lut[*input++];
+ g = cups_srgb_lut[*input++];
+ b = cups_srgb_lut[*input++];
+ rgb = (((r << 8) | g) << 8) | b;
+
+ if (rgb == lastrgb)
+ {
+ /*
+ * Copy previous color and continue...
+ */
+
+ memcpy(output, output - rgbptr->num_channels, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+ else if (rgb == 0x000000 && rgbptr->cache_init)
+ {
+ /*
+ * Copy black color and continue...
+ */
+
+ memcpy(output, rgbptr->black, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+ else if (rgb == 0xffffff && rgbptr->cache_init)
+ {
+ /*
+ * Copy white color and continue...
+ */
+
+ memcpy(output, rgbptr->white, rgbsize);
+
+ output += rgbptr->num_channels;
+ continue;
+ }
+
+ /*
+ * Nope, figure this one out on our own...
+ */
+
+ ri = rgbptr->cube_index[r];
+ rm0 = rgbptr->cube_mult[r];
+ rm1 = 256 - rm0;
+
+ gi = rgbptr->cube_index[g];
+ gm0 = rgbptr->cube_mult[g];
+ gm1 = 256 - gm0;
+
+ bi = rgbptr->cube_index[b];
+ bm0 = rgbptr->cube_mult[b];
+ bm1 = 256 - bm0;
+
+ color = rgbptr->colors[ri][gi][bi];
+
+ for (i = rgbptr->num_channels; i > 0; i --, color ++)
+ {
+ tempb = (color[0] * bm0 + color[bs] * bm1) / 256;
+ tempg = tempb * gm0;
+ tempb = (color[gs] * gm0 + color[gs + bs] * bm1) / 256;
+ tempg = (tempg + tempb * gm1) / 256;
+
+ tempr = tempg * rm0;
+
+ tempb = (color[rs] * bm0 + color[rs + bs] * bm1) / 256;
+ tempg = tempb * gm0;
+ tempb = (color[rs + gs] * bm0 + color[rs + gs + bs] * bm1) / 256;
+ tempg = (tempg + tempb * gm1) / 256;
+
+ tempr = (tempr + tempg * rm1) / 256;
+
+ if (tempr > 255)
+ *output++ = 255;
+ else if (tempr < 0)
+ *output++ = 0;
+ else
+ *output++ = tempr;
+ }
+ }
+}
+
+
+/*
+ * 'cupsRGBLoad()' - Load a RGB color profile from a PPD file.
+ */
+
+cups_rgb_t * /* O - New color profile */
+cupsRGBLoad(ppd_file_t *ppd, /* I - PPD file */
+ const char *colormodel, /* I - Color model */
+ const char *media, /* I - Media type */
+ const char *resolution) /* I - Resolution */
+{
+ int i, /* Looping var */
+ cube_size, /* Size of color lookup cube */
+ num_channels, /* Number of color channels */
+ num_samples; /* Number of color samples */
+ cups_sample_t *samples; /* Color samples */
+ float values[7]; /* Color sample values */
+ char spec[PPD_MAX_NAME]; /* Profile name */
+ ppd_attr_t *attr; /* Attribute from PPD file */
+ cups_rgb_t *rgbptr; /* RGB color profile */
+
+
+ /*
+ * Find the following attributes:
+ *
+ * cupsRGBProfile - Specifies the cube size, number of channels, and
+ * number of samples
+ * cupsRGBSample - Specifies an RGB to CMYK color sample
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsRGBProfile", colormodel, media,
+ resolution, spec, sizeof(spec))) == NULL)
+ {
+ fputs("DEBUG2: No cupsRGBProfile attribute found for the current settings!\n", stderr);
+ return (NULL);
+ }
+
+ if (!attr->value || sscanf(attr->value, "%d%d%d", &cube_size, &num_channels,
+ &num_samples) != 3)
+ {
+ fprintf(stderr, "ERROR: Bad cupsRGBProfile attribute \'%s\'!\n",
+ attr->value ? attr->value : "(null)");
+ return (NULL);
+ }
+
+ if (cube_size < 2 || cube_size > 16 ||
+ num_channels < 1 || num_channels > CUPS_MAX_RGB ||
+ num_samples != (cube_size * cube_size * cube_size))
+ {
+ fprintf(stderr, "ERROR: Bad cupsRGBProfile attribute \'%s\'!\n",
+ attr->value);
+ return (NULL);
+ }
+
+ /*
+ * Allocate memory for the samples and read them...
+ */
+
+ if ((samples = calloc(num_samples, sizeof(cups_sample_t))) == NULL)
+ {
+ fputs("ERROR: Unable to allocate memory for RGB profile!\n", stderr);
+ return (NULL);
+ }
+
+ /*
+ * Read all of the samples...
+ */
+
+ for (i = 0; i < num_samples; i ++)
+ if ((attr = ppdFindNextAttr(ppd, "cupsRGBSample", spec)) == NULL)
+ break;
+ else if (!attr->value)
+ {
+ fputs("ERROR: Bad cupsRGBSample value!\n", stderr);
+ break;
+ }
+ else if (sscanf(attr->value, "%f%f%f%f%f%f%f", values + 0,
+ values + 1, values + 2, values + 3, values + 4, values + 5,
+ values + 6) != (3 + num_channels))
+ {
+ fputs("ERROR: Bad cupsRGBSample value!\n", stderr);
+ break;
+ }
+ else
+ {
+ samples[i].rgb[0] = (int)(255.0 * values[0] + 0.5);
+ samples[i].rgb[1] = (int)(255.0 * values[1] + 0.5);
+ samples[i].rgb[2] = (int)(255.0 * values[2] + 0.5);
+ samples[i].colors[0] = (int)(255.0 * values[3] + 0.5);
+ if (num_channels > 1)
+ samples[i].colors[1] = (int)(255.0 * values[4] + 0.5);
+ if (num_channels > 2)
+ samples[i].colors[2] = (int)(255.0 * values[5] + 0.5);
+ if (num_channels > 3)
+ samples[i].colors[3] = (int)(255.0 * values[6] + 0.5);
+ }
+
+ /*
+ * If everything went OK, create the color profile...
+ */
+
+ if (i == num_samples)
+ rgbptr = cupsRGBNew(num_samples, samples, cube_size, num_channels);
+ else
+ rgbptr = NULL;
+
+ /*
+ * Free the temporary sample array and return...
+ */
+
+ free(samples);
+
+ return (rgbptr);
+}
+
+
+/*
+ * 'cupsRGBNew()' - Create a new RGB color separation.
+ */
+
+cups_rgb_t * /* O - New color separation or NULL */
+cupsRGBNew(int num_samples, /* I - Number of samples */
+ cups_sample_t *samples, /* I - Samples */
+ int cube_size, /* I - Size of LUT cube */
+ int num_channels) /* I - Number of color components */
+{
+ cups_rgb_t *rgbptr; /* New color separation */
+ int i; /* Looping var */
+ int r, g, b; /* Current RGB */
+ int tempsize; /* Sibe of main arrays */
+ unsigned char *tempc; /* Pointer for C arrays */
+ unsigned char **tempb ; /* Pointer for Z arrays */
+ unsigned char ***tempg; /* Pointer for Y arrays */
+ unsigned char ****tempr; /* Pointer for X array */
+ unsigned char rgb[3]; /* Temporary RGB value */
+
+
+ /*
+ * Range-check the input...
+ */
+
+ if (!samples || num_samples != (cube_size * cube_size * cube_size) ||
+ num_channels <= 0 || num_channels > CUPS_MAX_RGB)
+ return (NULL);
+
+ /*
+ * Allocate memory for the separation...
+ */
+
+ if ((rgbptr = calloc(1, sizeof(cups_rgb_t))) == NULL)
+ return (NULL);
+
+ /*
+ * Allocate memory for the samples and the LUT cube...
+ */
+
+ tempsize = cube_size * cube_size * cube_size; /* FUTURE: num_samples < cs^3 */
+
+ tempc = calloc(tempsize, num_channels);
+ tempb = calloc(tempsize, sizeof(unsigned char *));
+ tempg = calloc(cube_size * cube_size, sizeof(unsigned char **));
+ tempr = calloc(cube_size, sizeof(unsigned char ***));
+
+ if (tempc == NULL || tempb == NULL || tempg == NULL || tempr == NULL)
+ {
+ free(rgbptr);
+
+ if (tempc)
+ free(tempc);
+
+ if (tempb)
+ free(tempb);
+
+ if (tempg)
+ free(tempg);
+
+ if (tempr)
+ free(tempr);
+
+ return (NULL);
+ }
+
+ /*
+ * Fill in the arrays...
+ */
+
+ for (i = 0, r = 0; r < cube_size; r ++)
+ {
+ tempr[r] = tempg + r * cube_size;
+
+ for (g = 0; g < cube_size; g ++)
+ {
+ tempr[r][g] = tempb + i;
+
+ for (b = 0; b < cube_size; b ++, i ++)
+ tempr[r][g][b] = tempc + i * num_channels;
+ }
+ }
+
+ for (i = 0; i < num_samples; i ++)
+ {
+ r = samples[i].rgb[0] * (cube_size - 1) / 255;
+ g = samples[i].rgb[1] * (cube_size - 1) / 255;
+ b = samples[i].rgb[2] * (cube_size - 1) / 255;
+
+ memcpy(tempr[r][g][b], samples[i].colors, num_channels);
+ }
+
+ rgbptr->cube_size = cube_size;
+ rgbptr->num_channels = num_channels;
+ rgbptr->colors = tempr;
+
+ /*
+ * Generate the lookup tables for the cube indices and multipliers...
+ */
+
+ for (i = 0; i < 256; i ++)
+ {
+ rgbptr->cube_index[i] = i * (cube_size - 1) / 256;
+
+ if (i == 0)
+ rgbptr->cube_mult[i] = 256;
+ else
+ rgbptr->cube_mult[i] = 255 - ((i * (cube_size - 1)) & 255);
+ }
+
+ /*
+ * Generate the black and white cache values for the separation...
+ */
+
+ rgb[0] = 0;
+ rgb[1] = 0;
+ rgb[2] = 0;
+
+ cupsRGBDoRGB(rgbptr, rgb, rgbptr->black, 1);
+
+ rgb[0] = 255;
+ rgb[1] = 255;
+ rgb[2] = 255;
+
+ cupsRGBDoRGB(rgbptr, rgb, rgbptr->white, 1);
+
+ rgbptr->cache_init = 1;
+
+ /*
+ * Return the separation...
+ */
+
+ return (rgbptr);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * sRGB lookup tables for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+
+
+/*
+ * sRGB gamma lookup table.
+ */
+
+const unsigned char cups_srgb_lut[256] =
+{
+ 0, 20, 28, 33, 38, 42, 46, 49, 52, 55, 58, 61, 63, 65, 68,
+ 70, 72, 74, 76, 78, 80, 81, 83, 85, 87, 88, 90, 91, 93, 94,
+ 96, 97, 99, 100, 102, 103, 104, 106, 107, 108, 109, 111, 112, 113, 114,
+ 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
+ 146, 147, 147, 148, 149, 150, 151, 152, 153, 153, 154, 155, 156, 157, 158,
+ 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 168, 168, 169,
+ 170, 171, 171, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180,
+ 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190,
+ 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 197, 198, 199, 199,
+ 200, 200, 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 207, 208, 208,
+ 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217,
+ 217, 218, 218, 219, 219, 220, 220, 221, 222, 222, 223, 223, 224, 224, 225,
+ 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232,
+ 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240,
+ 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247,
+ 248, 248, 249, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254,
+ 255
+};
+
+
+/*
+ * sRGB gamma lookup table (inverted output to map to CMYK...)
+ */
+
+const unsigned char cups_scmy_lut[256] =
+{
+ 255, 235, 227, 222, 217, 213, 209, 206, 203, 200, 197, 194, 192, 190, 187,
+ 185, 183, 181, 179, 177, 175, 174, 172, 170, 168, 167, 165, 164, 162, 161,
+ 159, 158, 156, 155, 153, 152, 151, 149, 148, 147, 146, 144, 143, 142, 141,
+ 140, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 127, 126, 125, 124,
+ 123, 122, 121, 120, 119, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
+ 109, 108, 108, 107, 106, 105, 104, 103, 102, 102, 101, 100, 99, 98, 97,
+ 97, 96, 95, 94, 93, 93, 92, 91, 90, 90, 89, 88, 87, 87, 86,
+ 85, 84, 84, 83, 82, 81, 81, 80, 79, 79, 78, 77, 77, 76, 75,
+ 74, 74, 73, 72, 72, 71, 70, 70, 69, 68, 68, 67, 66, 66, 65,
+ 65, 64, 63, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 56, 56,
+ 55, 55, 54, 53, 53, 52, 52, 51, 50, 50, 49, 49, 48, 47, 47,
+ 46, 46, 45, 45, 44, 43, 43, 42, 42, 41, 41, 40, 39, 39, 38,
+ 38, 37, 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31, 30,
+ 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23,
+ 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16, 15,
+ 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8,
+ 7, 7, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1,
+ 0
+};
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Test the CMYK color separation code for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * test_gray() - Test grayscale separations...
+ * test_rgb() - Test color separations...
+ * main() - Do color separation tests.
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+#include "driver.h"
+#include <sys/stat.h>
+
+
+void test_gray(int num_comps, const char *basename);
+void test_rgb(int num_comps, const char *basename);
+
+
+/*
+ * 'main()' - Do color separation tests.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ /*
+ * Make the test directory...
+ */
+
+ mkdir("test", 0755);
+
+ /*
+ * Run tests for K, Kk, CMY, CMYK, CcMmYK, and CcMmYKk separations...
+ */
+
+ test_rgb(1, "test/K-rgb");
+ test_rgb(2, "test/Kk-rgb");
+ test_rgb(3, "test/CMY-rgb");
+ test_rgb(4, "test/CMYK-rgb");
+ test_rgb(6, "test/CcMmYK-rgb");
+ test_rgb(7, "test/CcMmYKk-rgb");
+
+ test_gray(1, "test/K-gray");
+ test_gray(2, "test/Kk-gray");
+ test_gray(3, "test/CMY-gray");
+ test_gray(4, "test/CMYK-gray");
+ test_gray(6, "test/CcMmYK-gray");
+ test_gray(7, "test/CcMmYKk-gray");
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+}
+
+
+/*
+ * 'test_gray()' - Test grayscale separations...
+ */
+
+void
+test_gray(int num_comps, /* I - Number of components */
+ const char *basename) /* I - Base filename of output */
+{
+ int i; /* Looping var */
+ char filename[255]; /* Output filename */
+ char line[255]; /* Line from PGM file */
+ int width, height; /* Width and height of test image */
+ int x, y; /* Current coordinate in image */
+ int r, g, b; /* Current RGB color */
+ unsigned char input[7000]; /* Line to separate */
+ short output[48000], /* Output separation data */
+ *outptr; /* Pointer in output */
+ FILE *in; /* Input PPM file */
+ FILE *out[CUPS_MAX_CHAN];
+ /* Output PGM files */
+ FILE *comp; /* Composite output */
+ cups_cmyk_t *cmyk; /* Color separation */
+
+
+ /*
+ * Open the test image...
+ */
+
+ in = fopen("image.pgm", "rb");
+ while (fgets(line, sizeof(line), in) != NULL)
+ if (isdigit(line[0]))
+ break;
+
+ sscanf(line, "%d%d", &width, &height);
+
+ fgets(line, sizeof(line), in);
+
+ /*
+ * Create the color separation...
+ */
+
+ cmyk = cupsCMYKNew(num_comps);
+
+ switch (num_comps)
+ {
+ case 2 : /* Kk */
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ break;
+
+ case 4 :
+ cupsCMYKSetGamma(cmyk, 2, 1.0, 0.9);
+ cupsCMYKSetBlack(cmyk, 0.5, 1.0);
+ break;
+
+ case 6 : /* CcMmYK */
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ cupsCMYKSetLtDk(cmyk, 2, 0.5, 1.0);
+ cupsCMYKSetGamma(cmyk, 4, 1.0, 0.9);
+ cupsCMYKSetBlack(cmyk, 0.5, 1.0);
+ break;
+
+ case 7 : /* CcMmYKk */
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ cupsCMYKSetLtDk(cmyk, 2, 0.5, 1.0);
+ cupsCMYKSetGamma(cmyk, 4, 1.0, 0.9);
+ cupsCMYKSetLtDk(cmyk, 5, 0.5, 1.0);
+ break;
+ }
+
+ /*
+ * Open the color separation files...
+ */
+
+ for (i = 0; i < num_comps; i ++)
+ {
+ sprintf(filename, "%s%d.pgm", basename, i);
+ out[i] = fopen(filename, "wb");
+
+ fprintf(out[i], "P5\n%d %d 255\n", width, height);
+ }
+
+ sprintf(filename, "%s.ppm", basename);
+ comp = fopen(filename, "wb");
+
+ fprintf(comp, "P6\n%d %d 255\n", width, height);
+
+ /*
+ * Read the image and do the separations...
+ */
+
+ for (y = 0; y < height; y ++)
+ {
+ fread(input, width, 1, in);
+
+ cupsCMYKDoGray(cmyk, input, output, width);
+
+ for (x = 0, outptr = output; x < width; x ++, outptr += num_comps)
+ {
+ for (i = 0; i < num_comps; i ++)
+ putc(255 - 255 * outptr[i] / 4095, out[i]);
+
+ r = 4095;
+ g = 4095;
+ b = 4095;
+
+ switch (num_comps)
+ {
+ case 1 :
+ r -= outptr[0];
+ g -= outptr[0];
+ b -= outptr[0];
+ break;
+ case 2 :
+ r -= outptr[0];
+ g -= outptr[0];
+ b -= outptr[0];
+
+ r -= outptr[1] / 2;
+ g -= outptr[1] / 2;
+ b -= outptr[1] / 2;
+ break;
+ case 3 :
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+ break;
+ case 4 :
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+
+ r -= outptr[3];
+ g -= outptr[3];
+ b -= outptr[3];
+ break;
+ case 6 :
+ r -= outptr[0] + outptr[1] / 2;
+ g -= outptr[2] + outptr[3] / 3;
+ b -= outptr[4];
+
+ r -= outptr[5];
+ g -= outptr[5];
+ b -= outptr[5];
+ break;
+ case 7 :
+ r -= outptr[0] + outptr[1] / 2;
+ g -= outptr[2] + outptr[3] / 3;
+ b -= outptr[4];
+
+ r -= outptr[5] + outptr[6] / 2;
+ g -= outptr[5] + outptr[6] / 2;
+ b -= outptr[5] + outptr[6] / 2;
+ break;
+ }
+
+ if (r < 0)
+ putc(0, comp);
+ else
+ putc(255 * r / 4095, comp);
+
+ if (g < 0)
+ putc(0, comp);
+ else
+ putc(255 * g / 4095, comp);
+
+ if (b < 0)
+ putc(0, comp);
+ else
+ putc(255 * b / 4095, comp);
+ }
+ }
+
+ for (i = 0; i < num_comps; i ++)
+ fclose(out[i]);
+
+ fclose(comp);
+ fclose(in);
+
+ cupsCMYKDelete(cmyk);
+}
+
+
+/*
+ * 'test_rgb()' - Test color separations...
+ */
+
+void
+test_rgb(int num_comps, /* I - Number of components */
+ const char *basename) /* I - Base filename of output */
+{
+ int i; /* Looping var */
+ char filename[255]; /* Output filename */
+ char line[255]; /* Line from PPM file */
+ int width, height; /* Width and height of test image */
+ int x, y; /* Current coordinate in image */
+ int r, g, b; /* Current RGB color */
+ unsigned char input[7000]; /* Line to separate */
+ short output[48000], /* Output separation data */
+ *outptr; /* Pointer in output */
+ FILE *in; /* Input PPM file */
+ FILE *out[CUPS_MAX_CHAN];
+ /* Output PGM files */
+ FILE *comp; /* Composite output */
+ cups_cmyk_t *cmyk; /* Color separation */
+
+
+ /*
+ * Open the test image...
+ */
+
+ in = fopen("image.ppm", "rb");
+ while (fgets(line, sizeof(line), in) != NULL)
+ if (isdigit(line[0]))
+ break;
+
+ sscanf(line, "%d%d", &width, &height);
+
+ fgets(line, sizeof(line), in);
+
+ /*
+ * Create the color separation...
+ */
+
+ cmyk = cupsCMYKNew(num_comps);
+
+ cupsCMYKSetBlack(cmyk, 0.5, 1.0);
+
+ switch (num_comps)
+ {
+ case 2 : /* Kk */
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ break;
+ case 6 : /* CcMmYK */
+ cupsCMYKSetGamma(cmyk, 0, 1.0, 0.8);
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ cupsCMYKSetGamma(cmyk, 2, 1.0, 0.8);
+ cupsCMYKSetLtDk(cmyk, 2, 0.5, 1.0);
+ break;
+ case 7 : /* CcMmYKk */
+ cupsCMYKSetGamma(cmyk, 0, 1.0, 0.8);
+ cupsCMYKSetLtDk(cmyk, 0, 0.5, 1.0);
+ cupsCMYKSetGamma(cmyk, 2, 1.0, 0.8);
+ cupsCMYKSetLtDk(cmyk, 2, 0.5, 1.0);
+ cupsCMYKSetLtDk(cmyk, 5, 0.5, 1.0);
+ break;
+ }
+
+ /*
+ * Open the color separation files...
+ */
+
+ for (i = 0; i < num_comps; i ++)
+ {
+ sprintf(filename, "%s%d.pgm", basename, i);
+ out[i] = fopen(filename, "wb");
+
+ fprintf(out[i], "P5\n%d %d 255\n", width, height);
+ }
+
+ sprintf(filename, "%s.ppm", basename);
+ comp = fopen(filename, "wb");
+
+ fprintf(comp, "P6\n%d %d 255\n", width, height);
+
+ /*
+ * Read the image and do the separations...
+ */
+
+ for (y = 0; y < height; y ++)
+ {
+ fread(input, width, 3, in);
+
+ cupsCMYKDoRGB(cmyk, input, output, width);
+
+ for (x = 0, outptr = output; x < width; x ++, outptr += num_comps)
+ {
+ for (i = 0; i < num_comps; i ++)
+ putc(255 - 255 * outptr[i] / 4095, out[i]);
+
+ r = 4095;
+ g = 4095;
+ b = 4095;
+
+ switch (num_comps)
+ {
+ case 1 :
+ r -= outptr[0];
+ g -= outptr[0];
+ b -= outptr[0];
+ break;
+ case 2 :
+ r -= outptr[0];
+ g -= outptr[0];
+ b -= outptr[0];
+
+ r -= outptr[1] / 2;
+ g -= outptr[1] / 2;
+ b -= outptr[1] / 2;
+ break;
+ case 3 :
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+ break;
+ case 4 :
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+
+ r -= outptr[3];
+ g -= outptr[3];
+ b -= outptr[3];
+ break;
+ case 6 :
+ r -= outptr[0] + outptr[1] / 2;
+ g -= outptr[2] + outptr[3] / 3;
+ b -= outptr[4];
+
+ r -= outptr[5];
+ g -= outptr[5];
+ b -= outptr[5];
+ break;
+ case 7 :
+ r -= outptr[0] + outptr[1] / 2;
+ g -= outptr[2] + outptr[3] / 3;
+ b -= outptr[4];
+
+ r -= outptr[5] + outptr[6] / 2;
+ g -= outptr[5] + outptr[6] / 2;
+ b -= outptr[5] + outptr[6] / 2;
+ break;
+ }
+
+ if (r < 0)
+ putc(0, comp);
+ else
+ putc(255 * r / 4095, comp);
+
+ if (g < 0)
+ putc(0, comp);
+ else
+ putc(255 * g / 4095, comp);
+
+ if (b < 0)
+ putc(0, comp);
+ else
+ putc(255 * b / 4095, comp);
+ }
+ }
+
+ for (i = 0; i < num_comps; i ++)
+ fclose(out[i]);
+
+ fclose(comp);
+ fclose(in);
+
+ cupsCMYKDelete(cmyk);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Dither test program for CUPS.
+ *
+ * Try the following:
+ *
+ * testdither 0 255 > filename.ppm
+ * testdither 0 127 255 > filename.ppm
+ * testdither 0 85 170 255 > filename.ppm
+ * testdither 0 63 127 170 198 227 255 > filename.ppm
+ * testdither 0 210 383 > filename.ppm
+ * testdither 0 82 255 > filename.ppm
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * main() - Test dithering and output a PPM file.
+ * usage() - Show program usage...
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+
+
+/*
+ * Local functions...
+ */
+
+void usage(void);
+
+
+/*
+ * 'main()' - Test dithering and output a PPM file.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int x, y; /* Current coordinate in image */
+ short line[512]; /* Line to dither */
+ unsigned char pixels[512], /* Dither pixels */
+ *pixptr; /* Pointer in line */
+ int output; /* Output pixel */
+ cups_lut_t *lut; /* Dither lookup table */
+ cups_dither_t *dither; /* Dither state */
+ int nlutvals; /* Number of lookup values */
+ float lutvals[16]; /* Lookup values */
+ int pixvals[16]; /* Pixel values */
+
+
+ /*
+ * See if we have lookup table values on the command-line...
+ */
+
+ if (argc > 1)
+ {
+ /*
+ * Yes, collect them...
+ */
+
+ nlutvals = 0;
+
+ for (x = 1; x < argc; x ++)
+ if (isdigit(argv[x][0]) && nlutvals < 16)
+ {
+ pixvals[nlutvals] = atoi(argv[x]);
+ lutvals[nlutvals] = atof(argv[x]) / 255.0;
+ nlutvals ++;
+ }
+ else
+ usage();
+
+ /*
+ * See if we have at least 2 values...
+ */
+
+ if (nlutvals < 2)
+ usage();
+ }
+ else
+ {
+ /*
+ * Otherwise use the default 2-entry LUT with values of 0 and 255...
+ */
+
+ nlutvals = 2;
+ lutvals[0] = 0.0;
+ lutvals[1] = 1.0;
+ pixvals[0] = 0;
+ pixvals[1] = 255;
+ }
+
+ /*
+ * Create the lookup table and dither state...
+ */
+
+ lut = cupsLutNew(nlutvals, lutvals);
+ dither = cupsDitherNew(512);
+
+ /*
+ * Put out the PGM header for a raw 256x256x8-bit grayscale file...
+ */
+
+ puts("P5\n512\n512\n255");
+
+ /*
+ * Dither 512 lines, which are written out in 256 image lines...
+ */
+
+ for (y = 0; y < 512; y ++)
+ {
+ /*
+ * Create the grayscale data for the current line...
+ */
+
+ for (x = 0; x < 512; x ++)
+ line[x] = 4095 * ((y / 32) * 16 + x / 32) / 255;
+
+ /*
+ * Dither the line...
+ */
+
+ cupsDitherLine(dither, lut, line, 1, pixels);
+
+ if (y == 0)
+ {
+ fputs("DEBUG: pixels =", stderr);
+ for (x = 0; x < 512; x ++)
+ fprintf(stderr, " %d", pixels[x]);
+ fputs("\n", stderr);
+ }
+
+ /*
+ * Add or set the output pixel values...
+ */
+
+ for (x = 0, pixptr = pixels; x < 512; x ++, pixptr ++)
+ {
+ output = 255 - pixvals[*pixptr];
+
+ if (output < 0)
+ putchar(0);
+ else
+ putchar(output);
+ }
+ }
+
+ /*
+ * Free the dither state and lookup table...
+ */
+
+ cupsDitherDelete(dither);
+ cupsLutDelete(lut);
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+}
+
+
+/*
+ * 'usage()' - Show program usage...
+ */
+
+void
+usage(void)
+{
+ puts("Usage: testdither [val1 val2 [... val16]] >filename.ppm");
+ exit(1);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Image library test program for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Main entry...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "image.h"
+
+
+/*
+ * 'main()' - Main entry...
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ cups_image_t *img; /* Image to print */
+ cups_icspace_t primary; /* Primary image colorspace */
+ FILE *out; /* Output PPM/PGM file */
+ cups_ib_t *line; /* Line from file */
+ int y, /* Current line */
+ width, /* Width of image */
+ height, /* Height of image */
+ depth; /* Depth of image */
+
+
+ if (argc != 3)
+ {
+ puts("Usage: testimage filename.ext filename.[ppm|pgm]");
+ return (1);
+ }
+
+ if (strstr(argv[2], ".ppm") != NULL)
+ primary = CUPS_IMAGE_RGB;
+ else
+ primary = CUPS_IMAGE_WHITE;
+
+ img = cupsImageOpen(argv[1], primary, CUPS_IMAGE_WHITE, 100, 0, NULL);
+
+ if (!img)
+ {
+ perror(argv[1]);
+ return (1);
+ }
+
+ out = fopen(argv[2], "wb");
+
+ if (!out)
+ {
+ perror(argv[2]);
+ cupsImageClose(img);
+ return (1);
+ }
+
+ width = cupsImageGetWidth(img);
+ height = cupsImageGetHeight(img);
+ depth = cupsImageGetDepth(img);
+ line = calloc(width, depth);
+
+ fprintf(out, "P%d\n%d\n%d\n255\n",
+ cupsImageGetColorSpace(img) == CUPS_IMAGE_WHITE ? 5 : 6,
+ width, height);
+
+ for (y = 0; y < height; y ++)
+ {
+ cupsImageGetRow(img, 0, y, width, line);
+ fwrite(line, width, depth, out);
+ }
+
+ cupsImageClose(img);
+ fclose(out);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Test the new RGB color separation code for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * main() - Do color rgb tests.
+ * test_gray() - Test grayscale rgbs...
+ * test_rgb() - Test color rgbs...
+ */
+
+/*
+ * Include necessary headers.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+#include "driver.h"
+#include <sys/stat.h>
+
+#ifdef USE_LCMS1
+# include <lcms.h>
+#endif /* USE_LCMS1 */
+
+
+void test_gray(cups_sample_t *samples, int num_samples,
+ int cube_size, int num_comps, const char *basename);
+void test_rgb(cups_sample_t *samples, int num_samples,
+ int cube_size, int num_comps,
+ const char *basename);
+
+
+/*
+ * 'main()' - Do color rgb tests.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ static cups_sample_t CMYK[] = /* Basic 4-color sep */
+ {
+ /*{ r, g, b }, { C, M, Y, K }*/
+ { { 0, 0, 0 }, { 0, 0, 0, 255 } },
+ { { 255, 0, 0 }, { 0, 255, 240, 0 } },
+ { { 0, 255, 0 }, { 200, 0, 200, 0 } },
+ { { 255, 255, 0 }, { 0, 0, 240, 0 } },
+ { { 0, 0, 255 }, { 200, 200, 0, 0 } },
+ { { 255, 0, 255 }, { 0, 200, 0, 0 } },
+ { { 0, 255, 255 }, { 200, 0, 0, 0 } },
+ { { 255, 255, 255 }, { 0, 0, 0, 0 } }
+ };
+
+
+ /*
+ * Make the test directory...
+ */
+
+ mkdir("test", 0755);
+
+ /*
+ * Run tests for CMYK and CMYK separations...
+ */
+
+ test_rgb(CMYK, 8, 2, 4, "test/rgb-cmyk");
+
+ test_gray(CMYK, 8, 2, 4, "test/gray-cmyk");
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+}
+
+
+/*
+ * 'test_gray()' - Test grayscale rgbs...
+ */
+
+void
+test_gray(cups_sample_t *samples, /* I - Sample values */
+ int num_samples, /* I - Number of samples */
+ int cube_size, /* I - Cube size */
+ int num_comps, /* I - Number of components */
+ const char *basename) /* I - Base filename of output */
+{
+ int i; /* Looping var */
+ char filename[255]; /* Output filename */
+ char line[255]; /* Line from PPM file */
+ int width, height; /* Width and height of test image */
+ int x, y; /* Current coordinate in image */
+ int r, g, b; /* Current RGB color */
+ unsigned char input[7000]; /* Line to rgbarate */
+ unsigned char output[48000], /* Output rgb data */
+ *outptr; /* Pointer in output */
+ FILE *in; /* Input PPM file */
+ FILE *out[CUPS_MAX_CHAN];
+ /* Output PGM files */
+ FILE *comp; /* Composite output */
+ cups_rgb_t *rgb; /* Color separation */
+
+
+ /*
+ * Open the test image...
+ */
+
+ in = fopen("image.pgm", "rb");
+ while (fgets(line, sizeof(line), in) != NULL)
+ if (isdigit(line[0]))
+ break;
+
+ sscanf(line, "%d%d", &width, &height);
+
+ fgets(line, sizeof(line), in);
+
+ /*
+ * Create the color rgb...
+ */
+
+ rgb = cupsRGBNew(num_samples, samples, cube_size, num_comps);
+
+ /*
+ * Open the color rgb files...
+ */
+
+ for (i = 0; i < num_comps; i ++)
+ {
+ sprintf(filename, "%s%d.pgm", basename, i);
+ out[i] = fopen(filename, "wb");
+
+ fprintf(out[i], "P5\n%d %d 255\n", width, height);
+ }
+
+ sprintf(filename, "%s.ppm", basename);
+ comp = fopen(filename, "wb");
+
+ fprintf(comp, "P6\n%d %d 255\n", width, height);
+
+ /*
+ * Read the image and do the rgbs...
+ */
+
+ for (y = 0; y < height; y ++)
+ {
+ fread(input, width, 1, in);
+
+ cupsRGBDoGray(rgb, input, output, width);
+
+ for (x = 0, outptr = output; x < width; x ++, outptr += num_comps)
+ {
+ for (i = 0; i < num_comps; i ++)
+ putc(255 - outptr[i], out[i]);
+
+ r = 255;
+ g = 255;
+ b = 255;
+
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+
+ r -= outptr[3];
+ g -= outptr[3];
+ b -= outptr[3];
+
+ if (num_comps > 4)
+ {
+ r -= outptr[4] / 2;
+ g -= outptr[5] / 2;
+ }
+
+ if (num_comps > 6)
+ {
+ r -= outptr[6] / 2;
+ g -= outptr[6] / 2;
+ b -= outptr[6] / 2;
+ }
+
+ if (r < 0)
+ putc(0, comp);
+ else
+ putc(r, comp);
+
+ if (g < 0)
+ putc(0, comp);
+ else
+ putc(g, comp);
+
+ if (b < 0)
+ putc(0, comp);
+ else
+ putc(b, comp);
+ }
+ }
+
+ for (i = 0; i < num_comps; i ++)
+ fclose(out[i]);
+
+ fclose(comp);
+ fclose(in);
+
+ cupsRGBDelete(rgb);
+}
+
+
+/*
+ * 'test_rgb()' - Test color rgbs...
+ */
+
+void
+test_rgb(cups_sample_t *samples, /* I - Sample values */
+ int num_samples, /* I - Number of samples */
+ int cube_size, /* I - Cube size */
+ int num_comps, /* I - Number of components */
+ const char *basename) /* I - Base filename of output */
+{
+ int i; /* Looping var */
+ char filename[255]; /* Output filename */
+ char line[255]; /* Line from PPM file */
+ int width, height; /* Width and height of test image */
+ int x, y; /* Current coordinate in image */
+ int r, g, b; /* Current RGB color */
+ unsigned char input[7000]; /* Line to rgbarate */
+ unsigned char output[48000], /* Output rgb data */
+ *outptr; /* Pointer in output */
+ FILE *in; /* Input PPM file */
+ FILE *out[CUPS_MAX_CHAN];
+ /* Output PGM files */
+ FILE *comp; /* Composite output */
+ cups_rgb_t *rgb; /* Color separation */
+
+
+ /*
+ * Open the test image...
+ */
+
+ in = fopen("image.ppm", "rb");
+ while (fgets(line, sizeof(line), in) != NULL)
+ if (isdigit(line[0]))
+ break;
+
+ sscanf(line, "%d%d", &width, &height);
+
+ fgets(line, sizeof(line), in);
+
+ /*
+ * Create the color rgb...
+ */
+
+ rgb = cupsRGBNew(num_samples, samples, cube_size, num_comps);
+
+ /*
+ * Open the color rgb files...
+ */
+
+ for (i = 0; i < num_comps; i ++)
+ {
+ sprintf(filename, "%s%d.pgm", basename, i);
+ out[i] = fopen(filename, "wb");
+
+ fprintf(out[i], "P5\n%d %d 255\n", width, height);
+ }
+
+ sprintf(filename, "%s.ppm", basename);
+ comp = fopen(filename, "wb");
+
+ fprintf(comp, "P6\n%d %d 255\n", width, height);
+
+ /*
+ * Read the image and do the rgbs...
+ */
+
+ for (y = 0; y < height; y ++)
+ {
+ fread(input, width, 3, in);
+
+ cupsRGBDoRGB(rgb, input, output, width);
+
+ for (x = 0, outptr = output; x < width; x ++, outptr += num_comps)
+ {
+ for (i = 0; i < num_comps; i ++)
+ putc(255 - outptr[i], out[i]);
+
+ r = 255;
+ g = 255;
+ b = 255;
+
+ r -= outptr[0];
+ g -= outptr[1];
+ b -= outptr[2];
+
+ r -= outptr[3];
+ g -= outptr[3];
+ b -= outptr[3];
+
+ if (num_comps > 4)
+ {
+ r -= outptr[4] / 2;
+ g -= outptr[5] / 2;
+ }
+
+ if (num_comps > 6)
+ {
+ r -= outptr[6] / 2;
+ g -= outptr[6] / 2;
+ b -= outptr[6] / 2;
+ }
+
+ if (r < 0)
+ putc(0, comp);
+ else
+ putc(r, comp);
+
+ if (g < 0)
+ putc(0, comp);
+ else
+ putc(g, comp);
+
+ if (b < 0)
+ putc(0, comp);
+ else
+ putc(b, comp);
+ }
+ }
+
+ for (i = 0; i < num_comps; i ++)
+ fclose(out[i]);
+
+ fclose(comp);
+ fclose(in);
+
+ cupsRGBDelete(rgb);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+cups-filters (1.0.25-2slp2) unstable; urgency=low
+
+ * Applied missing OOM patch
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.25-2slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 26 Dec 2012 15:26:18 +0900
+
+cups-filters (1.0.25-1slp2) unstable; urgency=low
+
+ * Upgrade to 1.0.25
+ * Removed unnecassary filter
+ * texttopdf, textonly, texttops, commandtoescpx, commandtopclx
+ * rastertoescpx, rastertopclx, pdftoijs, pdftoopvp
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.25-1slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 17 Dec 2012 18:20:58 +0900
+
+cups-filters (1.0.18-14slp2) unstable; urgency=low
+
+ * Changed library smack label
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-14slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Tue, 04 Dec 2012 10:56:43 +0900
+
+cups-filters (1.0.18-13slp2) unstable; urgency=low
+
+ * Changed libjpeg-devel to libjpeg-turbo-devel
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-13slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 31 Oct 2012 11:29:17 +0900
+
+cups-filters (1.0.18-12) unstable; urgency=low
+
+ * Added license file
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-12
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Thu, 11 Oct 2012 18:43:50 +0900
+
+cups-filters (1.0.18-11) unstable; urgency=low
+
+ * Added smack manifest file
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-11
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Fri, 21 Sep 2012 14:49:49 +0900
+
+cups-filters (1.0.18-10) unstable; urgency=low
+
+ * Fixed pdftoraster to divide page to some slices to decrease memory consumption
+ * Fixed pdftops crash in parsing page object incorrectly
+ * Deleted poppler version dependency
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-10
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 19 Sep 2012 20:36:56 +0900
+
+cups-filters (1.0.18-9) unstable; urgency=low
+
+ * Deleted pdf.h and some pdf files to resolve GPL3 license conflict
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-9
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Tue, 11 Sep 2012 16:32:41 +0900
+
+cups-filters (1.0.18-8) unstable; urgency=low
+
+ * Added installation of cupsfilters.convs and cupsfilters.types
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.18-8
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Tue, 21 Aug 2012 22:47:22 +0900
+
+cups-filters (1.0.18-7slp2) unstable; urgency=low
+
+ * Deleted bannertopdf license and source files
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-7slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 13 Aug 2012 14:32:12 +0900
+
+cups-filters (1.0.18-6slp2) unstable; urgency=low
+
+ * Deleted bannertopdf filter(GPLv3)
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-6slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Tue, 24 Jul 2012 19:10:38 +0900
+
+cups-filters (1.0.18-5slp2) unstable; urgency=low
+
+ * Applied mandatory filter package for normal operation of cups-1.5.3
+ * Fixed jira defects(S1-6103, S1-6134, S1-6165)
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-5slp2
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Fri, 20 Jul 2012 23:02:10 +0900
+
+cups-filters (1.0.18-4slp2) unstable; urgency=low
+
+ * Fixed to use pdftops instead of gs in configuration
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-4slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 18 Jul 2012 21:17:59 +0900
+
+cups-filters (1.0.18-3slp2) unstable; urgency=low
+
+ * Updated spec file for rpm packaging
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-3slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 16 Jul 2012 22:32:17 +0900
+
+cups-filters (1.0.18-2slp2) unstable; urgency=low
+
+ * Ported on SLP initially
+ * Git: slp/pkgs/c/cups-filters
+ * Tag: cups-filters_1.0.18-2slp2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 16 Jul 2012 21:37:59 +0900
+
+cups-filters (1.0.18-2) unstable; urgency=low
+
+ [ Fabian Greffrath ]
+ * Add patch to avoid trimming the results of FcFontSort(), as this may
+ miss some reasonable candidates under certain circumstances. BTW,
+ fix passing a non-pointer as a pointer to "result". (Closes: #670055)
+
+ -- Didier Raboud <odyx@debian.org> Fri, 18 May 2012 15:01:54 +0200
+
+cups-filters (1.0.18-1) unstable; urgency=low
+
+ * New upstream release
+ - pdftops: Allow selection whether Ghostscript or Poppler is used
+ at runtime, setting the "pdftops-renderer" option to "gs" or
+ "pdftops". This way one can switch to Poppler per-queue if there
+ are incompatibilities with certain PostScript printers.
+ - pdftops: Allow setting an upper limit for the image rendering
+ resolution, also at runtime, setting the option
+ "pdftops-max-image-resolution-default" to the desired limit in dpi.
+ "0" means no limit. Default limit is 1440 dpi. This prevents slow
+ processing by the printer if very high resolutions are used or
+ if the printing resolution is mis-detected by the pdftops filter.
+ - pdftops: Fixed crash by wrong usage of sizeof() function when adding
+ "Collate" to the fifth command line argument for the "pstops" CUPS
+ filter call (LP: #982675).
+ - pdftops: Removed newline from copies value when reading it from
+ the "%%PDFTOPDFNumCopies" entry of the incoming PDF file.
+ - pdftops: Silenced compiler warning about ignoring the return
+ value of the write() function.
+ - pdftops: Added a crash guard.
+ - pdftops: Start determining the printing resolution with
+ cupsRasterInterpretPPD(), this is the most reliable as often
+ the choice names of the "Resolution" option are marketing names
+ with higher numerical values than the actual resolution. Also
+ ignore error exit values of cupsRasterInterpretPPD() as the
+ function can error out after having found the resolution.
+ - pdftops: If printing resolution is determined by
+ cupsRasterInterpretPPD() do not stick on 100 dpi if the
+ resolution cannot be determined (LP: #984082).
+ - pdftopdf: Fixed segmentation fault when printing selected pages
+ ("page-ranges" option, LP: #980673).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 16 May 2012 11:45:03 +0200
+
+cups-filters (1.0.16-2) unstable; urgency=low
+
+ * Drop libtiff5-dev, just use libtiff-dev, this fixes the FTBFS due to
+ incompatibility with cups.
+
+ -- Didier Raboud <odyx@debian.org> Thu, 19 Apr 2012 10:35:41 +0200
+
+cups-filters (1.0.16-1) unstable; urgency=low
+
+ * New upstream release
+ - pdftopdf: Fixed segmentation faults when using N-up with certain PDF
+ files (LP: #980673) and when calling pdftopdf manually without
+ specifyting a PPD file.
+ - pdftops: Suppress image compression only for Brother printers as they
+ really need this measure to print at all. This accelerates printer-
+ internal job processing on most other printers (tested on HP and
+ Kyocera). Also suppress page compression on Kyocera printers, this
+ works around a bug in Kyocera's PostScript interpreters which makes
+ printing pages with images very slow (LP: #977912).
+ - pdftops: Determine printing resolution from the PPD file and supply
+ it on the Ghostscript or pdftops (Poppler) command line, so that
+ the renderer does the image rendering with a resolution matching the
+ printer's resolution. This avoids too slow processing of the jobs
+ by the printer's built-in PostScript interpreter. In addition
+ a default resolution of 300 dpi is used for PPDs without any hint
+ of the printer's resolution, as most PostScript lasers use multiples
+ of 300 dpi as resolution (LP: #977912).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 16 Apr 2012 12:36:03 +0200
+
+cups-filters (1.0.13-1) unstable; urgency=low
+
+ * New upstream release
+ - Fixed display of job date on test page and banner pages (LP: #975064).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 10 Apr 2012 07:40:11 +0200
+
+cups-filters (1.0.12-1) unstable; urgency=low
+
+ * New upstream release
+ - Fixed crash of imagetopdf filter when it is called manually
+ without supplying a valid PPD file (LP: #973564).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Thu, 05 Apr 2012 13:35:24 +0200
+
+cups-filters (1.0.11-1) unstable; urgency=low
+
+ [ Till Kamppeter ]
+ * New upstream release
+ - Updated all code copied from Poppler to the current state of Poppler,
+ to fix any bugs or security vulnerabilities which were in that
+ Poppler code.
+ - Made Poppler-based PDF filters building with various versions of
+ Poppler.
+ - Deactivated MIME conversion rules which are not used by the PDF-
+ based printing workflow.
+ - Added generic PPD for native PDF printers.
+ - Cleaned up sample PPD file HP-Color_LaserJet_CM3530_MFP-PDF.ppd.
+ - imagetopdf: Added support for native PDF printers.
+ - imagetopdf, imagetoraster: Let image input "scale to fit"
+ by default. This makes photo printing via AirPrint work,
+ as the iOS devices send JPEG but do not allow setting options.
+ - pdftops: Generally do not compress fonts and images, and
+ also do not do CCITT compression for bitmap glyphs to make
+ the PostScript output more compatible with buggy PostScript
+ interpreters. The output gets 30-50% longer but will work on
+ many more different printer models. Problems were also
+ discovered on HP and not only on Brother (LP: #960666).
+
+ [ Martin Pitt ]
+ * Drop debian/patches/poppler-pre-0.18.patch and patch machinery around it.
+ It's not necessary with the current upstream version any more.
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 30 Mar 2012 08:49:48 +0200
+
+cups-filters (1.0.7-1) unstable; urgency=low
+
+ * New upstream release
+ - cups-filters 1.0.7 release
+ - pdftops: Added debug mode for investigating PostScript printer
+ incompatibilities and interpreter bugs. Now sending a job with
+ "lpr -o psdebug" makes the filter sending uncompressed PostScript.
+ - pdftops: Additional workaround for a bug in the PostsSript interpreters
+ of Brother printers, calling Ghostscript with special command line
+ options (LP: #955553).
+ - pdftopdf: Correct handling of PJL output and page_log messages on
+ native PDF printers and on printers using a driver after pdftopdf
+ (including PostScript printers).
+ - texttopdf: Full fontconfig support, several bug fixes and improvements
+ to make the output work on more different PDF interpreters, including
+ built-in interpreters in printers.
+ - Fixed cupsfilters.drv PPD generator and rastertopclx filter to make the
+ supported HP DesignJet printers actually work.
+ - parallel backend: Use same method as CUPS to overcome infinite loop
+ on side channel errors (LP: #936647, CUPS STR #4044).
+ - "make clean" and "make distclesn" work also correctly now when called
+ repeatedly (Closes: #663564).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 21 Mar 2012 09:18:55 +0100
+
+cups-filters (1.0.5-1) unstable; urgency=low
+
+ * New upstream release
+ - cups-filters 1.0.5 release
+ - pdftops: Added insertion of workaround PostScript code for printers
+ with bugs in their PS interpreters (LP: #950713, LP: #951627).
+ - parallel backend: Break infinite loop (LP: #936647).
+ - texttopdf: Complete the implementation of fontconfig-based font
+ selection (Closes: #663070).
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 14 Mar 2012 11:43:22 +0100
+
+cups-filters (1.0.4-1) unstable; urgency=low
+
+ [ Till Kamppeter ]
+ * New upstream release
+ - cups-filters 1.0.4 release
+ - texttopdf: Fall back to altermative fonts via fontconfig if the
+ FreeMono TrueType fonts are not installed (Closes: #495598,
+ Closes: #662660).
+ - bannertopdf: Fix off-by-one error in page duplication
+ - bannertopdf: Put indirect references to streams into the page's
+ contents
+ - bannertopdf: Let byte offsets for the Xref table of the PDF output
+ being determined correctly also when the output goes to stdout
+ (LP: #939735).
+ - bannertopdf: Output multiple copies of the test page if duplex
+ and/or N-up is chosen, to let the test page appear on all possible
+ positions of the sheet (LP: #939530).
+ - bannertopdf: Scale test page template to fit the job's page size,
+ get and display full page geometry information, draw the frame which
+ marks the printable area 1pt smaller, to assure that it gets completely
+ visible (LP: #921073).
+ * debian/local/default-testpage.pdf: Added missing "Q" operator to the end of
+ the page. This broke N-up printing with pdftopdf (LP: #939530).
+ * debian/control: Added explicit build dependency on libfontconfig1-dev.
+ (Closes: #661127)
+ * debian/control: Changed font dependency (for texttopdf) to "ttf-freefont |
+ fonts-liberation | ttf-dejavu" instead of only "ttf-freefont"
+ (Closes: #495598, Closes: #662660).
+
+ [ Martin Pitt ]
+ * debian/control: Build against libpng-dev, with an alternative to the older
+ libpng12-dev. (Closes: #662295)
+ * debian/control: Prefer building against libtiff5-dev if available, falling
+ back to libtiff-dev.
+ * debian/control, debian/rules: Move from hardening-wrapper to using
+ dpkg-buildflags. Bump dpkg-dev build dependency to (>= 1.16.1~) for this.
+ * debian/copyright: Update Format header for official copyright format 1.0.
+ * debian/control: Bump Standards-Version to 3.9.3.
+ * debian/rules: Drop LC_MESSAGES setting, leftover from cups.
+ * debian/control: Bump libcupsimage2-dev build dependency to ensure to build
+ against a version which does not conflict on the libtiff?-dev build
+ dependency.
+
+ -- Martin Pitt <mpitt@debian.org> Wed, 07 Mar 2012 14:36:49 +0100
+
+cups-filters (1.0.2-1) unstable; urgency=low
+
+ [ Till Kamppeter ]
+ * New upstream release
+ - cups-filters 1.0.2 release
+ - bannertopdf fixes
+ * debian/local/default-testpage.pdf, debian/source/include-binaries: Added
+ Ubuntu-branded test page template.
+ * debian/rules: Replace the upstream test page template by the Ubuntu-branded
+ one if the package is built under Ubuntu.
+
+ [ Martin Pitt ]
+ * debian/control: Build-depend on libpoppler-private-dev for the impending
+ poppler 0.18 transition. Thanks Pino Toscano! (Closes: #660989)
+
+ -- Martin Pitt <mpitt@debian.org> Thu, 23 Feb 2012 14:48:00 +0100
+
+cups-filters (1.0.1-1) unstable; urgency=low
+
+ * New upstream release
+ - cups-filters 1.0.1 release
+ - Included the textonly filter, Red Hat's driver for text-only printers.
+ - Install sample PPD file for pdftoijs (for HP PhotoSmart Pro B8300).
+ - Added cupsfilters.drv, providing support for the HP DesignJet 600,
+ 750C, 1050C, 4000, T1100, T790.
+ - Added texttops and imagetops filters for backward compatibility
+ (Closes: #658258).
+ - Use Ghostscript as default renderer when building pdftops (LP: #926068).
+ - Build system and documentation fixes
+ - Incorporated distro patches upstream: Cost factor 100 for pdftoraster,
+ installation of C headers, PDF filter documentation
+ * debian/local/text*, debian/local/README.pdf-filters: Removed, incorporated
+ upstream.
+ * debian/cups-filters.ppd-updater: Updated appropriate to changes in the
+ upstream package.
+ * debian/cups-filters.install: Updated due to upstream inclusion of
+ textonly filter.
+ * debian/rules: Removed extra rules for working around build system bugs
+ in 1.0b1.
+ * debian/libcupsfilters-dev.install: Install the files via this .install file
+ now and not via debian/rules.
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 14 Feb 2012 07:23:51 +0100
+
+cups-filters (1.0~b1-3) unstable; urgency=low
+
+ * debian/control: Add missing libijs-dev build dependency.
+
+ -- Martin Pitt <mpitt@debian.org> Mon, 30 Jan 2012 07:21:37 +0100
+
+cups-filters (1.0~b1-2) unstable; urgency=low
+
+ * Upload to unstable.
+
+ -- Martin Pitt <mpitt@debian.org> Mon, 30 Jan 2012 06:35:46 +0100
+
+cups-filters (1.0~b1-1) experimental; urgency=low
+
+ * Initial Release. This is a splitout of all filters which are currently
+ being shipped by the "cups" package but are not provided by upstream any
+ more. These now have a new home at openprinting.org. Upload to
+ experimental for getting it through NEW, then cups and cups-filters will
+ be uploaded to unstable in lockstep.
+
+ -- Till Kamppeter <till.kamppeter@gmail.com> Sat, 28 Jan 2012 13:13:07 +0100
--- /dev/null
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2012-03-27.16; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like '#:fec' to the end of the
+ # dependency line.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\':
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' "$nl" < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
--- /dev/null
+/*
+
+Copyright (c) 2012, BBR Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/*
+ P2PError.h
+*/
+#ifndef _P2PERROR_H_
+#define _P2PERROR_H_
+
+#include <config.h>
+#include <stdarg.h>
+#include <Error.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+#define pdfError(pos,...) error(errInternal,pos,__VA_ARGS__)
+#else
+#define pdfError(pos,...) error(pos,__VA_ARGS__)
+#endif
+
+#endif
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Advanced EPSON ESC/P command filter for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ *
+ * Contents:
+ *
+ * main() - Main entry and command processing.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <cupsfilters/driver.h>
+#include <string.h>
+#include <ctype.h>
+#include "escp.h"
+
+
+/*
+ * 'main()' - Main entry and processing of driver.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ FILE *fp; /* Command file */
+ char line[1024], /* Line from file */
+ *lineptr; /* Pointer into line */
+ int feedpage; /* Feed the page */
+ ppd_file_t *ppd; /* PPD file */
+
+
+ /*
+ * Check for valid arguments...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ /*
+ * We don't have the correct number of arguments; write an error message
+ * and return.
+ */
+
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ argv[0]);
+ return (1);
+ }
+
+ /*
+ * Open the PPD file...
+ */
+
+ if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL)
+ {
+ fputs("ERROR: Unable to open PPD file!\n", stderr);
+ return (1);
+ }
+
+ /*
+ * Open the command file as needed...
+ */
+
+ if (argc == 7)
+ {
+ if ((fp = fopen(argv[6], "r")) == NULL)
+ {
+ perror("ERROR: Unable to open command file - ");
+ return (1);
+ }
+ }
+ else
+ fp = stdin;
+
+ /*
+ * Some EPSON printers need an additional command issued at the
+ * beginning of each job to exit from USB "packet" mode...
+ */
+
+ if (ppd->model_number & ESCP_USB)
+ cupsWritePrintData("\000\000\000\033\001@EJL 1284.4\n@EJL \n\033@", 29);
+
+ /*
+ * Reset the printer...
+ */
+
+ cupsWritePrintData("\033@", 2);
+
+ /*
+ * Enter remote mode...
+ */
+
+ cupsWritePrintData("\033(R\010\000\000REMOTE1", 13);
+ feedpage = 0;
+
+ /*
+ * Read the commands from the file and send the appropriate commands...
+ */
+
+ while (fgets(line, sizeof(line), fp) != NULL)
+ {
+ /*
+ * Drop trailing newline...
+ */
+
+ lineptr = line + strlen(line) - 1;
+ if (*lineptr == '\n')
+ *lineptr = '\0';
+
+ /*
+ * Skip leading whitespace...
+ */
+
+ for (lineptr = line; isspace(*lineptr); lineptr ++);
+
+ /*
+ * Skip comments and blank lines...
+ */
+
+ if (*lineptr == '#' || !*lineptr)
+ continue;
+
+ /*
+ * Parse the command...
+ */
+
+ if (strncasecmp(lineptr, "Clean", 5) == 0)
+ {
+ /*
+ * Clean heads...
+ */
+
+ cupsWritePrintData("CH\002\000\000\000", 6);
+ }
+ else if (strncasecmp(lineptr, "PrintAlignmentPage", 18) == 0)
+ {
+ /*
+ * Print alignment page...
+ */
+
+ int phase;
+
+ phase = atoi(lineptr + 18);
+
+ cupsWritePrintData("DT\003\000\000", 5);
+ putchar(phase & 255);
+ putchar(phase >> 8);
+ feedpage = 1;
+ }
+ else if (strncasecmp(lineptr, "PrintSelfTestPage", 17) == 0)
+ {
+ /*
+ * Print version info and nozzle check...
+ */
+
+ cupsWritePrintData("VI\002\000\000\000", 6);
+ cupsWritePrintData("NC\002\000\000\000", 6);
+ feedpage = 1;
+ }
+ else if (strncasecmp(lineptr, "ReportLevels", 12) == 0)
+ {
+ /*
+ * Report ink levels...
+ */
+
+ cupsWritePrintData("IQ\001\000\001", 5);
+ }
+ else if (strncasecmp(lineptr, "SetAlignment", 12) == 0)
+ {
+ /*
+ * Set head alignment...
+ */
+
+ int phase, x;
+
+ if (sscanf(lineptr + 12, "%d%d", &phase, &x) != 2)
+ {
+ fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
+ continue;
+ }
+
+ cupsWritePrintData("DA\004\000", 4);
+ putchar(0);
+ putchar(phase);
+ putchar(0);
+ putchar(x);
+ cupsWritePrintData("SV\000\000", 4);
+ }
+ else
+ fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
+ }
+
+ /*
+ * Exit remote mode...
+ */
+
+ cupsWritePrintData("\033\000\000\000", 4);
+
+ /*
+ * Eject the page as needed...
+ */
+
+ if (feedpage)
+ {
+ fputs("PAGE: 1 1\n", stderr);
+
+ putchar(13);
+ putchar(10);
+ putchar(12);
+ }
+
+ /*
+ * Reset the printer...
+ */
+
+ cupsWritePrintData("\033@", 2);
+
+ /*
+ * Close the command file and return...
+ */
+
+ ppdClose(ppd);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Advanced PCL command filter for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ *
+ * Contents:
+ *
+ * main() - Main entry and command processing.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <cupsfilters/driver.h>
+#include <string.h>
+#include <ctype.h>
+#include "pcl.h"
+
+
+/*
+ * 'main()' - Main entry and processing of driver.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ FILE *fp; /* Command file */
+ char line[1024], /* Line from file */
+ *lineptr; /* Pointer into line */
+ int feedpage; /* Feed the page */
+ ppd_file_t *ppd; /* PPD file */
+
+
+ /*
+ * Check for valid arguments...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ /*
+ * We don't have the correct number of arguments; write an error message
+ * and return.
+ */
+
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ argv[0]);
+ return (1);
+ }
+
+ /*
+ * Open the PPD file...
+ */
+
+ if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL)
+ {
+ fputs("ERROR: Unable to open PPD file!\n", stderr);
+ return (1);
+ }
+
+ /*
+ * Open the command file as needed...
+ */
+
+ if (argc == 7)
+ {
+ if ((fp = fopen(argv[6], "r")) == NULL)
+ {
+ perror("ERROR: Unable to open command file - ");
+ return (1);
+ }
+ }
+ else
+ fp = stdin;
+
+ /*
+ * Reset the printer...
+ */
+
+ cupsWritePrintData("\033E", 2);
+
+ /*
+ * Read the commands from the file and send the appropriate commands...
+ */
+
+ feedpage = 0;
+
+ while (fgets(line, sizeof(line), fp) != NULL)
+ {
+ /*
+ * Drop trailing newline...
+ */
+
+ lineptr = line + strlen(line) - 1;
+ if (*lineptr == '\n')
+ *lineptr = '\0';
+
+ /*
+ * Skip leading whitespace...
+ */
+
+ for (lineptr = line; isspace(*lineptr); lineptr ++);
+
+ /*
+ * Skip comments and blank lines...
+ */
+
+ if (*lineptr == '#' || !*lineptr)
+ continue;
+
+ /*
+ * Parse the command...
+ */
+
+ if (strncasecmp(lineptr, "Clean", 5) == 0 &&
+ (ppd->model_number & PCL_INKJET))
+ {
+ /*
+ * Clean heads...
+ */
+
+ cupsWritePrintData("\033&b16WPML \004\000\006\001\004\001\005\001"
+ "\001\004\001\144", 22);
+ }
+ else
+ fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
+ }
+
+ /*
+ * Eject the page as needed...
+ */
+
+ if (feedpage)
+ {
+ fputs("PAGE: 1 1\n", stderr);
+
+ putchar(12);
+ }
+
+ /*
+ * Reset the printer...
+ */
+
+ cupsWritePrintData("\033E", 2);
+
+ /*
+ * Close the command file and return...
+ */
+
+ ppdClose(ppd);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common filter routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * SetCommonOptions() - Set common filter options for media size,
+ * etc.
+ * UpdatePageVars() - Update the page variables for the orientation.
+ * WriteComment() - Write a DSC comment.
+ * WriteCommon() - Write common procedures...
+ * WriteLabelProlog() - Write the prolog with the classification
+ * and page label.
+ * WriteLabels() - Write the actual page labels.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "common.h"
+#include <locale.h>
+
+
+/*
+ * Globals...
+ */
+
+int Orientation = 0, /* 0 = portrait, 1 = landscape, etc. */
+ Duplex = 0, /* Duplexed? */
+ LanguageLevel = 1, /* Language level of printer */
+ ColorDevice = 1; /* Do color text? */
+float PageLeft = 18.0f, /* Left margin */
+ PageRight = 594.0f, /* Right margin */
+ PageBottom = 36.0f, /* Bottom margin */
+ PageTop = 756.0f, /* Top margin */
+ PageWidth = 612.0f, /* Total page width */
+ PageLength = 792.0f; /* Total page length */
+
+
+/*
+ * 'SetCommonOptions()' - Set common filter options for media size, etc.
+ */
+
+ppd_file_t * /* O - PPD file */
+SetCommonOptions(
+ int num_options, /* I - Number of options */
+ cups_option_t *options, /* I - Options */
+ int change_size) /* I - Change page size? */
+{
+ ppd_file_t *ppd; /* PPD file */
+ ppd_size_t *pagesize; /* Current page size */
+ const char *val; /* Option value */
+
+
+#ifdef LC_TIME
+ setlocale(LC_TIME, "");
+#endif /* LC_TIME */
+
+ ppd = ppdOpenFile(getenv("PPD"));
+
+ ppdMarkDefaults(ppd);
+ cupsMarkOptions(ppd, num_options, options);
+
+ if ((pagesize = ppdPageSize(ppd, NULL)) != NULL)
+ {
+ PageWidth = pagesize->width;
+ PageLength = pagesize->length;
+ PageTop = pagesize->top;
+ PageBottom = pagesize->bottom;
+ PageLeft = pagesize->left;
+ PageRight = pagesize->right;
+
+ fprintf(stderr, "DEBUG: Page = %.0fx%.0f; %.0f,%.0f to %.0f,%.0f\n",
+ PageWidth, PageLength, PageLeft, PageBottom, PageRight, PageTop);
+ }
+
+ if (ppd != NULL)
+ {
+ ColorDevice = ppd->color_device;
+ LanguageLevel = ppd->language_level;
+ }
+
+ if ((val = cupsGetOption("landscape", num_options, options)) != NULL)
+ {
+ if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 &&
+ strcasecmp(val, "false") != 0)
+ {
+ if (ppd && ppd->landscape > 0)
+ Orientation = 1;
+ else
+ Orientation = 3;
+ }
+ }
+ else if ((val = cupsGetOption("orientation-requested", num_options, options)) != NULL)
+ {
+ /*
+ * Map IPP orientation values to 0 to 3:
+ *
+ * 3 = 0 degrees = 0
+ * 4 = 90 degrees = 1
+ * 5 = -90 degrees = 3
+ * 6 = 180 degrees = 2
+ */
+
+ Orientation = atoi(val) - 3;
+ if (Orientation >= 2)
+ Orientation ^= 1;
+ }
+
+ if ((val = cupsGetOption("page-left", num_options, options)) != NULL)
+ {
+ switch (Orientation & 3)
+ {
+ case 0 :
+ PageLeft = (float)atof(val);
+ break;
+ case 1 :
+ PageBottom = (float)atof(val);
+ break;
+ case 2 :
+ PageRight = PageWidth - (float)atof(val);
+ break;
+ case 3 :
+ PageTop = PageLength - (float)atof(val);
+ break;
+ }
+ }
+
+ if ((val = cupsGetOption("page-right", num_options, options)) != NULL)
+ {
+ switch (Orientation & 3)
+ {
+ case 0 :
+ PageRight = PageWidth - (float)atof(val);
+ break;
+ case 1 :
+ PageTop = PageLength - (float)atof(val);
+ break;
+ case 2 :
+ PageLeft = (float)atof(val);
+ break;
+ case 3 :
+ PageBottom = (float)atof(val);
+ break;
+ }
+ }
+
+ if ((val = cupsGetOption("page-bottom", num_options, options)) != NULL)
+ {
+ switch (Orientation & 3)
+ {
+ case 0 :
+ PageBottom = (float)atof(val);
+ break;
+ case 1 :
+ PageLeft = (float)atof(val);
+ break;
+ case 2 :
+ PageTop = PageLength - (float)atof(val);
+ break;
+ case 3 :
+ PageRight = PageWidth - (float)atof(val);
+ break;
+ }
+ }
+
+ if ((val = cupsGetOption("page-top", num_options, options)) != NULL)
+ {
+ switch (Orientation & 3)
+ {
+ case 0 :
+ PageTop = PageLength - (float)atof(val);
+ break;
+ case 1 :
+ PageRight = PageWidth - (float)atof(val);
+ break;
+ case 2 :
+ PageBottom = (float)atof(val);
+ break;
+ case 3 :
+ PageLeft = (float)atof(val);
+ break;
+ }
+ }
+
+ if (change_size)
+ UpdatePageVars();
+
+ if (ppdIsMarked(ppd, "Duplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "Duplex", "DuplexTumble") ||
+ ppdIsMarked(ppd, "JCLDuplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "JCLDuplex", "DuplexTumble") ||
+ ppdIsMarked(ppd, "EFDuplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "EFDuplex", "DuplexTumble") ||
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexTumble"))
+ Duplex = 1;
+
+ return (ppd);
+}
+
+
+/*
+ * 'UpdatePageVars()' - Update the page variables for the orientation.
+ */
+
+void
+UpdatePageVars(void)
+{
+ float temp; /* Swapping variable */
+
+
+ switch (Orientation & 3)
+ {
+ case 0 : /* Portait */
+ break;
+
+ case 1 : /* Landscape */
+ temp = PageLeft;
+ PageLeft = PageBottom;
+ PageBottom = temp;
+
+ temp = PageRight;
+ PageRight = PageTop;
+ PageTop = temp;
+
+ temp = PageWidth;
+ PageWidth = PageLength;
+ PageLength = temp;
+ break;
+
+ case 2 : /* Reverse Portrait */
+ temp = PageWidth - PageLeft;
+ PageLeft = PageWidth - PageRight;
+ PageRight = temp;
+
+ temp = PageLength - PageBottom;
+ PageBottom = PageLength - PageTop;
+ PageTop = temp;
+ break;
+
+ case 3 : /* Reverse Landscape */
+ temp = PageWidth - PageLeft;
+ PageLeft = PageWidth - PageRight;
+ PageRight = temp;
+
+ temp = PageLength - PageBottom;
+ PageBottom = PageLength - PageTop;
+ PageTop = temp;
+
+ temp = PageLeft;
+ PageLeft = PageBottom;
+ PageBottom = temp;
+
+ temp = PageRight;
+ PageRight = PageTop;
+ PageTop = temp;
+
+ temp = PageWidth;
+ PageWidth = PageLength;
+ PageLength = temp;
+ break;
+ }
+}
+
+
+/*
+ * 'WriteCommon()' - Write common procedures...
+ */
+
+void
+WriteCommon(void)
+{
+ puts("% x y w h ESPrc - Clip to a rectangle.\n"
+ "userdict/ESPrc/rectclip where{pop/rectclip load}\n"
+ "{{newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto\n"
+ "neg 0 rlineto closepath clip newpath}bind}ifelse put");
+ puts("% x y w h ESPrf - Fill a rectangle.\n"
+ "userdict/ESPrf/rectfill where{pop/rectfill load}\n"
+ "{{gsave newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto\n"
+ "neg 0 rlineto closepath fill grestore}bind}ifelse put");
+ puts("% x y w h ESPrs - Stroke a rectangle.\n"
+ "userdict/ESPrs/rectstroke where{pop/rectstroke load}\n"
+ "{{gsave newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto\n"
+ "neg 0 rlineto closepath stroke grestore}bind}ifelse put");
+}
+
+
+/*
+ * 'WriteLabelProlog()' - Write the prolog with the classification
+ * and page label.
+ */
+
+void
+WriteLabelProlog(const char *label, /* I - Page label */
+ float bottom, /* I - Bottom position in points */
+ float top, /* I - Top position in points */
+ float width) /* I - Width in points */
+{
+ const char *classification; /* CLASSIFICATION environment variable */
+ const char *ptr; /* Temporary string pointer */
+
+
+ /*
+ * First get the current classification...
+ */
+
+ if ((classification = getenv("CLASSIFICATION")) == NULL)
+ classification = "";
+ if (strcmp(classification, "none") == 0)
+ classification = "";
+
+ /*
+ * If there is nothing to show, bind an empty 'write labels' procedure
+ * and return...
+ */
+
+ if (!classification[0] && (label == NULL || !label[0]))
+ {
+ puts("userdict/ESPwl{}bind put");
+ return;
+ }
+
+ /*
+ * Set the classification + page label string...
+ */
+
+ printf("userdict");
+ if (strcmp(classification, "confidential") == 0)
+ printf("/ESPpl(CONFIDENTIAL");
+ else if (strcmp(classification, "classified") == 0)
+ printf("/ESPpl(CLASSIFIED");
+ else if (strcmp(classification, "secret") == 0)
+ printf("/ESPpl(SECRET");
+ else if (strcmp(classification, "topsecret") == 0)
+ printf("/ESPpl(TOP SECRET");
+ else if (strcmp(classification, "unclassified") == 0)
+ printf("/ESPpl(UNCLASSIFIED");
+ else
+ {
+ printf("/ESPpl(");
+
+ for (ptr = classification; *ptr; ptr ++)
+ if (*ptr < 32 || *ptr > 126)
+ printf("\\%03o", *ptr);
+ else if (*ptr == '_')
+ putchar(' ');
+ else
+ {
+ if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
+ putchar('\\');
+
+ putchar(*ptr);
+ }
+ }
+
+ if (label)
+ {
+ if (classification[0])
+ printf(" - ");
+
+ /*
+ * Quote the label string as needed...
+ */
+
+ for (ptr = label; *ptr; ptr ++)
+ if (*ptr < 32 || *ptr > 126)
+ printf("\\%03o", *ptr);
+ else
+ {
+ if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
+ putchar('\\');
+
+ putchar(*ptr);
+ }
+ }
+
+ puts(")put");
+
+ /*
+ * Then get a 14 point Helvetica-Bold font...
+ */
+
+ puts("userdict/ESPpf /Helvetica-Bold findfont 14 scalefont put");
+
+ /*
+ * Finally, the procedure to write the labels on the page...
+ */
+
+ puts("userdict/ESPwl{");
+ puts(" ESPpf setfont");
+ printf(" ESPpl stringwidth pop dup 12 add exch -0.5 mul %.0f add\n",
+ width * 0.5f);
+ puts(" 1 setgray");
+ printf(" dup 6 sub %.0f 3 index 20 ESPrf\n", bottom - 2.0);
+ printf(" dup 6 sub %.0f 3 index 20 ESPrf\n", top - 18.0);
+ puts(" 0 setgray");
+ printf(" dup 6 sub %.0f 3 index 20 ESPrs\n", bottom - 2.0);
+ printf(" dup 6 sub %.0f 3 index 20 ESPrs\n", top - 18.0);
+ printf(" dup %.0f moveto ESPpl show\n", bottom + 2.0);
+ printf(" %.0f moveto ESPpl show\n", top - 14.0);
+ puts("pop");
+ puts("}bind put");
+}
+
+
+/*
+ * 'WriteLabels()' - Write the actual page labels.
+ */
+
+void
+WriteLabels(int orient) /* I - Orientation of the page */
+{
+ float width, /* Width of page */
+ length; /* Length of page */
+
+
+ puts("gsave");
+
+ if ((orient ^ Orientation) & 1)
+ {
+ width = PageLength;
+ length = PageWidth;
+ }
+ else
+ {
+ width = PageWidth;
+ length = PageLength;
+ }
+
+ switch (orient & 3)
+ {
+ case 1 : /* Landscape */
+ printf("%.1f 0.0 translate 90 rotate\n", length);
+ break;
+ case 2 : /* Reverse Portrait */
+ printf("%.1f %.1f translate 180 rotate\n", width, length);
+ break;
+ case 3 : /* Reverse Landscape */
+ printf("0.0 %.1f translate -90 rotate\n", width);
+ break;
+ }
+
+ puts("ESPwl");
+ puts("grestore");
+}
+
+
+/*
+ * 'WriteTextComment()' - Write a DSC text comment.
+ */
+
+void
+WriteTextComment(const char *name, /* I - Comment name ("Title", etc.) */
+ const char *value) /* I - Comment value */
+{
+ int len; /* Current line length */
+
+
+ /*
+ * DSC comments are of the form:
+ *
+ * %%name: value
+ *
+ * The name and value must be limited to 7-bit ASCII for most printers,
+ * so we escape all non-ASCII and ASCII control characters as described
+ * in the Adobe Document Structuring Conventions specification.
+ */
+
+ printf("%%%%%s: (", name);
+ len = 5 + strlen(name);
+
+ while (*value)
+ {
+ if (*value < ' ' || *value >= 127)
+ {
+ /*
+ * Escape this character value...
+ */
+
+ if (len >= 251) /* Keep line < 254 chars */
+ break;
+
+ printf("\\%03o", *value & 255);
+ len += 4;
+ }
+ else if (*value == '\\')
+ {
+ /*
+ * Escape the backslash...
+ */
+
+ if (len >= 253) /* Keep line < 254 chars */
+ break;
+
+ putchar('\\');
+ putchar('\\');
+ len += 2;
+ }
+ else
+ {
+ /*
+ * Put this character literally...
+ */
+
+ if (len >= 254) /* Keep line < 254 chars */
+ break;
+
+ putchar(*value);
+ len ++;
+ }
+
+ value ++;
+ }
+
+ puts(")");
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common filter definitions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <config.h>
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+
+/*
+ * C++ magic...
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/*
+ * Globals...
+ */
+
+extern int Orientation, /* 0 = portrait, 1 = landscape, etc. */
+ Duplex, /* Duplexed? */
+ LanguageLevel, /* Language level of printer */
+ ColorDevice; /* Do color text? */
+extern float PageLeft, /* Left margin */
+ PageRight, /* Right margin */
+ PageBottom, /* Bottom margin */
+ PageTop, /* Top margin */
+ PageWidth, /* Total page width */
+ PageLength; /* Total page length */
+
+
+/*
+ * Prototypes...
+ */
+
+extern ppd_file_t *SetCommonOptions(int num_options, cups_option_t *options,
+ int change_size);
+extern void UpdatePageVars(void);
+extern void WriteCommon(void);
+extern void WriteLabelProlog(const char *label, float bottom,
+ float top, float width);
+extern void WriteLabels(int orient);
+extern void WriteTextComment(const char *name, const char *value);
+
+
+/*
+ * C++ magic...
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * This file contains model number definitions for the CUPS unified
+ * ESC/P driver.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1997-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+/* General ESC/P Support */
+#define ESCP_DOTMATRIX 0x1 /* Dot matrix printer? */
+#define ESCP_MICROWEAVE 0x2 /* Use microweave command? */
+#define ESCP_STAGGER 0x4 /* Are color jets staggered? */
+#define ESCP_ESCK 0x8 /* Use print mode command?*/
+#define ESCP_EXT_UNITS 0x10 /* Use extended unit commands? */
+#define ESCP_EXT_MARGINS 0x20 /* Use extended margin command */
+#define ESCP_USB 0x40 /* Send USB packet mode escape? */
+#define ESCP_PAGE_SIZE 0x80 /* Use page size command */
+#define ESCP_RASTER_ESCI 0x100 /* Use ESC i graphics command */
+
+/* Remote mode support */
+#define ESCP_REMOTE 0x1000 /* Use remote mode commands? */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * Image file to PDF filter for the Common UNIX Printing System (CUPS).
+ * developped by BBR Inc. 2006-2007
+
+ * This is based on imagetops.c
+ * imagetops.c copyright notice is follows
+
+ * "$Id: imagetops.c 5379 2006-04-07 13:48:37Z mike $"
+ *
+ * Image file to PostScript filter for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 1993-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636 USA
+ *
+ * Voice: (301) 373-9600
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "config.h"
+#include "common.h"
+#include <cupsfilters/image.h>
+#include <math.h>
+#include <ctype.h>
+
+#if CUPS_VERSION_MAJOR < 1 \
+ || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+#ifndef CUPS_1_1
+#error Installed libs and specified source Version mismatch \
+ Libs >= 1.2 && Source < 1.2
+#define CUPS_1_1
+#endif
+#else
+#ifdef CUPS_1_1
+#error Installed libs and specified source Version mismatch \
+ Libs < 1.2 && Source >= 1.2
+#undef CUPS_1_1
+#endif
+#endif
+
+#define USE_CONVERT_CMD
+//#define OUT_AS_HEX
+//#define OUT_AS_ASCII85
+
+/*
+ * Globals...
+ */
+
+int Flip = 0, /* Flip/mirror pages */
+ XPosition = 0, /* Horizontal position on page */
+ YPosition = 0, /* Vertical position on page */
+ Collate = 0, /* Collate copies? */
+ Copies = 1, /* Number of copies */
+ Reverse = 0, /* Output order */
+ EvenDuplex = 0; /* cupsEvenDuplex */
+
+#ifdef CUPS_1_1
+#define cups_ib_t ib_t
+#define cups_image_t image_t
+#define CUPS_IMAGE_CMYK IMAGE_CMYK
+#define CUPS_IMAGE_WHITE IMAGE_WHITE
+#define CUPS_IMAGE_RGB IMAGE_RGB
+#define CUPS_IMAGE_RGB_CMYK IMAGE_RGB_CMYK
+#define cupsImageOpen ImageOpen
+#define cupsImageClose ImageClose
+#define cupsImageGetColorSpace(img) (img->colorspace)
+#define cupsImageGetXPPI(img) (img->xppi)
+#define cupsImageGetYPPI(img) (img->yppi)
+#define cupsImageGetWidth(img) (img->xsize)
+#define cupsImageGetHeight(img) (img->ysize)
+#define cupsImageGetRow ImageGetRow
+#endif
+
+/*
+ * Local functions...
+ */
+
+#ifdef OUT_AS_HEX
+static void out_hex(cups_ib_t *, int, int);
+#else
+#ifdef OUT_AS_ASCII85
+static void out_ascii85(cups_ib_t *, int, int);
+#else
+static void out_bin(cups_ib_t *, int, int);
+#endif
+#endif
+static void outPdf(const char *str);
+static void putcPdf(char c);
+static int newObj(void);
+static void freeAllObj(void);
+static void outXref(void);
+static void outTrailer(void);
+static void outString(const char *s);
+static void outPrologue(int nPages);
+static void allocPageObjects(int noPages);
+static void setOffset(int obj);
+static void outPageObject(int pageObj, int contentsObj, int imgObj);
+static void outPageContents(int contentsObj);
+static void outImage(int imgObj);
+
+struct pdfObject {
+ int offset;
+};
+
+static struct pdfObject *objects = NULL;
+static int currentObjectNo = 0;
+static int allocatedObjectNum = 0;
+static int currentOffset = 0;
+static int xrefOffset;
+static int *pageObjects = NULL;
+static int catalogObj;
+static int pagesObj;
+static const char *title;
+static int xpages, /* # x pages */
+ ypages, /* # y pages */
+ xpage, /* Current x page */
+ ypage, /* Current y page */
+ page; /* Current page number */
+static int xc0, yc0, /* Corners of the page in image coords */
+ xc1, yc1;
+static float left, top; /* Left and top of image */
+static float xprint, /* Printable area */
+ yprint,
+ xinches, /* Total size in inches */
+ yinches;
+static float xsize, /* Total size in points */
+ ysize,
+ xsize2,
+ ysize2;
+static float aspect; /* Aspect ratio */
+static cups_image_t *img; /* Image to print */
+static int colorspace; /* Output colorspace */
+static cups_ib_t *row; /* Current row */
+static float gammaval = 1.0; /* Gamma correction value */
+static float brightness = 1.0; /* Gamma correction value */
+static ppd_file_t *ppd; /* PPD file */
+
+#define N_OBJECT_ALLOC 100
+#define LINEBUFSIZE 1024
+
+static char linebuf[LINEBUFSIZE];
+
+void emitJCLOptions(FILE *fp, int copies)
+{
+ int section;
+ ppd_choice_t **choices;
+ int i;
+ char buf[1024];
+ ppd_attr_t *attr;
+ int pdftoopvp = 0;
+ int datawritten = 0;
+
+ if (ppd == 0) return;
+ if ((attr = ppdFindAttr(ppd,"pdftopdfJCLBegin",NULL)) != NULL) {
+ int n = strlen(attr->value);
+ pdftoopvp = 1;
+ for (i = 0;i < n;i++) {
+ if (attr->value[i] == '\r' || attr->value[i] == '\n') {
+ /* skip new line */
+ continue;
+ }
+ fputc(attr->value[i],fp);
+ datawritten = 1;
+ }
+ }
+
+ snprintf(buf,sizeof(buf),"%d",copies);
+ if (ppdFindOption(ppd,"Copies") != NULL) {
+ ppdMarkOption(ppd,"Copies",buf);
+ } else {
+ if ((attr = ppdFindAttr(ppd,"pdftopdfJCLCopies",buf)) != NULL) {
+ fputs(attr->value,fp);
+ datawritten = 1;
+ } else if (pdftoopvp) {
+ fprintf(fp,"Copies=%d;",copies);
+ datawritten = 1;
+ }
+ }
+ for (section = (int)PPD_ORDER_ANY;
+ section <= (int)PPD_ORDER_PROLOG;section++) {
+ int n;
+
+ n = ppdCollect(ppd,(ppd_section_t)section,&choices);
+ for (i = 0;i < n;i++) {
+ snprintf(buf,sizeof(buf),"pdftopdfJCL%s",
+ ((ppd_option_t *)(choices[i]->option))->keyword);
+ if ((attr = ppdFindAttr(ppd,buf,choices[i]->choice)) != NULL) {
+ fputs(attr->value,fp);
+ datawritten = 1;
+ } else if (pdftoopvp) {
+ fprintf(fp,"%s=%s;",
+ ((ppd_option_t *)(choices[i]->option))->keyword,
+ choices[i]->choice);
+ datawritten = 1;
+ }
+ }
+ }
+ if (datawritten) fputc('\n',fp);
+}
+
+
+static void setOffset(int obj)
+{
+ objects[obj].offset = currentOffset;
+}
+
+static void allocPageObjects(int nPages)
+{
+ int i;
+
+ if ((pageObjects = malloc(sizeof(int)*nPages)) == NULL)
+ {
+ fprintf(stderr,"ERROR: Can't allocate pageObjects\n");
+ exit(2);
+ }
+ for (i = 0;i < nPages;i++)
+ {
+ pageObjects[i] = newObj();
+ }
+}
+
+static int newObj(void)
+{
+ if (objects == NULL)
+ {
+ if ((objects = malloc(sizeof(struct pdfObject)*N_OBJECT_ALLOC))
+ == NULL)
+ {
+ fprintf(stderr,"ERROR: Can't allocate objects\n");
+ exit(2);
+ }
+ allocatedObjectNum = N_OBJECT_ALLOC;
+ }
+ if (currentObjectNo >= allocatedObjectNum)
+ {
+ if ((objects = realloc(objects,
+ sizeof(struct pdfObject)*(allocatedObjectNum+N_OBJECT_ALLOC)))
+ == NULL)
+ {
+ fprintf(stderr,"ERROR: Can't allocate objects\n");
+ exit(2);
+ }
+ allocatedObjectNum += N_OBJECT_ALLOC;
+ }
+ objects[currentObjectNo].offset = currentOffset;
+ return currentObjectNo++;
+}
+
+static void freeAllObj(void)
+{
+ if (objects != NULL)
+ {
+ free(objects);
+ objects = NULL;
+ }
+}
+
+static void putcPdf(char c)
+{
+ fputc(c,stdout);
+ currentOffset++;
+}
+
+static void outPdf(const char *str)
+{
+ unsigned long len = strlen(str);
+
+ fputs(str,stdout);
+ currentOffset += len;
+}
+
+static void outXref(void)
+{
+ char buf[21];
+ int i;
+
+ xrefOffset = currentOffset;
+ outPdf("xref\n");
+ snprintf(buf,21,"0 %d\n",currentObjectNo);
+ outPdf(buf);
+ outPdf("0000000000 65535 f \n");
+ for (i = 1;i < currentObjectNo;i++)
+ {
+ snprintf(buf,21,"%010d 00000 n \n",objects[i].offset);
+ outPdf(buf);
+ }
+}
+
+static void outString(const char *s)
+{
+ char c;
+
+ putcPdf('(');
+ for (;(c = *s) != '\0';s++) {
+ if (c == '\\' || c == '(' || c == ')') {
+ putcPdf('\\');
+ }
+ putcPdf(c);
+ }
+ putcPdf(')');
+}
+
+static void outTrailer(void)
+{
+ time_t curtime;
+ struct tm *curtm;
+ char curdate[255];
+
+ curtime = time(NULL);
+ curtm = localtime(&curtime);
+ strftime(curdate, sizeof(curdate),"D:%Y%m%d%H%M%S%z", curtm);
+
+ outPdf("trailer\n");
+ snprintf(linebuf, LINEBUFSIZE,"<</Size %d ",currentObjectNo);
+ outPdf(linebuf);
+ outPdf("/Root 1 0 R\n");
+ outPdf("/Info << /Title ");
+ outString(title);
+ putcPdf(' ');
+ snprintf(linebuf,LINEBUFSIZE,"/CreationDate (%s) ",curdate);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,"/ModDate (%s) ",curdate);
+ outPdf(linebuf);
+ outPdf("/Producer (imagetopdf) ");
+ outPdf("/Trapped /False >>\n");
+ outPdf(">>\n");
+ outPdf("startxref\n");
+ snprintf(linebuf,LINEBUFSIZE,"%d\n",xrefOffset);
+ outPdf(linebuf);
+ outPdf("%%EOF\n");
+}
+
+static void outPrologue(int nPages)
+{
+ int i;
+
+ /* out header */
+ newObj(); /* dummy for no 0 object */
+ outPdf("%PDF-1.3\n");
+ /* out binary for transfer program */
+ linebuf[0] = '%';
+ linebuf[1] = 129;
+ linebuf[2] = 130;
+ linebuf[3] = 131;
+ linebuf[4] = 132;
+ linebuf[5] = '\n';
+ linebuf[6] = 0;
+ outPdf(linebuf);
+ outPdf("% This file was generated by imagetopdf\n");
+
+ catalogObj = newObj();
+ pagesObj = newObj();
+ allocPageObjects(nPages);
+
+ /* out catalog */
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj <</Type/Catalog /Pages %d 0 R ",catalogObj,pagesObj);
+ outPdf(linebuf);
+ outPdf(">> endobj\n");
+
+ /* out Pages */
+ setOffset(pagesObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj <</Type/Pages /Kids [ ",pagesObj);
+ outPdf(linebuf);
+ if (Reverse) {
+ for (i = nPages-1;i >= 0;i--)
+ {
+ snprintf(linebuf,LINEBUFSIZE,"%d 0 R ",pageObjects[i]);
+ outPdf(linebuf);
+ }
+ } else {
+ for (i = 0;i < nPages;i++)
+ {
+ snprintf(linebuf,LINEBUFSIZE,"%d 0 R ",pageObjects[i]);
+ outPdf(linebuf);
+ }
+ }
+ outPdf("] ");
+ snprintf(linebuf,LINEBUFSIZE,"/Count %d >> endobj\n",nPages);
+ outPdf(linebuf);
+}
+
+static void outPageObject(int pageObj, int contentsObj, int imgObj)
+{
+ int trfuncObj = newObj();
+ int lengthObj = newObj();
+ int startOffset;
+ int length;
+ int outTrfunc = (gammaval != 1.0 || brightness != 1.0);
+
+ /* out Page Object */
+ setOffset(pageObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj <</Type/Page /Parent %d 0 R ",
+ pageObj,pagesObj);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,
+ "/MediaBox [ 0 0 %f %f ] ",PageWidth,PageLength);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,
+ "/TrimBox [ 0 0 %f %f ] ",PageWidth,PageLength);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,
+ "/CropBox [ %f %f %f %f ] ",
+ PageLeft,PageBottom,PageRight,PageTop);
+ outPdf(linebuf);
+ if (contentsObj >= 0) {
+ snprintf(linebuf,LINEBUFSIZE,
+ "/Contents %d 0 R ",contentsObj);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,
+ "/Resources <</ProcSet [/PDF] "
+ "/XObject << /Im %d 0 R >>\n",imgObj);
+ outPdf(linebuf);
+ } else {
+ /* empty page */
+ snprintf(linebuf,LINEBUFSIZE,
+ "/Resources <</ProcSet [/PDF] \n");
+ outPdf(linebuf);
+ }
+ if (outTrfunc) {
+ snprintf(linebuf,LINEBUFSIZE,
+ "/ExtGState << /GS1 << /TR %d 0 R >> >>\n",trfuncObj);
+ outPdf(linebuf);
+ }
+ outPdf(" >>\n>>\nendobj\n");
+
+ if (outTrfunc) {
+ /* out translate function */
+ setOffset(trfuncObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj <</FunctionType 4 /Domain [0 1.0]"
+ " /Range [0 1.0] /Length %d 0 R >>\n",
+ trfuncObj,lengthObj);
+ outPdf(linebuf);
+ outPdf("stream\n");
+ startOffset = currentOffset;
+ snprintf(linebuf,LINEBUFSIZE,
+ "{ neg 1 add dup 0 lt { pop 1 } { %.3f exp neg 1 add } "
+ "ifelse %.3f mul }\n", gammaval, brightness);
+ outPdf(linebuf);
+ length = currentOffset - startOffset;
+ snprintf(linebuf,LINEBUFSIZE,
+ "endstream\nendobj\n");
+ outPdf(linebuf);
+
+ /* out length object */
+ setOffset(lengthObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj %d endobj\n",lengthObj,length);
+ outPdf(linebuf);
+ }
+}
+
+static void outPageContents(int contentsObj)
+{
+ int startOffset;
+ int lengthObj;
+ int length;
+
+ setOffset(contentsObj);
+ lengthObj = newObj();
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj <</Length %d 0 R >> stream\n",contentsObj,lengthObj);
+ outPdf(linebuf);
+ startOffset = currentOffset;
+
+ if (gammaval != 1.0 || brightness != 1.0)
+ outPdf("/GS1 gs\n");
+ if (Flip)
+ {
+ snprintf(linebuf,LINEBUFSIZE,
+ "-1 0 0 1 %.0f 0 cm\n",PageWidth);
+ outPdf(linebuf);
+ }
+
+ switch (Orientation)
+ {
+ case 1:
+ snprintf(linebuf,LINEBUFSIZE,
+ "0 1 -1 0 %.0f 0 cm\n",PageWidth);
+ outPdf(linebuf);
+ break;
+ case 2:
+ snprintf(linebuf,LINEBUFSIZE,
+ "-1 0 0 -1 %.0f %.0f cm\n",PageWidth, PageLength);
+ outPdf(linebuf);
+ break;
+ case 3:
+ snprintf(linebuf,LINEBUFSIZE,
+ "0 -1 1 0 0 %.0f cm\n",PageLength);
+ outPdf(linebuf);
+ break;
+ }
+
+ xc0 = cupsImageGetWidth(img) * xpage / xpages;
+ xc1 = cupsImageGetWidth(img) * (xpage + 1) / xpages - 1;
+ yc0 = cupsImageGetHeight(img) * ypage / ypages;
+ yc1 = cupsImageGetHeight(img) * (ypage + 1) / ypages - 1;
+
+ snprintf(linebuf,LINEBUFSIZE,
+ "1 0 0 1 %.1f %.1f cm\n",left,top);
+ outPdf(linebuf);
+
+ snprintf(linebuf,LINEBUFSIZE,
+ "%.3f 0 0 %.3f 0 0 cm\n",
+ xprint * 72.0, yprint * 72.0);
+ outPdf(linebuf);
+ outPdf("/Im Do\n");
+ length = currentOffset - startOffset - 1;
+ outPdf("endstream\nendobj\n");
+
+ /* out length object */
+ setOffset(lengthObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj %d endobj\n",lengthObj,length);
+ outPdf(linebuf);
+}
+
+static void outImage(int imgObj)
+{
+ int y; /* Current Y coordinate in image */
+#ifdef OUT_AS_ASCII85
+ int out_offset; /* Offset into output buffer */
+#endif
+ int out_length; /* Length of output buffer */
+ int startOffset;
+ int lengthObj;
+ int length;
+
+ setOffset(imgObj);
+ lengthObj = newObj();
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj << /Length %d 0 R /Type /XObject "
+ "/Subtype /Image /Name /Im"
+#ifdef OUT_AS_HEX
+ "/Filter /ASCIIHexDecode "
+#else
+#ifdef OUT_AS_ASCII85
+ "/Filter /ASCII85Decode "
+#endif
+#endif
+ ,imgObj,lengthObj);
+ outPdf(linebuf);
+ snprintf(linebuf,LINEBUFSIZE,
+ "/Width %d /Height %d /BitsPerComponent 8 ",
+ xc1 - xc0 + 1, yc1 - yc0 + 1);
+ outPdf(linebuf);
+
+ switch (colorspace)
+ {
+ case CUPS_IMAGE_WHITE :
+ outPdf("/ColorSpace /DeviceGray ");
+ outPdf("/Decode[0 1] ");
+ break;
+ case CUPS_IMAGE_RGB :
+ outPdf("/ColorSpace /DeviceRGB ");
+ outPdf("/Decode[0 1 0 1 0 1] ");
+ break;
+ case CUPS_IMAGE_CMYK :
+ outPdf("/ColorSpace /DeviceCMYK ");
+ outPdf("/Decode[0 1 0 1 0 1 0 1] ");
+ break;
+ }
+ if (((xc1 - xc0 + 1) / xprint) < 100.0)
+ outPdf("/Interpolate true ");
+
+ outPdf(">>\n");
+ outPdf("stream\n");
+ startOffset = currentOffset;
+
+#ifdef OUT_AS_ASCII85
+ /* out ascii85 needs multiple of 4bytes */
+ for (y = yc0, out_offset = 0; y <= yc1; y ++)
+ {
+ cupsImageGetRow(img, xc0, y, xc1 - xc0 + 1, row + out_offset);
+
+ out_length = (xc1 - xc0 + 1) * abs(colorspace) + out_offset;
+ out_offset = out_length & 3;
+
+ out_ascii85(row, out_length, y == yc1);
+
+ if (out_offset > 0)
+ memcpy(row, row + out_length - out_offset, out_offset);
+ }
+#else
+ for (y = yc0; y <= yc1; y ++)
+ {
+ cupsImageGetRow(img, xc0, y, xc1 - xc0 + 1, row);
+
+ out_length = (xc1 - xc0 + 1) * abs(colorspace);
+
+#ifdef OUT_AS_HEX
+ out_hex(row, out_length, y == yc1);
+#else
+ out_bin(row, out_length, y == yc1);
+#endif
+ }
+#endif
+ length = currentOffset - startOffset;
+ outPdf("\nendstream\nendobj\n");
+
+ /* out length object */
+ setOffset(lengthObj);
+ snprintf(linebuf,LINEBUFSIZE,
+ "%d 0 obj %d endobj\n",lengthObj,length);
+ outPdf(linebuf);
+}
+
+/*
+ * Copied ppd_decode() from CUPS which is not exported to the API
+ */
+
+static int /* O - Length of decoded string */
+ppd_decode(char *string) /* I - String to decode */
+{
+ char *inptr, /* Input pointer */
+ *outptr; /* Output pointer */
+
+
+ inptr = string;
+ outptr = string;
+
+ while (*inptr != '\0')
+ if (*inptr == '<' && isxdigit(inptr[1] & 255))
+ {
+ /*
+ * Convert hex to 8-bit values...
+ */
+
+ inptr ++;
+ while (isxdigit(*inptr & 255))
+ {
+ if (isalpha(*inptr))
+ *outptr = (tolower(*inptr) - 'a' + 10) << 4;
+ else
+ *outptr = (*inptr - '0') << 4;
+
+ inptr ++;
+
+ if (!isxdigit(*inptr & 255))
+ break;
+
+ if (isalpha(*inptr))
+ *outptr |= tolower(*inptr) - 'a' + 10;
+ else
+ *outptr |= *inptr - '0';
+
+ inptr ++;
+ outptr ++;
+ }
+
+ while (*inptr != '>' && *inptr != '\0')
+ inptr ++;
+ while (*inptr == '>')
+ inptr ++;
+ }
+ else
+ *outptr++ = *inptr++;
+
+ *outptr = '\0';
+
+ return ((int)(outptr - string));
+}
+
+/*
+ * 'main()' - Main entry...
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ ppd_choice_t *choice; /* PPD option choice */
+ int num_options; /* Number of print options */
+ cups_option_t *options; /* Print options */
+ const char *val; /* Option value */
+ float zoom; /* Zoom facter */
+ int xppi, yppi; /* Pixels-per-inch */
+ int hue, sat; /* Hue and saturation adjustment */
+ int emit_jcl;
+ int pdf_printer = 0;
+ char filename[1024]; /* Name of file to print */
+ int deviceCopies = 1;
+ int deviceCollate = 0;
+ int deviceReverse = 0;
+ ppd_attr_t *attr;
+ int pl,pr;
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fputs("ERROR: imagetopdf job-id user title copies options [file]\n", stderr);
+ return (1);
+ }
+
+ title = argv[3];
+#ifdef DEBUG
+ fprintf(stderr, "INFO: %s %s %s %s %s %s %s\n", argv[0], argv[1], argv[2],
+ argv[3], argv[4], argv[5], argv[6] ? argv[6] : "(null)");
+#endif
+
+ /*
+ * Copy stdin as needed...
+ */
+
+ if (argc == 6)
+ {
+ int fd; /* File to write to */
+ char buffer[8192]; /* Buffer to read into */
+ int bytes; /* # of bytes to read */
+
+
+ if ((fd = cupsTempFd(filename, sizeof(filename))) < 0)
+ {
+ perror("ERROR: Unable to copy image file");
+ return (1);
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: imagetopdf - copying to temp print file \"%s\"\n",
+ filename);
+#endif
+
+ while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
+ write(fd, buffer, bytes);
+
+ close(fd);
+ }
+ else
+ {
+ strncpy(filename, argv[6], sizeof(filename));
+ }
+
+ /*
+ * Process command-line options and write the prolog...
+ */
+
+ zoom = 1.0;
+ xppi = 0;
+ yppi = 0;
+ hue = 0;
+ sat = 100;
+
+ Copies = atoi(argv[4]);
+
+ options = NULL;
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ ppd = SetCommonOptions(num_options, options, 0);
+
+ if (Copies == 1
+ && (choice = ppdFindMarkedChoice(ppd,"Copies")) != NULL) {
+ Copies = atoi(choice->choice);
+ }
+ if (Copies == 0) Copies = 1;
+ if ((val = cupsGetOption("Duplex",num_options,options)) != 0 &&
+ (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))) {
+ /* for compatiblity */
+ if (ppdFindOption(ppd,"Duplex") != NULL) {
+ ppdMarkOption(ppd,"Duplex","True");
+ ppdMarkOption(ppd,"Duplex","On");
+ Duplex = 1;
+ }
+ } else if ((val = cupsGetOption("sides",num_options,options)) != 0 &&
+ (!strcasecmp(val, "two-sided-long-edge") ||
+ !strcasecmp(val, "two-sided-short-edge"))) {
+ /* for compatiblity */
+ if (ppdFindOption(ppd,"Duplex") != NULL) {
+ ppdMarkOption(ppd,"Duplex","True");
+ ppdMarkOption(ppd,"Duplex","On");
+ Duplex = 1;
+ }
+ }
+
+
+ if ((val = cupsGetOption("OutputOrder",num_options,options)) != 0) {
+ if (!strcasecmp(val, "Reverse")) {
+ Reverse = 1;
+ }
+ } else if (ppd) {
+ /*
+ * Figure out the right default output order from the PPD file...
+ */
+
+ if ((choice = ppdFindMarkedChoice(ppd,"OutputOrder")) != 0) {
+ Reverse = !strcasecmp(choice->choice,"Reverse");
+ } else if ((choice = ppdFindMarkedChoice(ppd,"OutputBin")) != 0 &&
+ (attr = ppdFindAttr(ppd,"PageStackOrder",choice->choice)) != 0 &&
+ attr->value) {
+ Reverse = !strcasecmp(attr->value,"Reverse");
+ } else if ((attr = ppdFindAttr(ppd,"DefaultOutputOrder",0)) != 0 &&
+ attr->value) {
+ Reverse = !strcasecmp(attr->value,"Reverse");
+ }
+ }
+
+ /* adjust to even page when duplex */
+ if (((val = cupsGetOption("cupsEvenDuplex",num_options,options)) != 0 &&
+ (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))) ||
+ ((attr = ppdFindAttr(ppd,"cupsEvenDuplex",0)) != 0 &&
+ (!strcasecmp(attr->value, "true")
+ || !strcasecmp(attr->value, "on") ||
+ !strcasecmp(attr->value, "yes")))) {
+ EvenDuplex = 1;
+ }
+
+ if ((val = cupsGetOption("multiple-document-handling", num_options, options)) != NULL)
+ {
+ /*
+ * This IPP attribute is unnecessarily complicated...
+ *
+ * single-document, separate-documents-collated-copies, and
+ * single-document-new-sheet all require collated copies.
+ *
+ * separate-documents-uncollated-copies allows for uncollated copies.
+ */
+
+ Collate = strcasecmp(val, "separate-documents-uncollated-copies") != 0;
+ }
+
+ if ((val = cupsGetOption("Collate", num_options, options)) != NULL) {
+ if (strcasecmp(val, "True") == 0) {
+ Collate = 1;
+ }
+ } else {
+ if ((choice = ppdFindMarkedChoice(ppd,"Collate")) != NULL
+ && (!strcasecmp(choice->choice,"true")
+ || !strcasecmp(choice->choice, "on")
+ || !strcasecmp(choice->choice, "yes"))) {
+ Collate = 1;
+ }
+ }
+
+ if ((val = cupsGetOption("gamma", num_options, options)) != NULL)
+ gammaval = atoi(val) * 0.001f;
+
+ if ((val = cupsGetOption("brightness", num_options, options)) != NULL)
+ brightness = atoi(val) * 0.01f;
+
+ if ((val = cupsGetOption("scaling", num_options, options)) != NULL)
+ zoom = atoi(val) * 0.01;
+ else if (((val =
+ cupsGetOption("fit-to-page", num_options, options)) != NULL) ||
+ ((val = cupsGetOption("fitplot", num_options, options)) != NULL))
+ {
+ if (!strcasecmp(val, "yes") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "true"))
+ zoom = 1.0;
+ else
+ zoom = 0.0;
+ }
+ else if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
+ zoom = 0.0;
+
+ if ((val = cupsGetOption("ppi", num_options, options)) != NULL)
+ {
+ if (sscanf(val, "%dx%d", &xppi, &yppi) < 2)
+ yppi = xppi;
+ zoom = 0.0;
+ }
+
+ if ((val = cupsGetOption("position", num_options, options)) != NULL)
+ {
+ if (strcasecmp(val, "center") == 0)
+ {
+ XPosition = 0;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "top") == 0)
+ {
+ XPosition = 0;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "left") == 0)
+ {
+ XPosition = -1;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "right") == 0)
+ {
+ XPosition = 1;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "top-left") == 0)
+ {
+ XPosition = -1;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "top-right") == 0)
+ {
+ XPosition = 1;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "bottom") == 0)
+ {
+ XPosition = 0;
+ YPosition = -1;
+ }
+ else if (strcasecmp(val, "bottom-left") == 0)
+ {
+ XPosition = -1;
+ YPosition = -1;
+ }
+ else if (strcasecmp(val, "bottom-right") == 0)
+ {
+ XPosition = 1;
+ YPosition = -1;
+ }
+ }
+
+ if ((val = cupsGetOption("saturation", num_options, options)) != NULL)
+ sat = atoi(val);
+
+ if ((val = cupsGetOption("hue", num_options, options)) != NULL)
+ hue = atoi(val);
+
+ if ((val = cupsGetOption("mirror", num_options, options)) != NULL &&
+ strcasecmp(val, "True") == 0)
+ Flip = 1;
+
+ if ((val = cupsGetOption("emit-jcl", num_options, options)) != NULL &&
+ (!strcasecmp(val, "false") || !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no") || !strcmp(val, "0")))
+ emit_jcl = 0;
+ else
+ emit_jcl = 1;
+
+
+
+ /*
+ * Open the input image to print...
+ */
+
+ colorspace = ColorDevice ? CUPS_IMAGE_RGB_CMYK : CUPS_IMAGE_WHITE;
+
+ img = cupsImageOpen(filename, colorspace, CUPS_IMAGE_WHITE, sat, hue, NULL);
+
+#if defined(USE_CONVERT_CMD) && defined(CONVERT_CMD)
+ if (img == NULL) {
+ char filename2[1024];
+ int fd2;
+
+ if ((fd2 = cupsTempFd(filename2, sizeof(filename2))) < 0)
+ {
+ perror("ERROR: Unable to copy image file");
+ return (1);
+ }
+ close(fd2);
+ snprintf(linebuf,LINEBUFSIZE,
+ CONVERT_CMD
+ " %s png:%s",filename, filename2);
+ if (system(linebuf) != 0) {
+ unlink(filename2);
+ perror("ERROR: Unable to copy image file");
+ return (1);
+ }
+ img = cupsImageOpen(filename2, colorspace,
+ CUPS_IMAGE_WHITE, sat, hue, NULL);
+ unlink(filename2);
+ }
+#endif
+ if (argc == 6)
+ unlink(filename);
+
+ if (img == NULL)
+ {
+ fputs("ERROR: Unable to open image file for printing!\n", stderr);
+ ppdClose(ppd);
+ return (1);
+ }
+
+ colorspace = cupsImageGetColorSpace(img);
+
+ /*
+ * Scale as necessary...
+ */
+
+ if (zoom == 0.0 && xppi == 0)
+ {
+ xppi = cupsImageGetXPPI(img);
+ yppi = cupsImageGetYPPI(img);
+ }
+
+ if (yppi == 0)
+ yppi = xppi;
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Before scaling: xppi=%d, yppi=%d, zoom=%.2f\n",
+ xppi, yppi, zoom);
+#endif
+
+ if (xppi > 0)
+ {
+ /*
+ * Scale the image as neccesary to match the desired pixels-per-inch.
+ */
+
+ if (Orientation & 1)
+ {
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
+ xprint, yprint);
+#endif
+
+ xinches = (float)cupsImageGetWidth(img) / (float)xppi;
+ yinches = (float)cupsImageGetHeight(img) / (float)yppi;
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Image size is %.1f x %.1f inches...\n",
+ xinches, yinches);
+#endif
+
+ if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
+ {
+ xinches = xinches * atoi(val) / 100;
+ yinches = yinches * atoi(val) / 100;
+ }
+
+ if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
+ cupsGetOption("landscape", num_options, options) == NULL)
+ {
+ /*
+ * Rotate the image if it will fit landscape but not portrait...
+ */
+
+#ifdef DEBUG
+ fputs("DEBUG: Auto orientation...\n", stderr);
+#endif
+
+ if ((xinches > xprint || yinches > yprint) &&
+ xinches <= yprint && yinches <= xprint)
+ {
+ /*
+ * Rotate the image as needed...
+ */
+
+#ifdef DEBUG
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+#endif
+
+ Orientation = (Orientation + 1) & 3;
+ xsize = yprint;
+ yprint = xprint;
+ xprint = xsize;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Scale percentage of page size...
+ */
+
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ aspect = (float)cupsImageGetYPPI(img) / (float)cupsImageGetXPPI(img);
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
+ xprint, yprint);
+
+ fprintf(stderr, "DEBUG: cupsImageGetXPPI(img) = %d, cupsImageGetYPPI(img) = %d, aspect = %f\n",
+ cupsImageGetXPPI(img), cupsImageGetYPPI(img), aspect);
+#endif
+
+ xsize = xprint * zoom;
+ ysize = xsize * cupsImageGetHeight(img) / cupsImageGetWidth(img) / aspect;
+
+ if (ysize > (yprint * zoom))
+ {
+ ysize = yprint * zoom;
+ xsize = ysize * cupsImageGetWidth(img) * aspect / cupsImageGetHeight(img);
+ }
+
+ xsize2 = yprint * zoom;
+ ysize2 = xsize2 * cupsImageGetHeight(img) / cupsImageGetWidth(img) / aspect;
+
+ if (ysize2 > (xprint * zoom))
+ {
+ ysize2 = xprint * zoom;
+ xsize2 = ysize2 * cupsImageGetWidth(img) * aspect / cupsImageGetHeight(img);
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Portrait size is %.2f x %.2f inches\n", xsize, ysize);
+ fprintf(stderr, "DEBUG: Landscape size is %.2f x %.2f inches\n", xsize2, ysize2);
+#endif
+
+ if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
+ cupsGetOption("landscape", num_options, options) == NULL)
+ {
+ /*
+ * Choose the rotation with the largest area, but prefer
+ * portrait if they are equal...
+ */
+
+#ifdef DEBUG
+ fputs("DEBUG: Auto orientation...\n", stderr);
+#endif
+
+ if ((xsize * ysize) < (xsize2 * xsize2))
+ {
+ /*
+ * Do landscape orientation...
+ */
+
+#ifdef DEBUG
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+#endif
+
+ Orientation = 1;
+ xinches = xsize2;
+ yinches = ysize2;
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+ /*
+ * Do portrait orientation...
+ */
+
+#ifdef DEBUG
+ fputs("DEBUG: Using portrait orientation...\n", stderr);
+#endif
+
+ Orientation = 0;
+ xinches = xsize;
+ yinches = ysize;
+ }
+ }
+ else if (Orientation & 1)
+ {
+#ifdef DEBUG
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+#endif
+
+ xinches = xsize2;
+ yinches = ysize2;
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+#ifdef DEBUG
+ fputs("DEBUG: Using portrait orientation...\n", stderr);
+#endif
+
+ xinches = xsize;
+ yinches = ysize;
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ }
+ }
+
+ /*
+ * Compute the number of pages to print and the size of the image on each
+ * page...
+ */
+
+ if (zoom == 1.0) {
+ /* If fitplot is specified, make xpages, ypages 1 forcedly.
+ Because calculation error may be caused and
+ result of ceil function may be larger than 1.
+ */
+ xpages = ypages = 1;
+ } else {
+ xpages = ceil(xinches / xprint);
+ ypages = ceil(yinches / yprint);
+ }
+
+ xprint = xinches / xpages;
+ yprint = yinches / ypages;
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: xpages = %dx%.2fin, ypages = %dx%.2fin\n",
+ xpages, xprint, ypages, yprint);
+#endif
+
+ /*
+ * Update the page size for custom sizes...
+ */
+
+ if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL &&
+ strcasecmp(choice->choice, "Custom") == 0)
+ {
+ float width, /* New width in points */
+ length; /* New length in points */
+ char s[255]; /* New custom page size... */
+
+
+ /*
+ * Use the correct width and length for the current orientation...
+ */
+
+ if (Orientation & 1)
+ {
+ width = yprint * 72.0;
+ length = xprint * 72.0;
+ }
+ else
+ {
+ width = xprint * 72.0;
+ length = yprint * 72.0;
+ }
+
+ /*
+ * Add margins to page size...
+ */
+
+ width += ppd->custom_margins[0] + ppd->custom_margins[2];
+ length += ppd->custom_margins[1] + ppd->custom_margins[3];
+
+ /*
+ * Enforce minimums...
+ */
+
+ if (width < ppd->custom_min[0])
+ width = ppd->custom_min[0];
+
+ if (length < ppd->custom_min[1])
+ length = ppd->custom_min[1];
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: Updated custom page size to %.2f x %.2f inches...\n",
+ width / 72.0, length / 72.0);
+#endif
+
+ /*
+ * Set the new custom size...
+ */
+
+ sprintf(s, "Custom.%.0fx%.0f", width, length);
+ ppdMarkOption(ppd, "PageSize", s);
+
+ /*
+ * Update page variables...
+ */
+
+ PageWidth = width;
+ PageLength = length;
+ PageLeft = ppd->custom_margins[0];
+ PageRight = width - ppd->custom_margins[2];
+ PageBottom = ppd->custom_margins[1];
+ PageTop = length - ppd->custom_margins[3];
+ }
+
+ if (Copies == 1) {
+ /* collate is not needed */
+ Collate = 0;
+ ppdMarkOption(ppd,"Collate","False");
+ }
+ if (!Duplex) {
+ /* evenDuplex is not needed */
+ EvenDuplex = 0;
+ }
+
+ /* check collate device */
+ if (Collate) {
+ if ((choice = ppdFindMarkedChoice(ppd,"Collate")) != NULL &&
+ !strcasecmp(choice->choice,"true")) {
+ ppd_option_t *opt;
+
+ if ((opt = ppdFindOption(ppd,"Collate")) != NULL &&
+ !opt->conflicted) {
+ deviceCollate = 1;
+ } else {
+ ppdMarkOption(ppd,"Collate","False");
+ }
+ }
+ }
+ /* check OutputOrder device */
+ if (Reverse) {
+ if (ppdFindOption(ppd,"OutputOrder") != NULL) {
+ deviceReverse = 1;
+ }
+ }
+ if (ppd != NULL &&
+ !ppd->manual_copies && Collate && !deviceCollate) {
+ /* Copying by device , software collate is impossible */
+ /* Enable software copying */
+ ppd->manual_copies = 1;
+ }
+ if (Copies > 1 && (ppd == NULL || ppd->manual_copies)
+ && Duplex) {
+ /* Enable software collate , or same pages are printed in both sides */
+ Collate = 1;
+ if (deviceCollate) {
+ deviceCollate = 0;
+ ppdMarkOption(ppd,"Collate","False");
+ }
+ }
+ if (Duplex && Collate && !deviceCollate) {
+ /* Enable evenDuplex or the first page may be printed other side of the
+ end of precedings */
+ EvenDuplex = 1;
+ }
+ if (Duplex && Reverse && !deviceReverse) {
+ /* Enable evenDuplex or the first page may be empty. */
+ EvenDuplex = 1;
+ }
+ /* change feature for software */
+ if (deviceCollate) {
+ Collate = 0;
+ }
+ if (deviceReverse) {
+ Reverse = 0;
+ }
+ if (ppd != NULL) {
+ if (ppd->manual_copies) {
+ /* sure disable hardware copying */
+ ppdMarkOption(ppd,"Copies","1");
+ ppdMarkOption(ppd,"JCLCopies","1");
+ } else {
+ /* change for hardware copying */
+ deviceCopies = Copies;
+ Copies = 1;
+ }
+ }
+
+ /*
+ * See if we need to collate, and if so how we need to do it...
+ */
+
+ if (xpages == 1 && ypages == 1
+ && (Collate || deviceCollate) && !EvenDuplex) {
+ /* collate is not needed, disable it */
+ deviceCollate = 0;
+ Collate = 0;
+ ppdMarkOption(ppd,"Collate","False");
+ }
+
+ if (((xpages*ypages) % 2) == 0) {
+ /* even pages, disable EvenDuplex */
+ EvenDuplex = 0;
+ }
+
+ /*
+ * Write any "exit server" options that have been selected...
+ */
+
+ ppdEmit(ppd, stdout, PPD_ORDER_EXIT);
+
+ /*
+ * Write any JCL commands that are needed to print PostScript code...
+ */
+
+ if (ppd && emit_jcl) {
+ /* pdftopdf only adds JCL to the job if the printer is a native PDF
+ printer and the PPD is for this mode, having the "*JCLToPDFInterpreter:"
+ keyword. We need to read this keyword manually from the PPD and replace
+ the content of ppd->jcl_ps by the value of this keyword, so that
+ ppdEmitJCL() actalually adds JCL based on the presence on
+ "*JCLToPDFInterpreter:". */
+ if ((attr = ppdFindAttr(ppd,"JCLToPDFInterpreter",NULL)) != NULL)
+ {
+ ppd->jcl_ps = strdup(attr->value);
+ ppd_decode(ppd->jcl_ps);
+ pdf_printer = 1;
+ }
+ else
+ {
+ ppd->jcl_ps = NULL;
+ pdf_printer = 0;
+ }
+ ppdEmitJCL(ppd, stdout, atoi(argv[1]), argv[2], argv[3]);
+ emitJCLOptions(stdout,deviceCopies);
+ }
+
+ /*
+ * Start sending the document with any commands needed...
+ */
+
+ outPrologue(Copies*xpages*ypages+(EvenDuplex ? 1 : 0));
+
+ /*
+ * Output the pages...
+ */
+
+ row = malloc(cupsImageGetWidth(img) * abs(colorspace) + 3);
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: XPosition=%d, YPosition=%d, Orientation=%d\n",
+ XPosition, YPosition, Orientation);
+ fprintf(stderr, "DEBUG: xprint=%.0f, yprint=%.0f\n", xprint, yprint);
+ fprintf(stderr, "DEBUG: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f\n",
+ PageLeft, PageRight, PageWidth);
+ fprintf(stderr, "DEBUG: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f\n",
+ PageBottom, PageTop, PageLength);
+#endif
+
+ if (Flip) {
+ pr = PageWidth - PageLeft;
+ pl = PageWidth - PageRight;
+ } else {
+ pr = PageRight;
+ pl = PageLeft;
+ }
+
+ switch (Orientation)
+ {
+ default :
+ switch (XPosition)
+ {
+ case -1 :
+ left = pl;
+ break;
+ default :
+ left = (pr + pl - xprint * 72) / 2;
+ break;
+ case 1 :
+ left = pr - xprint * 72;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ top = PageBottom;
+ break;
+ default :
+ top = (PageTop + PageBottom - yprint * 72) / 2;
+ break;
+ case 1 :
+ top = PageTop - yprint * 72;;
+ break;
+ }
+ break;
+
+ case 1 :
+ switch (XPosition)
+ {
+ case -1 :
+ left = PageBottom;
+ break;
+ default :
+ left = (PageTop + PageBottom - xprint * 72) / 2;
+ break;
+ case 1 :
+ left = PageTop - xprint * 72;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ top = pl;
+ break;
+ default :
+ top = (pr + pl - yprint * 72) / 2;
+ break;
+ case 1 :
+ top = pr - yprint * 72;;
+ break;
+ }
+ break;
+
+ case 2 :
+ switch (XPosition)
+ {
+ case -1 :
+ left = pr - xprint * 72;
+ break;
+ default :
+ left = (pr + pl - xprint * 72) / 2;
+ break;
+ case 1 :
+ left = pl;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ top = PageTop - yprint * 72;
+ break;
+ default :
+ top = (PageTop + PageBottom - yprint * 72) / 2;
+ break;
+ case 1 :
+ top = PageBottom;
+ break;
+ }
+ break;
+
+ case 3 :
+ switch (XPosition)
+ {
+ case -1 :
+ left = PageTop - xprint * 72;
+ break;
+ default :
+ left = (PageTop + PageBottom - xprint * 72) / 2;
+ break;
+ case 1 :
+ left = PageBottom;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ top = pr - yprint * 72;;
+ break;
+ default :
+ top = (pr + pl - yprint * 72) / 2;
+ break;
+ case 1 :
+ top = pl;
+ break;
+ }
+ break;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "DEBUG: left=%.2f, top=%.2f\n", left, top);
+#endif
+
+ if (Collate)
+ {
+ int *contentsObjs;
+ int *imgObjs;
+
+ if ((contentsObjs = malloc(sizeof(int)*xpages*ypages)) == NULL)
+ {
+ fprintf(stderr,"ERROR: Can't allocate contentsObjs\n");
+ exit(2);
+ }
+ if ((imgObjs = malloc(sizeof(int)*xpages*ypages)) == NULL)
+ {
+ fprintf(stderr,"ERROR: Can't allocate imgObjs\n");
+ exit(2);
+ }
+ for (xpage = 0; xpage < xpages; xpage ++)
+ for (ypage = 0; ypage < ypages; ypage ++)
+ {
+ int imgObj;
+ int contentsObj;
+
+ contentsObj = contentsObjs[ypages*xpage+ypage] = newObj();
+ imgObj = imgObjs[ypages*xpage+ypage] = newObj();
+
+ /* out contents object */
+ outPageContents(contentsObj);
+
+ /* out image object */
+ outImage(imgObj);
+ }
+ for (page = 0; Copies > 0 ; Copies --) {
+ for (xpage = 0; xpage < xpages; xpage ++)
+ for (ypage = 0; ypage < ypages; ypage ++, page ++)
+ {
+ /* out Page Object */
+ outPageObject(pageObjects[page],
+ contentsObjs[ypages*xpage+ypage],
+ imgObjs[ypages*xpage+ypage]);
+ if (pdf_printer)
+ fprintf(stderr, "PAGE: %d %d\n", page+1, 1);
+ }
+ if (EvenDuplex) {
+ /* out empty page */
+ outPageObject(pageObjects[page],-1,-1);
+ if (pdf_printer)
+ fprintf(stderr, "PAGE: %d %d\n", page+1, 1);
+ }
+ }
+ free(contentsObjs);
+ free(imgObjs);
+ }
+ else {
+ for (page = 0, xpage = 0; xpage < xpages; xpage ++)
+ for (ypage = 0; ypage < ypages; ypage ++)
+ {
+ int imgObj;
+ int contentsObj;
+ int p;
+
+ imgObj = newObj();
+ contentsObj = newObj();
+
+ /* out contents object */
+ outPageContents(contentsObj);
+
+ /* out image object */
+ outImage(imgObj);
+
+ for (p = 0;p < Copies;p++, page++)
+ {
+ /* out Page Object */
+ outPageObject(pageObjects[page],contentsObj,imgObj);
+ if (pdf_printer)
+ fprintf(stderr, "PAGE: %d %d\n", page+1, 1);
+ }
+ }
+ if (EvenDuplex) {
+ /* out empty pages */
+ int p;
+
+ for (p = 0;p < Copies;p++, page++)
+ {
+ outPageObject(pageObjects[page],-1,-1);
+ if (pdf_printer)
+ fprintf(stderr, "PAGE: %d %d\n", page+1, 1);
+ }
+ }
+ }
+
+ outXref();
+ outTrailer();
+ freeAllObj();
+ /*
+ * Close files...
+ */
+
+#ifndef CUPS_1_1
+ if (emit_jcl)
+ {
+ if (ppd && ppd->jcl_end)
+ ppdEmitJCLEnd(ppd, stdout);
+ }
+#endif
+
+ cupsImageClose(img);
+ ppdClose(ppd);
+
+ return (0);
+}
+
+#ifdef OUT_AS_HEX
+/*
+ * 'out_hex()' - Print binary data as a series of hexadecimal numbers.
+ */
+
+static void
+out_hex(cups_ib_t *data, /* I - Data to print */
+ int length, /* I - Number of bytes to print */
+ int last_line) /* I - Last line of raster data? */
+{
+ static int col = 0; /* Current column */
+ static char *hex = "0123456789ABCDEF";
+ /* Hex digits */
+
+
+ while (length > 0)
+ {
+ /*
+ * Put the hex chars out to the file; note that we don't use printf()
+ * for speed reasons...
+ */
+
+ putcPdf(hex[*data >> 4]);
+ putcPdf(hex[*data & 15]);
+
+ data ++;
+ length --;
+
+ col += 2;
+ if (col > 78)
+ {
+ putcPdf('\n');
+ col = 0;
+ }
+ }
+
+ if (last_line && col)
+ {
+ putcPdf('\n');
+ col = 0;
+ }
+}
+#else
+
+#ifdef OUT_AS_ASCII85
+/*
+ * 'out_ascii85()' - Print binary data as a series of base-85 numbers.
+ */
+
+static void
+out_ascii85(cups_ib_t *data, /* I - Data to print */
+ int length, /* I - Number of bytes to print */
+ int last_line) /* I - Last line of raster data? */
+{
+ unsigned b; /* Binary data word */
+ unsigned char c[6]; /* ASCII85 encoded chars */
+ static int col = 0; /* Current column */
+
+
+ c[5] = '\0'; /* end mark */
+ while (length > 3)
+ {
+ b = (((((data[0] << 8) | data[1]) << 8) | data[2]) << 8) | data[3];
+
+ if (b == 0)
+ {
+ putcPdf('z');
+ col ++;
+ }
+ else
+ {
+ c[4] = (b % 85) + '!';
+ b /= 85;
+ c[3] = (b % 85) + '!';
+ b /= 85;
+ c[2] = (b % 85) + '!';
+ b /= 85;
+ c[1] = (b % 85) + '!';
+ b /= 85;
+ c[0] = b + '!';
+
+ outPdf(c);
+ col += 5;
+ }
+
+ data += 4;
+ length -= 4;
+
+ if (col >= 75)
+ {
+ putcPdf('\n');
+ col = 0;
+ }
+ }
+
+ if (last_line)
+ {
+ if (length > 0)
+ {
+ memset(data + length, 0, 4 - length);
+ b = (((((data[0] << 8) | data[1]) << 8) | data[2]) << 8) | data[3];
+
+ c[4] = (b % 85) + '!';
+ b /= 85;
+ c[3] = (b % 85) + '!';
+ b /= 85;
+ c[2] = (b % 85) + '!';
+ b /= 85;
+ c[1] = (b % 85) + '!';
+ b /= 85;
+ c[0] = b + '!';
+
+ c[length+1] = '\0';
+ outPdf(c);
+ }
+
+ outPdf("~>");
+ col = 0;
+ }
+}
+#else
+/*
+ * 'out_bin()' - Print binary data as binary.
+ */
+
+static void
+out_bin(cups_ib_t *data, /* I - Data to print */
+ int length, /* I - Number of bytes to print */
+ int last_line) /* I - Last line of raster data? */
+{
+ while (length > 0)
+ {
+ putcPdf(*data);
+ data ++;
+ length --;
+ }
+
+ if (last_line)
+ {
+ putcPdf('\n');
+ }
+}
+#endif
+#endif
--- /dev/null
+#!/bin/sh
+
+# $Id: $
+#
+# imagetops - This is a Image-to-PostScript filter for CUPS
+#
+# Note: This wrapper filter is only included for backward compatibility with
+# certan custom configurations. It is not mentioned in any of the .convs
+# files included in this package and therefore never used with the default
+# configuration. It makes sure that third-party PPD files referring to
+# imagetops explicitly or custom configurations (in /etc/cups/*.convs files)
+# will not break.
+#
+# DO NOT create new PPD or .convs files using this filter! imagetops is
+# DEPRECATED!
+
+# (C) 2012 Till Kamppeter <till.kamppeter@gmail.com>
+#
+# Released under GPL 2 or later
+#
+
+PDF2PS=`which pdf2ps`
+
+echo "DEBUG: imagetops argv[$#] = $@" >&2
+echo "DEBUG: PPD: $PPD" >&2
+
+if [ $# -lt 5 -o $# -gt 6 ]; then
+ echo "ERROR: $0 job-id user title copies options [file]" >&2
+ exit 1
+fi
+
+# Read from given file.
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+`dirname $0`/imagetopdf "$1" "$2" "$3" "$4" "$5" | $PDF2PS - -
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Image file to raster filter for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Main entry...
+ * blank_line() - Clear a line buffer to the blank value...
+ * format_CMY() - Convert image data to CMY.
+ * format_CMYK() - Convert image data to CMYK.
+ * format_K() - Convert image data to black.
+ * format_KCMY() - Convert image data to KCMY.
+ * format_KCMYcm() - Convert image data to KCMYcm.
+ * format_RGBA() - Convert image data to RGBA/RGBW.
+ * format_W() - Convert image data to luminance.
+ * format_YMC() - Convert image data to YMC.
+ * format_YMCK() - Convert image data to YMCK.
+ * make_lut() - Make a lookup table given gamma and brightness values.
+ * raster_cb() - Validate the page header.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "common.h"
+#include <cupsfilters/image-private.h>
+#include <unistd.h>
+#include <math.h>
+#include <signal.h>
+#include <string.h>
+
+
+/*
+ * Globals...
+ */
+
+int Flip = 0, /* Flip/mirror pages */
+ XPosition = 0, /* Horizontal position on page */
+ YPosition = 0, /* Vertical position on page */
+ Collate = 0, /* Collate copies? */
+ Copies = 1; /* Number of copies */
+int Floyd16x16[16][16] = /* Traditional Floyd ordered dither */
+ {
+ { 0, 128, 32, 160, 8, 136, 40, 168,
+ 2, 130, 34, 162, 10, 138, 42, 170 },
+ { 192, 64, 224, 96, 200, 72, 232, 104,
+ 194, 66, 226, 98, 202, 74, 234, 106 },
+ { 48, 176, 16, 144, 56, 184, 24, 152,
+ 50, 178, 18, 146, 58, 186, 26, 154 },
+ { 240, 112, 208, 80, 248, 120, 216, 88,
+ 242, 114, 210, 82, 250, 122, 218, 90 },
+ { 12, 140, 44, 172, 4, 132, 36, 164,
+ 14, 142, 46, 174, 6, 134, 38, 166 },
+ { 204, 76, 236, 108, 196, 68, 228, 100,
+ 206, 78, 238, 110, 198, 70, 230, 102 },
+ { 60, 188, 28, 156, 52, 180, 20, 148,
+ 62, 190, 30, 158, 54, 182, 22, 150 },
+ { 252, 124, 220, 92, 244, 116, 212, 84,
+ 254, 126, 222, 94, 246, 118, 214, 86 },
+ { 3, 131, 35, 163, 11, 139, 43, 171,
+ 1, 129, 33, 161, 9, 137, 41, 169 },
+ { 195, 67, 227, 99, 203, 75, 235, 107,
+ 193, 65, 225, 97, 201, 73, 233, 105 },
+ { 51, 179, 19, 147, 59, 187, 27, 155,
+ 49, 177, 17, 145, 57, 185, 25, 153 },
+ { 243, 115, 211, 83, 251, 123, 219, 91,
+ 241, 113, 209, 81, 249, 121, 217, 89 },
+ { 15, 143, 47, 175, 7, 135, 39, 167,
+ 13, 141, 45, 173, 5, 133, 37, 165 },
+ { 207, 79, 239, 111, 199, 71, 231, 103,
+ 205, 77, 237, 109, 197, 69, 229, 101 },
+ { 63, 191, 31, 159, 55, 183, 23, 151,
+ 61, 189, 29, 157, 53, 181, 21, 149 },
+ { 254, 127, 223, 95, 247, 119, 215, 87,
+ 253, 125, 221, 93, 245, 117, 213, 85 }
+ };
+int Floyd8x8[8][8] =
+ {
+ { 0, 32, 8, 40, 2, 34, 10, 42 },
+ { 48, 16, 56, 24, 50, 18, 58, 26 },
+ { 12, 44, 4, 36, 14, 46, 6, 38 },
+ { 60, 28, 52, 20, 62, 30, 54, 22 },
+ { 3, 35, 11, 43, 1, 33, 9, 41 },
+ { 51, 19, 59, 27, 49, 17, 57, 25 },
+ { 15, 47, 7, 39, 13, 45, 5, 37 },
+ { 63, 31, 55, 23, 61, 29, 53, 21 }
+ };
+int Floyd4x4[4][4] =
+ {
+ { 0, 8, 2, 10 },
+ { 12, 4, 14, 6 },
+ { 3, 11, 1, 9 },
+ { 15, 7, 13, 5 }
+ };
+
+cups_ib_t OnPixels[256], /* On-pixel LUT */
+ OffPixels[256]; /* Off-pixel LUT */
+
+
+/*
+ * Local functions...
+ */
+
+static void blank_line(cups_page_header2_t *header, unsigned char *row);
+static void format_CMY(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_CMYK(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_K(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_KCMYcm(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_KCMY(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+#define format_RGB format_CMY
+static void format_RGBA(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_W(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_YMC(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void format_YMCK(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1);
+static void make_lut(cups_ib_t *, int, float, float);
+static int raster_cb(cups_page_header2_t *header, int preferred_bits);
+
+
+/*
+ * 'main()' - Main entry...
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int i; /* Looping var */
+ cups_image_t *img; /* Image to print */
+ float xprint, /* Printable area */
+ yprint,
+ xinches, /* Total size in inches */
+ yinches;
+ float xsize, /* Total size in points */
+ ysize,
+ xsize2,
+ ysize2;
+ float aspect; /* Aspect ratio */
+ int xpages, /* # x pages */
+ ypages, /* # y pages */
+ xpage, /* Current x page */
+ ypage, /* Current y page */
+ xtemp, /* Bitmap width in pixels */
+ ytemp, /* Bitmap height in pixels */
+ page; /* Current page number */
+ int xc0, yc0, /* Corners of the page in image coords */
+ xc1, yc1;
+ ppd_file_t *ppd; /* PPD file */
+ ppd_choice_t *choice; /* PPD option choice */
+ char *resolution, /* Output resolution */
+ *media_type; /* Media type */
+ ppd_profile_t *profile; /* Color profile */
+ ppd_profile_t userprofile; /* User-specified profile */
+ cups_raster_t *ras; /* Raster stream */
+ cups_page_header2_t header; /* Page header */
+ int num_options; /* Number of print options */
+ cups_option_t *options; /* Print options */
+ const char *val; /* Option value */
+ int slowcollate, /* Collate copies the slow way */
+ slowcopies; /* Make copies the "slow" way? */
+ float g; /* Gamma correction value */
+ float b; /* Brightness factor */
+ float zoom; /* Zoom facter */
+ int xppi, yppi; /* Pixels-per-inch */
+ int hue, sat; /* Hue and saturation adjustment */
+ cups_izoom_t *z; /* Image zoom buffer */
+ cups_iztype_t zoom_type; /* Image zoom type */
+ int primary, /* Primary image colorspace */
+ secondary; /* Secondary image colorspace */
+ cups_ib_t *row, /* Current row */
+ *r0, /* Top row */
+ *r1; /* Bottom row */
+ int y, /* Current Y coordinate on page */
+ iy, /* Current Y coordinate in image */
+ last_iy, /* Previous Y coordinate in image */
+ yerr0, /* Top Y error value */
+ yerr1; /* Bottom Y error value */
+ cups_ib_t lut[256]; /* Gamma/brightness LUT */
+ int plane, /* Current color plane */
+ num_planes; /* Number of color planes */
+ char filename[1024]; /* Name of file to print */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Ignore broken pipe signals...
+ */
+
+ signal(SIGPIPE, SIG_IGN);
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ argv[0]);
+ return (1);
+ }
+
+ /*
+ * See if we need to use the imagetops and pstoraster filters instead...
+ */
+
+ options = NULL;
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ if (getenv("CLASSIFICATION") ||
+ cupsGetOption("page-label", num_options, options))
+ {
+ /*
+ * Yes, fork a copy of pstoraster and then transfer control to imagetops...
+ */
+
+ int mypipes[2]; /* New pipes for imagetops | pstoraster */
+ int pid; /* PID of pstoraster */
+
+
+ cupsFreeOptions(num_options, options);
+
+ if (pipe(mypipes))
+ {
+ perror("ERROR: Unable to create pipes for filters");
+ return (errno);
+ }
+
+ if ((pid = fork()) == 0)
+ {
+ /*
+ * Child process for pstoraster... Assign new pipe input to pstoraster...
+ */
+
+ dup2(mypipes[0], 0);
+ close(mypipes[0]);
+ close(mypipes[1]);
+
+ execlp("pstoraster", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
+ NULL);
+ return (errno);
+ }
+ else if (pid < 0)
+ {
+ /*
+ * Error!
+ */
+
+ perror("ERROR: Unable to fork filter");
+ return (errno);
+ }
+
+ /*
+ * Update stdout so it points at the new pstoraster...
+ */
+
+ dup2(mypipes[1], 1);
+ close(mypipes[0]);
+ close(mypipes[1]);
+
+ /*
+ * Run imagetops to get the classification or page labeling that was
+ * requested...
+ */
+
+ execlp("imagetops", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
+ argv[6], NULL);
+ return (errno);
+ }
+
+ /*
+ * Copy stdin as needed...
+ */
+
+ if (argc == 6)
+ {
+ int fd; /* File to write to */
+ char buffer[8192]; /* Buffer to read into */
+ int bytes; /* # of bytes to read */
+
+
+ if ((fd = cupsTempFd(filename, sizeof(filename))) < 0)
+ {
+ perror("ERROR: Unable to copy print file");
+ return (1);
+ }
+
+ fprintf(stderr,
+ "DEBUG: imagetoraster - copying to temp print file \"%s\".\n",
+ filename);
+
+ while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
+ write(fd, buffer, bytes);
+
+ close(fd);
+ }
+ else
+ {
+ strncpy(filename, argv[6], sizeof(filename) - 1);
+ filename[sizeof(filename) - 1] = '\0';
+ }
+
+ /*
+ * Process command-line options and write the prolog...
+ */
+
+ zoom = 1.0;
+ xppi = 0;
+ yppi = 0;
+ hue = 0;
+ sat = 100;
+ g = 1.0;
+ b = 1.0;
+
+ Copies = atoi(argv[4]);
+
+ ppd = SetCommonOptions(num_options, options, 0);
+
+ if ((val = cupsGetOption("multiple-document-handling", num_options, options)) != NULL)
+ {
+ /*
+ * This IPP attribute is unnecessarily complicated...
+ *
+ * single-document, separate-documents-collated-copies, and
+ * single-document-new-sheet all require collated copies.
+ *
+ * separate-documents-collated-copies allows for uncollated copies.
+ */
+
+ Collate = strcasecmp(val, "separate-documents-collated-copies") != 0;
+ }
+
+ if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
+ strcasecmp(val, "True") == 0)
+ Collate = 1;
+
+ if ((val = cupsGetOption("gamma", num_options, options)) != NULL)
+ {
+ /*
+ * Get gamma value from 1 to 10000...
+ */
+
+ g = atoi(val) * 0.001f;
+
+ if (g < 0.001f)
+ g = 0.001f;
+ else if (g > 10.0f)
+ g = 10.0f;
+ }
+
+ if ((val = cupsGetOption("brightness", num_options, options)) != NULL)
+ {
+ /*
+ * Get brightness value from 10 to 1000.
+ */
+
+ b = atoi(val) * 0.01f;
+
+ if (b < 0.1f)
+ b = 0.1f;
+ else if (b > 10.0f)
+ b = 10.0f;
+ }
+
+ if ((val = cupsGetOption("scaling", num_options, options)) != NULL)
+ zoom = atoi(val) * 0.01;
+ else if (((val =
+ cupsGetOption("fit-to-page", num_options, options)) != NULL) ||
+ ((val = cupsGetOption("fitplot", num_options, options)) != NULL))
+ {
+ if (!strcasecmp(val, "yes") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "true"))
+ zoom = 1.0;
+ else
+ zoom = 0.0;
+ }
+ else if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
+ zoom = 0.0;
+
+ if ((val = cupsGetOption("ppi", num_options, options)) != NULL)
+ {
+ if (sscanf(val, "%dx%d", &xppi, &yppi) < 2)
+ yppi = xppi;
+ zoom = 0.0;
+ }
+
+ if ((val = cupsGetOption("position", num_options, options)) != NULL)
+ {
+ if (strcasecmp(val, "center") == 0)
+ {
+ XPosition = 0;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "top") == 0)
+ {
+ XPosition = 0;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "left") == 0)
+ {
+ XPosition = -1;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "right") == 0)
+ {
+ XPosition = 1;
+ YPosition = 0;
+ }
+ else if (strcasecmp(val, "top-left") == 0)
+ {
+ XPosition = -1;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "top-right") == 0)
+ {
+ XPosition = 1;
+ YPosition = 1;
+ }
+ else if (strcasecmp(val, "bottom") == 0)
+ {
+ XPosition = 0;
+ YPosition = -1;
+ }
+ else if (strcasecmp(val, "bottom-left") == 0)
+ {
+ XPosition = -1;
+ YPosition = -1;
+ }
+ else if (strcasecmp(val, "bottom-right") == 0)
+ {
+ XPosition = 1;
+ YPosition = -1;
+ }
+ }
+
+ if ((val = cupsGetOption("saturation", num_options, options)) != NULL)
+ sat = atoi(val);
+
+ if ((val = cupsGetOption("hue", num_options, options)) != NULL)
+ hue = atoi(val);
+
+ if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL)
+ {
+ val = choice->choice;
+ choice->marked = 0;
+ }
+ else
+ val = cupsGetOption("mirror", num_options, options);
+
+ if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes")))
+ Flip = 1;
+
+ /*
+ * Set the needed options in the page header...
+ */
+
+ if (cupsRasterInterpretPPD(&header, ppd, num_options, options, raster_cb))
+ {
+ fputs("ERROR: The page setup information was not valid.\n", stderr);
+ fprintf(stderr, "DEBUG: %s\n", cupsRasterErrorString());
+ return (1);
+ }
+
+ /*
+ * Get the media type and resolution that have been chosen...
+ */
+
+ if ((choice = ppdFindMarkedChoice(ppd, "MediaType")) != NULL)
+ media_type = choice->choice;
+ else
+ media_type = "";
+
+ if ((choice = ppdFindMarkedChoice(ppd, "Resolution")) != NULL)
+ resolution = choice->choice;
+ else
+ resolution = "";
+
+ /*
+ * Choose the appropriate colorspace...
+ */
+
+ switch (header.cupsColorSpace)
+ {
+ case CUPS_CSPACE_W :
+ case CUPS_CSPACE_SW :
+ if (header.cupsBitsPerColor >= 8)
+ {
+ primary = CUPS_IMAGE_WHITE;
+ secondary = CUPS_IMAGE_WHITE;
+ }
+ else
+ {
+ primary = CUPS_IMAGE_BLACK;
+ secondary = CUPS_IMAGE_BLACK;
+ }
+ break;
+
+ default :
+ case CUPS_CSPACE_RGB :
+ case CUPS_CSPACE_RGBA :
+ case CUPS_CSPACE_RGBW :
+ case CUPS_CSPACE_SRGB :
+ case CUPS_CSPACE_ADOBERGB :
+ if (header.cupsBitsPerColor >= 8)
+ {
+ primary = CUPS_IMAGE_RGB;
+ secondary = CUPS_IMAGE_RGB;
+ }
+ else
+ {
+ primary = CUPS_IMAGE_CMY;
+ secondary = CUPS_IMAGE_CMY;
+ }
+ break;
+
+ case CUPS_CSPACE_K :
+ case CUPS_CSPACE_WHITE :
+ case CUPS_CSPACE_GOLD :
+ case CUPS_CSPACE_SILVER :
+ primary = CUPS_IMAGE_BLACK;
+ secondary = CUPS_IMAGE_BLACK;
+ break;
+
+ case CUPS_CSPACE_CMYK :
+ case CUPS_CSPACE_YMCK :
+ case CUPS_CSPACE_KCMY :
+ case CUPS_CSPACE_KCMYcm :
+ case CUPS_CSPACE_GMCK :
+ case CUPS_CSPACE_GMCS :
+ if (header.cupsBitsPerColor == 1)
+ {
+ primary = CUPS_IMAGE_CMY;
+ secondary = CUPS_IMAGE_CMY;
+ }
+ else
+ {
+ primary = CUPS_IMAGE_CMYK;
+ secondary = CUPS_IMAGE_CMYK;
+ }
+ break;
+
+ case CUPS_CSPACE_CMY :
+ case CUPS_CSPACE_YMC :
+ primary = CUPS_IMAGE_CMY;
+ secondary = CUPS_IMAGE_CMY;
+ break;
+
+ case CUPS_CSPACE_CIEXYZ :
+ case CUPS_CSPACE_CIELab :
+ case CUPS_CSPACE_ICC1 :
+ case CUPS_CSPACE_ICC2 :
+ case CUPS_CSPACE_ICC3 :
+ case CUPS_CSPACE_ICC4 :
+ case CUPS_CSPACE_ICC5 :
+ case CUPS_CSPACE_ICC6 :
+ case CUPS_CSPACE_ICC7 :
+ case CUPS_CSPACE_ICC8 :
+ case CUPS_CSPACE_ICC9 :
+ case CUPS_CSPACE_ICCA :
+ case CUPS_CSPACE_ICCB :
+ case CUPS_CSPACE_ICCC :
+ case CUPS_CSPACE_ICCD :
+ case CUPS_CSPACE_ICCE :
+ case CUPS_CSPACE_ICCF :
+ case CUPS_CSPACE_DEVICE1 :
+ case CUPS_CSPACE_DEVICE2 :
+ case CUPS_CSPACE_DEVICE3 :
+ case CUPS_CSPACE_DEVICE4 :
+ case CUPS_CSPACE_DEVICE5 :
+ case CUPS_CSPACE_DEVICE6 :
+ case CUPS_CSPACE_DEVICE7 :
+ case CUPS_CSPACE_DEVICE8 :
+ case CUPS_CSPACE_DEVICE9 :
+ case CUPS_CSPACE_DEVICEA :
+ case CUPS_CSPACE_DEVICEB :
+ case CUPS_CSPACE_DEVICEC :
+ case CUPS_CSPACE_DEVICED :
+ case CUPS_CSPACE_DEVICEE :
+ case CUPS_CSPACE_DEVICEF :
+ fprintf(stderr, "DEBUG: Colorspace %d not supported.\n",
+ header.cupsColorSpace);
+ exit(1);
+ break;
+ }
+
+ /*
+ * Find a color profile matching the current options...
+ */
+
+ if ((val = cupsGetOption("profile", num_options, options)) != NULL)
+ {
+ profile = &userprofile;
+ sscanf(val, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f",
+ &(userprofile.density), &(userprofile.gamma),
+ userprofile.matrix[0] + 0, userprofile.matrix[0] + 1,
+ userprofile.matrix[0] + 2,
+ userprofile.matrix[1] + 0, userprofile.matrix[1] + 1,
+ userprofile.matrix[1] + 2,
+ userprofile.matrix[2] + 0, userprofile.matrix[2] + 1,
+ userprofile.matrix[2] + 2);
+
+ userprofile.density *= 0.001f;
+ userprofile.gamma *= 0.001f;
+ userprofile.matrix[0][0] *= 0.001f;
+ userprofile.matrix[0][1] *= 0.001f;
+ userprofile.matrix[0][2] *= 0.001f;
+ userprofile.matrix[1][0] *= 0.001f;
+ userprofile.matrix[1][1] *= 0.001f;
+ userprofile.matrix[1][2] *= 0.001f;
+ userprofile.matrix[2][0] *= 0.001f;
+ userprofile.matrix[2][1] *= 0.001f;
+ userprofile.matrix[2][2] *= 0.001f;
+ }
+ else if (ppd != NULL)
+ {
+ fprintf(stderr, "DEBUG: Searching for profile \"%s/%s\"...\n",
+ resolution, media_type);
+
+ for (i = 0, profile = ppd->profiles; i < ppd->num_profiles; i ++, profile ++)
+ {
+ fprintf(stderr, "DEBUG: \"%s/%s\" = ", profile->resolution,
+ profile->media_type);
+
+ if ((strcmp(profile->resolution, resolution) == 0 ||
+ profile->resolution[0] == '-') &&
+ (strcmp(profile->media_type, media_type) == 0 ||
+ profile->media_type[0] == '-'))
+ {
+ fputs("MATCH\n", stderr);
+ break;
+ }
+ else
+ fputs("no.\n", stderr);
+ }
+
+ /*
+ * If we found a color profile, use it!
+ */
+
+ if (i >= ppd->num_profiles)
+ profile = NULL;
+ }
+ else
+ profile = NULL;
+
+ if (profile)
+ cupsImageSetProfile(profile->density, profile->gamma, profile->matrix);
+
+ cupsImageSetRasterColorSpace(header.cupsColorSpace);
+
+ /*
+ * Create a gamma/brightness LUT...
+ */
+
+ make_lut(lut, primary, g, b);
+
+ /*
+ * Open the input image to print...
+ */
+
+ fputs("INFO: Loading print file.\n", stderr);
+
+ if (header.cupsColorSpace == CUPS_CSPACE_CIEXYZ ||
+ header.cupsColorSpace == CUPS_CSPACE_CIELab ||
+ header.cupsColorSpace >= CUPS_CSPACE_ICC1)
+ img = cupsImageOpen(filename, primary, secondary, sat, hue, NULL);
+ else
+ img = cupsImageOpen(filename, primary, secondary, sat, hue, lut);
+
+ if (argc == 6)
+ unlink(filename);
+
+ if (img == NULL)
+ {
+ fputs("ERROR: The print file could not be opened.\n", stderr);
+ ppdClose(ppd);
+ return (1);
+ }
+
+ /*
+ * Scale as necessary...
+ */
+
+ if (zoom == 0.0 && xppi == 0)
+ {
+ xppi = img->xppi;
+ yppi = img->yppi;
+ }
+
+ if (yppi == 0)
+ yppi = xppi;
+
+ fprintf(stderr, "DEBUG: Before scaling: xppi=%d, yppi=%d, zoom=%.2f\n",
+ xppi, yppi, zoom);
+
+ if (xppi > 0)
+ {
+ /*
+ * Scale the image as neccesary to match the desired pixels-per-inch.
+ */
+
+ if (Orientation & 1)
+ {
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ }
+
+ fprintf(stderr, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
+ xprint, yprint);
+
+ xinches = (float)img->xsize / (float)xppi;
+ yinches = (float)img->ysize / (float)yppi;
+
+ fprintf(stderr, "DEBUG: Image size is %.1f x %.1f inches...\n",
+ xinches, yinches);
+
+ if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
+ {
+ xinches = xinches * atoi(val) / 100;
+ yinches = yinches * atoi(val) / 100;
+ }
+
+ if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
+ cupsGetOption("landscape", num_options, options) == NULL)
+ {
+ /*
+ * Rotate the image if it will fit landscape but not portrait...
+ */
+
+ fputs("DEBUG: Auto orientation...\n", stderr);
+
+ if ((xinches > xprint || yinches > yprint) &&
+ xinches <= yprint && yinches <= xprint)
+ {
+ /*
+ * Rotate the image as needed...
+ */
+
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+
+ Orientation = (Orientation + 1) & 3;
+ xsize = yprint;
+ yprint = xprint;
+ xprint = xsize;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Scale percentage of page size...
+ */
+
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ aspect = (float)img->yppi / (float)img->xppi;
+
+ fprintf(stderr, "DEBUG: Before scaling: xprint=%.1f, yprint=%.1f\n",
+ xprint, yprint);
+
+ fprintf(stderr, "DEBUG: img->xppi = %d, img->yppi = %d, aspect = %f\n",
+ img->xppi, img->yppi, aspect);
+
+ xsize = xprint * zoom;
+ ysize = xsize * img->ysize / img->xsize / aspect;
+
+ if (ysize > (yprint * zoom))
+ {
+ ysize = yprint * zoom;
+ xsize = ysize * img->xsize * aspect / img->ysize;
+ }
+
+ xsize2 = yprint * zoom;
+ ysize2 = xsize2 * img->ysize / img->xsize / aspect;
+
+ if (ysize2 > (xprint * zoom))
+ {
+ ysize2 = xprint * zoom;
+ xsize2 = ysize2 * img->xsize * aspect / img->ysize;
+ }
+
+ fprintf(stderr, "DEBUG: Portrait size is %.2f x %.2f inches\n", xsize, ysize);
+ fprintf(stderr, "DEBUG: Landscape size is %.2f x %.2f inches\n", xsize2, ysize2);
+
+ if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
+ cupsGetOption("landscape", num_options, options) == NULL)
+ {
+ /*
+ * Choose the rotation with the largest area, but prefer
+ * portrait if they are equal...
+ */
+
+ fputs("DEBUG: Auto orientation...\n", stderr);
+
+ if ((xsize * ysize) < (xsize2 * xsize2))
+ {
+ /*
+ * Do landscape orientation...
+ */
+
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+
+ Orientation = 1;
+ xinches = xsize2;
+ yinches = ysize2;
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+ /*
+ * Do portrait orientation...
+ */
+
+ fputs("DEBUG: Using portrait orientation...\n", stderr);
+
+ Orientation = 0;
+ xinches = xsize;
+ yinches = ysize;
+ }
+ }
+ else if (Orientation & 1)
+ {
+ fputs("DEBUG: Using landscape orientation...\n", stderr);
+
+ xinches = xsize2;
+ yinches = ysize2;
+ xprint = (PageTop - PageBottom) / 72.0;
+ yprint = (PageRight - PageLeft) / 72.0;
+ }
+ else
+ {
+ fputs("DEBUG: Using portrait orientation...\n", stderr);
+
+ xinches = xsize;
+ yinches = ysize;
+ xprint = (PageRight - PageLeft) / 72.0;
+ yprint = (PageTop - PageBottom) / 72.0;
+ }
+ }
+
+ /*
+ * Compute the number of pages to print and the size of the image on each
+ * page...
+ */
+
+ xpages = ceil(xinches / xprint);
+ ypages = ceil(yinches / yprint);
+
+ xprint = xinches / xpages;
+ yprint = yinches / ypages;
+
+ fprintf(stderr, "DEBUG: xpages = %dx%.2fin, ypages = %dx%.2fin\n",
+ xpages, xprint, ypages, yprint);
+
+ /*
+ * Compute the bitmap size...
+ */
+
+ if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL &&
+ strcasecmp(choice->choice, "Custom") == 0)
+ {
+ float width, /* New width in points */
+ length; /* New length in points */
+
+
+ /*
+ * Use the correct width and length for the current orientation...
+ */
+
+ if (Orientation & 1)
+ {
+ width = yprint * 72.0;
+ length = xprint * 72.0;
+ }
+ else
+ {
+ width = xprint * 72.0;
+ length = yprint * 72.0;
+ }
+
+ /*
+ * Add margins to page size...
+ */
+
+ width += ppd->custom_margins[0] + ppd->custom_margins[2];
+ length += ppd->custom_margins[1] + ppd->custom_margins[3];
+
+ /*
+ * Enforce minimums...
+ */
+
+ if (width < ppd->custom_min[0])
+ width = ppd->custom_min[0];
+
+ if (length < ppd->custom_min[1])
+ length = ppd->custom_min[1];
+
+ fprintf(stderr, "DEBUG: Updated custom page size to %.2f x %.2f inches...\n",
+ width / 72.0, length / 72.0);
+
+ /*
+ * Set the new custom size...
+ */
+
+ strcpy(header.cupsPageSizeName, "Custom");
+
+ header.cupsPageSize[0] = width + 0.5;
+ header.cupsPageSize[1] = length + 0.5;
+ header.PageSize[0] = width + 0.5;
+ header.PageSize[1] = length + 0.5;
+
+ /*
+ * Update page variables...
+ */
+
+ PageWidth = width;
+ PageLength = length;
+ PageLeft = ppd->custom_margins[0];
+ PageRight = width - ppd->custom_margins[2];
+ PageBottom = ppd->custom_margins[1];
+ PageTop = length - ppd->custom_margins[3];
+
+ /*
+ * Remove margins from page size...
+ */
+
+ width -= ppd->custom_margins[0] + ppd->custom_margins[2];
+ length -= ppd->custom_margins[1] + ppd->custom_margins[3];
+
+ /*
+ * Set the bitmap size...
+ */
+
+ header.cupsWidth = width * header.HWResolution[0] / 72.0;
+ header.cupsHeight = length * header.HWResolution[1] / 72.0;
+
+ header.cupsBytesPerLine = (header.cupsBitsPerPixel *
+ header.cupsWidth + 7) / 8;
+
+ if (header.cupsColorOrder == CUPS_ORDER_BANDED)
+ header.cupsBytesPerLine *= header.cupsNumColors;
+ }
+
+ header.Margins[0] = PageLeft;
+ header.Margins[1] = PageBottom;
+
+ fprintf(stderr, "DEBUG: PageSize = [%d %d]\n", header.PageSize[0],
+ header.PageSize[1]);
+
+ switch (Orientation)
+ {
+ default :
+ switch (XPosition)
+ {
+ case -1 :
+ header.cupsImagingBBox[0] = PageLeft;
+ header.cupsImagingBBox[2] = PageLeft + xprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[0] = (PageRight + PageLeft - xprint * 72) / 2;
+ header.cupsImagingBBox[2] = (PageRight + PageLeft + xprint * 72) / 2;
+ break;
+ case 1 :
+ header.cupsImagingBBox[0] = PageRight - xprint * 72;
+ header.cupsImagingBBox[2] = PageRight;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ header.cupsImagingBBox[1] = PageBottom;
+ header.cupsImagingBBox[3] = PageBottom + yprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[1] = (PageTop + PageBottom - yprint * 72) / 2;
+ header.cupsImagingBBox[3] = (PageTop + PageBottom + yprint * 72) / 2;
+ break;
+ case 1 :
+ header.cupsImagingBBox[1] = PageTop - yprint * 72;
+ header.cupsImagingBBox[3] = PageTop;
+ break;
+ }
+ break;
+
+ case 1 :
+ switch (XPosition)
+ {
+ case -1 :
+ header.cupsImagingBBox[0] = PageBottom;
+ header.cupsImagingBBox[2] = PageBottom + yprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[0] = (PageTop + PageBottom - yprint * 72) / 2;
+ header.cupsImagingBBox[2] = (PageTop + PageBottom + yprint * 72) / 2;
+ break;
+ case 1 :
+ header.cupsImagingBBox[0] = PageTop - yprint * 72;
+ header.cupsImagingBBox[2] = PageTop;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case -1 :
+ header.cupsImagingBBox[1] = PageLeft;
+ header.cupsImagingBBox[3] = PageLeft + xprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[1] = (PageRight + PageLeft - xprint * 72) / 2;
+ header.cupsImagingBBox[3] = (PageRight + PageLeft + xprint * 72) / 2;
+ break;
+ case 1 :
+ header.cupsImagingBBox[1] = PageRight - xprint * 72;
+ header.cupsImagingBBox[3] = PageRight;
+ break;
+ }
+ break;
+
+ case 2 :
+ switch (XPosition)
+ {
+ case 1 :
+ header.cupsImagingBBox[0] = PageLeft;
+ header.cupsImagingBBox[2] = PageLeft + xprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[0] = (PageRight + PageLeft - xprint * 72) / 2;
+ header.cupsImagingBBox[2] = (PageRight + PageLeft + xprint * 72) / 2;
+ break;
+ case -1 :
+ header.cupsImagingBBox[0] = PageRight - xprint * 72;
+ header.cupsImagingBBox[2] = PageRight;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case 1 :
+ header.cupsImagingBBox[1] = PageBottom;
+ header.cupsImagingBBox[3] = PageBottom + yprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[1] = (PageTop + PageBottom - yprint * 72) / 2;
+ header.cupsImagingBBox[3] = (PageTop + PageBottom + yprint * 72) / 2;
+ break;
+ case -1 :
+ header.cupsImagingBBox[1] = PageTop - yprint * 72;
+ header.cupsImagingBBox[3] = PageTop;
+ break;
+ }
+ break;
+
+ case 3 :
+ switch (XPosition)
+ {
+ case 1 :
+ header.cupsImagingBBox[0] = PageBottom;
+ header.cupsImagingBBox[2] = PageBottom + yprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[0] = (PageTop + PageBottom - yprint * 72) / 2;
+ header.cupsImagingBBox[2] = (PageTop + PageBottom + yprint * 72) / 2;
+ break;
+ case -1 :
+ header.cupsImagingBBox[0] = PageTop - yprint * 72;
+ header.cupsImagingBBox[2] = PageTop;
+ break;
+ }
+
+ switch (YPosition)
+ {
+ case 1 :
+ header.cupsImagingBBox[1] = PageLeft;
+ header.cupsImagingBBox[3] = PageLeft + xprint * 72;
+ break;
+ default :
+ header.cupsImagingBBox[1] = (PageRight + PageLeft - xprint * 72) / 2;
+ header.cupsImagingBBox[3] = (PageRight + PageLeft + xprint * 72) / 2;
+ break;
+ case -1 :
+ header.cupsImagingBBox[1] = PageRight - xprint * 72;
+ header.cupsImagingBBox[3] = PageRight;
+ break;
+ }
+ break;
+ }
+
+ header.ImagingBoundingBox[0] = header.cupsImagingBBox[0];
+ header.ImagingBoundingBox[1] = header.cupsImagingBBox[1];
+ header.ImagingBoundingBox[2] = header.cupsImagingBBox[2];
+ header.ImagingBoundingBox[3] = header.cupsImagingBBox[3];
+
+ if (header.cupsColorOrder == CUPS_ORDER_PLANAR)
+ num_planes = header.cupsNumColors;
+ else
+ num_planes = 1;
+
+ if (header.cupsBitsPerColor >= 8)
+ zoom_type = CUPS_IZOOM_NORMAL;
+ else
+ zoom_type = CUPS_IZOOM_FAST;
+
+ /*
+ * See if we need to collate, and if so how we need to do it...
+ */
+
+ if (xpages == 1 && ypages == 1)
+ Collate = 0;
+
+ slowcollate = Collate && ppdFindOption(ppd, "Collate") == NULL;
+ if (ppd != NULL)
+ slowcopies = ppd->manual_copies;
+ else
+ slowcopies = 1;
+
+ if (Copies > 1 && !slowcollate && !slowcopies)
+ {
+ header.Collate = (cups_bool_t)Collate;
+ header.NumCopies = Copies;
+
+ Copies = 1;
+ }
+ else
+ header.NumCopies = 1;
+
+ /*
+ * Create the dithering lookup tables...
+ */
+
+ OnPixels[0] = 0x00;
+ OnPixels[255] = 0xff;
+ OffPixels[0] = 0x00;
+ OffPixels[255] = 0xff;
+
+ switch (header.cupsBitsPerColor)
+ {
+ case 2 :
+ for (i = 1; i < 255; i ++)
+ {
+ OnPixels[i] = 0x55 * (i / 85 + 1);
+ OffPixels[i] = 0x55 * (i / 64);
+ }
+ break;
+ case 4 :
+ for (i = 1; i < 255; i ++)
+ {
+ OnPixels[i] = 17 * (i / 17 + 1);
+ OffPixels[i] = 17 * (i / 16);
+ }
+ break;
+ }
+
+ /*
+ * Output the pages...
+ */
+
+ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header.cupsWidth);
+ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header.cupsHeight);
+ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header.cupsBitsPerColor);
+ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header.cupsBitsPerPixel);
+ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header.cupsBytesPerLine);
+ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header.cupsColorOrder);
+ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header.cupsColorSpace);
+ fprintf(stderr, "DEBUG: img->colorspace = %d\n", img->colorspace);
+
+ row = malloc(2 * header.cupsBytesPerLine);
+ ras = cupsRasterOpen(1, CUPS_RASTER_WRITE);
+
+ for (i = 0, page = 1; i < Copies; i ++)
+ for (xpage = 0; xpage < xpages; xpage ++)
+ for (ypage = 0; ypage < ypages; ypage ++, page ++)
+ {
+ fprintf(stderr, "INFO: Formatting page %d.\n", page);
+
+ if (Orientation & 1)
+ {
+ xc0 = img->xsize * ypage / ypages;
+ xc1 = img->xsize * (ypage + 1) / ypages - 1;
+ yc0 = img->ysize * xpage / xpages;
+ yc1 = img->ysize * (xpage + 1) / xpages - 1;
+
+ xtemp = header.HWResolution[0] * yprint;
+ ytemp = header.HWResolution[1] * xprint;
+ }
+ else
+ {
+ xc0 = img->xsize * xpage / xpages;
+ xc1 = img->xsize * (xpage + 1) / xpages - 1;
+ yc0 = img->ysize * ypage / ypages;
+ yc1 = img->ysize * (ypage + 1) / ypages - 1;
+
+ xtemp = header.HWResolution[0] * xprint;
+ ytemp = header.HWResolution[1] * yprint;
+ }
+
+ cupsRasterWriteHeader2(ras, &header);
+
+ for (plane = 0; plane < num_planes; plane ++)
+ {
+ /*
+ * Initialize the image "zoom" engine...
+ */
+
+ if (Flip)
+ z = _cupsImageZoomNew(img, xc0, yc0, xc1, yc1, -xtemp, ytemp,
+ Orientation & 1, zoom_type);
+ else
+ z = _cupsImageZoomNew(img, xc0, yc0, xc1, yc1, xtemp, ytemp,
+ Orientation & 1, zoom_type);
+
+ /*
+ * Write leading blank space as needed...
+ */
+
+ if (header.cupsHeight > z->ysize && YPosition <= 0)
+ {
+ blank_line(&header, row);
+
+ y = header.cupsHeight - z->ysize;
+ if (YPosition == 0)
+ y /= 2;
+
+ fprintf(stderr, "DEBUG: Writing %d leading blank lines...\n", y);
+
+ for (; y > 0; y --)
+ {
+ if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
+ header.cupsBytesPerLine)
+ {
+ fputs("ERROR: Unable to send raster data to the driver.\n",
+ stderr);
+ cupsImageClose(img);
+ exit(1);
+ }
+ }
+ }
+
+ /*
+ * Then write image data...
+ */
+
+ for (y = z->ysize, yerr0 = 0, yerr1 = z->ysize, iy = 0, last_iy = -2;
+ y > 0;
+ y --)
+ {
+ if (iy != last_iy)
+ {
+ if (zoom_type != CUPS_IZOOM_FAST && (iy - last_iy) > 1)
+ _cupsImageZoomFill(z, iy);
+
+ _cupsImageZoomFill(z, iy + z->yincr);
+
+ last_iy = iy;
+ }
+
+ /*
+ * Format this line of raster data for the printer...
+ */
+
+ blank_line(&header, row);
+
+ r0 = z->rows[z->row];
+ r1 = z->rows[1 - z->row];
+
+ switch (header.cupsColorSpace)
+ {
+ case CUPS_CSPACE_W :
+ format_W(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ default :
+ case CUPS_CSPACE_RGB :
+ format_RGB(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_RGBA :
+ case CUPS_CSPACE_RGBW :
+ format_RGBA(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_K :
+ case CUPS_CSPACE_WHITE :
+ case CUPS_CSPACE_GOLD :
+ case CUPS_CSPACE_SILVER :
+ format_K(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_CMY :
+ format_CMY(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_YMC :
+ format_YMC(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_CMYK :
+ format_CMYK(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_YMCK :
+ case CUPS_CSPACE_GMCK :
+ case CUPS_CSPACE_GMCS :
+ format_YMCK(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ case CUPS_CSPACE_KCMYcm :
+ if (header.cupsBitsPerColor == 1)
+ {
+ format_KCMYcm(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ }
+ case CUPS_CSPACE_KCMY :
+ format_KCMY(&header, row, y, plane, z->xsize, z->ysize,
+ yerr0, yerr1, r0, r1);
+ break;
+ }
+
+ /*
+ * Write the raster data to the driver...
+ */
+
+ if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
+ header.cupsBytesPerLine)
+ {
+ fputs("ERROR: Unable to send raster data to the driver.\n",
+ stderr);
+ cupsImageClose(img);
+ exit(1);
+ }
+
+ /*
+ * Compute the next scanline in the image...
+ */
+
+ iy += z->ystep;
+ yerr0 += z->ymod;
+ yerr1 -= z->ymod;
+ if (yerr1 <= 0)
+ {
+ yerr0 -= z->ysize;
+ yerr1 += z->ysize;
+ iy += z->yincr;
+ }
+ }
+
+ /*
+ * Write trailing blank space as needed...
+ */
+
+ if (header.cupsHeight > z->ysize && YPosition >= 0)
+ {
+ blank_line(&header, row);
+
+ y = header.cupsHeight - z->ysize;
+ if (YPosition == 0)
+ y = y - y / 2;
+
+ fprintf(stderr, "DEBUG: Writing %d trailing blank lines...\n", y);
+
+ for (; y > 0; y --)
+ {
+ if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
+ header.cupsBytesPerLine)
+ {
+ fputs("ERROR: Unable to send raster data to the driver.\n",
+ stderr);
+ cupsImageClose(img);
+ exit(1);
+ }
+ }
+ }
+
+ /*
+ * Free memory used for the "zoom" engine...
+ */
+
+ _cupsImageZoomDelete(z);
+ }
+ }
+
+ /*
+ * Close files...
+ */
+
+ free(row);
+ cupsRasterClose(ras);
+ cupsImageClose(img);
+ ppdClose(ppd);
+
+ return (0);
+}
+
+
+/*
+ * 'blank_line()' - Clear a line buffer to the blank value...
+ */
+
+static void
+blank_line(cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row) /* I - Row buffer */
+{
+ int count; /* Remaining bytes */
+
+
+ count = header->cupsBytesPerLine;
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_CIEXYZ :
+ while (count > 2)
+ {
+ *row++ = 242;
+ *row++ = 255;
+ *row++ = 255;
+ count -= 3;
+ }
+ break;
+
+ case CUPS_CSPACE_CIELab :
+ case CUPS_CSPACE_ICC1 :
+ case CUPS_CSPACE_ICC2 :
+ case CUPS_CSPACE_ICC3 :
+ case CUPS_CSPACE_ICC4 :
+ case CUPS_CSPACE_ICC5 :
+ case CUPS_CSPACE_ICC6 :
+ case CUPS_CSPACE_ICC7 :
+ case CUPS_CSPACE_ICC8 :
+ case CUPS_CSPACE_ICC9 :
+ case CUPS_CSPACE_ICCA :
+ case CUPS_CSPACE_ICCB :
+ case CUPS_CSPACE_ICCC :
+ case CUPS_CSPACE_ICCD :
+ case CUPS_CSPACE_ICCE :
+ case CUPS_CSPACE_ICCF :
+ while (count > 2)
+ {
+ *row++ = 255;
+ *row++ = 128;
+ *row++ = 128;
+ count -= 3;
+ }
+ break;
+
+ case CUPS_CSPACE_K :
+ case CUPS_CSPACE_CMY :
+ case CUPS_CSPACE_CMYK :
+ case CUPS_CSPACE_YMC :
+ case CUPS_CSPACE_YMCK :
+ case CUPS_CSPACE_KCMY :
+ case CUPS_CSPACE_KCMYcm :
+ case CUPS_CSPACE_GMCK :
+ case CUPS_CSPACE_GMCS :
+ case CUPS_CSPACE_WHITE :
+ case CUPS_CSPACE_GOLD :
+ case CUPS_CSPACE_SILVER :
+ memset(row, 0, count);
+ break;
+
+ default :
+ memset(row, 255, count);
+ break;
+ }
+}
+
+
+/*
+ * 'format_CMY()' - Convert image data to CMY.
+ */
+
+static void
+format_CMY(cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 3;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 64 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 64;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[1]]);
+
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr++ ^= (0x03 & OnPixels[r0[2]]);
+ else
+ *ptr++ ^= (0x03 & OffPixels[r0[2]]);
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[0]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[0]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[1]]);
+
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[2]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[2]]);
+ }
+ break;
+
+ case 8 :
+ for (x = xsize * 3; x > 0; x --, r0 ++, r1 ++)
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ cptr = ptr;
+ mptr = ptr + bandwidth;
+ yptr = ptr + 2 * bandwidth;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *cptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *mptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *yptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ switch (z)
+ {
+ case 0 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[0] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 1 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[1] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[2] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ r0 += z;
+ r1 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_CMYK()' - Convert image data to CMYK.
+ */
+
+static void
+format_CMYK(cups_page_header2_t *header,/* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ *kptr, /* Pointer into black */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+ int pc, pm, py; /* CMY pixels */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 4;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 128 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ {
+ bitmask >>= 3;
+ *ptr ^= bitmask;
+ }
+ else
+ {
+ if (pc)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (pm)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (py)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 128;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr ^= (0xc0 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0xc0 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[1]]);
+
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[2]]);
+
+ if ((r0[3] & 63) > dither[x & 7])
+ *ptr++ ^= (0x03 & OnPixels[r0[3]]);
+ else
+ *ptr++ ^= (0x03 & OffPixels[r0[3]]);
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[1]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[1]]);
+
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[2]]);
+
+ if ((r0[3] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[3]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[3]]);
+ }
+ break;
+
+ case 8 :
+ for (x = xsize * 4; x > 0; x --, r0 ++, r1 ++)
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ cptr = ptr;
+ mptr = ptr + bandwidth;
+ yptr = ptr + 2 * bandwidth;
+ kptr = ptr + 3 * bandwidth;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ *kptr ^= bitmask;
+ else
+ {
+ if (pc)
+ *cptr ^= bitmask;
+ if (pm)
+ *mptr ^= bitmask;
+ if (py)
+ *yptr ^= bitmask;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ if (r0[3] == r1[3])
+ *kptr++ = r0[3];
+ else
+ *kptr++ = (r0[3] * yerr0 + r1[3] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if ((pc && pm && py && z == 3) ||
+ (pc && z == 0) || (pm && z == 1) || (py && z == 2))
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ r0 += z;
+ r1 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_K()' - Convert image data to black.
+ */
+
+static void
+format_K(cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ (void)z;
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 ++, r1 ++)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_KCMY()' - Convert image data to KCMY.
+ */
+
+static void
+format_KCMY(cups_page_header2_t *header,/* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ *kptr, /* Pointer into black */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+ int pc, pm, py; /* CMY pixels */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 4;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 128 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ {
+ *ptr ^= bitmask;
+ bitmask >>= 3;
+ }
+ else
+ {
+ bitmask >>= 1;
+ if (pc)
+ *ptr ^= bitmask;
+
+ bitmask >>= 1;
+ if (pm)
+ *ptr ^= bitmask;
+
+ bitmask >>= 1;
+ if (py)
+ *ptr ^= bitmask;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 128;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[3] & 63) > dither[x & 7])
+ *ptr ^= (0xc0 & OnPixels[r0[3]]);
+ else
+ *ptr ^= (0xc0 & OffPixels[r0[3]]);
+
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[1]]);
+
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr++ ^= (0x03 & OnPixels[r0[2]]);
+ else
+ *ptr++ ^= (0x03 & OffPixels[r0[2]]);
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[3] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[3]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[3]]);
+
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[0]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[0]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[1]]);
+
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[2]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[2]]);
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (r0[3] == r1[3])
+ *ptr++ = r0[3];
+ else
+ *ptr++ = (r0[3] * yerr0 + r1[3] * yerr1) / ysize;
+
+ if (r0[0] == r1[0])
+ *ptr++ = r0[0];
+ else
+ *ptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *ptr++ = r0[1];
+ else
+ *ptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *ptr++ = r0[2];
+ else
+ *ptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ kptr = ptr;
+ cptr = ptr + bandwidth;
+ mptr = ptr + 2 * bandwidth;
+ yptr = ptr + 3 * bandwidth;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ *kptr ^= bitmask;
+ else
+ {
+ if (pc)
+ *cptr ^= bitmask;
+ if (pm)
+ *mptr ^= bitmask;
+ if (py)
+ *yptr ^= bitmask;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ if (r0[3] == r1[3])
+ *kptr++ = r0[3];
+ else
+ *kptr++ = (r0[3] * yerr0 + r1[3] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if ((pc && pm && py && z == 0) ||
+ (pc && z == 1) || (pm && z == 2) || (py && z == 3))
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ if (z == 0)
+ r0 += 3;
+ else
+ r0 += z - 1;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ if (z == 0)
+ r0 += 3;
+ else
+ r0 += z - 1;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ if (z == 0)
+ {
+ r0 += 3;
+ r1 += 3;
+ }
+ else
+ {
+ r0 += z - 1;
+ r1 += z - 1;
+ }
+
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_KCMYcm()' - Convert image data to KCMYcm.
+ */
+
+static void
+format_KCMYcm(
+ cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ int pc, pm, py, pk; /* Cyan, magenta, yellow, and black values */
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ *kptr, /* Pointer into black */
+ *lcptr, /* Pointer into light cyan */
+ *lmptr, /* Pointer into light magenta */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 6;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+ pk = pc && pm && py;
+
+ if (pk)
+ *ptr++ ^= 32; /* Black */
+ else if (pc && pm)
+ *ptr++ ^= 17; /* Blue (cyan + light magenta) */
+ else if (pc && py)
+ *ptr++ ^= 6; /* Green (light cyan + yellow) */
+ else if (pm && py)
+ *ptr++ ^= 12; /* Red (magenta + yellow) */
+ else if (pc)
+ *ptr++ ^= 16;
+ else if (pm)
+ *ptr++ ^= 8;
+ else if (py)
+ *ptr++ ^= 4;
+ else
+ ptr ++;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ kptr = ptr;
+ cptr = ptr + bandwidth;
+ mptr = ptr + 2 * bandwidth;
+ yptr = ptr + 3 * bandwidth;
+ lcptr = ptr + 4 * bandwidth;
+ lmptr = ptr + 5 * bandwidth;
+
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+ pk = pc && pm && py;
+
+ if (pk)
+ *kptr ^= bitmask; /* Black */
+ else if (pc && pm)
+ {
+ *cptr ^= bitmask; /* Blue (cyan + light magenta) */
+ *lmptr ^= bitmask;
+ }
+ else if (pc && py)
+ {
+ *lcptr ^= bitmask; /* Green (light cyan + yellow) */
+ *yptr ^= bitmask;
+ }
+ else if (pm && py)
+ {
+ *mptr ^= bitmask; /* Red (magenta + yellow) */
+ *yptr ^= bitmask;
+ }
+ else if (pc)
+ *cptr ^= bitmask;
+ else if (pm)
+ *mptr ^= bitmask;
+ else if (py)
+ *yptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ lcptr ++;
+ lmptr ++;
+ }
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+ pk = pc && pm && py;
+
+ if (pk && z == 0)
+ *ptr ^= bitmask;
+ else if (pc && pm && (z == 1 || z == 5))
+ *ptr ^= bitmask; /* Blue (cyan + light magenta) */
+ else if (pc && py && (z == 3 || z == 4))
+ *ptr ^= bitmask; /* Green (light cyan + yellow) */
+ else if (pm && py && (z == 2 || z == 3))
+ *ptr ^= bitmask; /* Red (magenta + yellow) */
+ else if (pc && z == 1)
+ *ptr ^= bitmask;
+ else if (pm && z == 2)
+ *ptr ^= bitmask;
+ else if (py && z == 3)
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_RGBA()' - Convert image data to RGBA/RGBW.
+ */
+
+static void
+format_RGBA(cups_page_header2_t *header,/* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 4;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 128 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 2)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 128;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr ^= (0xc0 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0xc0 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[1]]);
+
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[2]]);
+
+ ptr ++;
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[0]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[1]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[1]]);
+
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[2]]);
+
+ ptr ++;
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (r0[0] == r1[0])
+ *ptr++ = r0[0];
+ else
+ *ptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *ptr++ = r0[1];
+ else
+ *ptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *ptr++ = r0[2];
+ else
+ *ptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ ptr ++;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ cptr = ptr;
+ mptr = ptr + bandwidth;
+ yptr = ptr + 2 * bandwidth;
+
+ memset(ptr + 3 * bandwidth, 255, bandwidth);
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *cptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *mptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *yptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ if (z == 3)
+ {
+ memset(row, 255, header->cupsBytesPerLine);
+ break;
+ }
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ switch (z)
+ {
+ case 0 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[0] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 1 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[1] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[2] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ r0 += z;
+ r1 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_W()' - Convert image data to luminance.
+ */
+
+static void
+format_W(cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ (void)z;
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 ++, r1 ++)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_YMC()' - Convert image data to YMC.
+ */
+
+static void
+format_YMC(cups_page_header2_t *header, /* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 3;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 64 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if (r0[2] > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (r0[1] > dither[x & 15])
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (r0[0] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 64;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[2]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[1]]);
+
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr++ ^= (0x03 & OnPixels[r0[0]]);
+ else
+ *ptr++ ^= (0x03 & OffPixels[r0[0]]);
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 3)
+ {
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[2]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[2]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[1]]);
+
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[0]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[0]]);
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (r0[2] == r1[2])
+ *ptr++ = r0[2];
+ else
+ *ptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *ptr++ = r0[1];
+ else
+ *ptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[0] == r1[0])
+ *ptr++ = r0[0];
+ else
+ *ptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ yptr = ptr;
+ mptr = ptr + bandwidth;
+ cptr = ptr + 2 * bandwidth;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if (*r0++ > dither[x & 15])
+ *cptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *mptr ^= bitmask;
+ if (*r0++ > dither[x & 15])
+ *yptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ switch (z)
+ {
+ case 2 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[0] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 1 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[1] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 0 :
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if (r0[2] > dither[x & 15])
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ z = 2 - z;
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ z = 2 - z;
+ r0 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ z = 2 - z;
+ r0 += z;
+ r1 += z;
+
+ for (x = xsize; x > 0; x --, r0 += 3, r1 += 3)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'format_YMCK()' - Convert image data to YMCK.
+ */
+
+static void
+format_YMCK(cups_page_header2_t *header,/* I - Page header */
+ unsigned char *row, /* IO - Bitmap data for device */
+ int y, /* I - Current row */
+ int z, /* I - Current plane */
+ int xsize, /* I - Width of image data */
+ int ysize, /* I - Height of image data */
+ int yerr0, /* I - Top Y error */
+ int yerr1, /* I - Bottom Y error */
+ cups_ib_t *r0, /* I - Primary image data */
+ cups_ib_t *r1) /* I - Image data for interpolation */
+{
+ cups_ib_t *ptr, /* Pointer into row */
+ *cptr, /* Pointer into cyan */
+ *mptr, /* Pointer into magenta */
+ *yptr, /* Pointer into yellow */
+ *kptr, /* Pointer into black */
+ bitmask; /* Current mask for pixel */
+ int bitoffset; /* Current offset in line */
+ int bandwidth; /* Width of a color band */
+ int x, /* Current X coordinate on page */
+ *dither; /* Pointer into dither array */
+ int pc, pm, py; /* CMY pixels */
+
+
+ switch (XPosition)
+ {
+ case -1 :
+ bitoffset = 0;
+ break;
+ default :
+ bitoffset = header->cupsBitsPerPixel * ((header->cupsWidth - xsize) / 2);
+ break;
+ case 1 :
+ bitoffset = header->cupsBitsPerPixel * (header->cupsWidth - xsize);
+ break;
+ }
+
+ ptr = row + bitoffset / 8;
+ bandwidth = header->cupsBytesPerLine / 4;
+
+ switch (header->cupsColorOrder)
+ {
+ case CUPS_ORDER_CHUNKED :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 128 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize ; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ {
+ bitmask >>= 3;
+ *ptr ^= bitmask;
+ }
+ else
+ {
+ if (py)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (pm)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+
+ if (pc)
+ *ptr ^= bitmask;
+ bitmask >>= 1;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 128;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[2] & 63) > dither[x & 7])
+ *ptr ^= (0xc0 & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0xc0 & OffPixels[r0[2]]);
+
+ if ((r0[1] & 63) > dither[x & 7])
+ *ptr ^= (0x30 & OnPixels[r0[1]]);
+ else
+ *ptr ^= (0x30 & OffPixels[r0[1]]);
+
+ if ((r0[0] & 63) > dither[x & 7])
+ *ptr ^= (0x0c & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0x0c & OffPixels[r0[0]]);
+
+ if ((r0[3] & 63) > dither[x & 7])
+ *ptr++ ^= (0x03 & OnPixels[r0[3]]);
+ else
+ *ptr++ ^= (0x03 & OffPixels[r0[3]]);
+ }
+ break;
+
+ case 4 :
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize ; x > 0; x --, r0 += 4)
+ {
+ if ((r0[2] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[2]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[2]]);
+
+ if ((r0[1] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[1]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[1]]);
+
+ if ((r0[0] & 15) > dither[x & 3])
+ *ptr ^= (0xf0 & OnPixels[r0[0]]);
+ else
+ *ptr ^= (0xf0 & OffPixels[r0[0]]);
+
+ if ((r0[3] & 15) > dither[x & 3])
+ *ptr++ ^= (0x0f & OnPixels[r0[3]]);
+ else
+ *ptr++ ^= (0x0f & OffPixels[r0[3]]);
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (r0[2] == r1[2])
+ *ptr++ = r0[2];
+ else
+ *ptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *ptr++ = r0[1];
+ else
+ *ptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[0] == r1[0])
+ *ptr++ = r0[0];
+ else
+ *ptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[3] == r1[3])
+ *ptr++ = r0[3];
+ else
+ *ptr++ = (r0[3] * yerr0 + r1[3] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_BANDED :
+ yptr = ptr;
+ mptr = ptr + bandwidth;
+ cptr = ptr + 2 * bandwidth;
+ kptr = ptr + 3 * bandwidth;
+
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if (pc && pm && py)
+ *kptr ^= bitmask;
+ else
+ {
+ if (pc)
+ *cptr ^= bitmask;
+ if (pm)
+ *mptr ^= bitmask;
+ if (py)
+ *yptr ^= bitmask;
+ }
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 63) > dither[x & 7])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+
+ for (x = xsize; x > 0; x --)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *cptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *cptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *mptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *mptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *yptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *yptr ^= (bitmask & OffPixels[*r0++]);
+
+ if ((*r0 & 15) > dither[x & 3])
+ *kptr ^= (bitmask & OnPixels[*r0++]);
+ else
+ *kptr ^= (bitmask & OffPixels[*r0++]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ cptr ++;
+ mptr ++;
+ yptr ++;
+ kptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (r0[0] == r1[0])
+ *cptr++ = r0[0];
+ else
+ *cptr++ = (r0[0] * yerr0 + r1[0] * yerr1) / ysize;
+
+ if (r0[1] == r1[1])
+ *mptr++ = r0[1];
+ else
+ *mptr++ = (r0[1] * yerr0 + r1[1] * yerr1) / ysize;
+
+ if (r0[2] == r1[2])
+ *yptr++ = r0[2];
+ else
+ *yptr++ = (r0[2] * yerr0 + r1[2] * yerr1) / ysize;
+
+ if (r0[3] == r1[3])
+ *kptr++ = r0[3];
+ else
+ *kptr++ = (r0[3] * yerr0 + r1[3] * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+
+ case CUPS_ORDER_PLANAR :
+ switch (header->cupsBitsPerColor)
+ {
+ case 1 :
+ bitmask = 0x80 >> (bitoffset & 7);
+ dither = Floyd16x16[y & 15];
+
+ for (x = xsize; x > 0; x --)
+ {
+ pc = *r0++ > dither[x & 15];
+ pm = *r0++ > dither[x & 15];
+ py = *r0++ > dither[x & 15];
+
+ if ((pc && pm && py && z == 3) ||
+ (pc && z == 2) || (pm && z == 1) || (py && z == 0))
+ *ptr ^= bitmask;
+
+ if (bitmask > 1)
+ bitmask >>= 1;
+ else
+ {
+ bitmask = 0x80;
+ ptr ++;
+ }
+ }
+ break;
+
+ case 2 :
+ bitmask = 0xc0 >> (bitoffset & 7);
+ dither = Floyd8x8[y & 7];
+ if (z == 3)
+ r0 += 3;
+ else
+ r0 += 2 - z;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 63) > dither[x & 7])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask > 3)
+ bitmask >>= 2;
+ else
+ {
+ bitmask = 0xc0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 4 :
+ bitmask = 0xf0 >> (bitoffset & 7);
+ dither = Floyd4x4[y & 3];
+ if (z == 3)
+ r0 += 3;
+ else
+ r0 += 2 - z;
+
+ for (x = xsize; x > 0; x --, r0 += 4)
+ {
+ if ((*r0 & 15) > dither[x & 3])
+ *ptr ^= (bitmask & OnPixels[*r0]);
+ else
+ *ptr ^= (bitmask & OffPixels[*r0]);
+
+ if (bitmask == 0xf0)
+ bitmask = 0x0f;
+ else
+ {
+ bitmask = 0xf0;
+
+ ptr ++;
+ }
+ }
+ break;
+
+ case 8 :
+ if (z == 3)
+ {
+ r0 += 3;
+ r1 += 3;
+ }
+ else
+ {
+ r0 += 2 - z;
+ r1 += 2 - z;
+ }
+
+ for (x = xsize; x > 0; x --, r0 += 4, r1 += 4)
+ {
+ if (*r0 == *r1)
+ *ptr++ = *r0;
+ else
+ *ptr++ = (*r0 * yerr0 + *r1 * yerr1) / ysize;
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+/*
+ * 'make_lut()' - Make a lookup table given gamma and brightness values.
+ */
+
+static void
+make_lut(cups_ib_t *lut, /* I - Lookup table */
+ int colorspace, /* I - Colorspace */
+ float g, /* I - Image gamma */
+ float b) /* I - Image brightness */
+{
+ int i; /* Looping var */
+ int v; /* Current value */
+
+
+ g = 1.0 / g;
+ b = 1.0 / b;
+
+ for (i = 0; i < 256; i ++)
+ {
+ if (colorspace < 0)
+ v = 255.0 * b * (1.0 - pow(1.0 - (float)i / 255.0, g)) + 0.5;
+ else
+ v = 255.0 * (1.0 - b * (1.0 - pow((float)i / 255.0, g))) + 0.5;
+
+ if (v < 0)
+ *lut++ = 0;
+ else if (v > 255)
+ *lut++ = 255;
+ else
+ *lut++ = v;
+ }
+}
+
+
+/*
+ * 'raster_cb()' - Validate the page header.
+ */
+
+static int /* O - 0 if OK, -1 if not */
+raster_cb(
+ cups_page_header2_t *header, /* IO - Raster header */
+ int preferred_bits) /* I - Preferred bits per color */
+{
+ /*
+ * Ensure that colorimetric colorspaces use at least 8 bits per
+ * component...
+ */
+
+ if ((header->cupsColorSpace == CUPS_CSPACE_CIEXYZ ||
+ header->cupsColorSpace == CUPS_CSPACE_CIELab ||
+ header->cupsColorSpace >= CUPS_CSPACE_ICC1) &&
+ header->cupsBitsPerColor < 8)
+ header->cupsBitsPerColor = 8;
+
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common PCL functions for CUPS.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * pcl_set_media_size() - Set media size using the page size command.
+ * pjl_write() - Write a PJL command string, performing
+ * substitutions as needed.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cupsfilters/driver.h>
+#include "pcl-common.h"
+#include <math.h>
+
+
+/*
+ * 'pcl_set_media_size()' - Set media size using the page size command.
+ */
+
+void
+pcl_set_media_size(ppd_file_t *ppd, /* I - PPD file */
+ float width, /* I - Width of page */
+ float length) /* I - Length of page */
+{
+ (void)width;
+
+ printf("\033&l0O"); /* Set portrait orientation */
+
+ if (ppd->model_number & PCL_PAPER_SIZE)
+ switch ((int)(length + 0.5f))
+ {
+ case 419 : /* Postcard */
+ printf("\033&l71A"); /* Set page size */
+ break;
+
+ case 540 : /* Monarch Envelope */
+ printf("\033&l80A"); /* Set page size */
+ break;
+
+ case 567 : /* Double Postcard */
+ printf("\033&l72A"); /* Set page size */
+ break;
+
+ case 595 : /* A5 */
+ printf("\033&l25A"); /* Set page size */
+ break;
+
+ case 612 : /* Statement */
+ printf("\033&l5A"); /* Set page size */
+ break;
+
+ case 624 : /* DL Envelope */
+ printf("\033&l90A"); /* Set page size */
+ break;
+
+ case 649 : /* C5 Envelope */
+ printf("\033&l91A"); /* Set page size */
+ break;
+
+ case 684 : /* COM-10 Envelope */
+ printf("\033&l81A"); /* Set page size */
+ break;
+
+ case 709 : /* B5 Envelope */
+ printf("\033&l100A"); /* Set page size */
+ break;
+
+ case 729 : /* B5 */
+ printf("\033&l45A"); /* Set page size */
+ break;
+
+ case 756 : /* Executive */
+ printf("\033&l1A"); /* Set page size */
+ break;
+
+ case 792 : /* Letter */
+ printf("\033&l2A"); /* Set page size */
+ break;
+
+ case 842 : /* A4 */
+ printf("\033&l26A"); /* Set page size */
+ break;
+
+ case 936 : /* Foolscap */
+ printf("\033&l23A"); /* Set page size */
+ break;
+
+ case 1008 : /* Legal */
+ printf("\033&l3A"); /* Set page size */
+ break;
+
+ case 1032 : /* B4 */
+ printf("\033&l46A"); /* Set page size */
+ break;
+
+ case 1191 : /* A3 */
+ printf("\033&l27A"); /* Set page size */
+ break;
+
+ case 1224 : /* Tabloid */
+ printf("\033&l6A"); /* Set page size */
+ break;
+
+ default :
+ printf("\033&l101A"); /* Set page size */
+ printf("\033&l6D\033&k12H"); /* Set 6 LPI, 10 CPI */
+ printf("\033&l%.2fP", length / 12.0);
+ /* Set page length */
+ printf("\033&l%.0fF", length / 12.0);
+ /* Set text length to page */
+ break;
+ }
+ else
+ {
+ printf("\033&l6D\033&k12H"); /* Set 6 LPI, 10 CPI */
+ printf("\033&l%.2fP", length / 12.0);
+ /* Set page length */
+ printf("\033&l%.0fF", length / 12.0);
+ /* Set text length to page */
+ }
+
+ printf("\033&l0L"); /* Turn off perforation skip */
+ printf("\033&l0E"); /* Reset top margin to 0 */
+}
+
+
+/*
+ * 'pjl_write()' - Write a PJL command string, performing substitutions as needed.
+ */
+
+void
+pjl_write(ppd_file_t *ppd, /* I - PPD file */
+ const char *format, /* I - Format string */
+ const char *value, /* I - Value for %s */
+ int job_id, /* I - Job ID */
+ const char *user, /* I - Username */
+ const char *title, /* I - Title */
+ int num_options, /* I - Number of options */
+ cups_option_t *options) /* I - Options */
+{
+ const char *optval; /* Option value */
+ char match[255], /* Match string */
+ *mptr; /* Pointer into match string */
+
+
+ if (!format)
+ return;
+
+ while (*format)
+ {
+ if (*format == '%')
+ {
+ /*
+ * Perform substitution...
+ */
+
+ format ++;
+ switch (*format)
+ {
+ case 'b' : /* job-billing */
+ if ((optval = cupsGetOption("job-billing", num_options,
+ options)) != NULL)
+ fputs(optval, stdout);
+ break;
+
+ case 'h' : /* job-originating-host-name */
+ if ((optval = cupsGetOption("job-originating-host-name",
+ num_options, options)) != NULL)
+ fputs(optval, stdout);
+ break;
+
+ case 'j' : /* job-id */
+ printf("%d", job_id);
+ break;
+
+ case 'n' : /* CR + LF */
+ putchar('\r');
+ putchar('\n');
+ break;
+
+ case 'q' : /* double quote (") */
+ putchar('\"');
+ break;
+
+ case 's' : /* "value" */
+ if (value)
+ fputs(value, stdout);
+ break;
+
+ case 't' : /* job-name */
+ fputs(title, stdout);
+ break;
+
+ case 'u' : /* job-originating-user-name */
+ fputs(user, stdout);
+ break;
+
+ case '?' : /* ?value:string; */
+ /*
+ * Get the match value...
+ */
+
+ for (format ++, mptr = match; *format && *format != ':'; format ++)
+ if (mptr < (match + sizeof(match) - 1))
+ *mptr++ = *format;
+
+ if (!*format)
+ return;
+
+ /*
+ * See if we have a match...
+ */
+
+ format ++;
+ *mptr = '\0';
+
+ if (!value || strcmp(match, value))
+ {
+ /*
+ * Value doesn't match; skip the string that follows...
+ */
+
+ while (*format && *format != ';')
+ format ++;
+ }
+ else
+ {
+ /*
+ * Value matches; copy the string that follows...
+ */
+
+ while (*format && *format != ';')
+ putchar(*format++);
+ }
+
+ if (!*format)
+ return;
+ break;
+
+ default : /* Anything else */
+ putchar('%');
+ case '%' : /* %% = single % */
+ putchar(*format);
+ break;
+ }
+ }
+ else
+ putchar(*format);
+
+ format ++;
+ }
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common HP-PCL definitions for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <string.h>
+#include <ctype.h>
+#include "pcl.h"
+
+
+/*
+ * Functions/macros...
+ */
+
+#define pcl_reset()\
+ printf("\033E")
+#define pcl_set_copies(copies)\
+ printf("\033&l%dX", (copies))
+#define pcl_set_pcl_mode(m)\
+ printf("\033%%%dA", (m))
+#define pcl_set_hpgl_mode(m)\
+ printf("\033%%%dB", (m))
+#define pcl_set_negative_motion()\
+ printf("\033&a1N")
+#define pcl_set_media_source(source)\
+ printf("\033&l%dH", source)
+#define pcl_set_media_type(type)\
+ printf("\033&l%dM", type)
+#define pcl_set_duplex(duplex,landscape)\
+ if (duplex) printf("\033&l%dS", (duplex) + (landscape))
+#define pcl_set_simple_black()\
+ printf("\033*r-1U")
+#define pcl_set_simple_color()\
+ printf("\033*r3U")
+#define pcl_set_simple_cmy()\
+ printf("\033*r-3U")
+#define pcl_set_simple_kcmy()\
+ printf("\033*r-4U")
+#define pcl_set_simple_resolution(r)\
+ printf("\033*t%dR", (r))
+
+#define pjl_escape()\
+ printf("\033%%-12345X@PJL\r\n")
+#define pjl_set_job(job_id,user,title)\
+ printf("@PJL JOB NAME = \"%s\" DISPLAY = \"%d %s %s\"\r\n", \
+ (title), (job_id), (user), (title))
+#define pjl_enter_language(lang)\
+ printf("@PJL ENTER LANGUAGE=%s\r\n", (lang))
+
+extern void pcl_set_media_size(ppd_file_t *ppd, float width, float length);
+extern void pjl_write(ppd_file_t *ppd, const char *format,
+ const char *value, int job_id,
+ const char *user, const char *title,
+ int num_options, cups_option_t *options);
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * This file contains model number definitions for the CUPS unified
+ * PCL driver.
+ *
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1997-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+/* General PCL Support */
+#define PCL_PAPER_SIZE 0x1 /* Use ESC&l#A */
+#define PCL_INKJET 0x2 /* Use inkjet commands */
+
+/* Raster Support */
+#define PCL_RASTER_END_COLOR 0x100 /* Use ESC*rC */
+#define PCL_RASTER_CID 0x200 /* Use ESC*v#W */
+#define PCL_RASTER_CRD 0x400 /* Use ESC*g#W */
+#define PCL_RASTER_SIMPLE 0x800 /* Use ESC*r#U */
+#define PCL_RASTER_RGB24 0x1000 /* Use 24-bit RGB mode */
+
+/* PJL Support */
+#define PCL_PJL 0x10000 /* Use PJL Commands */
+#define PCL_PJL_PAPERWIDTH 0x20000 /* Use PJL PAPERWIDTH/LENGTH */
+#define PCL_PJL_HPGL2 0x40000 /* Enter HPGL2 */
+#define PCL_PJL_PCL3GUI 0x80000 /* Enter PCL3GUI */
+#define PCL_PJL_RESOLUTION 0x100000 /* Use PJL SET RESOLUTION */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+Copyright (c) 2008, BBR Inc. All rights reserved.
+ (c) 2008 Tobias Hoffmann
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/*
+ pdftoijs.cc
+ pdf to ijs filter
+*/
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include <goo/GooString.h>
+#include <goo/gmem.h>
+#include <Object.h>
+#include <Stream.h>
+#include <PDFDoc.h>
+#include <SplashOutputDev.h>
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <stdarg.h>
+#include "PDFError.h"
+#include <GlobalParams.h>
+#include <splash/SplashTypes.h>
+#include <splash/SplashBitmap.h>
+extern "C" {
+#include <ijs/ijs.h>
+#include <ijs/ijs_client.h>
+}
+#include <vector>
+#include <string>
+
+#define MAX_CHECK_COMMENT_LINES 20
+
+namespace {
+ int exitCode = 0;
+ char *outputfile = NULL;
+// int deviceCopies = 1;
+// bool deviceCollate = false;
+ const char *ijsserver = NULL;
+ int resolution[2] = {0,0};
+ enum ColEnum { NONE=-1, COL_RGB, COL_CMYK, COL_BLACK1, COL_WHITE1, COL_BLACK8, COL_WHITE8 } colspace=NONE;
+ const char *devManu=NULL, *devModel=NULL;
+ std::vector<std::pair<std::string,std::string> > params;
+
+ ppd_file_t *ppd = 0; // holds the memory for the strings
+}
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+void CDECL myErrorFun(void *data, ErrorCategory category,
+ int pos, char *msg)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ fprintf(stderr, "%s\n",msg);
+ fflush(stderr);
+}
+#else
+void CDECL myErrorFun(int pos, char *msg, va_list args)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ vfprintf(stderr, msg, args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+}
+#endif
+
+/* parse "300 400" */
+void parse_resolution(const char *str)
+{
+ const char *tmp=strchr(str,' ');
+ if (tmp) {
+ resolution[0]=atoi(str);
+ resolution[1]=atoi(tmp+1);
+ } else {
+ resolution[0]=resolution[1]=atoi(str);
+ }
+}
+
+/* parse "cmyk" "grey" "rgb" */
+void parse_colorspace(const char *str)
+{
+ if (strcasecmp(str,"rgb")==0) {
+ colspace=COL_RGB;
+ } else if (strcasecmp(str,"black1")==0) {
+ colspace=COL_BLACK1;
+ } else if (strcasecmp(str,"white1")==0) {
+ colspace=COL_WHITE1;
+ } else if (strcasecmp(str,"black8")==0) {
+ colspace=COL_BLACK8;
+ } else if (strcasecmp(str,"white8")==0) {
+ colspace=COL_WHITE8;
+#ifdef SPLASH_CMYK
+ } else if (strcasecmp(str,"cmyk")==0) {
+ colspace=COL_CMYK;
+ } else {
+ pdfError(-1,"Unknown colorspace; supported are 'rgb', 'cmyk', 'white1', 'black1', 'white8', 'black8'");
+#else
+ } else {
+ pdfError(-1,"Unknown colorspace; supported are 'rgb', 'white1', 'black1', 'white8', 'black8'");
+#endif
+ exit(1);
+ }
+}
+
+std::string str_trim(const char *str,int len)
+{
+ int start=strspn(str," \r\n\t");
+ for (len--;len>=0;len--) {
+ if (!strchr(" \r\n\t",str[len])) {
+ break;
+ }
+ }
+ len++;
+ if (start>=len) {
+ return std::string();
+ }
+ return std::string(str+start,len-start);
+}
+
+/* parse key=value */
+void parse_param(const char *str)
+{
+ const char *eq=strchr(str,'=');
+ if (!eq) {
+ fprintf(stderr, "WARNING: ignored ijsParam without '='");
+ return;
+ }
+ params.push_back(make_pair(str_trim(str,eq-str),str_trim(eq+1,strlen(eq+1))));
+}
+
+/* parse key1=value1,key2=value2,... */
+void parse_paramlist(const char *str)
+{
+ std::string tmp;
+ const char *cur=str;
+ while (*cur) {
+ tmp.clear();
+ for (;*cur;++cur) {
+ if ( (*cur=='\\')&&(cur[1]) ) {
+ ++cur;
+ tmp.push_back(*cur);
+ } else if(*cur==',') {
+ ++cur;
+ break;
+ } else {
+ tmp.push_back(*cur);
+ }
+ }
+ parse_param(tmp.c_str());
+ }
+}
+
+void parseOpts(int argc, char **argv)
+{
+ int num_options = 0;
+ cups_option_t *options = 0;
+
+ if (argc < 6 || argc > 7) {
+ pdfError(-1,"%s job-id user title copies options [file]",
+ argv[0]);
+ exit(1);
+ }
+
+ assert(!ppd);
+ ppd = ppdOpenFile(getenv("PPD"));
+ ppdMarkDefaults(ppd);
+
+ // handle *ijsServer, *ijsManufacturer, *ijsModel, *ijsColorspace
+ ppd_attr_t *attr;
+ if ((attr = ppdFindAttr(ppd,"ijsServer",0)) != 0) {
+ ijsserver=attr->value;
+ }
+ if ((attr = ppdFindAttr(ppd,"ijsManufacturer",0)) != 0) {
+ devManu=attr->value;
+ }
+ if ((attr = ppdFindAttr(ppd,"ijsModel",0)) != 0) {
+ devModel=attr->value;
+ }
+ if ((attr = ppdFindAttr(ppd,"ijsColorspace",0)) != 0) {
+ parse_colorspace(attr->value);
+ }
+ if ( (!ijsserver)||(!devManu)||(!devModel)||(colspace==NONE) ) {
+ pdfError(-1,"ijsServer, ijsManufacturer, ijsModel and ijsColorspace must be specified in the PPD");
+ exit(1);
+ }
+
+ options = NULL;
+
+ num_options = cupsParseOptions(argv[5],0,&options);
+// cupsMarkOptions(ppd,num_options,options); // TODO? returns 1 on conflict
+ // handle *ijsResolution, *ijsParam here
+ char spec[PPD_MAX_NAME];
+ for (int iA=0;iA<num_options;iA++) {
+ snprintf(spec,PPD_MAX_NAME,"%s=%s",options[iA].name,options[iA].value);
+ if ((attr = ppdFindAttr(ppd,"ijsResolution",spec)) != 0) {
+ parse_resolution(attr->value);
+ }
+ if ((attr = ppdFindAttr(ppd,"ijsParams",spec)) != 0) {
+ parse_paramlist(attr->value);
+ }
+ if (strcmp(options[iA].name,"ijsOutputFile")==0) {
+ outputfile=strdup(options[iA].value);
+ }
+ }
+ if (!resolution[0]) {
+ pdfError(-1,"ijsResolution must be specified");
+ exit(1);
+ }
+ cupsFreeOptions(num_options,options);
+}
+
+#if 0
+void parsePDFTOPDFComment(FILE *fp)
+{
+ char buf[4096];
+ int i;
+
+ /* skip until PDF start header */
+ while (fgets(buf,sizeof(buf),fp) != 0) {
+ if (strncmp(buf,"%PDF",4) == 0) {
+ break;
+ }
+ }
+ for (i = 0;i < MAX_CHECK_COMMENT_LINES;i++) {
+ if (fgets(buf,sizeof(buf),fp) == 0) break;
+ if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) {
+ char *p;
+
+ p = strchr(buf+19,':');
+ deviceCopies = atoi(p+1);
+ } else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
+ char *p;
+
+ p = strchr(buf+17,':');
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ deviceCollate = true;
+ } else {
+ deviceCollate = false;
+ }
+ }
+ }
+}
+#endif
+
+int main(int argc, char *argv[]) {
+ PDFDoc *doc;
+ SplashOutputDev *out;
+ SplashColor paperColor;
+ int i;
+ int npages;
+ IjsClientCtx *ctx=NULL;
+ int job_id;
+ enum SplashColorMode cmode;
+ int rowpad;
+ GBool reverseVideo;
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ setErrorCallback(::myErrorFun,NULL);
+#else
+ setErrorFunction(::myErrorFun);
+#endif
+ globalParams = new GlobalParams();
+ parseOpts(argc, argv);
+
+ if (argc == 6) {
+ /* stdin */
+ int fd;
+ Object obj;
+ BaseStream *str;
+ FILE *fp;
+ char buf[BUFSIZ];
+ int n;
+
+ fd = cupsTempFd(buf,sizeof(buf));
+ if (fd < 0) {
+ pdfError(-1,"Can't create temporary file");
+ exit(1);
+ }
+ /* remove name */
+ unlink(buf);
+
+ /* copy stdin to the tmp file */
+ while ((n = read(0,buf,BUFSIZ)) > 0) {
+ if (write(fd,buf,n) != n) {
+ pdfError(-1,"Can't copy stdin to temporary file");
+ close(fd);
+ exit(1);
+ }
+ }
+ if (lseek(fd,0,SEEK_SET) < 0) {
+ pdfError(-1,"Can't rewind temporary file");
+ close(fd);
+ exit(1);
+ }
+
+ if ((fp = fdopen(fd,"rb")) == 0) {
+ pdfError(-1,"Can't fdopen temporary file");
+ close(fd);
+ exit(1);
+ }
+
+ obj.initNull();
+// parsePDFTOPDFComment(fp); // TODO?
+ rewind(fp);
+ str = new FileStream(fp,0,gFalse,0,&obj);
+ doc = new PDFDoc(str);
+ } else {
+ GooString *fileName = new GooString(argv[6]);
+ /* argc == 7 filenmae is specified */
+ FILE *fp;
+
+ if ((fp = fopen(argv[6],"rb")) == 0) {
+ pdfError(-1,"Can't open input file %s",argv[6]);
+ exit(1);
+ }
+// parsePDFTOPDFComment(fp); // TODO?
+ fclose(fp);
+ doc = new PDFDoc(fileName,NULL,NULL);
+ }
+
+ if (!doc->isOk()) {
+ exitCode = 1;
+ goto err1;
+ }
+
+ char tmp[100];
+ tmp[99]=0;
+ // ... OutputFD=stdout .. needs to be done before forking
+ int outfd;
+ outfd=dup(fileno(stdout));
+
+#if 0
+ /* fix NumCopies, Collate ccording to PDFTOPDFComments */
+ header.NumCopies = deviceCopies;
+ header.Collate = deviceCollate ? CUPS_TRUE : CUPS_FALSE;
+ /* fixed other values that pdftopdf handles */
+ header.MirrorPrint = CUPS_FALSE;
+ header.Orientation = CUPS_ORIENT_0;
+#endif
+
+ job_id=atoi(argv[1]);
+ ctx = ijs_invoke_server (ijsserver);
+ ijs_client_open (ctx);
+ ijs_client_begin_job (ctx,job_id);
+ if (outputfile) {
+ ijs_client_set_param(ctx,job_id,"OutputFile",outputfile,strlen(outputfile));
+ } else {
+ snprintf(tmp,99,"%d",outfd);
+ ijs_client_set_param(ctx,job_id,"OutputFD",tmp,strlen(tmp));
+ close(outfd);
+ }
+ ijs_client_set_param(ctx,job_id,"DeviceManufacturer",devManu,strlen(devManu));
+ ijs_client_set_param(ctx,job_id,"DeviceModel",devModel,strlen(devModel));
+ // TODO: get supported output-formats from ijs-server, overriding PPD
+
+ /* set image's values */
+ int numChan,bitsPerSample;
+ const char *devName;
+ reverseVideo = gFalse;
+ switch (colspace) {
+ case COL_RGB:
+ numChan=3;
+ bitsPerSample=8;
+ cmode = splashModeRGB8;
+ devName = "DeviceRGB";
+ rowpad = 3;
+ /* set paper color white */
+ paperColor[0] = 255;
+ paperColor[1] = 255;
+ paperColor[2] = 255;
+ break;
+ case COL_BLACK1:
+ reverseVideo = gTrue;
+ case COL_WHITE1:
+ numChan=1;
+ bitsPerSample=1;
+ cmode = splashModeMono1;
+ devName = "DeviceGray";
+ /* set paper color white */
+ paperColor[0] = 255;
+ rowpad = 1;
+ break;
+ case COL_BLACK8:
+ reverseVideo = gTrue;
+ case COL_WHITE8:
+ numChan=1;
+ bitsPerSample=8;
+ cmode = splashModeMono8;
+ devName = "DeviceGray";
+ /* set paper color white */
+ paperColor[0] = 255;
+ rowpad = 1;
+ break;
+#ifdef SPLASH_CMYK
+ case COL_CMYK:
+ numChan=4;
+ bitsPerSample=8;
+ cmode = splashModeCMYK8;
+ devName = "DeviceCMYK";
+ /* set paper color white */
+ paperColor[0] = 0;
+ paperColor[1] = 0;
+ paperColor[2] = 0;
+ paperColor[3] = 0;
+ rowpad = 4;
+ break;
+#endif
+ default:
+ pdfError(-1,"Specified ColorSpace is not supported");
+ exit(1);
+ break;
+ }
+
+ out = new SplashOutputDev(cmode,rowpad/* row padding */,
+ reverseVideo,paperColor,gTrue,gFalse);
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ out->startDoc(doc);
+#else
+ out->startDoc(doc->getXRef());
+#endif
+
+ snprintf(tmp,99,"%d",numChan);
+ ijs_client_set_param(ctx,job_id,"NumChan",tmp,strlen(tmp));
+ snprintf(tmp,99,"%d",bitsPerSample);
+ ijs_client_set_param(ctx,job_id,"BitsPerSample",tmp,strlen(tmp));
+ ijs_client_set_param(ctx,job_id,"ColorSpace",devName,strlen(devName));
+ snprintf(tmp,99,"%dx%d",resolution[0],resolution[1]);
+ ijs_client_set_param(ctx,job_id,"Dpi",tmp,strlen(tmp));
+
+ { // set the custom ijs parameters
+ const int plen=params.size();
+ for (i=0;i<plen;i++) {
+ ijs_client_set_param(ctx,job_id,params[i].first.c_str(),params[i].second.c_str(),params[i].second.size());
+ }
+ }
+
+ npages = doc->getNumPages();
+ for (i = 1;i <= npages;i++) {
+ SplashBitmap *bitmap;
+ unsigned int size;
+
+ doc->displayPage(out,i,resolution[0],resolution[1],0,gFalse,gFalse,gFalse);
+ bitmap = out->getBitmap();
+
+ /* set page parameters */
+ snprintf(tmp,99,"%d",bitmap->getWidth());
+ ijs_client_set_param(ctx,job_id,"Width",tmp,strlen(tmp));
+ snprintf(tmp,99,"%d",bitmap->getHeight());
+ ijs_client_set_param(ctx,job_id,"Height",tmp,strlen(tmp));
+ ijs_client_begin_page(ctx,job_id);
+
+ /* write page image */
+ size = bitmap->getRowSize()*bitmap->getHeight();
+ int status=ijs_client_send_data_wait(ctx,job_id,(const char *)bitmap->getDataPtr(),size);
+ if (status) {
+ pdfError(-1,"Can't write page %d image: %d",i,status);
+ exit(1);
+ }
+
+ status=ijs_client_end_page(ctx,job_id);
+ if (status) {
+ pdfError(-1,"Can't finish page %d: %d",i,status);
+ exit(1);
+ }
+ }
+ ijs_client_end_job (ctx, job_id);
+ ijs_client_close (ctx);
+
+ ijs_client_begin_cmd (ctx, IJS_CMD_EXIT);
+ ijs_client_send_cmd_wait (ctx);
+
+ delete out;
+err1:
+ delete doc;
+ ppdClose(ppd);
+ free(outputfile);
+
+ // Check for memory leaks
+ Object::memCheck(stderr);
+ gMemReport(stderr);
+
+ return exitCode;
+}
+
+/* replace memory allocation methods for memory check */
+
+void * operator new(size_t size) throw (std::bad_alloc)
+{
+ return gmalloc(size);
+}
+
+void operator delete(void *p) throw ()
+{
+ gfree(p);
+}
+
+void * operator new[](size_t size) throw (std::bad_alloc)
+{
+ return gmalloc(size);
+}
+
+void operator delete[](void *p) throw ()
+{
+ gfree(p);
+}
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<!-- conf.d/pdftoopvp.fconf -->
+<fontconfig>
+<!-- Symbol and ZapfDingbats -->
+ <alias>
+ <family>ZapfDingbats</family>
+ <prefer>
+ <family>Dingbats</family>
+ </prefer>
+ </alias>
+ <alias>
+ <family>Symbol</family>
+ <prefer>
+ <family>Standard Symbols L</family>
+ </prefer>
+ </alias>
+</fontconfig>
--- /dev/null
+/*
+
+Copyright (c) 2012, BBR Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/*
+ OPVPError.h
+*/
+#ifndef _OPVPERROR_H_
+#define _OPVPERROR_H_
+
+#include <config.h>
+#include <stdarg.h>
+#include <Error.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+#define opvpError(pos,...) error(errInternal,pos,__VA_ARGS__)
+#else
+#define opvpError(pos,...) error(pos,__VA_ARGS__)
+#endif
+
+#endif
--- /dev/null
+//
+// OPVPOutputDev.cc
+// Based SplashOutputDev.cc : Copyright 2003 Glyph & Cog, LLC
+//
+// Copyright 2005 AXE,Inc.
+//
+// 2007,2008 Modified by BBR Inc.
+//========================================================================
+
+#include <config.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <string.h>
+#include <math.h>
+#include "goo/gfile.h"
+#include "GlobalParams.h"
+#include "OPVPError.h"
+#include "Object.h"
+#include "GfxState.h"
+#include "GfxFont.h"
+#include "Link.h"
+#include "CharCodeToUnicode.h"
+#include "FontEncodingTables.h"
+#include "fofi/FoFiTrueType.h"
+#include "splash/SplashMath.h"
+#include "CMap.h"
+#include "splash/SplashBitmap.h"
+#include "splash/SplashGlyphBitmap.h"
+#include "splash/SplashPattern.h"
+#include "splash/SplashScreen.h"
+#include "splash/SplashErrorCodes.h"
+#include "splash/SplashFontEngine.h"
+#include "splash/SplashFont.h"
+#include "splash/SplashFontFile.h"
+#include "splash/SplashFontFileID.h"
+#include "OPVPSplashPath.h"
+#include "OPVPSplashState.h"
+#include "OPRS.h"
+#include "OPVPOutputDev.h"
+
+#define SLICE_FOR_PATTERN 1000
+
+//------------------------------------------------------------------------
+// Font substitutions
+//------------------------------------------------------------------------
+
+struct SplashOutFontSubst {
+ char *name;
+ double mWidth;
+};
+
+//------------------------------------------------------------------------
+
+#define soutRound(x) ((int)(x + 0.5))
+
+//------------------------------------------------------------------------
+// SplashOutFontFileID
+//------------------------------------------------------------------------
+
+class SplashOutFontFileID: public SplashFontFileID {
+public:
+
+ SplashOutFontFileID(Ref *rA) { r = *rA; substIdx = -1; }
+
+ ~SplashOutFontFileID() {}
+
+ GBool matches(SplashFontFileID *id) {
+ return ((SplashOutFontFileID *)id)->r.num == r.num &&
+ ((SplashOutFontFileID *)id)->r.gen == r.gen;
+ }
+
+ void setSubstIdx(int substIdxA) { substIdx = substIdxA; }
+ int getSubstIdx() { return substIdx; }
+
+private:
+
+ Ref r;
+ int substIdx;
+};
+
+//------------------------------------------------------------------------
+// T3FontCache
+//------------------------------------------------------------------------
+
+struct T3FontCacheTag {
+ Gushort code;
+ Gushort mru; // valid bit (0x8000) and MRU index
+};
+
+class T3FontCache {
+public:
+
+ T3FontCache(Ref *fontID, double m11A, double m12A,
+ double m21A, double m22A,
+ int glyphXA, int glyphYA, int glyphWA, int glyphHA,
+ GBool aa);
+ ~T3FontCache();
+ GBool matches(Ref *idA, double m11A, double m12A,
+ double m21A, double m22A)
+ { return fontID.num == idA->num && fontID.gen == idA->gen &&
+ m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; }
+
+ Ref fontID; // PDF font ID
+ double m11, m12, m21, m22; // transform matrix
+ int glyphX, glyphY; // pixel offset of glyph bitmaps
+ int glyphW, glyphH; // size of glyph bitmaps, in pixels
+ int glyphSize; // size of glyph bitmaps, in bytes
+ int cacheSets; // number of sets in cache
+ int cacheAssoc; // cache associativity (glyphs per set)
+ Guchar *cacheData; // glyph pixmap cache
+ T3FontCacheTag *cacheTags; // cache tags, i.e., char codes
+};
+
+T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A,
+ double m21A, double m22A,
+ int glyphXA, int glyphYA, int glyphWA, int glyphHA,
+ GBool aa) {
+ int i;
+
+ fontID = *fontIDA;
+ m11 = m11A;
+ m12 = m12A;
+ m21 = m21A;
+ m22 = m22A;
+ glyphX = glyphXA;
+ glyphY = glyphYA;
+ glyphW = glyphWA;
+ glyphH = glyphHA;
+ if (aa) {
+ glyphSize = glyphW * glyphH;
+ } else {
+ glyphSize = ((glyphW + 7) >> 3) * glyphH;
+ }
+ cacheAssoc = 8;
+ if (glyphSize <= 256) {
+ cacheSets = 8;
+ } else if (glyphSize <= 512) {
+ cacheSets = 4;
+ } else if (glyphSize <= 1024) {
+ cacheSets = 2;
+ } else {
+ cacheSets = 1;
+ }
+ cacheData = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
+ cacheTags = (T3FontCacheTag *)gmalloc(cacheSets * cacheAssoc *
+ sizeof(T3FontCacheTag));
+ for (i = 0; i < cacheSets * cacheAssoc; ++i) {
+ cacheTags[i].mru = i & (cacheAssoc - 1);
+ }
+}
+
+T3FontCache::~T3FontCache() {
+ gfree(cacheData);
+ gfree(cacheTags);
+}
+
+struct T3GlyphStack {
+ Gushort code; // character code
+ double x, y; // position to draw the glyph
+
+ //----- cache info
+ T3FontCache *cache; // font cache for the current font
+ T3FontCacheTag *cacheTag; // pointer to cache tag for the glyph
+ Guchar *cacheData; // pointer to cache data for the glyph
+
+ //----- saved state
+ SplashBitmap *origBitmap;
+ OPRS *origOPRS;
+ double origCTM4, origCTM5;
+
+ T3GlyphStack *next; // next object on stack
+};
+
+//------------------------------------------------------------------------
+// OPVPOutputDev
+//------------------------------------------------------------------------
+
+OPVPOutputDev::OPVPOutputDev()
+{
+ xref = 0;
+ bitmap = 0;
+ fontEngine = 0;
+ nT3Fonts = 0;
+ t3GlyphStack = 0;
+ font = NULL;
+ needFontUpdate = gFalse;
+ textClipPath = 0;
+ underlayCbk = 0;
+ underlayCbkData = 0;
+ scaleWidth = scaleHeight = -1;
+ leftMargin = 0;
+ bottomMargin = 0;
+ rotate = 0;
+ sliceHeight = 0;
+ yoffset = 0;
+ oprs = 0;
+}
+
+void OPVPOutputDev::setScale(double w, double h,
+ double leftMarginA, double bottomMarginA, int rotateA,
+ int yoffsetA, int sliceHeightA)
+{
+ scaleWidth = w;
+ scaleHeight = h;
+ leftMargin = leftMarginA;
+ bottomMargin = bottomMarginA;
+ rotate = rotateA;
+ yoffset = yoffsetA;
+ sliceHeight = sliceHeightA;
+}
+
+int OPVPOutputDev::init(SplashColorMode colorModeA,
+ GBool colorProfile,
+ GBool reverseVideoA,
+ SplashColor paperColorA,
+ const char *driverName,
+ int outputFD,
+ const char *printerModel,
+ int nOptions,
+ const char *optionKeys[],
+ const char *optionVals[]) {
+ int result;
+
+ oprs = new OPRS();
+
+ if ((result = oprs->init(driverName, outputFD, printerModel,
+ nOptions,optionKeys,optionVals)) < 0) {
+ opvpError(-1,"OPRS initialization fail");
+ return result;
+ }
+ colorMode = colorModeA;
+ if ((result = oprs->setColorMode(colorMode,colorProfile)) < 0) {
+ opvpError(-1,"Can't setColorMode");
+ return result;
+ }
+ reverseVideo = reverseVideoA;
+ splashColorCopy(paperColor,paperColorA);
+
+ return 0;
+}
+
+OPVPOutputDev::~OPVPOutputDev() {
+ int i;
+
+ for (i = 0; i < nT3Fonts; ++i) {
+ delete t3FontCache[i];
+ }
+ if (fontEngine) {
+ delete fontEngine;
+ }
+ if (oprs) {
+ delete oprs;
+ }
+ if (bitmap) {
+ delete bitmap;
+ }
+}
+
+void OPVPOutputDev::startDoc(XRef *xrefA) {
+ int i;
+
+ xref = xrefA;
+ if (fontEngine) {
+ delete fontEngine;
+ }
+ fontEngine = new SplashFontEngine(
+#if HAVE_T1LIB_H
+ globalParams->getEnableT1lib(),
+#endif
+#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
+ globalParams->getEnableFreeType(),
+ gFalse,
+ gFalse,
+#endif
+ globalParams->getAntialias());
+ for (i = 0; i < nT3Fonts; ++i) {
+ delete t3FontCache[i];
+ }
+ nT3Fonts = 0;
+}
+
+void OPVPOutputDev::startPage(int pageNum, GfxState *state) {
+ int w, h;
+
+ if (state) {
+ if (scaleWidth > 0 && scaleHeight > 0) {
+ double *ctm = state->getCTM();
+
+ switch (rotate) {
+ case 90:
+ state->setCTM(0,ctm[1],ctm[2],0,leftMargin,bottomMargin-yoffset);
+ break;
+ case 180:
+ state->setCTM(ctm[0],0,0,ctm[3],paperWidth-leftMargin,
+ bottomMargin-yoffset);
+ break;
+ case 270:
+ state->setCTM(0,ctm[1],ctm[2],0,paperWidth-leftMargin,
+ -bottomMargin+paperHeight-yoffset);
+ break;
+ default:
+ state->setCTM(ctm[0],0,0,ctm[3],leftMargin,
+ -bottomMargin+paperHeight-yoffset);
+ break;
+ }
+ state->concatCTM(scaleWidth,0.0,0.0,scaleHeight,0,0);
+ }
+ w = (int)(state->getPageWidth()+0.5);
+ h = (int)(state->getPageHeight()+0.5);
+ } else {
+ w = h = 1;
+ }
+ oprs->initGS(colorMode,w,h,paperColor);
+
+ if (underlayCbk) {
+ (*underlayCbk)(underlayCbkData);
+ }
+}
+
+void OPVPOutputDev::endPage() {
+ oprs->endPage();
+}
+
+void OPVPOutputDev::saveState(GfxState *state) {
+ oprs->saveState();
+}
+
+void OPVPOutputDev::restoreState(GfxState *state) {
+ oprs->restoreState();
+ needFontUpdate = gTrue;
+}
+
+void OPVPOutputDev::updateAll(GfxState *state) {
+ updateLineDash(state);
+ updateLineJoin(state);
+ updateLineCap(state);
+ updateLineWidth(state);
+ updateFlatness(state);
+ updateMiterLimit(state);
+ updateFillColor(state);
+ updateStrokeColor(state);
+ needFontUpdate = gTrue;
+}
+
+void OPVPOutputDev::updateCTM(GfxState *state, double m11, double m12,
+ double m21, double m22,
+ double m31, double m32) {
+ updateLineDash(state);
+ updateLineJoin(state);
+ updateLineCap(state);
+ updateLineWidth(state);
+}
+
+void OPVPOutputDev::transLineDash(GfxState *state, SplashCoord **adash,
+ int *adashLength, SplashCoord *aphase) {
+ double *dashPattern;
+ double dashStart;
+ static SplashCoord dash[20];
+ int i;
+
+ state->getLineDash(&dashPattern, adashLength, &dashStart);
+ if (*adashLength > 20) {
+ *adashLength = 20;
+ }
+ for (i = 0; i < *adashLength; ++i) {
+ dash[i] = (SplashCoord)state->transformWidth(dashPattern[i]);
+ if (dash[i] < 1) {
+ dash[i] = 1;
+ }
+ }
+ *adash = dash;
+ *aphase = (SplashCoord)state->transformWidth(dashStart);
+}
+
+void OPVPOutputDev::updateSplashLineDash(GfxState *state, Splash *splash) {
+ int dashLength;
+ SplashCoord *dash;
+ SplashCoord phase;
+
+ transLineDash(state, &dash, &dashLength, &phase);
+ splash->setLineDash(dash, dashLength, phase);
+}
+
+void OPVPOutputDev::updateLineDash(GfxState *state) {
+ int dashLength;
+ SplashCoord *dash;
+ SplashCoord phase;
+
+ transLineDash(state, &dash, &dashLength, &phase);
+ oprs->setLineDash(dash, dashLength, phase);
+}
+
+void OPVPOutputDev::updateFlatness(GfxState *state) {
+ oprs->setFlatness(state->getFlatness());
+}
+
+void OPVPOutputDev::updateLineJoin(GfxState *state) {
+ oprs->setLineJoin(state->getLineJoin());
+}
+
+void OPVPOutputDev::updateLineCap(GfxState *state) {
+ oprs->setLineCap(state->getLineCap());
+}
+
+void OPVPOutputDev::updateMiterLimit(GfxState *state) {
+ oprs->setMiterLimit(state->getMiterLimit());
+}
+
+void OPVPOutputDev::updateLineWidth(GfxState *state) {
+ oprs->setLineWidth(state->getTransformedLineWidth());
+}
+
+void OPVPOutputDev::updateFillColor(GfxState *state) {
+ GfxGray gray;
+ GfxRGB rgb;
+
+ state->getFillGray(&gray);
+ state->getFillRGB(&rgb);
+ oprs->setFillPattern(getColor(gray, &rgb));
+}
+
+void OPVPOutputDev::updateStrokeColor(GfxState *state) {
+ GfxGray gray;
+ GfxRGB rgb;
+
+ state->getStrokeGray(&gray);
+ state->getStrokeRGB(&rgb);
+ oprs->setStrokePattern(getColor(gray, &rgb));
+}
+
+#ifdef SPLASH_CMYK
+SplashPattern *OPVPOutputDev::getColor(double gray, GfxRGB *rgb,
+ GfxCMYK *cmyk) {
+#else
+SplashPattern *OPVPOutputDev::getColor(GfxGray gray, GfxRGB *rgb) {
+#endif
+ SplashPattern *pattern;
+ SplashColor color1;
+ GfxColorComp r, g, b;
+
+ if (reverseVideo) {
+ gray = gfxColorComp1 - gray;
+ r = gfxColorComp1 - rgb->r;
+ g = gfxColorComp1 - rgb->g;
+ b = gfxColorComp1 - rgb->b;
+ } else {
+ r = rgb->r;
+ g = rgb->g;
+ b = rgb->b;
+ }
+
+ pattern = NULL; // make gcc happy
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ color1[0] = colToByte(gray);
+ pattern = new SplashSolidColor(color1);
+ break;
+ case splashModeRGB8:
+ color1[0] = colToByte(r);
+ color1[1] = colToByte(g);
+ color1[2] = colToByte(b);
+ pattern = new SplashSolidColor(color1);
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ color[0] = colToByte(cmyk->c);
+ color[1] = colToByte(cmyk->m);
+ color[2] = colToByte(cmyk->y);
+ color[3] = colToByte(cmyk->k);
+ pattern = new SplashSolidColor(color);
+ break;
+#endif
+ default:
+ opvpError(-1, "no supported color mode");
+ break;
+ }
+
+ return pattern;
+}
+
+void OPVPOutputDev::updateFont(GfxState *state) {
+ needFontUpdate = gTrue;
+}
+
+void OPVPOutputDev::doUpdateFont(GfxState *state) {
+ GfxFont *gfxFont;
+ GfxFontType fontType;
+ SplashOutFontFileID *id;
+ SplashFontFile *fontFile;
+ SplashFontSrc *fontsrc = NULL;
+ FoFiTrueType *ff;
+ Ref embRef;
+ Object refObj, strObj;
+ GooString *fileName;
+ char *tmpBuf;
+ int tmpBufLen;
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ int *codeToGID;
+#else
+ Gushort *codeToGID;
+#endif
+ double m11, m12, m21, m22;
+ int substIdx, n;
+ int faceIndex = 0;
+ GBool recreateFont = gFalse;
+
+ needFontUpdate = gFalse;
+ font = NULL;
+ fileName = NULL;
+ tmpBuf = NULL;
+ substIdx = -1;
+
+ if (!(gfxFont = state->getFont())) {
+ goto err1;
+ }
+ fontType = gfxFont->getType();
+ if (fontType == fontType3) {
+ goto err1;
+ }
+
+ // check the font file cache
+ id = new SplashOutFontFileID(gfxFont->getID());
+ if ((fontFile = fontEngine->getFontFile(id))) {
+ delete id;
+
+ } else {
+
+ // if there is an embedded font, write it to disk
+ if (gfxFont->getEmbeddedFontID(&embRef)) {
+ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
+ if (! tmpBuf)
+ goto err2;
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ } else {
+ SysFontType sftype;
+ fileName = globalParams->findSystemFontFile(gfxFont,&sftype,
+ &faceIndex, NULL);
+ if (fileName == 0) {
+ opvpError(-1, "Couldn't find a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ switch (sftype) {
+ case sysFontPFA:
+ case sysFontPFB:
+ fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1;
+ break;
+ case sysFontTTF:
+ case sysFontTTC:
+ fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType;
+ break;
+ }
+ }
+#else
+ // if there is an external font file, use it
+ } else if (!(fileName = gfxFont->getExtFontFile())) {
+ DisplayFontParam *dfp;
+ // look for a display font mapping or a substitute font
+ dfp = NULL;
+ if (gfxFont->getName()) {
+ dfp = globalParams->getDisplayFont(gfxFont);
+ }
+ if (!dfp) {
+ opvpError(-1, "Couldn't find a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ switch (dfp->kind) {
+ case displayFontT1:
+ fileName = dfp->t1.fileName;
+ fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1;
+ break;
+ case displayFontTT:
+ fileName = dfp->tt.fileName;
+ fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType;
+ faceIndex = dfp->tt.faceIndex;
+ break;
+ }
+ }
+#endif
+
+ fontsrc = new SplashFontSrc;
+ if (fileName)
+ fontsrc->setFile(fileName, gFalse);
+ else
+ fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
+
+ // load the font file
+ switch (fontType) {
+ case fontType1:
+ if (!(fontFile = fontEngine->loadType1Font(
+ id,
+ fontsrc,
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ (const char **)
+#endif
+ ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontType1C:
+ if (!(fontFile = fontEngine->loadType1CFont(
+ id,
+ fontsrc,
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ (const char **)
+#endif
+ ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontType1COT:
+ if (!(fontFile = fontEngine->loadOpenTypeT1CFont(
+ id,
+ fontsrc,
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ (const char **)
+#endif
+ ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontTrueTypeOT:
+ case fontTrueType:
+ if (fileName)
+ ff = FoFiTrueType::load(fileName->getCString());
+ else
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
+ if (ff) {
+ codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
+ n = 256;
+ delete ff;
+ } else {
+ codeToGID = NULL;
+ n = 0;
+ }
+ if (!(fontFile = fontEngine->loadTrueTypeFont(
+ id,
+ fontsrc,
+ codeToGID, n))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontCIDType0:
+ case fontCIDType0C:
+ if (!(fontFile = fontEngine->loadCIDFont(
+ id,
+ fontsrc))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontCIDType0COT:
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+ if (n) {
+ codeToGID = (int *)gmallocn(n, sizeof(int));
+ memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+ n * sizeof(int));
+ } else {
+ codeToGID = NULL;
+ }
+ if (!(fontFile = fontEngine->loadOpenTypeCFFFont(
+ id,
+ fontsrc,codeToGID,n))) {
+#else
+ if (!(fontFile = fontEngine->loadOpenTypeCFFFont(
+ id,
+ fontsrc))) {
+#endif
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontCIDType2OT:
+ case fontCIDType2:
+ codeToGID = NULL;
+ n = 0;
+ if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
+ n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+ if (n) {
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ codeToGID = (int *)gmallocn(n, sizeof(int));
+ memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+ n * sizeof(int));
+#else
+ codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
+ memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+ n * sizeof(Gushort));
+#endif
+ }
+ } else {
+ if (fileName)
+ ff = FoFiTrueType::load(fileName->getCString());
+ else
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
+ if (! ff)
+ goto err2;
+ codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
+ delete ff;
+ }
+ if (!(fontFile = fontEngine->loadTrueTypeFont(
+ id,
+ fontsrc,
+ codeToGID, n, faceIndex))) {
+ opvpError(-1, "Couldn't create a font for '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ goto err2;
+ }
+ break;
+ default:
+ // this shouldn't happen
+ goto err2;
+ }
+ fontFile->doAdjustMatrix = gTrue;
+ }
+
+ // get the font matrix
+ state->getFontTransMat(&m11, &m12, &m21, &m22);
+ m11 *= state->getHorizScaling();
+ m12 *= state->getHorizScaling();
+
+ // create the scaled font
+ fontMat[0] = m11; fontMat[1] = m12;
+ fontMat[2] = m21; fontMat[3] = m22;
+ font = fontEngine->getFont(fontFile, fontMat, oprs->getMatrix());
+
+ // for substituted fonts: adjust the font matrix -- compare the
+ // width of 'm' in the original font and the substituted font
+ if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) {
+ double w1, w2;
+ CharCode code;
+ char *name;
+ for (code = 0; code < 256; ++code) {
+ if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) &&
+ name[0] == 'm' && name[1] == '\0') {
+ break;
+ }
+ }
+ if (code < 256) {
+ w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code);
+ w2 = font->getGlyphAdvance(code);
+ if (!gfxFont->isSymbolic() && w2 > 0) {
+ // if real font is substantially narrower than substituted
+ // font, reduce the font size accordingly
+ if (w1 > 0.01 && w1 < 0.9 * w2) {
+ w1 /= w2;
+ m11 *= w1;
+ m21 *= w1;
+ recreateFont = gTrue;
+ }
+ }
+ }
+ }
+
+ if (recreateFont)
+ {
+ fontMat[0] = m11; fontMat[1] = m12;
+ fontMat[2] = m21; fontMat[3] = m22;
+ font = fontEngine->getFont(fontFile, fontMat, oprs->getMatrix());
+ }
+
+ if (fontsrc && !fontsrc->isFile)
+ fontsrc->unref();
+ return;
+
+ err2:
+ delete id;
+ err1:
+ if (fontsrc && !fontsrc->isFile)
+ fontsrc->unref();
+ return;
+}
+
+void OPVPOutputDev::stroke(GfxState *state) {
+ OPVPSplashPath *path;
+ GfxColorSpace *cs;
+
+ /* check None separate color */
+ if ((cs = state->getStrokeColorSpace()) == NULL) return;
+ if (cs->getMode() == csSeparation) {
+ GooString *name;
+
+ name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
+ if (name == NULL) return;
+ if (name->cmp("None") == 0) return;
+ }
+
+ path = convertPath(state, state->getPath());
+ oprs->stroke(path);
+ delete path;
+}
+
+void OPVPOutputDev::fill(GfxState *state) {
+ OPVPSplashPath *path;
+ GfxColorSpace *cs;
+
+ /* check None separate color */
+ if ((cs = state->getFillColorSpace()) == NULL) return;
+ if (cs->getMode() == csSeparation) {
+ GooString *name;
+
+ name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
+ if (name == NULL) return;
+ if (name->cmp("None") == 0) return;
+ }
+
+ path = convertPath(state, state->getPath());
+ oprs->fill(path, gFalse);
+ delete path;
+}
+
+void OPVPOutputDev::eoFill(GfxState *state) {
+ OPVPSplashPath *path;
+ GfxColorSpace *cs;
+
+ /* check None separate color */
+ if ((cs = state->getFillColorSpace()) == NULL) return;
+ if (cs->getMode() == csSeparation) {
+ GooString *name;
+
+ name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
+ if (name == NULL) return;
+ if (name->cmp("None") == 0) return;
+ }
+
+ path = convertPath(state, state->getPath());
+ oprs->fill(path, gTrue);
+ delete path;
+}
+
+void OPVPOutputDev::clip(GfxState *state) {
+ OPVPSplashPath *path;
+
+ path = convertPath(state, state->getPath());
+ oprs->clipToPath(path, gFalse);
+ delete path;
+}
+
+void OPVPOutputDev::eoClip(GfxState *state) {
+ OPVPSplashPath *path;
+
+ path = convertPath(state, state->getPath());
+ oprs->clipToPath(path, gTrue);
+ delete path;
+}
+
+OPVPSplashPath *OPVPOutputDev::bitmapToPath(SplashBitmap *bitmapA,
+ int width, int height)
+{
+ int x,y;
+ OPVPSplashPath *path;
+ int x1, x2;
+ SplashColor pix;
+
+ path = new OPVPSplashPath();
+
+ for (y = 0;y < height;y++) {
+ for (x = 0;x < width;x++) {
+ bitmapA->getPixel(x,y,pix);
+ if (pix[0] == 0) {
+ /* start */
+ x1 = x;
+ for (x++;x < width;x++) {
+ bitmapA->getPixel(x,y,pix);
+ if (pix[0] != 0) {
+ /* end */
+ break;
+ }
+ }
+ x2 = x-1;
+ path->moveTo(x1,y);
+ path->lineTo(x2,y);
+ path->lineTo(x2,(y+1));
+ path->lineTo(x1,(y+1));
+ path->close();
+ }
+ }
+ }
+ return path;
+}
+
+void OPVPOutputDev::clipToStrokePath(GfxState *state) {
+ SplashBitmap *tbitmap;
+ Splash *tsplash;
+ SplashPath *spath;
+ OPVPSplashPath *path, *path2;
+
+ // use splash for makeStrokePath
+ // create dummy bitmap for creating splash
+ tbitmap = new SplashBitmap(1, 1, 1, splashModeMono1, gFalse);
+ tsplash = new Splash(tbitmap, gFalse);
+ // set line parameters
+ // except colors
+ updateSplashLineDash(state, tsplash);
+ tsplash->setLineJoin(state->getLineJoin());
+ tsplash->setLineCap(state->getLineCap());
+ tsplash->setMiterLimit(state->getMiterLimit());
+ tsplash->setLineWidth(state->getTransformedLineWidth());
+
+ path = convertPath(state, state->getPath());
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ spath = tsplash->makeStrokePath(path,0);
+#else
+ spath = tsplash->makeStrokePath(path);
+#endif
+ path2 = new OPVPSplashPath(spath);
+ delete spath;
+ delete path;
+ delete tsplash;
+ delete tbitmap;
+ oprs->clipToPath(path2, gFalse);
+ delete path2;
+}
+
+OPVPSplashPath *OPVPOutputDev::convertPath(GfxState *state, GfxPath *path) {
+ OPVPSplashPath *sPath;
+ GfxSubpath *subpath;
+ double x1, y1, x2, y2, x3, y3;
+ int i, j;
+
+ sPath = new OPVPSplashPath();
+ for (i = 0; i < path->getNumSubpaths(); ++i) {
+ subpath = path->getSubpath(i);
+ if (subpath->getNumPoints() > 0) {
+ state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1);
+ sPath->moveTo((SplashCoord)x1, (SplashCoord)y1);
+ j = 1;
+ while (j < subpath->getNumPoints()) {
+ if (subpath->getCurve(j)) {
+ state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1);
+ state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2);
+ state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3);
+ sPath->curveTo((SplashCoord)x1, (SplashCoord)y1,
+ (SplashCoord)x2, (SplashCoord)y2,
+ (SplashCoord)x3, (SplashCoord)y3);
+ j += 3;
+ } else {
+ state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1);
+ sPath->lineTo((SplashCoord)x1, (SplashCoord)y1);
+ ++j;
+ }
+ }
+ if (subpath->isClosed()) {
+ sPath->close();
+ }
+ }
+ }
+ return sPath;
+}
+
+void OPVPOutputDev::drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, int nBytes,
+ Unicode *u, int uLen) {
+ double x1, y1;
+ SplashPath *spath;
+ OPVPSplashPath *path;
+ int render;
+
+ // check for invisible text -- this is used by Acrobat Capture
+ render = state->getRender();
+ if (render == 3) {
+ return;
+ }
+
+ if (needFontUpdate) {
+ doUpdateFont(state);
+ }
+ if (!font) {
+ return;
+ }
+
+ x -= originX;
+ y -= originY;
+ state->transform(x,y,&x1,&y1);
+
+ // fill
+ if (!(render & 1)) {
+ oprs->fillChar((SplashCoord)x1, (SplashCoord)y1, code, font, u, fontMat);
+ }
+
+ // stroke
+ if ((render & 3) == 1 || (render & 3) == 2) {
+ if ((spath = font->getGlyphPath(code))) {
+ path = new OPVPSplashPath(spath);
+ delete spath;
+ path->closeAllSubPath();
+ path->offset((SplashCoord)x1, (SplashCoord)y1);
+ oprs->stroke(path);
+ delete path;
+ } else {
+ opvpError(-1,"No glyph outline infomation");
+ }
+ }
+
+ // clip
+ if (render & 4) {
+ if ((spath = font->getGlyphPath(code)) != NULL) {
+ path = new OPVPSplashPath(spath);
+ delete spath;
+ path->offset((SplashCoord)x1, (SplashCoord)y1);
+ if (textClipPath) {
+ textClipPath->append(path);
+ delete path;
+ } else {
+ textClipPath = path;
+ }
+ } else {
+ opvpError(-1,"No glyph outline infomation");
+ }
+ }
+}
+
+GBool OPVPOutputDev::beginType3Char(GfxState *state, double x, double y,
+ double dx, double dy,
+ CharCode code, Unicode *u, int uLen) {
+ /* In a vector mode, cache is not needed */
+ return gFalse;
+}
+
+void OPVPOutputDev::endType3Char(GfxState *state) {
+ /* In a vector mode, cache is not needed */
+ /* do nothing */
+}
+
+void OPVPOutputDev::type3D0(GfxState *state, double wx, double wy) {
+ /* In a vector mode, cache is not needed */
+ /* do nothing */
+}
+
+void OPVPOutputDev::type3D1(GfxState *state, double wx, double wy,
+ double llx, double lly, double urx, double ury) {
+}
+
+void OPVPOutputDev::drawType3Glyph(T3FontCache *t3Font,
+ T3FontCacheTag *tag, Guchar *data,
+ double x, double y) {
+ SplashGlyphBitmap glyph;
+
+ glyph.x = -t3Font->glyphX;
+ glyph.y = -t3Font->glyphY;
+ glyph.w = t3Font->glyphW;
+ glyph.h = t3Font->glyphH;
+ glyph.aa = colorMode != splashModeMono1;
+ glyph.data = data;
+ glyph.freeData = gFalse;
+ oprs->fillGlyph((SplashCoord)x, (SplashCoord)y, &glyph);
+}
+
+void OPVPOutputDev::endTextObject(GfxState *state) {
+ if (textClipPath) {
+ oprs->clipToPath(textClipPath, gFalse);
+ delete textClipPath;
+ textClipPath = NULL;
+ }
+}
+
+struct SplashOutImageMaskData {
+ ImageStream *imgStr;
+ GBool invert;
+ int width, height, y;
+};
+
+GBool OPVPOutputDev::imageMaskSrc(void *data, SplashColorPtr line) {
+ SplashOutImageMaskData *imgMaskData = (SplashOutImageMaskData *)data;
+ Guchar *p;
+ SplashColorPtr q;
+ int x;
+
+ if (imgMaskData->y == imgMaskData->height) {
+ return gFalse;
+ }
+ for (x = 0, p = imgMaskData->imgStr->getLine(), q = line;
+ x < imgMaskData->width;
+ ++x) {
+ *q++ = *p++ ^ imgMaskData->invert;
+ }
+ ++imgMaskData->y;
+ return gTrue;
+}
+
+void OPVPOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GBool invert,
+ GBool interpolate,
+ GBool inlineImg) {
+ double *ctm;
+ SplashCoord mat[6];
+ SplashOutImageMaskData imgMaskData;
+
+ ctm = state->getCTM();
+ mat[0] = ctm[0];
+ mat[1] = ctm[1];
+ mat[2] = -ctm[2];
+ mat[3] = -ctm[3];
+ mat[4] = ctm[2] + ctm[4];
+ mat[5] = ctm[3] + ctm[5];
+
+ imgMaskData.imgStr = new ImageStream(str, width, 1, 1);
+ imgMaskData.imgStr->reset();
+ imgMaskData.invert = invert ? 0 : 1;
+ imgMaskData.width = width;
+ imgMaskData.height = height;
+ imgMaskData.y = 0;
+
+ oprs->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat,
+ t3GlyphStack != NULL);
+ if (inlineImg) {
+ while (imgMaskData.y < height) {
+ imgMaskData.imgStr->getLine();
+ ++imgMaskData.y;
+ }
+ }
+
+ delete imgMaskData.imgStr;
+}
+
+struct SplashOutImageData {
+ ImageStream *imgStr;
+ GfxImageColorMap *colorMap;
+ SplashColorPtr lookup;
+ int *maskColors;
+ SplashColorMode colorMode;
+ int width, height, y;
+};
+
+GBool OPVPOutputDev::imageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine)
+{
+ SplashOutImageData *imgData = (SplashOutImageData *)data;
+ Guchar *p;
+ SplashColorPtr q, col;
+ GfxRGB rgb;
+ GfxGray gray;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ int nComps, x;
+
+ if (imgData->y == imgData->height) {
+ return gFalse;
+ }
+
+ nComps = imgData->colorMap->getNumPixelComps();
+
+ if (imgData->lookup) {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, ++p) {
+ *q++ = imgData->lookup[*p];
+ }
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, ++p) {
+ col = &imgData->lookup[3 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ }
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, ++p) {
+ col = &imgData->lookup[4 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ *q++ = col[3];
+ }
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ } else {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ imgData->colorMap->getGray(p, &gray);
+ *q++ = colToByte(gray);
+ }
+ break;
+ case splashModeRGB8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = colToByte(rgb.r);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.b);
+ }
+ break;
+ case splashModeBGR8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = colToByte(rgb.b);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.r);
+ }
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ imgData->colorMap->getCMYK(p, &cmyk);
+ *q++ = colToByte(cmyk.c);
+ *q++ = colToByte(cmyk.m);
+ *q++ = colToByte(cmyk.y);
+ *q++ = colToByte(cmyk.k);
+ }
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+
+ ++imgData->y;
+ return gTrue;
+}
+
+GBool OPVPOutputDev::alphaImageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine) {
+ SplashOutImageData *imgData = (SplashOutImageData *)data;
+ Guchar *p;
+ SplashColorPtr q, col;
+ GfxRGB rgb;
+ GfxGray gray;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ Guchar alpha;
+ int nComps, x, i;
+
+ if (imgData->y == imgData->height) {
+ return gFalse;
+ }
+
+ nComps = imgData->colorMap->getNumPixelComps();
+
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ alpha = 0;
+ for (i = 0; i < nComps; ++i) {
+ if (p[i] < imgData->maskColors[2*i] ||
+ p[i] > imgData->maskColors[2*i+1]) {
+ alpha = 0xff;
+ break;
+ }
+ }
+ if (imgData->lookup) {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ *q++ = alpha;
+ *q++ = imgData->lookup[*p];
+ break;
+ case splashModeRGB8:
+ *q++ = alpha;
+ col = &imgData->lookup[3 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ break;
+ case splashModeBGR8:
+ col = &imgData->lookup[3 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ *q++ = alpha;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ *q++ = alpha;
+ col = &imgData->lookup[4 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ *q++ = col[3];
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ } else {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ imgData->colorMap->getGray(p, &gray);
+ *q++ = alpha;
+ *q++ = colToByte(gray);
+ break;
+ case splashModeRGB8:
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = alpha;
+ *q++ = colToByte(rgb.r);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.b);
+ break;
+ case splashModeBGR8:
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = colToByte(rgb.b);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.r);
+ *q++ = alpha;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ imgData->colorMap->getCMYK(p, &cmyk);
+ *q++ = alpha;
+ *q++ = colToByte(cmyk.c);
+ *q++ = colToByte(cmyk.m);
+ *q++ = colToByte(cmyk.y);
+ *q++ = colToByte(cmyk.k);
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+ }
+
+ ++imgData->y;
+ return gTrue;
+}
+
+void OPVPOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height,
+ GfxImageColorMap *colorMap,
+ GBool interpolate,
+ int *maskColors, GBool inlineImg) {
+ double *ctm;
+ SplashCoord mat[6];
+ SplashOutImageData imgData;
+ SplashColorMode srcMode;
+ SplashImageSource src;
+ GfxGray gray;
+ GfxRGB rgb;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ Guchar pix;
+ int n, i;
+
+ ctm = state->getCTM();
+ mat[0] = ctm[0];
+ mat[1] = ctm[1];
+ mat[2] = -ctm[2];
+ mat[3] = -ctm[3];
+ mat[4] = ctm[2] + ctm[4];
+ mat[5] = ctm[3] + ctm[5];
+
+ imgData.imgStr = new ImageStream(str, width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgData.imgStr->reset();
+ imgData.colorMap = colorMap;
+ imgData.maskColors = maskColors;
+ imgData.colorMode = colorMode;
+ imgData.width = width;
+ imgData.height = height;
+ imgData.y = 0;
+
+ // special case for one-channel (monochrome/gray/separation) images:
+ // build a lookup table here
+ imgData.lookup = NULL;
+ if (colorMap->getNumPixelComps() == 1) {
+ n = 1 << colorMap->getBits();
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ imgData.lookup = (SplashColorPtr)gmalloc(n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getGray(&pix, &gray);
+ imgData.lookup[i] = colToByte(gray);
+ }
+ break;
+ case splashModeRGB8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.r);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.b);
+ }
+ break;
+ case splashModeBGR8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.b);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.r);
+ }
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getCMYK(&pix, &cmyk);
+ imgData.lookup[4*i] = colToByte(cmyk.c);
+ imgData.lookup[4*i+1] = colToByte(cmyk.m);
+ imgData.lookup[4*i+2] = colToByte(cmyk.y);
+ imgData.lookup[4*i+3] = colToByte(cmyk.k);
+ }
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+
+ if (colorMode == splashModeMono1) {
+ srcMode = splashModeMono8;
+ } else {
+ srcMode = colorMode;
+ }
+ src = maskColors ? &alphaImageSrc : &imageSrc;
+ oprs->drawImage(src, &imgData, srcMode, maskColors ? gTrue : gFalse,
+ width, height, mat);
+ if (inlineImg) {
+ while (imgData.y < height) {
+ imgData.imgStr->getLine();
+ ++imgData.y;
+ }
+ }
+
+ gfree(imgData.lookup);
+ delete imgData.imgStr;
+ str->close();
+}
+
+struct SplashOutMaskedImageData {
+ ImageStream *imgStr;
+ GfxImageColorMap *colorMap;
+ SplashBitmap *mask;
+ SplashColorPtr lookup;
+ SplashColorMode colorMode;
+ int width, height, y;
+};
+
+GBool OPVPOutputDev::maskedImageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine) {
+ SplashOutMaskedImageData *imgData = (SplashOutMaskedImageData *)data;
+ Guchar *p;
+ SplashColor maskColor;
+ SplashColorPtr q, col;
+ GfxRGB rgb;
+ GfxGray gray;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ Guchar alpha;
+ int nComps, x;
+
+ if (imgData->y == imgData->height) {
+ return gFalse;
+ }
+
+ nComps = imgData->colorMap->getNumPixelComps();
+
+ for (x = 0, p = imgData->imgStr->getLine(), q = line;
+ x < imgData->width;
+ ++x, p += nComps) {
+ imgData->mask->getPixel(x, imgData->y, maskColor);
+ alpha = maskColor[0] ? 0xff : 0x00;
+ if (imgData->lookup) {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ *q++ = alpha;
+ *q++ = imgData->lookup[*p];
+ break;
+ case splashModeRGB8:
+ *q++ = alpha;
+ col = &imgData->lookup[3 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ break;
+ case splashModeBGR8:
+ col = &imgData->lookup[3 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ *q++ = alpha;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ *q++ = alpha;
+ col = &imgData->lookup[4 * *p];
+ *q++ = col[0];
+ *q++ = col[1];
+ *q++ = col[2];
+ *q++ = col[3];
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ } else {
+ switch (imgData->colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ imgData->colorMap->getGray(p, &gray);
+ *q++ = alpha;
+ *q++ = colToByte(gray);
+ break;
+ case splashModeRGB8:
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = alpha;
+ *q++ = colToByte(rgb.r);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.b);
+ break;
+ case splashModeBGR8:
+ imgData->colorMap->getRGB(p, &rgb);
+ *q++ = colToByte(rgb.b);
+ *q++ = colToByte(rgb.g);
+ *q++ = colToByte(rgb.r);
+ *q++ = alpha;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ imgData->colorMap->getCMYK(p, &cmyk);
+ *q++ = alpha;
+ *q++ = colToByte(cmyk.c);
+ *q++ = colToByte(cmyk.m);
+ *q++ = colToByte(cmyk.y);
+ *q++ = colToByte(cmyk.k);
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+ }
+
+ ++imgData->y;
+ return gTrue;
+}
+
+void OPVPOutputDev::drawMaskedImage(GfxState *state, Object *ref,
+ Stream *str, int width, int height,
+ GfxImageColorMap *colorMap,
+ GBool interpolate,
+ Stream *maskStr, int maskWidth,
+ int maskHeight, GBool maskInvert,
+ GBool maskInterpolate) {
+ double *ctm;
+ SplashCoord mat[6];
+ SplashOutMaskedImageData imgData;
+ SplashOutImageMaskData imgMaskData;
+ SplashColorMode srcMode;
+ SplashBitmap *maskBitmap;
+ Splash *maskSplash;
+ SplashColor maskColor;
+ GfxGray gray;
+ GfxRGB rgb;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ Guchar pix;
+ int n, i;
+
+ //----- scale the mask image to the same size as the source image
+
+ mat[0] = (SplashCoord)width;
+ mat[1] = 0;
+ mat[2] = 0;
+ mat[3] = (SplashCoord)height;
+ mat[4] = 0;
+ mat[5] = 0;
+ imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, 1, 1);
+ imgMaskData.imgStr->reset();
+ imgMaskData.invert = maskInvert ? 0 : 1;
+ imgMaskData.width = maskWidth;
+ imgMaskData.height = maskHeight;
+ imgMaskData.y = 0;
+ maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse);
+ maskSplash = new Splash(maskBitmap, gFalse);
+ maskColor[0] = 0;
+ maskSplash->clear(maskColor);
+ maskColor[0] = 1;
+ maskSplash->setFillPattern(new SplashSolidColor(maskColor));
+ maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData,
+ maskWidth, maskHeight, mat, gFalse);
+ delete imgMaskData.imgStr;
+ maskStr->close();
+ delete maskSplash;
+
+ //----- draw the source image
+
+ ctm = state->getCTM();
+ mat[0] = ctm[0];
+ mat[1] = ctm[1];
+ mat[2] = -ctm[2];
+ mat[3] = -ctm[3];
+ mat[4] = ctm[2] + ctm[4];
+ mat[5] = ctm[3] + ctm[5];
+
+ imgData.imgStr = new ImageStream(str, width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgData.imgStr->reset();
+ imgData.colorMap = colorMap;
+ imgData.mask = maskBitmap;
+ imgData.colorMode = colorMode;
+ imgData.width = width;
+ imgData.height = height;
+ imgData.y = 0;
+
+ // special case for one-channel (monochrome/gray/separation) images:
+ // build a lookup table here
+ imgData.lookup = NULL;
+ if (colorMap->getNumPixelComps() == 1) {
+ n = 1 << colorMap->getBits();
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ imgData.lookup = (SplashColorPtr)gmalloc(n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getGray(&pix, &gray);
+ imgData.lookup[i] = colToByte(gray);
+ }
+ break;
+ case splashModeRGB8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.r);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.b);
+ }
+ break;
+ case splashModeBGR8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.b);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.r);
+ }
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getCMYK(&pix, &cmyk);
+ imgData.lookup[4*i] = colToByte(cmyk.c);
+ imgData.lookup[4*i+1] = colToByte(cmyk.m);
+ imgData.lookup[4*i+2] = colToByte(cmyk.y);
+ imgData.lookup[4*i+3] = colToByte(cmyk.k);
+ }
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ srcMode = splashModeMono8;
+ break;
+ case splashModeRGB8:
+ srcMode = splashModeRGB8;
+ break;
+ case splashModeBGR8:
+ srcMode = splashModeBGR8;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ srcMode = splashModeCMYK8;
+ break;
+#endif
+ default:
+ //~ unimplemented
+ srcMode = splashModeRGB8;
+ break;
+ }
+ oprs->drawImage(&maskedImageSrc, &imgData, srcMode, gTrue,
+ width, height, mat);
+
+ delete maskBitmap;
+ gfree(imgData.lookup);
+ delete imgData.imgStr;
+ str->close();
+}
+
+void OPVPOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
+ Stream *str, int width, int height,
+ GfxImageColorMap *colorMap,
+ GBool interpolate,
+ Stream *maskStr,
+ int maskWidth, int maskHeight,
+ GfxImageColorMap *maskColorMap,
+ GBool maskInterpolate) {
+ double *ctm;
+ SplashCoord mat[6];
+ SplashOutImageData imgData;
+ SplashOutImageData imgMaskData;
+ SplashColorMode srcMode;
+ SplashBitmap *maskBitmap;
+ Splash *maskSplash;
+ SplashColor maskColor;
+ GfxGray gray;
+ GfxRGB rgb;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+ Guchar pix;
+ int n, i;
+
+ ctm = state->getCTM();
+ mat[0] = ctm[0];
+ mat[1] = ctm[1];
+ mat[2] = -ctm[2];
+ mat[3] = -ctm[3];
+ mat[4] = ctm[2] + ctm[4];
+ mat[5] = ctm[3] + ctm[5];
+
+ //----- set up the soft mask
+
+ imgMaskData.imgStr = new ImageStream(maskStr, maskWidth,
+ maskColorMap->getNumPixelComps(),
+ maskColorMap->getBits());
+ imgMaskData.imgStr->reset();
+ imgMaskData.colorMap = maskColorMap;
+ imgMaskData.maskColors = NULL;
+ imgMaskData.colorMode = splashModeMono8;
+ imgMaskData.width = maskWidth;
+ imgMaskData.height = maskHeight;
+ imgMaskData.y = 0;
+ n = 1 << maskColorMap->getBits();
+ imgMaskData.lookup = (SplashColorPtr)gmalloc(n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ maskColorMap->getGray(&pix, &gray);
+ imgMaskData.lookup[i] = colToByte(gray);
+ }
+ maskBitmap = new SplashBitmap(maskWidth,maskHeight,
+ 1, splashModeMono8, gFalse);
+ maskSplash = new Splash(maskBitmap, gFalse);
+ maskColor[0] = 0;
+ maskSplash->clear(maskColor);
+ maskSplash->drawImage(&imageSrc, &imgMaskData,
+ splashModeMono8, gFalse, maskWidth, maskHeight, mat);
+ delete imgMaskData.imgStr;
+ maskStr->close();
+ gfree(imgMaskData.lookup);
+ delete maskSplash;
+ oprs->setSoftMask(maskBitmap);
+
+ //----- draw the source image
+
+ imgData.imgStr = new ImageStream(str, width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgData.imgStr->reset();
+ imgData.colorMap = colorMap;
+ imgData.maskColors = NULL;
+ imgData.colorMode = colorMode;
+ imgData.width = width;
+ imgData.height = height;
+ imgData.y = 0;
+
+ // special case for one-channel (monochrome/gray/separation) images:
+ // build a lookup table here
+ imgData.lookup = NULL;
+ if (colorMap->getNumPixelComps() == 1) {
+ n = 1 << colorMap->getBits();
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ imgData.lookup = (SplashColorPtr)gmalloc(n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getGray(&pix, &gray);
+ imgData.lookup[i] = colToByte(gray);
+ }
+ break;
+ case splashModeRGB8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.r);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.b);
+ }
+ break;
+ case splashModeBGR8:
+ imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getRGB(&pix, &rgb);
+ imgData.lookup[3*i] = colToByte(rgb.b);
+ imgData.lookup[3*i+1] = colToByte(rgb.g);
+ imgData.lookup[3*i+2] = colToByte(rgb.r);
+ }
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
+ for (i = 0; i < n; ++i) {
+ pix = (Guchar)i;
+ colorMap->getCMYK(&pix, &cmyk);
+ imgData.lookup[4*i] = colToByte(cmyk.c);
+ imgData.lookup[4*i+1] = colToByte(cmyk.m);
+ imgData.lookup[4*i+2] = colToByte(cmyk.y);
+ imgData.lookup[4*i+3] = colToByte(cmyk.k);
+ }
+ break;
+#endif
+ default:
+ //~ unimplemented
+ break;
+ }
+ }
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ srcMode = splashModeMono8;
+ break;
+ case splashModeRGB8:
+ srcMode = splashModeRGB8;
+ break;
+ case splashModeBGR8:
+ srcMode = splashModeBGR8;
+ break;
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+ srcMode = splashModeCMYK8;
+ break;
+#endif
+ default:
+ //~ unimplemented
+ srcMode = splashModeRGB8;
+ break;
+ }
+ oprs->drawImage(&imageSrc, &imgData, srcMode, gFalse, width, height, mat);
+
+ oprs->setSoftMask(NULL);
+ gfree(imgData.lookup);
+ delete imgData.imgStr;
+ str->close();
+}
+
+int OPVPOutputDev::getBitmapWidth() {
+ return bitmap->getWidth();
+}
+
+int OPVPOutputDev::getBitmapHeight() {
+ return bitmap->getHeight();
+}
+
+void OPVPOutputDev::xorRectangle(int x0, int y0, int x1, int y1,
+ SplashPattern *pattern) {
+ /* no need in printing */
+}
+
+void OPVPOutputDev::setFillColor(int r, int g, int b) {
+ GfxRGB rgb;
+ GfxGray gray;
+#if SPLASH_CMYK
+ GfxCMYK cmyk;
+#endif
+
+ rgb.r = byteToCol(r);
+ rgb.g = byteToCol(g);
+ rgb.b = byteToCol(b);
+ gray = (GfxColorComp)(0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.g + 0.5);
+ if (gray > gfxColorComp1) {
+ gray = gfxColorComp1;
+ }
+#if SPLASH_CMYK
+ cmyk.c = gfxColorComp1 - rgb.r;
+ cmyk.m = gfxColorComp1 - rgb.g;
+ cmyk.y = gfxColorComp1 - rgb.b;
+ cmyk.k = 0;
+ oprs->setFillPattern(getColor(gray, &rgb, &cmyk));
+#else
+ oprs->setFillPattern(getColor(gray, &rgb));
+#endif
+}
+
+int OPVPOutputDev::OPVPStartJob(char *jobInfo)
+{
+ return oprs->OPVPStartJob(jobInfo);
+}
+
+int OPVPOutputDev::OPVPEndJob()
+{
+ return oprs->OPVPEndJob();
+}
+
+int OPVPOutputDev::OPVPStartDoc(char *docInfo)
+{
+ return oprs->OPVPStartDoc(docInfo);
+}
+
+int OPVPOutputDev::OPVPEndDoc()
+{
+ return oprs->OPVPEndDoc();
+}
+
+int OPVPOutputDev::OPVPStartPage(char *pageInfo,
+ int rasterWidth, int rasterHeight)
+{
+ paperWidth = rasterWidth;
+ paperHeight = rasterHeight;
+ return oprs->OPVPStartPage(pageInfo,rasterWidth);
+}
+
+int OPVPOutputDev::OPVPEndPage()
+{
+ return oprs->OPVPEndPage();
+}
+
+int OPVPOutputDev::outSlice()
+{
+ return oprs->outSlice();
+}
+
+void OPVPOutputDev::psXObject(Stream *psStream, Stream *level1Stream)
+{
+ opvpError(-1,"psXObject is found, but it is not supported");
+}
--- /dev/null
+//========================================================================
+//
+// OPVPOutputDev.h
+//
+// Copyright 2005 AXE,Inc.
+//
+//========================================================================
+
+#ifndef OPVPOUTPUTDEV_H
+#define OPVPOUTPUTDEV_H
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "goo/gtypes.h"
+#include "splash/SplashTypes.h"
+#include "config.h"
+#include "OutputDev.h"
+#include "GfxState.h"
+#include "GfxFont.h"
+
+class GfxState;
+class GfxPath;
+class Gfx8BitFont;
+class SplashBitmap;
+class OPRS;
+class OPVPSplashPath;
+class SplashPattern;
+class SplashFontEngine;
+class SplashFont;
+class T3FontCache;
+struct T3FontCacheTag;
+struct T3GlyphStack;
+struct GfxRGB;
+
+//------------------------------------------------------------------------
+
+// number of Type 3 fonts to cache
+#define splashOutT3FontCacheSize 8
+
+//------------------------------------------------------------------------
+// OPVPOutputDev
+//------------------------------------------------------------------------
+
+class OPVPOutputDev: public OutputDev {
+public:
+
+ // Constructor.
+ OPVPOutputDev();
+
+ // Second Constructor
+ int init(SplashColorMode colorModeA, GBool colorProfile, GBool reverseVideoA,
+ SplashColor paperColorA,
+ const char *driverName, int outputFD,
+ const char *printerModel,
+ int nOptions,
+ const char *optionKeys[], const char *optionVals[]);
+
+ // Destructor.
+ virtual ~OPVPOutputDev();
+
+ //----- get info about output device
+
+ // Does this device use upside-down coordinates?
+ // (Upside-down means (0,0) is the top left corner of the page.)
+ virtual GBool upsideDown() { return gTrue; }
+
+ // Does this device use drawChar() or drawString()?
+ virtual GBool useDrawChar() { return gTrue; }
+
+ // Does this device use beginType3Char/endType3Char? Otherwise,
+ // text in Type 3 fonts will be drawn with drawChar/drawString.
+ virtual GBool interpretType3Chars() { return gTrue; }
+
+ //----- initialization and control
+
+ // Start a page.
+ virtual void startPage(int pageNum, GfxState *state);
+
+ // End a page.
+ virtual void endPage();
+
+ //----- save/restore graphics state
+ virtual void saveState(GfxState *state);
+ virtual void restoreState(GfxState *state);
+
+ //----- update graphics state
+ virtual void updateAll(GfxState *state);
+ virtual void updateCTM(GfxState *state, double m11, double m12,
+ double m21, double m22, double m31, double m32);
+ virtual void updateLineDash(GfxState *state);
+ virtual void updateFlatness(GfxState *state);
+ virtual void updateLineJoin(GfxState *state);
+ virtual void updateLineCap(GfxState *state);
+ virtual void updateMiterLimit(GfxState *state);
+ virtual void updateLineWidth(GfxState *state);
+ virtual void updateFillColor(GfxState *state);
+ virtual void updateStrokeColor(GfxState *state);
+
+ //----- update text state
+ virtual void updateFont(GfxState *state);
+
+ //----- path painting
+ virtual void stroke(GfxState *state);
+ virtual void fill(GfxState *state);
+ virtual void eoFill(GfxState *state);
+
+ //----- path clipping
+ virtual void clip(GfxState *state);
+ virtual void eoClip(GfxState *state);
+ virtual void clipToStrokePath(GfxState *state);
+
+ //----- text drawing
+ virtual void drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, int nBytes, Unicode *u, int uLen);
+ virtual GBool beginType3Char(GfxState *state, double x, double y,
+ double dx, double dy,
+ CharCode code, Unicode *u, int uLen);
+ virtual void endType3Char(GfxState *state);
+ virtual void endTextObject(GfxState *state);
+
+ //----- image drawing
+ virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GBool invert,
+ GBool interpolate,
+ GBool inlineImg);
+ virtual void drawImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GfxImageColorMap *colorMap,
+ GBool interpolate,
+ int *maskColors, GBool inlineImg);
+ virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height,
+ GfxImageColorMap *colorMap,
+ GBool interpolate,
+ Stream *maskStr, int maskWidth, int maskHeight,
+ GBool maskInvert, GBool maskeInterpolate);
+ virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height,
+ GfxImageColorMap *colorMap,
+ GBool interpolate,
+ Stream *maskStr,
+ int maskWidth, int maskHeight,
+ GfxImageColorMap *maskColorMap,
+ GBool maskInterpolate);
+
+ //----- Type 3 font operators
+ virtual void type3D0(GfxState *state, double wx, double wy);
+ virtual void type3D1(GfxState *state, double wx, double wy,
+ double llx, double lly, double urx, double ury);
+
+ //----- special access
+
+ // Called to indicate that a new PDF document has been loaded.
+ void startDoc(XRef *xrefA);
+
+ GBool isReverseVideo() { return reverseVideo; }
+
+ // Get the bitmap and its size.
+ SplashBitmap *getBitmap() { return bitmap; }
+ int getBitmapWidth();
+ int getBitmapHeight();
+
+ // Get the Splash object.
+ OPRS *getOPRS() { return oprs; }
+
+ // XOR a rectangular region in the bitmap with <pattern>. <pattern>
+ // is passed to Splash::setFillPattern, so it should not be used
+ // after calling this function.
+ void xorRectangle(int x0, int y0, int x1, int y1, SplashPattern *pattern);
+
+ // Set the Splash fill color.
+ void setFillColor(int r, int g, int b);
+
+ void setUnderlayCbk(void (*cbk)(void *data), void *data)
+ { underlayCbk = cbk; underlayCbkData = data; }
+
+ int OPVPStartJob(char *jobInfo);
+ int OPVPEndJob();
+ int OPVPStartDoc(char *docInfo);
+ int OPVPEndDoc();
+ int OPVPStartPage(char *pageInfo, int rasterWidth, int rasterHeight);
+ int OPVPEndPage();
+ int outSlice();
+ virtual void psXObject(Stream *psStream, Stream *level1Stream);
+ void setScale(double w, double h, double leftMarginA, double bottomMarginA,
+ int rotateA, int yoffsetA, int sliceHeightA);
+
+private:
+
+ SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
+ OPVPSplashPath *convertPath(GfxState *state, GfxPath *path);
+ void drawType3Glyph(T3FontCache *t3Font,
+ T3FontCacheTag *tag, Guchar *data,
+ double x, double y);
+ void patternFillChar(GfxState *state,
+ double x, double y, CharCode code);
+
+ static GBool imageMaskSrc(void *data, SplashColorPtr line);
+ static GBool imageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine);
+ static GBool alphaImageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine);
+ static GBool maskedImageSrc(void *data, SplashColorPtr line,
+ Guchar *alphaLine);
+
+ OPVPSplashPath *bitmapToPath(SplashBitmap *bitmapA, int width, int height);
+ void closeAllSubPath(OPVPSplashPath *path);
+ void patternFillImageMask(GfxState *state,
+ SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat);
+ void doUpdateFont(GfxState *state);
+ void transLineDash(GfxState *state, SplashCoord **adash,
+ int *adashLength, SplashCoord *aphase);
+ void updateSplashLineDash(GfxState *state, Splash *splash);
+
+ SplashColorMode colorMode;
+ GBool reverseVideo; // reverse video mode
+ SplashColor paperColor; // paper color
+
+ XRef *xref; // xref table for current document
+
+ SplashBitmap *bitmap;
+ OPRS *oprs;
+ SplashFontEngine *fontEngine;
+
+ T3FontCache * // Type 3 font cache
+ t3FontCache[splashOutT3FontCacheSize];
+ int nT3Fonts; // number of valid entries in t3FontCache
+ T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack
+
+ SplashFont *font; // current font
+ GBool needFontUpdate; // set when the font needs to be updated
+ OPVPSplashPath *textClipPath; // clipping path built with text object
+
+ void (*underlayCbk)(void *data);
+ void *underlayCbkData;
+ double fontMat[4];
+ double scaleWidth, scaleHeight;
+ int paperWidth, paperHeight;
+ double leftMargin, bottomMargin;
+ int rotate;
+ int yoffset;
+ int sliceHeight;
+};
+
+#endif
--- /dev/null
+//========================================================================
+//
+// OPRS.cc
+//
+//========================================================================
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <stdarg.h>
+#if defined __OpenBSD__
+#include <sys/endian.h>
+#if BYTE_ORDER == BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+#endif
+
+#include "goo/gmem.h"
+#include "splash/SplashErrorCodes.h"
+#include "splash/SplashMath.h"
+#include "splash/SplashBitmap.h"
+#include "splash/SplashState.h"
+#include "splash/SplashXPathScanner.h"
+#include "splash/SplashPattern.h"
+#include "splash/SplashScreen.h"
+#include "splash/SplashFont.h"
+#include "splash/SplashGlyphBitmap.h"
+#include "splash/Splash.h"
+#include "OPVPSplash.h"
+#include "OPVPSplashClip.h"
+#include "OPVPSplashPath.h"
+#include "OPVPSplashXPath.h"
+#include "OPRS.h"
+
+//------------------------------------------------------------------------
+// Splash
+//------------------------------------------------------------------------
+
+#define SPLASH(x) (rasterMode ? (splash->x) : (opvpSplash->x))
+
+OPRS::OPRS()
+{
+ opvp = 0;
+ splash = 0;
+ opvpSplash = 0;
+ rasterMode = gFalse;
+}
+
+int OPRS::setBitmap(SplashBitmap *bitmapA) {
+ if (splash != 0) {
+ delete splash;
+ }
+ splash = new Splash(bitmapA, gFalse);
+ rasterMode = gTrue;
+ return 0;
+}
+
+OPRS::~OPRS() {
+ if (splash != 0) {
+ delete splash;
+ splash = 0;
+ }
+ if (opvpSplash != 0) {
+ opvpSplash->restoreAllDriverState();
+ delete opvpSplash;
+ opvpSplash = 0;
+ }
+}
+
+//------------------------------------------------------------------------
+// state read
+//------------------------------------------------------------------------
+
+
+SplashPattern *OPRS::getStrokePattern() {
+ return SPLASH(getStrokePattern());
+}
+
+SplashPattern *OPRS::getFillPattern() {
+ return SPLASH(getFillPattern());
+}
+
+SplashScreen *OPRS::getScreen() {
+ return SPLASH(getScreen());
+}
+
+SplashCoord OPRS::getLineWidth() {
+ return SPLASH(getLineWidth());
+}
+
+int OPRS::getLineCap() {
+ return SPLASH(getLineCap());
+}
+
+int OPRS::getLineJoin() {
+ return SPLASH(getLineJoin());
+}
+
+SplashCoord OPRS::getMiterLimit() {
+ return SPLASH(getMiterLimit());
+}
+
+SplashCoord OPRS::getFlatness() {
+ return 1;
+}
+
+SplashCoord *OPRS::getLineDash() {
+ return SPLASH(getLineDash());
+}
+
+int OPRS::getLineDashLength() {
+ return SPLASH(getLineDashLength());
+}
+
+SplashCoord OPRS::getLineDashPhase() {
+ return SPLASH(getLineDashPhase());
+}
+
+OPVPSplashClip *OPRS::getClip() {
+ if (rasterMode) {
+ SplashClip *sclip = splash->getClip();
+ OPVPSplashClip *r = new OPVPSplashClip(sclip);
+ delete sclip;
+ return r;
+ } else {
+ return opvpSplash->getClip();
+ }
+}
+
+//------------------------------------------------------------------------
+// state write
+//------------------------------------------------------------------------
+
+void OPRS::setStrokePattern(SplashPattern *strokePattern) {
+ SPLASH(setStrokePattern(strokePattern));
+}
+
+void OPRS::setFillPattern(SplashPattern *fillPattern) {
+ SPLASH(setFillPattern(fillPattern));
+}
+
+void OPRS::setScreen(SplashScreen *screen) {
+ SPLASH(setScreen(screen));
+}
+
+void OPRS::setLineWidth(SplashCoord lineWidth) {
+ SPLASH(setLineWidth(lineWidth));
+}
+
+void OPRS::setMiterLimit(SplashCoord miterLimit) {
+ SPLASH(setMiterLimit(miterLimit));
+}
+
+void OPRS::setLineCap(int lineCap) {
+ SPLASH(setLineCap(lineCap));
+}
+
+void OPRS::setLineJoin(int lineJoin) {
+ SPLASH(setLineJoin(lineJoin));
+}
+
+void OPRS::setFlatness(SplashCoord flatness) {
+/* ignore flatness */
+}
+
+void OPRS::setLineDash(SplashCoord *lineDash, int lineDashLength,
+ SplashCoord lineDashPhase) {
+ SPLASH(setLineDash(lineDash,lineDashLength,lineDashPhase));
+}
+
+SplashError OPRS::clipToPath(OPVPSplashPath *path, GBool eo) {
+ return SPLASH(clipToPath(path,eo));
+}
+
+//------------------------------------------------------------------------
+// state save/restore
+//------------------------------------------------------------------------
+
+void OPRS::saveState() {
+ SPLASH(saveState());
+}
+
+SplashError OPRS::restoreState() {
+ SPLASH(restoreState());
+ return splashOk;
+}
+
+//------------------------------------------------------------------------
+// drawing operations
+//------------------------------------------------------------------------
+
+void OPRS::clear(SplashColor color) {
+ SPLASH(clear(color));
+}
+
+SplashError OPRS::stroke(OPVPSplashPath *path) {
+ return SPLASH(stroke(path));
+}
+
+SplashError OPRS::fill(OPVPSplashPath *path, GBool eo) {
+ return SPLASH(fill(path,eo));
+}
+
+SplashError OPRS::fillChar(SplashCoord x, SplashCoord y,
+ int c, SplashFont *font, Unicode *u,
+ double *fontMat) {
+ if (rasterMode) {
+ return splash->fillChar(x,y,c,font);
+ } else {
+ return opvpSplash->fillChar(x,y,c,font,u,fontMat);
+ }
+}
+
+SplashError OPRS::fillGlyph(SplashCoord x, SplashCoord y,
+ SplashGlyphBitmap *glyph) {
+ SPLASH(fillGlyph(x,y,glyph));
+ return splashOk;
+}
+
+SplashError OPRS::fillImageMask(SplashImageMaskSource src, void *srcData,
+ int w, int h, SplashCoord *mat, GBool glyphMode) {
+ return SPLASH(fillImageMask(src,srcData,w,h,mat,glyphMode));
+}
+
+SplashError OPRS::drawImage(SplashImageSource src, void *srcData,
+ SplashColorMode srcMode, GBool srcAlpha,
+ int w, int h, SplashCoord *mat) {
+ if (rasterMode) {
+ return splash->drawImage(src,srcData,srcMode,srcAlpha,w,h,mat);
+ } else {
+ return opvpSplash->drawImage(src,srcData,srcMode,srcAlpha,w,h,mat);
+ }
+}
+
+/*
+ * initialize and load vector-driver
+ */
+int OPRS::init(const char *driverName, int outputFD,
+ const char *printerModel, int nOptions,
+ const char *optionKeys[], const char *optionVals[])
+{
+ opvp = OPVPWrapper::loadDriver(driverName,outputFD,printerModel);
+ if (opvp == 0) return -1;
+ rasterMode = gFalse;
+ if (!rasterMode) {
+ opvpSplash = new OPVPSplash(opvp,nOptions,
+ optionKeys, optionVals);
+ }
+ return 0;
+}
+
+int OPRS::OPVPStartJob(char *jobInfo)
+{
+ if (!opvp->supportStartJob) {
+ return 0;
+ }
+ return opvp->StartJob((const opvp_char_t *)jobInfo);
+}
+
+int OPRS::OPVPEndJob()
+{
+ if (!opvp->supportEndJob) {
+ return 0;
+ }
+ return opvp->EndJob();
+}
+
+int OPRS::OPVPStartDoc(char *docInfo)
+{
+ if (!opvp->supportStartDoc) {
+ return 0;
+ }
+ return opvp->StartDoc((const opvp_char_t *)docInfo);
+}
+
+int OPRS::OPVPEndDoc()
+{
+ if (!opvp->supportEndDoc) {
+ return 0;
+ }
+ return opvp->EndDoc();
+}
+
+int OPRS::OPVPStartPage(char *pageInfo, int rasterWidth)
+{
+ int r;
+
+ if (opvp->supportStartPage) {
+ if ((r = opvp->StartPage((const opvp_char_t *)pageInfo)) < 0) {
+ return r;
+ }
+ }
+ if (rasterMode) {
+ if (!opvp->supportStartRaster) {
+ error("No StartRaster error in raster mode\n");
+ return -1;
+ }
+ if (opvp->supportSetCurrentPoint) {
+ opvp_fix_t x,y;
+
+ OPVP_F2FIX(0.0,x);
+ OPVP_F2FIX(0.0,y);
+ opvp->SetCurrentPoint(x,y);
+ }
+ opvp->StartRaster(rasterWidth);
+ }
+ return 0;
+}
+
+int OPRS::OPVPEndPage()
+{
+ int r;
+
+ if (rasterMode) {
+ if (!opvp->supportEndRaster) {
+ error("No EndRaster error in raster mode\n");
+ return -1;
+ }
+ opvp->EndRaster();
+ }
+ if (opvp->supportEndPage) {
+ if ((r = opvp->EndPage()) < 0) {
+ return r;
+ }
+ }
+ return splashOk;
+}
+
+unsigned char *OPRS::getScanLineDataMono1(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth)
+{
+ int n = (rasterWidth+7)/8;
+
+ memcpy(dst,bitmap,n);
+ return bitmap+n;
+}
+
+unsigned char *OPRS::getScanLineDataMono8(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth)
+{
+ memcpy(dst,bitmap,rasterWidth);
+ return bitmap+rasterWidth;
+}
+
+unsigned char *OPRS::getScanLineDataRGB8(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth)
+{
+ int i;
+
+ for (i = 0;i < rasterWidth;i++) {
+#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
+ bitmap++;
+ *dst++ = *bitmap++;
+ *dst++ = *bitmap++;
+ *dst++ = *bitmap++;
+#else
+ dst[2] = *bitmap++;
+ dst[1] = *bitmap++;
+ dst[0] = *bitmap++;
+ bitmap++;
+ dst += 3;
+#endif
+ }
+ return bitmap;
+}
+
+unsigned char *OPRS::getScanLineDataBGR8Packed(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth)
+{
+ memcpy(dst,bitmap,rasterWidth*3);
+ return bitmap+rasterWidth*3;
+}
+
+OPRS::GetScanLineDataFunT OPRS::getGetScanLineDataFun(SplashBitmap *bitmap)
+{
+ switch (bitmap->getMode()) {
+ case splashModeMono1:
+ return getScanLineDataMono1;
+ case splashModeMono8:
+ return getScanLineDataMono8;
+ case splashModeRGB8:
+ return getScanLineDataRGB8;
+ default:
+ OPRS::error("Unknown bitmap mode\n");
+ break;
+ }
+ return getScanLineDataMono8;
+}
+
+int OPRS::getRasterSize(SplashBitmap *bitmap)
+{
+ int rw = bitmap->getWidth();
+
+ switch (bitmap->getMode()) {
+ case splashModeMono1:
+ return (rw+7)/8;
+ case splashModeMono8:
+ return rw;
+ case splashModeRGB8:
+ return rw*3;
+ default:
+ OPRS::error("Unknown bitmap mode\n");
+ break;
+ }
+ return 0;
+}
+
+GBool OPRS::checkAll1(unsigned char *bp, int n, int width, int mode)
+{
+ int lastbytemask = 0xff;
+ int i;
+
+ if (mode == splashModeMono1) {
+ lastbytemask <<= (width & 0x7);
+ lastbytemask &= 0xff;
+ }
+ for (i = 0;i < n-1;i++) {
+ if (*bp++ != 0xff) return gFalse;
+ }
+ return (*bp & lastbytemask) == lastbytemask;
+}
+
+int OPRS::outSlice()
+{
+ if (rasterMode) {
+ /* out bitmap */
+ int rasterWidth;
+ int nScanLines;
+ int rasterSize;
+ unsigned char *p;
+ int i;
+ SplashBitmap *bitmap;
+ SplashColorPtr cp;
+ unsigned char *bp;
+ GetScanLineDataFunT fun;
+ int mode;
+
+ if (!opvp->supportStartRaster || !opvp->supportTransferRasterData
+ || !opvp->supportEndRaster) {
+ OPRS::error("No raster supporting printer driver\n");
+ return -1;
+ }
+
+ bitmap = splash->getBitmap();
+ rasterWidth = bitmap->getWidth();
+ nScanLines = bitmap->getHeight();
+ rasterSize = getRasterSize(bitmap);
+ if ((bp = new unsigned char[rasterSize]) == 0) {
+ OPRS::error("Not enough memory\n");
+ return -1;
+ }
+ cp = (bitmap->getDataPtr());
+ p = reinterpret_cast<unsigned char *>(cp);
+ fun = getGetScanLineDataFun(bitmap);
+ mode = bitmap->getMode();
+ for (i = 0;i < nScanLines;i++) {
+ p = (*fun)(bp,p,rasterWidth);
+ if (opvp->supportSkipRaster
+ && checkAll1(bp,rasterSize,rasterWidth,mode)) {
+ /* all white, skip raster */
+ opvp->SkipRaster(1);
+ } else {
+ opvp->TransferRasterData(rasterSize,bp);
+ }
+ }
+ delete[] bp;
+ }
+ return 0;
+}
+
+int OPRS::setColorMode(int colorModeA, GBool colorProfile)
+{
+ opvp_cspace_t cspace = OPVP_CSPACE_STANDARDRGB;
+
+ if (opvp->supportGetColorSpace) opvp->GetColorSpace(&cspace);
+ switch (cspace){
+ case OPVP_CSPACE_BW:
+ if (colorModeA != splashModeMono1) {
+ OPRS::error("not mono mode is specified on a monochrome printer\n");
+ return -1;
+ }
+ break;
+ case OPVP_CSPACE_DEVICEGRAY:
+ if (colorModeA != splashModeMono1 && colorModeA != splashModeMono8) {
+ OPRS::error("colorMode is specified on not a color printer\n");
+ return -1;
+ }
+ break;
+ case OPVP_CSPACE_DEVICERGB:
+ if (colorProfile) break;
+ default:
+ /* rgb color */
+ if (colorProfile) {
+ /* try set colorspace to DEVICERGB */
+ if (opvp->supportSetColorSpace) opvp->SetColorSpace(
+ OPVP_CSPACE_DEVICERGB);
+ if (opvp->supportGetColorSpace) opvp->GetColorSpace(&cspace);
+ if (cspace == OPVP_CSPACE_DEVICERGB) break;
+ /* fail to set, fall through */
+ }
+ if (opvp->supportSetColorSpace) opvp->SetColorSpace(
+ OPVP_CSPACE_STANDARDRGB);
+ break;
+ }
+ if (!rasterMode) {
+ opvpSplash->setColorMode(colorModeA);
+ }
+ return 0;
+}
+
+SplashBitmap *OPRS::getBitmap()
+{
+ return SPLASH(getBitmap());
+}
+
+void OPRS::setDebugMode(GBool debugModeA)
+{
+ SPLASH(setDebugMode(debugModeA));
+}
+
+void OPRS::initGS(int colorMode, int w, int h, SplashColor paperColor)
+{
+ SplashColor color;
+
+ if (!rasterMode && opvp->supportInitGS) {
+ opvp->InitGS();
+ }
+ if (opvp->supportSetPaintMode) {
+ opvp->SetPaintMode(OPVP_PAINTMODE_TRANSPARENT);
+ }
+ switch (colorMode) {
+ case splashModeMono1: color[0] = 0; break;
+ case splashModeMono8: color[0] = 0; break;
+ case splashModeRGB8: color[0] = color[1] = color[2] = 0; break;
+ }
+ if (!rasterMode) {
+ opvpSplash->setStateBypass(gTrue);
+ }
+ SPLASH(setStrokePattern(new SplashSolidColor(color)));
+ SPLASH(setFillPattern(new SplashSolidColor(color)));
+ SPLASH(setLineCap(splashLineCapButt));
+ SPLASH(setLineJoin(splashLineJoinMiter));
+ SPLASH(setLineDash(0, 0, 0));
+ SPLASH(setLineWidth(0));
+ SPLASH(setMiterLimit(10));
+ SPLASH(setFlatness(1));
+ SPLASH(clipResetToRect(0,0,w-1,h-1));
+ SPLASH(clear(paperColor));
+ if (!rasterMode) {
+ opvpSplash->setStateBypass(gFalse);
+ }
+}
+
+void OPRS::error(const char *msg, ...)
+{
+ va_list args;
+
+ fprintf(stderr,"ERROR:OPRS:");
+ va_start(args, msg);
+ vfprintf(stderr, msg, args);
+ va_end(args);
+ fflush(stderr);
+}
+
+void OPRS::endPage()
+{
+ /* restore state */
+ while (SPLASH(restoreState()) == splashOk);
+ if (!rasterMode) {
+ opvpSplash->endPage();
+ }
+}
+
+void OPRS::setSoftMask(SplashBitmap *softMaskA)
+{
+ /* Soft Mask is not supported in vector mode. */
+ if (rasterMode) {
+ splash->setSoftMask(softMaskA);
+ }
+}
+
+SplashCoord *OPRS::getMatrix()
+{
+ return SPLASH(getMatrix());
+}
--- /dev/null
+//========================================================================
+//
+// OPRS.h
+//
+//========================================================================
+
+#ifndef OPRS_H
+#define OPRS_H
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "splash/SplashTypes.h"
+#include "opvp_common.h"
+#include "splash/Splash.h"
+#include "OPVPSplash.h"
+#include "OPVPWrapper.h"
+
+#define OPVP_BUFF_SIZE 256
+
+class SplashBitmap;
+class SplashGlyphBitmap;
+class SplashState;
+class SplashPattern;
+class SplashScreen;
+class OPVPSplashPath;
+class SplashXPath;
+class OPVPSplashClip;
+class SplashFont;
+
+//------------------------------------------------------------------------
+// OPRS
+//------------------------------------------------------------------------
+
+class OPRS {
+public:
+
+ static void error(const char *msg, ...);
+ OPRS();
+ ~OPRS();
+
+ int setBitmap(SplashBitmap *bitmapA);
+
+ //----- state read
+
+ SplashPattern *getStrokePattern();
+ SplashPattern *getFillPattern();
+ SplashScreen *getScreen();
+ SplashCoord getLineWidth();
+ int getLineCap();
+ int getLineJoin();
+ SplashCoord getMiterLimit();
+ SplashCoord getFlatness();
+ SplashCoord *getLineDash();
+ int getLineDashLength();
+ SplashCoord getLineDashPhase();
+ OPVPSplashClip *getClip();
+
+ //----- state write
+
+ void setStrokePattern(SplashPattern *strokeColor);
+ void setFillPattern(SplashPattern *fillColor);
+ void setScreen(SplashScreen *screen);
+ void setLineWidth(SplashCoord lineWidth);
+ void setMiterLimit(SplashCoord miterLimit);
+ void setLineCap(int lineCap);
+ void setLineJoin(int lineJoin);
+ void setFlatness(SplashCoord flatness);
+ // the <lineDash> array will be copied
+ void setLineDash(SplashCoord *lineDash, int lineDashLength,
+ SplashCoord lineDashPhase);
+ SplashError clipToPath(OPVPSplashPath *path, GBool eo);
+
+ //----- state save/restore
+
+ void saveState();
+ SplashError restoreState();
+
+ void setSoftMask(SplashBitmap *softMaskA);
+
+ //----- drawing operations
+
+ // Fill the bitmap with <color>. This is not subject to clipping.
+ void clear(SplashColor color);
+
+ // Stroke a path using the current stroke pattern.
+ SplashError stroke(OPVPSplashPath *path);
+
+ // Fill a path using the current fill pattern.
+ SplashError fill(OPVPSplashPath *path, GBool eo);
+
+ // Draw a character, using the current fill pattern.
+ SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font,
+ Unicode *u, double *fontMat);
+
+ // Draw a glyph, using the current fill pattern. This function does
+ // not free any data, i.e., it ignores glyph->freeData.
+ SplashError fillGlyph(SplashCoord x, SplashCoord y,
+ SplashGlyphBitmap *glyph);
+
+ // Draws an image mask using the fill color. This will read <w>*<h>
+ // pixels from <src>, in raster order, starting with the top line.
+ // "1" pixels will be drawn with the current fill color; "0" pixels
+ // are transparent. The matrix:
+ // [ mat[0] mat[1] 0 ]
+ // [ mat[2] mat[3] 0 ]
+ // [ mat[4] mat[5] 1 ]
+ // maps a unit square to the desired destination for the image, in
+ // PostScript style:
+ // [x' y' 1] = [x y 1] * mat
+ // Note that the Splash y axis points downward, and the image source
+ // is assumed to produce pixels in raster order, starting from the
+ // top line.
+ SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
+ int w, int h, SplashCoord *mat, GBool glyphMode);
+
+ // Draw an image. This will read <w>*<h> pixels from <src>, in
+ // raster order, starting with the top line. These pixels are
+ // assumed to be in the source mode, <srcMode>. The following
+ // combinations of source and target modes are supported:
+ // source target
+ // ------ ------
+ // Mono1 Mono1
+ // Mono8 Mono1 -- with dithering
+ // Mono8 Mono8
+ // RGB8 RGB8
+ // BGR8packed BGR8Packed
+ // The matrix behaves as for fillImageMask.
+ SplashError drawImage(SplashImageSource src, void *srcData,
+ SplashColorMode srcMode, GBool srcAlpha,
+ int w, int h, SplashCoord *mat);
+
+ //~ drawMaskedImage
+
+ //----- misc
+
+ // Return the associated bitmap.
+ SplashBitmap *getBitmap();
+
+ // Toggle debug mode on or off.
+ void setDebugMode(GBool debugModeA);
+
+ int init(const char *driverName, int outputFD,
+ const char *printerModel, int nOptions,
+ const char *optionKeys[], const char *optionVals[]);
+ void initGS(int colorMode, int w, int h, SplashColor paperColor);
+ int setColorMode(int colorModeA, GBool colorProfile);
+ int unloadVectorDriver();
+
+ int OPVPStartJob(char *jobInfo);
+ int OPVPEndJob();
+ int OPVPStartDoc(char *docInfo);
+ int OPVPEndDoc();
+ int OPVPStartPage(char *pageInfo, int rasterWidth);
+ int OPVPEndPage();
+ int outSlice();
+ Splash *getSplash() { return splash; }
+ int getRasterMode() { return rasterMode; }
+ void endPage();
+ SplashCoord *getMatrix();
+
+private:
+ int rasterMode;
+ OPVPSplash *opvpSplash;
+ Splash *splash;
+ OPVPWrapper *opvp;
+ int getRasterSize(SplashBitmap *bitmap);
+
+ typedef unsigned char *(*GetScanLineDataFunT)(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth);
+
+ static unsigned char *getScanLineDataMono1(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth);
+ static unsigned char *getScanLineDataMono8(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth);
+ static unsigned char *getScanLineDataRGB8(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth);
+ static unsigned char *getScanLineDataBGR8Packed(unsigned char *dst,
+ unsigned char *bitmap, int rasterWidth);
+
+ GetScanLineDataFunT getGetScanLineDataFun(SplashBitmap *bitmap);
+ GBool checkAll1(unsigned char *bp, int n, int width, int mode);
+};
+
+#endif
--- /dev/null
+//========================================================================
+//
+// OPVPSplash.cc
+//
+//========================================================================
+
+#include <config.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <limits.h>
+#include "goo/gmem.h"
+#include "splash/SplashErrorCodes.h"
+#include "splash/SplashMath.h"
+#include "splash/SplashBitmap.h"
+#include "splash/SplashXPathScanner.h"
+#include "splash/SplashPattern.h"
+#include "splash/SplashScreen.h"
+#include "splash/SplashFont.h"
+#include "splash/SplashGlyphBitmap.h"
+#include "splash/Splash.h"
+#include "OPRS.h"
+#include "OPVPSplashState.h"
+#include "OPVPSplash.h"
+#include "OPVPSplashPath.h"
+#include "OPVPSplashXPath.h"
+#include "OPVPSplashClip.h"
+
+//------------------------------------------------------------------------
+// OPVPSplash
+//------------------------------------------------------------------------
+
+inline void OPVPSplash::transform(SplashCoord *matrix,
+ SplashCoord xi, SplashCoord yi,
+ SplashCoord *xo, SplashCoord *yo) {
+ // [ m[0] m[1] 0 ]
+ // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ]
+ // [ m[4] m[5] 1 ]
+ *xo = xi * matrix[0] + yi * matrix[2] + matrix[4];
+ *yo = xi * matrix[1] + yi * matrix[3] + matrix[5];
+}
+
+OPVPSplash::OPVPSplash(OPVPWrapper *opvpA,
+ int nOptions, const char *optionKeys[], const char *optionVals[])
+{
+ const char *opv;
+
+ opvp = opvpA;
+ // with default screen params
+ state = new OPVPSplashState(0,0,gFalse,(SplashScreenParams *)NULL);
+ debugMode = gFalse;
+ stateBypass = gFalse;
+ clipPath = 0;
+ if (getOption("OPVP_OLDLIPSDRIVER",nOptions,
+ optionKeys,optionVals) != NULL) {
+ oldLipsDriver = gTrue;
+ } else {
+ oldLipsDriver = gFalse;
+ }
+ if (getOption("OPVP_CLIPPATHNOTSAVED",nOptions,
+ optionKeys,optionVals) != NULL) {
+ clipPathNotSaved = gTrue;
+ } else {
+ clipPathNotSaved = gFalse;
+ }
+ if (getOption("OPVP_NOSHEARIMAGE",nOptions,
+ optionKeys,optionVals) != NULL) {
+ noShearImage = gTrue;
+ } else {
+ noShearImage = gFalse;
+ }
+ if (getOption("OPVP_NOLINESTYLE",nOptions,
+ optionKeys,optionVals) != NULL) {
+ noLineStyle = gTrue;
+ } else {
+ noLineStyle = gFalse;
+ }
+ if (!opvpA->supportSetLineStyle || !opvpA->supportSetLineDash
+ || !opvpA->supportSetLineDashOffset) {
+ noLineStyle = gTrue;
+ }
+ if (getOption("OPVP_NOCLIPPATH",nOptions,
+ optionKeys,optionVals) != NULL) {
+ noClipPath = gTrue;
+ } else {
+ noClipPath = gFalse;
+ }
+ if (getOption("OPVP_IGNOREMITERLIMIT",nOptions,
+ optionKeys,optionVals) != NULL) {
+ ignoreMiterLimit = gTrue;
+ } else {
+ ignoreMiterLimit = gFalse;
+ }
+ if (getOption("OPVP_NOMITERLIMIT",nOptions,
+ optionKeys,optionVals) != NULL) {
+ noMiterLimit = gTrue;
+ } else {
+ noMiterLimit = gFalse;
+ }
+ if (!opvpA->supportSetMiterLimit) {
+ noMiterLimit = gTrue;
+ }
+ if ((opv = getOption("OPVP_BITMAPCHARTHRESHOLD",nOptions,
+ optionKeys,optionVals)) != NULL) {
+ bitmapCharThreshold = atoi(opv);
+ } else {
+ bitmapCharThreshold = OPVP_BITMAPCHAR_THRESHOLD;
+ }
+ if ((opv = getOption("OPVP_MAXCLIPPATHLENGTH",nOptions,
+ optionKeys,optionVals)) != NULL) {
+ maxClipPathLength = atoi(opv);
+ } else {
+ maxClipPathLength = OPVP_MAX_CLIPPATH_LENGTH;
+ }
+ if ((opv = getOption("OPVP_MAXFILLPATHLENGTH",nOptions,
+ optionKeys,optionVals)) != NULL) {
+ maxFillPathLength = atoi(opv);
+ } else {
+ maxFillPathLength = OPVP_MAX_FILLPATH_LENGTH;
+ }
+ if (getOption("OPVP_NOIMAGEMASK",nOptions,
+ optionKeys,optionVals) != NULL) {
+ noImageMask = gTrue;
+ } else {
+ noImageMask = gFalse;
+ }
+ if (getOption("OPVP_NOBITMAPCHAR",nOptions,
+ optionKeys,optionVals) != NULL) {
+ bitmapCharThreshold = 0;
+ }
+ if (!opvpA->supportSetClipPath) {
+ noClipPath = gTrue;
+ }
+ savedNoClipPath = noClipPath;
+ saveDriverStateCount = 0;
+ if (noImageMask) {
+ /* We draw bitmapChar with imageMask feature.
+ So, when noImageMask, noBitmapChar */
+ bitmapCharThreshold = 0;
+ }
+#ifdef OPTION_DEBUG
+fprintf(stderr,"noClipPath=%d\n",noClipPath);
+fprintf(stderr,"oldLipsDriver=%d\n",oldLipsDriver);
+fprintf(stderr,"noLineStyle=%d\n",noLineStyle);
+fprintf(stderr,"noMiterLimit=%d\n",noMiterLimit);
+fprintf(stderr,"ignoreMiterLimit=%d\n",ignoreMiterLimit);
+fprintf(stderr,"noShearImage=%d\n",noShearImage);
+fprintf(stderr,"clipPathNotSaved=%d\n",clipPathNotSaved);
+fprintf(stderr,"bitmapCharThreshold=%d\n",bitmapCharThreshold);
+fprintf(stderr,"maxClipPathLength=%d\n",maxClipPathLength);
+#endif
+}
+
+OPVPSplash::~OPVPSplash()
+{
+ while (state->next) {
+ restoreState();
+ }
+ delete state;
+ if (opvp->supportClosePrinter) {
+ opvp->ClosePrinter();
+ }
+ delete opvp;
+}
+
+//------------------------------------------------------------------------
+// state read
+//------------------------------------------------------------------------
+
+
+SplashPattern *OPVPSplash::getStrokePattern() {
+ return state->strokePattern;
+}
+
+SplashPattern *OPVPSplash::getFillPattern() {
+ return state->fillPattern;
+}
+
+SplashScreen *OPVPSplash::getScreen() {
+ return state->screen;
+}
+
+SplashCoord OPVPSplash::getLineWidth() {
+ return state->lineWidth;
+}
+
+int OPVPSplash::getLineCap() {
+ return state->lineCap;
+}
+
+int OPVPSplash::getLineJoin() {
+ return state->lineJoin;
+}
+
+SplashCoord OPVPSplash::getMiterLimit() {
+ return state->miterLimit;
+}
+
+SplashCoord OPVPSplash::getFlatness() {
+ return state->flatness;
+}
+
+SplashCoord *OPVPSplash::getLineDash() {
+ return state->lineDash;
+}
+
+int OPVPSplash::getLineDashLength() {
+ return state->lineDashLength;
+}
+
+SplashCoord OPVPSplash::getLineDashPhase() {
+ return state->lineDashPhase;
+}
+
+OPVPSplashClip *OPVPSplash::getClip() {
+ return state->clip;
+}
+
+//------------------------------------------------------------------------
+// state write
+//------------------------------------------------------------------------
+
+opvp_cspace_t OPVPSplash::getOPVPColorSpace()
+{
+ switch (colorMode) {
+ case splashModeMono1:
+ return OPVP_CSPACE_BW;
+ break;
+ case splashModeMono8:
+ return OPVP_CSPACE_DEVICEGRAY;
+ break;
+ case splashModeRGB8:
+ default:
+ break;
+ }
+ return OPVP_CSPACE_STANDARDRGB;
+}
+
+void OPVPSplash::makeBrush(SplashPattern *pattern, opvp_brush_t *brush)
+{
+ brush->colorSpace = getOPVPColorSpace();
+ brush->pbrush = NULL;
+ brush->color[3] = -1;
+ brush->xorg = brush->yorg = 0;
+ if (pattern == NULL) {
+ /* set default black color */
+ brush->color[2] = 0;
+ brush->color[1] = 0;
+ brush->color[0] = 0;
+ } else if (typeid(*pattern) == typeid(SplashSolidColor)) {
+ /* solid color */
+ SplashColor color;
+
+ pattern->getColor(0,0,color);
+ switch (colorMode) {
+ case splashModeMono1:
+ brush->color[2] = color[0];
+ brush->color[1] = 0;
+ brush->color[0] = 0;
+ break;
+ case splashModeMono8:
+ brush->color[2] = color[0];
+ brush->color[1] = 0;
+ brush->color[0] = 0;
+ break;
+ case splashModeRGB8:
+ brush->color[2] = splashRGB8R(color);
+ brush->color[1] = splashRGB8G(color);
+ brush->color[0] = splashRGB8B(color);
+ break;
+ default:
+ OPRS::error("Unknown color mode\n");
+ brush->color[2] = splashRGB8R(color);
+ brush->color[1] = splashRGB8G(color);
+ brush->color[0] = splashRGB8B(color);
+ break;
+ }
+ } else {
+ /* error */
+ return;
+ }
+}
+
+GBool OPVPSplash::equalPattern(SplashPattern *pat1, SplashPattern *pat2)
+{
+ SplashColor c1, c2;
+ if (pat1 == NULL || pat2 == NULL) {
+ return pat1 == pat2;
+ }
+ if (typeid(*pat1) != typeid(*pat2)) return gFalse;
+
+ pat1->getColor(0,0,c1);
+ pat2->getColor(0,0,c2);
+ switch (colorMode) {
+ case splashModeMono1:
+ return c1[0] == c2[0];
+ break;
+ case splashModeMono8:
+ return c1[0] == c2[0];
+ break;
+ case splashModeRGB8:
+ return c1[0] == c2[0] && c1[1] == c2[1] && c1[2] == c2[2];
+ break;
+ default:
+ break;
+ }
+ return gTrue;
+}
+
+void OPVPSplash::setStrokePattern(SplashPattern *strokePattern) {
+ opvp_brush_t brush;
+
+ if (!stateBypass && equalPattern(strokePattern,state->strokePattern)) {
+ delete strokePattern;
+ return;
+ }
+ state->setStrokePattern(strokePattern);
+ makeBrush(strokePattern,&brush);
+ if (opvp->SetStrokeColor(&brush) != 0) {
+ OPRS::error("SetStrokeColor error\n");
+ return;
+ }
+}
+
+void OPVPSplash::setFillPattern(SplashPattern *fillPattern) {
+ opvp_brush_t brush;
+
+ if (!stateBypass && equalPattern(fillPattern,state->fillPattern)) {
+ delete fillPattern;
+ return;
+ }
+ state->setFillPattern(fillPattern);
+ makeBrush(fillPattern,&brush);
+ if (opvp->SetFillColor(&brush) != 0) {
+ OPRS::error("SetFillColor error\n");
+ return;
+ }
+}
+
+void OPVPSplash::setScreen(SplashScreen *screen) {
+ state->setScreen(screen);
+}
+
+void OPVPSplash::setLineWidth(SplashCoord lineWidth) {
+ if (stateBypass || state->lineWidth != lineWidth) {
+ opvp_fix_t width;
+
+ state->lineWidth = lineWidth;
+ OPVP_F2FIX(lineWidth,width);
+ if (opvp->SetLineWidth(width) < 0) {
+ OPRS::error("SetLineWidth error\n");
+ return;
+ }
+ }
+}
+
+void OPVPSplash::setLineCap(int lineCap) {
+ if (stateBypass || state->lineCap != lineCap) {
+ opvp_linecap_t cap;
+
+ state->lineCap = lineCap;
+ switch (lineCap) {
+ case splashLineCapButt:
+ cap = OPVP_LINECAP_BUTT;
+ break;
+ case splashLineCapRound:
+ cap = OPVP_LINECAP_ROUND;
+ break;
+ case splashLineCapProjecting:
+ cap = OPVP_LINECAP_SQUARE;
+ break;
+ default:
+ /* error */
+ cap = OPVP_LINECAP_BUTT;
+ break;
+ }
+ if (opvp->SetLineCap(cap) < 0) {
+ OPRS::error("SetLineCap error\n");
+ return;
+ }
+ }
+}
+
+void OPVPSplash::setLineJoin(int lineJoin) {
+ if (stateBypass || state->lineJoin != lineJoin) {
+ opvp_linejoin_t join;
+
+ state->lineJoin = lineJoin;
+ switch (lineJoin) {
+ case splashLineJoinMiter:
+ join = OPVP_LINEJOIN_MITER;
+ break;
+ case splashLineJoinRound:
+ join = OPVP_LINEJOIN_ROUND;
+ break;
+ case splashLineJoinBevel:
+ join = OPVP_LINEJOIN_BEVEL;
+ break;
+ default:
+ /* error */
+ join = OPVP_LINEJOIN_MITER;
+ break;
+ }
+ if (opvp->SetLineJoin(join) < 0) {
+ OPRS::error("SetLineJoin error\n");
+ return;
+ }
+ }
+}
+
+void OPVPSplash::setMiterLimit(SplashCoord miterLimit) {
+ if (stateBypass || state->miterLimit != miterLimit) {
+ opvp_fix_t limit;
+
+ state->miterLimit = miterLimit;
+ if (noMiterLimit) return;
+ if (oldLipsDriver) {
+ /* for old driver for lips */
+ /* miterLimit is length/2 */
+ miterLimit = miterLimit*state->lineWidth*0.5;
+ }
+ OPVP_F2FIX(miterLimit,limit);
+ if (opvp->SetMiterLimit(limit) < 0) {
+ OPRS::error("SetMiterLimit error\n");
+ return;
+ }
+ }
+}
+
+void OPVPSplash::setFlatness(SplashCoord flatness) {
+ if (flatness < 1) {
+ state->flatness = 1;
+ } else {
+ state->flatness = flatness;
+ }
+}
+
+void OPVPSplash::setLineDash(SplashCoord *lineDash, int lineDashLength,
+ SplashCoord lineDashPhase) {
+ int i;
+ opvp_fix_t *pdash;
+ GBool equal;
+
+ if (stateBypass || lineDash != state->lineDash) {
+ if (lineDash == NULL || lineDashLength == 0) {
+ if (!noLineStyle
+ && opvp->SetLineStyle(OPVP_LINESTYLE_SOLID) < 0) {
+ OPRS::error("SetLineStyle error\n");
+ return;
+ }
+ state->setLineDash(lineDash, lineDashLength, lineDashPhase);
+ return;
+ } else if (stateBypass || state->lineDash == NULL) {
+ if (!noLineStyle
+ && opvp->SetLineStyle(OPVP_LINESTYLE_DASH) < 0) {
+ OPRS::error("SetLineStyle error\n");
+ return;
+ }
+ }
+ }
+ if (lineDash == NULL || lineDashLength == 0) return;
+ if (!noLineStyle) {
+ equal = (state->lineDash != NULL);
+ pdash = new opvp_fix_t[lineDashLength];
+ for (i = 0;i < lineDashLength;i++) {
+ if (equal && lineDash[i] != state->lineDash[i]) equal = gFalse;
+ OPVP_F2FIX(lineDash[i],pdash[i]);
+ }
+ if (!equal && opvp->SetLineDash(lineDashLength,pdash) < 0) {
+ OPRS::error("SetLineDash error\n");
+ goto err;
+ }
+ if (stateBypass || lineDashPhase != state->lineDashPhase) {
+ opvp_fix_t offset;
+
+ OPVP_F2FIX(lineDashPhase,offset);
+ if (opvp->SetLineDashOffset(offset) < 0) {
+ OPRS::error("SetLineDashOffset error\n");
+ goto err;
+ }
+ }
+err:
+ delete[] pdash;
+ }
+ state->setLineDash(lineDash, lineDashLength, lineDashPhase);
+}
+
+SplashError OPVPSplash::doClipPath(OPVPSplashPath *path, GBool eo,
+ OPVPClipPath *prevClip)
+{
+ SplashError result;
+
+ if (path->getLength() > maxClipPathLength) {
+ if (!noClipPath) {
+ if (prevClip != 0 &&
+ prevClip->getPath()->getLength() <= maxClipPathLength) {
+ /* previous clipping is printer clipping */
+ if (opvp->ResetClipPath() != 0) {
+ OPRS::error("ResetClipPath error\n");
+ return splashErrOPVP;
+ }
+ }
+ noClipPath = gTrue;
+ }
+ } else {
+ noClipPath = savedNoClipPath;
+ }
+ if (!noClipPath && path->getLength() > 0) {
+ /* when path->length == 0, no drawable arae, and no output
+ so, it isn't need to set ClipPath */
+ if ((result = path->makePath(opvp)) != splashOk) {
+ return result;
+ }
+ if (opvp->SetClipPath(
+ eo ? OPVP_CLIPRULE_EVENODD : OPVP_CLIPRULE_WINDING) < 0) {
+ OPRS::error("SetClipPath error\n");
+ return splashErrOPVP;
+ }
+ }
+ return splashOk;
+}
+
+SplashError OPVPSplash::makeRectanglePath(SplashCoord x0,
+ SplashCoord y0, SplashCoord x1, SplashCoord y1, OPVPSplashPath **p)
+{
+ SplashError result;
+
+ *p = new OPVPSplashPath();
+ if ((result = (*p)->moveTo(x0,y0)) != splashOk) return result;
+ if ((result = (*p)->lineTo(x1,y0)) != splashOk) return result;
+ if ((result = (*p)->lineTo(x1,y1)) != splashOk) return result;
+ if ((result = (*p)->lineTo(x0,y1)) != splashOk) return result;
+ if ((result = (*p)->close()) != splashOk) return result;
+ return splashOk;
+}
+
+void OPVPSplash::clipResetToRect(SplashCoord x0, SplashCoord y0,
+ SplashCoord x1, SplashCoord y1) {
+ OPVPSplashPath *p;
+ OPVPClipPath *cp;
+
+ while ((cp = OPVPClipPath::pop()) != NULL) delete cp;
+ if (clipPath != 0) {
+ delete clipPath;
+ clipPath = 0;
+ }
+
+ if (makeRectanglePath(x0,y0,x1,y1,&p) != splashOk) return;
+
+ if (doClipPath(p,gTrue,clipPath) != splashOk) return;
+ clipPath = new OPVPClipPath(p,gTrue);
+ state->clip->resetToRect(x0, y0, x1, y1);
+}
+
+SplashError OPVPSplash::clipToPath(OPVPSplashPath *path, GBool eo) {
+ SplashError result;
+ SplashCoord x0, y0, x1, y1;
+ SplashCoord x2, y2, x3, y3;
+ SplashClipResult clipResult;
+ int xMin, yMin, xMax, yMax;
+
+ if (path == 0) return splashErrBogusPath;
+ if (path->getLength() == 0) return splashOk;
+ if (clipPath == 0) {
+ /* no clip region exist */
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = path->copy();
+ } else {
+ OPVPSplashPath *oldPath = clipPath->getPath();
+ if (path->isRectanglePath(&x0,&y0,&x1,&y1)) {
+ if ((clipResult = state->clip->testRect(
+ splashRound(x0), splashRound(y0), splashRound(x1), splashRound(y1)))
+ == splashClipAllOutside) {
+ /* no drawable area */
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = new OPVPSplashPath();
+ } else if (clipResult == splashClipPartial) {
+ if (oldPath->isRectanglePath(&x2,&y2,&x3,&y3)) {
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ /* both rectangle */
+ if (x0 < x2) x0 = x2;
+ if (y0 < y2) y0 = y2;
+ if (x1 > x3) x1 = x3;
+ if (y1 > y3) y1 = y3;
+ if ((result = makeRectanglePath(x0,y0,x1,y1,&path)) != splashOk) {
+ return result;
+ }
+ } else {
+ state->clip->getBBox(&xMin,&yMin,&xMax,&yMax);
+ if (splashRound(x0) <= xMin && splashRound(y0) <= yMin
+ && splashRound(x1) >= xMax && splashRound(y1)) {
+ /* The old path is all inside the new path */
+ /* We may ignore the new path */
+ return splashOk;
+ }
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ if (state->clip->getNumPaths() > 0) {
+ path = state->clip->makePath();
+ } else {
+ path = new OPVPSplashPath();
+ }
+ }
+ } else {
+ /* splashClipAllInside */
+ /* We may ignore the previous region. */
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = path->copy();
+ }
+ } else {
+ /* non rectangle path */
+
+ OPVPSplashXPath *xpath = new OPVPSplashXPath(path, state->matrix,
+ state->flatness, gFalse);
+
+ xpath->sort();
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo,
+ INT_MIN,INT_MAX);
+#else
+ SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo);
+#endif
+ scanner->getBBox(&xMin,&yMin,&xMax,&yMax);
+ delete scanner;
+ delete xpath;
+ if ((clipResult = state->clip->testRect(xMin,yMin,xMax,yMax))
+ == splashClipAllOutside) {
+ /* no efect */
+ /* no drawable area */
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = new OPVPSplashPath();
+ } else if (clipResult == splashClipPartial) {
+ OPVPSplashClip *nclip = new OPVPSplashClip(xMin,yMin,xMax,yMax,gFalse);
+ nclip->clipToPath(path,state->matrix,state->flatness,eo);
+ state->clip->getBBox(&xMin,&yMin,&xMax,&yMax);
+ if ((clipResult = nclip->testRect(xMin,yMin,xMax,yMax))
+ == splashClipAllOutside) {
+ /* no drawable area */
+ delete nclip;
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = new OPVPSplashPath();
+ } else {
+ delete nclip;
+ if (clipResult == splashClipAllInside) {
+ /* The old path is all inside the new path */
+ /* We may ignore the new path */
+ return splashOk;
+ }
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ if (state->clip->getNumPaths() > 0) {
+ path = state->clip->makePath();
+ } else {
+ path = new OPVPSplashPath();
+ }
+ }
+ } else {
+ /* splashClipAllInside */
+ /* We may ignore the previous region. */
+ if ((result = state->clip->clipToPath(path, state->matrix,
+ state->flatness, eo)) != splashOk) {
+ return result;
+ }
+ path = path->copy();
+ }
+ }
+ }
+ if ((result = doClipPath(path,eo,clipPath)) != splashOk) {
+ delete path;
+ return result;
+ }
+ if (clipPath != 0) delete clipPath;
+ clipPath = new OPVPClipPath(path,eo);
+
+ return splashOk;
+}
+
+//------------------------------------------------------------------------
+// state save/restore
+//------------------------------------------------------------------------
+
+void OPVPSplash::saveState() {
+ OPVPSplashState *newState;
+
+ newState = state->copy();
+ newState->next = state;
+ state = newState;
+ if (clipPath != 0) clipPath->push();
+ if (opvp->SaveGS() != 0) {
+ OPRS::error("SaveGS error\n");
+ return;
+ }
+ saveDriverStateCount++;
+}
+
+SplashError OPVPSplash::restoreState() {
+ OPVPSplashState *oldState;
+ OPVPClipPath *oldClip;
+ OPVPSplashPath *path;
+ GBool saved = gFalse;
+
+ if (!state->next) {
+ return splashErrNoSave;
+ }
+ oldState = state;
+ state = state->next;
+ delete oldState;
+ if (saveDriverStateCount > 0 && opvp->RestoreGS() != 0) {
+ OPRS::error("RestoreGS error\n");
+ return splashErrOPVP;
+ }
+ saveDriverStateCount--;
+ oldClip = clipPath;
+ if (clipPath != 0) {
+ saved = clipPath->getSaved();
+ delete clipPath;
+ clipPath = 0;
+ }
+ clipPath = OPVPClipPath::pop();
+ if (clipPath != 0) {
+ path = clipPath->getPath();
+ if (path->getLength() > maxClipPathLength) {
+ if (clipPathNotSaved && !noClipPath) {
+ if (opvp->ResetClipPath() != 0) {
+ OPRS::error("ResetClipPath error\n");
+ return splashErrOPVP;
+ }
+ noClipPath = gTrue;
+ }
+ } else {
+ noClipPath = savedNoClipPath;
+ }
+ } else {
+ noClipPath = savedNoClipPath;
+ }
+ if (clipPathNotSaved && !noClipPath) {
+ if (clipPath != 0) {
+ if (!saved) {
+ SplashError result;
+
+ if ((result = doClipPath(clipPath->getPath(),clipPath->getEo(),
+ oldClip))
+ != splashOk) return result;
+ }
+ } else if (oldClip != 0) {
+ if (opvp->ResetClipPath() != 0) {
+ OPRS::error("ResetClipPath error\n");
+ return splashErrOPVP;
+ }
+ }
+ }
+ return splashOk;
+}
+
+//------------------------------------------------------------------------
+// drawing operations
+//------------------------------------------------------------------------
+
+void OPVPSplash::clear(SplashColor color)
+{
+ opvp_brush_t brush;
+
+ brush.colorSpace = getOPVPColorSpace();
+ brush.pbrush = NULL;
+ brush.color[3] = -1;
+ brush.xorg = brush.yorg = 0;
+ switch (colorMode) {
+ case splashModeMono1:
+ brush.color[2] = color[0];
+ brush.color[1] = 0;
+ brush.color[0] = 0;
+ break;
+ case splashModeMono8:
+ brush.color[2] = color[0];
+ brush.color[1] = 0;
+ brush.color[0] = 0;
+ break;
+ case splashModeRGB8:
+ brush.color[2] = splashRGB8R(color);
+ brush.color[1] = splashRGB8G(color);
+ brush.color[0] = splashRGB8B(color);
+ break;
+ default:
+ OPRS::error("Unknown color mode\n");
+ brush.color[2] = splashRGB8R(color);
+ brush.color[1] = splashRGB8G(color);
+ brush.color[0] = splashRGB8B(color);
+ break;
+ }
+ opvp->SetBgColor(&brush);
+}
+
+/*
+ Translate arc to Bezier Curve
+
+ input start point (x0,y0) , center (cx, cy) and end point (x3, y3)
+ return Bezier curve control points (rx1,ry1 and rx2, ry2)
+
+ an angle should be less than eqaul 90 degree
+
+*/
+void OPVPSplash::arcToCurve(SplashCoord x0, SplashCoord y0,
+ SplashCoord x3, SplashCoord y3,
+ SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
+ SplashCoord *rx2, SplashCoord *ry2)
+{
+#define ROTX(x,y) (x*rotcos-y*rotsin)*r+cx
+#define ROTY(x,y) (x*rotsin+y*rotcos)*r+cy
+
+ SplashCoord x1,y1,x2,y2;
+ SplashCoord r;
+ SplashCoord rotcos, rotsin;
+ SplashCoord ox,oy,hx,hy,d;
+
+ hx = (x0+x3)/2;
+ hy = (y0+y3)/2;
+ r = splashDist(x0,y0,cx,cy);
+ d = splashDist(x0,y0,hx,hy);
+ rotcos = (hx-cx)/d;
+ rotsin = (hy-cy)/d;
+ oy = (splashDist(x0,y0,x3,y3)/2)/r;
+ ox = splashDist(hx,hy,cx,cy)/r;
+ x1 = ((4-ox)/3);
+ y1 = ((1-ox)*(3-ox)/(3*oy));
+ x2 = x1;
+ y2 = -y1;
+ *rx1 = ROTX(x1,y1);
+ *ry1 = ROTY(x1,y1);
+ *rx2 = ROTX(x2,y2);
+ *ry2 = ROTY(x2,y2);
+#undef ROTX
+#undef ROTY
+}
+
+SplashError OPVPSplash::strokeByMyself(OPVPSplashPath *path)
+{
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ SplashPath *dPath;
+ OPVPSplashPath *oPath;
+ Splash *osplash;
+ SplashPattern *savedPattern;
+
+ /* draw dashed line by myself */
+ if (path->getLength() == 0) {
+ return splashOk;
+ }
+
+ osplash = new Splash(new SplashBitmap(1,1,4,splashModeMono1,gFalse),gFalse);
+ state->setState(osplash);
+ dPath = osplash->makeStrokePath(path,state->lineWidth);
+ oPath = new OPVPSplashPath(dPath);
+ delete dPath;
+
+ if (state->lineWidth <= 1) {
+ OPVPSplashXPath *xPath;
+ xPath = new OPVPSplashXPath(oPath, state->matrix, state->flatness, gFalse);
+ xPath->strokeNarrow(this,state);
+ delete xPath;
+ } else {
+ /* change fill pattern temprarily */
+ savedPattern = state->fillPattern->copy();
+ setFillPattern(state->strokePattern->copy());
+
+ fillByMyself(oPath,gFalse);
+
+ /* restore fill pattern */
+ setFillPattern(savedPattern);
+ }
+ delete osplash;
+ return splashOk;
+#else
+ OPVPSplashXPath *xPath, *xPath2;
+ SplashPattern *savedPattern;
+
+ /* draw dashed line by myself */
+ if (path->getLength() == 0) {
+ return splashOk;
+ }
+ xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, gFalse);
+ if (state->lineDash != NULL && state->lineDashLength > 0) {
+ xPath2 = xPath->makeDashedPath(state);
+ delete xPath;
+ xPath = xPath2;
+ }
+
+ if (state->lineWidth <= 1) {
+ xPath->strokeNarrow(this,state);
+ } else {
+ /* change fill pattern temprarily */
+ savedPattern = state->fillPattern->copy();
+ setFillPattern(state->strokePattern->copy());
+
+ xPath->strokeWide(this,state);
+
+ /* restore fill pattern */
+ setFillPattern(savedPattern);
+ }
+
+ delete xPath;
+ return splashOk;
+#endif
+}
+
+SplashError OPVPSplash::stroke(OPVPSplashPath *path) {
+ SplashError result;
+
+ if (clipPath != 0 && clipPath->getPath()->getLength() == 0) {
+ return splashOk;
+ }
+ if ((state->lineDash != NULL
+ && state->lineDashLength > 0 && noLineStyle)) {
+ return strokeByMyself(path);
+ }
+ if (noMiterLimit && (!ignoreMiterLimit) && state->lineWidth != 0
+ && state->lineJoin == splashLineJoinMiter) {
+ return strokeByMyself(path);
+ }
+ if (noClipPath) {
+ int xMin, yMin, xMax, yMax;
+ SplashClipResult clipResult;
+ int fatOffset = splashCeil(state->lineWidth/2);
+ int miterLimit = splashCeil(state->miterLimit/2);
+
+ if (fatOffset < miterLimit) fatOffset = miterLimit;
+ path->getBBox(&xMin,&yMin,&xMax,&yMax);
+ xMin -= fatOffset;
+ yMin -= fatOffset;
+ xMax += fatOffset;
+ yMax += fatOffset;
+ clipResult = state->clip->testRect(xMin,yMin,xMax,yMax);
+ if (clipResult == splashClipAllOutside) {
+ /* not need to draw */
+ return splashOk;
+ } else if (clipResult == splashClipPartial) {
+ return strokeByMyself(path);
+ }
+ /* splashClipAllInside */
+ /* fall through */
+ }
+ if ((result = path->makePath(opvp)) != 0) return result;
+ if (opvp->StrokePath() < 0) {
+ OPRS::error("StrokePath error\n");
+ return splashErrOPVP;
+ }
+ return splashOk;
+}
+
+SplashError OPVPSplash::fillByMyself(OPVPSplashPath *path, GBool eo)
+{
+ OPVPSplashXPath *xPath;
+ SplashXPathScanner *scanner;
+ int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
+ SplashClipResult clipRes, clipRes2;
+
+ if (path->getLength() == 0) {
+ return splashOk;
+ }
+ xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, gTrue);
+ xPath->sort();
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ scanner = new SplashXPathScanner(xPath, eo, INT_MIN, INT_MAX);
+#else
+ scanner = new SplashXPathScanner(xPath, eo);
+#endif
+
+ // get the min and max x and y values
+ scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
+
+ // check clipping
+ if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
+ != splashClipAllOutside) {
+ SplashPattern *savedPattern;
+
+ /* change stroke pattern temporarily */
+ savedPattern = state->strokePattern->copy();
+ setStrokePattern(state->fillPattern->copy());
+
+ for (y = yMinI; y < yMaxI; ++y) {
+ while (scanner->getNextSpan(y, &x0, &x1)) {
+ if (x0 == x1) continue;
+ if (clipRes == splashClipAllInside) {
+ drawSpan(x0, x1-1, y, gTrue);
+ } else {
+ clipRes2 = state->clip->testSpan(x0, x1, y);
+ drawSpan(x0, x1-1, y, clipRes2 == splashClipAllInside);
+ }
+ }
+ }
+ /* restore stroke pattern */
+ setStrokePattern(savedPattern);
+ }
+
+ delete scanner;
+ delete xPath;
+ return splashOk;
+}
+
+SplashError OPVPSplash::fill(OPVPSplashPath *path, GBool eo) {
+ SplashError result;
+ opvp_fillmode_t mode;
+
+ if (path->getLength() <= 1) return splashOk;
+ if (clipPath != 0 && clipPath->getPath()->getLength() == 0) {
+ return splashOk;
+ }
+ if (path->getLength() > maxFillPathLength) {
+ return fillByMyself(path,eo);
+ }
+ if (noClipPath) {
+ int xMin, yMin, xMax, yMax;
+ SplashClipResult clipResult;
+
+ path->getBBox(&xMin,&yMin,&xMax,&yMax);
+ clipResult = state->clip->testRect(xMin,yMin,xMax,yMax);
+ if (clipResult == splashClipAllOutside) {
+ /* not need to draw */
+ return splashOk;
+ } else if (clipResult == splashClipPartial) {
+ return fillByMyself(path,eo);
+ }
+ /* splashClipAllInside */
+ /* fall through */
+ }
+ if ((result = path->makePath(opvp)) != 0) return result;
+ mode = eo ? OPVP_FILLMODE_EVENODD : OPVP_FILLMODE_WINDING;
+ if (opvp->SetFillMode(mode) < 0) {
+ OPRS::error("SetFillMode error\n");
+ return splashErrOPVP;
+ }
+ if (opvp->FillPath() < 0) {
+ OPRS::error("FillPath error\n");
+ return splashErrOPVP;
+ }
+ return splashOk;
+}
+
+void OPVPSplash::fillGlyph(SplashCoord x, SplashCoord y,
+ SplashGlyphBitmap *glyph)
+{
+ opvp_fix_t opvpx,opvpy;
+ int opvpbytes;
+ int x0, y0;
+ Guchar *bp;
+ SplashClipResult clipRes;
+ SplashCoord xt, yt;
+
+ transform(state->matrix,x,y,&xt,&yt);
+ x0 = splashFloor(xt)-glyph->x;
+ y0 = splashFloor(yt)-glyph->y;
+ clipRes = state->clip->testRect(x0,y0,
+ x0 + glyph->w - 1,
+ y0 + glyph->h - 1);
+ if (clipRes == splashClipAllOutside) return;
+ OPVP_i2Fix((x0),(opvpx));
+ OPVP_i2Fix((y0),(opvpy));
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ }
+
+ if (oldLipsDriver && (((glyph->w+7)/8) & 3) != 0) {
+ /* not 4bytes aligned, so make aligned */
+ int i;
+ int m = (glyph->w+7)/8;
+
+ opvpbytes = (m+3)/4;
+ opvpbytes *= 4;
+ bp = (Guchar *)gmalloc(opvpbytes*glyph->h);
+ for (i = 0;i < glyph->h;i++) {
+ memcpy(bp+i*opvpbytes,glyph->data+i*m,m);
+ }
+ } else {
+ bp = glyph->data;
+ opvpbytes = (glyph->w+7)/8;
+ }
+ if ((!noClipPath || clipRes != splashClipPartial) && !noImageMask) {
+ if (opvp->DrawImage(glyph->w,glyph->h,opvpbytes,OPVP_IFORMAT_MASK,
+ glyph->w,glyph->h,(void *)bp) < 0) {
+ OPRS::error("DrawImage error\n");
+ }
+ } else {
+ int tx,ty;
+ int sx = 0;
+ SplashPattern *savedPattern;
+ SplashCoord *savedLineDash = 0;
+ int savedLineDashLength;
+ SplashCoord savedLineDashPhase;
+ SplashCoord savedLineWidth;
+
+ /* change stroke pattern temprarily */
+ savedPattern = state->strokePattern->copy();
+ setStrokePattern(state->fillPattern->copy());
+ /* change lins style temporarily */
+ savedLineDashLength = state->lineDashLength;
+ savedLineDashPhase = state->lineDashPhase;
+ if (savedLineDashLength > 0 && state->lineDash != 0) {
+ savedLineDash = new SplashCoord[savedLineDashLength];
+ memcpy(savedLineDash, state->lineDash,
+ savedLineDashLength*sizeof(SplashCoord));
+ }
+ setLineDash(0,0,0);
+ savedLineWidth = state->lineWidth;
+ setLineWidth(0.0);
+
+
+ for (ty = 0;ty < glyph->h;ty++) {
+ GBool dmode = gFalse;
+ for (tx = 0;tx < glyph->w;tx++) {
+ GBool on = (bp[opvpbytes*ty+(tx/8)] & (0x80 >> (tx & 7))) != 0;
+
+ if (on && !dmode) {
+ sx = tx;
+ dmode = gTrue;
+ } else if (!on && dmode) {
+ drawSpan(x0+sx,x0+tx-1,y0+ty,gTrue);
+ dmode = gFalse;
+ }
+ }
+ if (dmode) {
+ drawSpan(x0+sx,x0+tx-1,y0+ty,gTrue);
+ }
+ }
+ /* restore stroke pattern */
+ setStrokePattern(savedPattern);
+ /* restore line style */
+ setLineDash(savedLineDash,savedLineDashLength,
+ savedLineDashPhase);
+ if (savedLineDash != 0) {
+ delete[] savedLineDash;
+ }
+ setLineWidth(savedLineWidth);
+ }
+ if (bp != glyph->data) gfree(bp);
+}
+
+SplashError OPVPSplash::fillChar(SplashCoord x, SplashCoord y,
+ int c, SplashFont *font,
+ Unicode *u, double *fontMat) {
+ SplashError err = splashOk;
+ SplashPath *spath;
+ OPVPSplashPath *path;
+ SplashCoord xt, yt;
+ double mx,my;
+
+ transform(state->matrix, x, y, &xt, &yt);
+ if ((spath = font->getGlyphPath(c)) == 0) return splashOk;
+ path = new OPVPSplashPath(spath);
+ delete spath;
+ if (bitmapCharThreshold > 0) {
+ mx = splashAbs(fontMat[0]);
+ if (mx < splashAbs(fontMat[1])) {
+ mx = splashAbs(fontMat[1]);
+ }
+ my = splashAbs(fontMat[3]);
+ if (my < splashAbs(fontMat[2])) {
+ my = splashAbs(fontMat[2]);
+ }
+ if (path == 0 || (mx*my < bitmapCharThreshold)) {
+ /* if a char is enough small, then out a char as a bitmask */
+ SplashGlyphBitmap glyph;
+ int x0, y0, xFrac, yFrac;
+ SplashClipResult clipRes;
+
+ x0 = splashFloor(xt);
+ xFrac = splashFloor((xt - x0) * splashFontFraction);
+ y0 = splashFloor(yt);
+ yFrac = splashFloor((yt - y0) * splashFontFraction);
+ if (font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip,
+ &clipRes)) {
+ if (path != 0) delete path;
+ if (glyph.w == 0 || glyph.h == 0) {
+ /* empty glyph */
+ return splashOk;
+ }
+ if (clipRes != splashClipAllOutside) {
+ fillGlyph(xt, yt, &glyph);
+ }
+ if (glyph.freeData) {
+ gfree(glyph.data);
+ }
+ return err;
+ }
+ }
+ /* fall through and out a char as a path */
+ }
+ if (path == 0) {
+ //OPRS::error("FillPath error\n");
+ err = splashErrOPVP;
+ goto err0;
+ }
+ path->offset(xt,yt);
+ err = fill(path,gFalse);
+err0:
+ if (path != 0) delete path;
+ return err;
+}
+
+SplashError OPVPSplash::fillImageMaskFastWithCTM(SplashImageMaskSource src,
+ void *srcData, int w, int h, int tx, int ty,SplashCoord *mat) {
+ int i, j;
+ opvp_fix_t opvpx,opvpy;
+ int opvpbytes;
+ opvp_ctm_t opvpctm;
+ Guchar *buf = 0, *bp;
+ SplashError result = splashOk;
+ SplashColorPtr lineBuf;
+
+ opvpbytes = (w+7)/8;
+ /* align 4 */
+ opvpbytes = (opvpbytes+3)/4;
+ opvpbytes *= 4;
+ buf = (Guchar *)gmalloc(opvpbytes*h);
+ lineBuf = (SplashColorPtr)gmalloc(opvpbytes*8);
+
+ for (i = 0;i < h;i++) {
+ int k;
+
+ bp = buf+opvpbytes*i;
+ (*src)(srcData, lineBuf);
+ for (j = 0;j < w;j += k) {
+ Guchar d;
+
+ d = 0;
+ for (k = 0;k < 8 && j+k < w;k++) {
+ d <<= 1;
+ if (lineBuf[j+k] != 0) d |= 1;
+ }
+ d <<= 8-k;
+ *bp++ = d;
+ }
+ }
+ free(lineBuf);
+ opvpctm.a = mat[0];
+ opvpctm.b = mat[1];
+ opvpctm.c = mat[2];
+ opvpctm.d = mat[3];
+ opvpctm.e = mat[4];
+ opvpctm.f = mat[5];
+ OPVP_i2Fix((tx),(opvpx));
+ OPVP_i2Fix((ty),(opvpy));
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ }
+
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+ if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_MASK,1,1,(void *)(buf)) < 0) {
+ OPRS::error("DrawImage error\n");
+ result = splashErrOPVP;
+ }
+ /* reset CTM */
+ opvpctm.a = 1.0;
+ opvpctm.b = 0.0;
+ opvpctm.c = 0.0;
+ opvpctm.d = 1.0;
+ opvpctm.e = 0.0;
+ opvpctm.f = 0.0;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ if (buf != 0) gfree(buf);
+ return result;
+}
+
+SplashError OPVPSplash::fillImageMask(SplashImageMaskSource src, void *srcData,
+ int w, int h, SplashCoord *mat, GBool glyphMode) {
+ GBool rot;
+ SplashCoord xScale, yScale, xShear, yShear;
+ int tx, ty, scaledWidth, scaledHeight, xSign, ySign;
+ int ulx, uly, llx, lly, urx, ury, lrx, lry;
+ int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1;
+ int xMin, xMax, yMin, yMax;
+ SplashClipResult clipRes;
+ SplashColorPtr pixBuf;
+ SplashColorPtr p;
+ int x, y;
+ int i;
+ SplashPattern *savedPattern;
+ SplashCoord *savedLineDash = 0;
+ int savedLineDashLength;
+ SplashCoord savedLineDashPhase;
+ SplashCoord savedLineWidth;
+
+ if (debugMode) {
+ printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
+ w, h, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
+ }
+
+ // check for singular matrix
+ if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) {
+ return splashErrSingularMatrix;
+ }
+
+ // compute scale, shear, rotation, translation parameters
+ rot = splashAbs(mat[1]) > splashAbs(mat[0]);
+ if (rot) {
+ xScale = -mat[1];
+ yScale = mat[2] - (mat[0] * mat[3]) / mat[1];
+ xShear = -mat[3] / yScale;
+ yShear = -mat[0] / mat[1];
+ } else {
+ xScale = mat[0];
+ yScale = mat[3] - (mat[1] * mat[2]) / mat[0];
+ xShear = mat[2] / yScale;
+ yShear = mat[1] / mat[0];
+ }
+ tx = splashRound(mat[4]);
+ ty = splashRound(mat[5]);
+ scaledWidth = abs(splashRound(mat[4] + xScale) - tx) + 1;
+ scaledHeight = abs(splashRound(mat[5] + yScale) - ty) + 1;
+ xSign = (xScale < 0) ? -1 : 1;
+ ySign = (yScale < 0) ? -1 : 1;
+
+ // clipping
+ ulx1 = 0;
+ uly1 = 0;
+ urx1 = xSign * (scaledWidth - 1);
+ ury1 = splashRound(yShear * urx1);
+ llx1 = splashRound(xShear * ySign * (scaledHeight - 1));
+ lly1 = ySign * (scaledHeight - 1) + splashRound(yShear * llx1);
+ lrx1 = xSign * (scaledWidth - 1) +
+ splashRound(xShear * ySign * (scaledHeight - 1));
+ lry1 = ySign * (scaledHeight - 1) + splashRound(yShear * lrx1);
+ if (rot) {
+ ulx = tx + uly1; uly = ty - ulx1;
+ urx = tx + ury1; ury = ty - urx1;
+ llx = tx + lly1; lly = ty - llx1;
+ lrx = tx + lry1; lry = ty - lrx1;
+ } else {
+ ulx = tx + ulx1; uly = ty + uly1;
+ urx = tx + urx1; ury = ty + ury1;
+ llx = tx + llx1; lly = ty + lly1;
+ lrx = tx + lrx1; lry = ty + lry1;
+ }
+ xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx
+ : (llx < lrx) ? llx : lrx
+ : (urx < llx) ? (urx < lrx) ? urx : lrx
+ : (llx < lrx) ? llx : lrx;
+ xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx
+ : (llx > lrx) ? llx : lrx
+ : (urx > llx) ? (urx > lrx) ? urx : lrx
+ : (llx > lrx) ? llx : lrx;
+ yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry
+ : (lly < lry) ? lly : lry
+ : (ury < lly) ? (ury < lry) ? ury : lry
+ : (lly < lry) ? lly : lry;
+ yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry
+ : (lly > lry) ? lly : lry
+ : (ury > lly) ? (ury > lry) ? ury : lry
+ : (lly > lry) ? lly : lry;
+ clipRes = state->clip->testRect(xMin, yMin, xMax, yMax);
+ if (clipRes == splashClipAllOutside) return splashOk;
+
+ if (!noClipPath || clipRes == splashClipAllInside) {
+ if (!noShearImage && !noImageMask) {
+ if (fillImageMaskFastWithCTM(src,srcData,w,h,tx,ty,mat)
+ == splashOk) {
+ return splashOk;
+ }
+ }
+ }
+
+ SplashError result = splashOk;
+ /* change stroke pattern temprarily */
+ savedPattern = state->strokePattern->copy();
+ setStrokePattern(state->fillPattern->copy());
+
+ /* change lins style temporarily */
+ savedLineDashLength = state->lineDashLength;
+ savedLineDashPhase = state->lineDashPhase;
+ if (savedLineDashLength > 0 && state->lineDash != 0) {
+ savedLineDash = new SplashCoord[savedLineDashLength];
+ memcpy(savedLineDash, state->lineDash,
+ savedLineDashLength*sizeof(SplashCoord));
+ }
+ setLineDash(0,0,0);
+ savedLineWidth = state->lineWidth;
+ setLineWidth(0.0);
+
+ /* calculate inverse matrix */
+ SplashCoord imat[4];
+ double det = mat[0] * mat[3] - mat[1] * mat[2];
+ imat[0] = mat[3]/det;
+ imat[1] = -mat[1]/det;
+ imat[2] = -mat[2]/det;
+ imat[3] = mat[0]/det;
+
+ /* read source image */
+ pixBuf = (SplashColorPtr)gmalloc(h * w);
+
+ p = pixBuf;
+ for (i = 0; i < h; ++i) {
+ (*src)(srcData, p);
+ p += w;
+ }
+ int width = xMax-xMin+1;
+ int height = yMax-yMin+1;
+ OPVPSplashClip *clip = state->clip->copy();
+
+ if (w < scaledWidth || h < scaledHeight) {
+ OPVPSplashPath cpath;
+
+ cpath.moveTo(tx,ty);
+ cpath.lineTo(mat[0]+tx,mat[1]+ty);
+ cpath.lineTo(mat[0]+mat[2]+tx,mat[1]+mat[3]+ty);
+ cpath.lineTo(mat[2]+tx,mat[3]+ty);
+ clip->clipToPath(&cpath,state->matrix,1.0,gFalse);
+ }
+ for (y = 0;y < height;y++) {
+ int dy = y+yMin-ty;
+ int sx = 0;
+ GBool dmode = gFalse;
+
+ for (x = 0;x < width;x++) {
+ if (!clip->test(x+xMin,y+yMin)) {
+ if (dmode) {
+ drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
+ dmode = gFalse;
+ }
+ continue;
+ }
+ int ox,oy;
+ /* calculate original coordinate */
+ int dx = x+xMin-tx;
+ ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
+ oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
+ if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
+ GBool on = pixBuf[oy*w+ox] != 0;
+
+ if (on && !dmode) {
+ dmode = gTrue;
+ sx = x;
+ } else if (!on && dmode) {
+ drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
+ dmode = gFalse;
+ }
+ } else if (dmode) {
+ drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
+ dmode = gFalse;
+ }
+ }
+ if (dmode) {
+ drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
+ }
+ }
+ delete clip;
+ gfree(pixBuf);
+
+ /* restore stroke pattern */
+ setStrokePattern(savedPattern);
+ /* restore line style */
+ setLineDash(savedLineDash,savedLineDashLength,
+ savedLineDashPhase);
+ if (savedLineDash != 0) {
+ delete[] savedLineDash;
+ }
+ setLineWidth(savedLineWidth);
+
+ return result;
+}
+
+SplashError OPVPSplash::drawImageNotShear(SplashImageSource src,
+ void *srcData,
+ int w, int h,
+ int tx, int ty,
+ int scaledWidth, int scaledHeight,
+ int xSign, int ySign, GBool rot) {
+ int i, j;
+ opvp_fix_t opvpx,opvpy;
+ int opvpbytes, linesize;
+ opvp_ctm_t opvpctm;
+ SplashError result = splashOk;
+ Guchar *buf = 0, *bp;
+ SplashColorPtr lineBuf = 0, color;
+ float e,f;
+ int hs,he, hstep;
+ int ow = w;
+ int lineBufSize;
+
+ if (rot) {
+ int t = h;
+
+ h = w;
+ w = t;
+ t = scaledHeight;
+ scaledHeight = scaledWidth;
+ scaledWidth = t;
+ if (xSign != ySign) {
+ xSign = xSign >= 0 ? -1 : 1;
+ } else {
+ ySign = ySign >= 0 ? -1 : 1;
+ }
+ }
+
+ if (xSign > 0) {
+ OPVP_i2Fix((tx),(opvpx));
+ e = tx;
+ } else {
+ OPVP_i2Fix((tx-scaledWidth),(opvpx));
+ e = tx-scaledWidth;
+ }
+ if (ySign > 0) {
+ OPVP_i2Fix((ty),(opvpy));
+ f = ty;
+ } else {
+ OPVP_i2Fix((ty-scaledHeight),(opvpy));
+ f = ty-scaledHeight;
+ }
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ return splashErrOPVP;
+ }
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ linesize = w;
+ opvpbytes = (w+3)/4;
+ opvpbytes *= 4;
+ lineBufSize = (ow+3)/4;
+ lineBufSize *= 4;
+ break;
+ case splashModeRGB8:
+ linesize = w*3;;
+ opvpbytes = (w*3+3)/4;
+ opvpbytes *= 4;
+ lineBufSize = (ow*3+3)/4;
+ lineBufSize *= 4;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ return splashErrOPVP;
+ break;
+ }
+ if (ySign >= 0) {
+ hstep = 1;
+ hs = 0;
+ he = h;
+ } else {
+ hstep = -1;
+ hs = h-1;
+ he = -1;
+ }
+ buf = (Guchar *)gmalloc(opvpbytes*h);
+ lineBuf = (SplashColorPtr)gmalloc(lineBufSize);
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ if (rot) {
+ if (xSign >= 0) {
+ for (i = 0;i < w;i++) {
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = hs;j != he;j += hstep) {
+ bp = buf+i+j*opvpbytes;
+ *bp = *color++;
+ }
+ }
+ } else {
+ for (i = 0;i < w;i++) {
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = hs;j != he;j += hstep) {
+ bp = buf+linesize-1-i+j*opvpbytes;
+ *bp = *color++;
+ }
+ }
+ }
+ } else {
+ if (xSign >= 0) {
+ for (i = hs;i != he;i += hstep) {
+ bp = buf+opvpbytes*i;
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = 0;j < w;j++) {
+ *bp++ = *color++;
+ }
+ }
+ } else {
+ for (i = hs;i != he;i += hstep) {
+ bp = buf+opvpbytes*i+linesize-1;
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = 0;j < w;j++) {
+ *bp-- = *color++;
+ }
+ }
+ }
+ }
+ break;
+ case splashModeRGB8:
+ if (rot) {
+ if (xSign >= 0) {
+ for (i = 0;i < w;i++) {
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = hs;j != he;j += hstep) {
+ bp = buf+i*3+j*opvpbytes;
+ bp[0] = *color++;
+ bp[1] = *color++;
+ bp[2] = *color++;
+ }
+ }
+ } else {
+ for (i = 0;i < w;i++) {
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = hs;j != he;j += hstep) {
+ bp = buf+linesize-3-i*3+j*opvpbytes;
+ bp[0] = *color++;
+ bp[1] = *color++;
+ bp[2] = *color++;
+ }
+ }
+ }
+ } else {
+ if (xSign >= 0) {
+ for (i = hs;i != he;i += hstep) {
+ bp = buf+opvpbytes*i;
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = 0;j < w;j++) {
+ *bp++ = *color++;
+ *bp++ = *color++;
+ *bp++ = *color++;
+ }
+ }
+ } else {
+ for (i = hs;i != he;i += hstep) {
+ bp = buf+opvpbytes*i+linesize-1;
+ (*src)(srcData, lineBuf, NULL);
+ color = lineBuf;
+ for (j = 0;j < w;j++) {
+ *bp-- = color[2];
+ *bp-- = color[1];
+ *bp-- = color[0];
+ color += 3;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ result = splashErrOPVP;
+ goto err1;
+ break;
+ }
+ if (lineBuf != 0) gfree(lineBuf);
+
+ /* canonlisp driver use CTM only, ignores currentPoint */
+ /* So, set start point to CTM */
+ opvpctm.a = 1.0;
+ opvpctm.b = 0.0;
+ opvpctm.c = 0.0;
+ opvpctm.d = 1.0;
+ opvpctm.e = e;
+ opvpctm.f = f;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_RAW,
+ scaledWidth,scaledHeight,(void *)(buf)) < 0) {
+ OPRS::error("DrawImage error\n");
+ result = splashErrOPVP;
+ goto err1;
+ }
+err1:
+ /* reset CTM */
+ opvpctm.e = 0.0;
+ opvpctm.f = 0.0;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ if (buf != 0) gfree(buf);
+ return result;
+}
+
+SplashError OPVPSplash::drawImageFastWithCTM(SplashImageSource src,
+ void *srcData,
+ int w, int h, int tx, int ty,
+ SplashCoord *mat) {
+ int i;
+ opvp_fix_t opvpx,opvpy;
+ int opvpbytes;
+ opvp_ctm_t opvpctm;
+ SplashError result = splashOk;
+ Guchar *buf = 0, *bp;
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ opvpbytes = (w+3)/4;
+ opvpbytes *= 4;
+ break;
+ case splashModeRGB8:
+ opvpbytes = (w*3+3)/4;
+ opvpbytes *= 4;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ return splashErrOPVP;
+ break;
+ }
+ buf = (Guchar *)gmalloc(opvpbytes*h);
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ for (i = 0;i < h;i++) {
+ bp = buf+opvpbytes*i;
+ (*src)(srcData, (SplashColorPtr)bp, NULL);
+ }
+ break;
+ case splashModeRGB8:
+ for (i = 0;i < h;i++) {
+ bp = buf+opvpbytes*i;
+ (*src)(srcData, (SplashColorPtr)bp, NULL);
+ }
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ result = splashErrOPVP;
+ goto err0;
+ break;
+ }
+
+ opvpctm.a = mat[0];
+ opvpctm.b = mat[1];
+ opvpctm.c = mat[2];
+ opvpctm.d = mat[3];
+ opvpctm.e = mat[4];
+ opvpctm.f = mat[5];
+ OPVP_i2Fix((tx),(opvpx));
+ OPVP_i2Fix((ty),(opvpy));
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ }
+
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+ if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_RAW,1,1,(void *)(buf)) < 0) {
+ OPRS::error("DrawImage error\n");
+ result = splashErrOPVP;
+ }
+err0:
+ /* reset CTM */
+ opvpctm.a = 1.0;
+ opvpctm.b = 0.0;
+ opvpctm.c = 0.0;
+ opvpctm.d = 1.0;
+ opvpctm.e = 0.0;
+ opvpctm.f = 0.0;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ if (buf != 0) gfree(buf);
+ return splashOk;
+}
+
+SplashError OPVPSplash::drawImage(SplashImageSource src, void *srcData,
+ SplashColorMode srcMode, GBool srcAlpha,
+ int w, int h, SplashCoord *mat) {
+ GBool ok, rot, halftone;
+ SplashCoord xScale, yScale, xShear, yShear;
+ int tx, ty, scaledWidth, scaledHeight, xSign, ySign;
+ int ulx, uly, llx, lly, urx, ury, lrx, lry;
+ int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1;
+ int xMin, xMax, yMin, yMax;
+ SplashClipResult clipRes;
+ SplashColorPtr pixBuf, p;
+ int x, y;
+ int i;
+
+ if (debugMode) {
+ printf("drawImage: srcMode=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
+ srcMode, w, h, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
+ }
+
+ // check color modes
+ ok = gFalse; // make gcc happy
+ switch (colorMode) {
+ case splashModeMono1:
+ ok = srcMode == splashModeMono1 || srcMode == splashModeMono8;
+ break;
+ case splashModeMono8:
+ ok = srcMode == splashModeMono8;
+ break;
+ case splashModeRGB8:
+ ok = srcMode == splashModeRGB8;
+ break;
+ }
+ if (!ok) {
+ OPRS::error("Image Mode mismatch\n");
+ return splashErrModeMismatch;
+ }
+ halftone = colorMode == splashModeMono1 && srcMode == splashModeMono8;
+
+ // check for singular matrix
+ if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) {
+ OPRS::error("Image Not Singular Matrix\n");
+ return splashErrSingularMatrix;
+ }
+
+ // compute scale, shear, rotation, translation parameters
+ rot = splashAbs(mat[1]) > splashAbs(mat[0]);
+ if (rot) {
+ xScale = -mat[1];
+ yScale = mat[2] - (mat[0] * mat[3]) / mat[1];
+ xShear = -mat[3] / yScale;
+ yShear = -mat[0] / mat[1];
+ } else {
+ xScale = mat[0];
+ yScale = mat[3] - (mat[1] * mat[2]) / mat[0];
+ xShear = mat[2] / yScale;
+ yShear = mat[1] / mat[0];
+ }
+ tx = splashRound(mat[4]);
+ ty = splashRound(mat[5]);
+ scaledWidth = abs(splashRound(mat[4] + xScale) - tx) + 1;
+ scaledHeight = abs(splashRound(mat[5] + yScale) - ty) + 1;
+ xSign = (xScale < 0) ? -1 : 1;
+ ySign = (yScale < 0) ? -1 : 1;
+
+ // clipping
+ ulx1 = 0;
+ uly1 = 0;
+ urx1 = xSign * (scaledWidth - 1);
+ ury1 = splashRound(yShear * urx1);
+ llx1 = splashRound(xShear * ySign * (scaledHeight - 1));
+ lly1 = ySign * (scaledHeight - 1) + splashRound(yShear * llx1);
+ lrx1 = xSign * (scaledWidth - 1) +
+ splashRound(xShear * ySign * (scaledHeight - 1));
+ lry1 = ySign * (scaledHeight - 1) + splashRound(yShear * lrx1);
+ if (rot) {
+ ulx = tx + uly1; uly = ty - ulx1;
+ urx = tx + ury1; ury = ty - urx1;
+ llx = tx + lly1; lly = ty - llx1;
+ lrx = tx + lry1; lry = ty - lrx1;
+ } else {
+ ulx = tx + ulx1; uly = ty + uly1;
+ urx = tx + urx1; ury = ty + ury1;
+ llx = tx + llx1; lly = ty + lly1;
+ lrx = tx + lrx1; lry = ty + lry1;
+ }
+ xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx
+ : (llx < lrx) ? llx : lrx
+ : (urx < llx) ? (urx < lrx) ? urx : lrx
+ : (llx < lrx) ? llx : lrx;
+ xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx
+ : (llx > lrx) ? llx : lrx
+ : (urx > llx) ? (urx > lrx) ? urx : lrx
+ : (llx > lrx) ? llx : lrx;
+ yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry
+ : (lly < lry) ? lly : lry
+ : (ury < lly) ? (ury < lry) ? ury : lry
+ : (lly < lry) ? lly : lry;
+ yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry
+ : (lly > lry) ? lly : lry
+ : (ury > lly) ? (ury > lry) ? ury : lry
+ : (lly > lry) ? lly : lry;
+ if ((clipRes = state->clip->testRect(xMin, yMin, xMax, yMax))
+ == splashClipAllOutside) {
+ return splashOk;
+ }
+
+ if (!noClipPath || clipRes == splashClipAllInside) {
+ if (!srcAlpha && !noShearImage) {
+ if (drawImageFastWithCTM(src,srcData,w,h,tx,ty,mat) == splashOk) {
+ return splashOk;
+ }
+ }
+ if (!srcAlpha && splashRound(xShear) == 0 && splashRound(yShear) == 0) {
+ /* no sheared case */
+ if (drawImageNotShear(src,srcData,w,h,tx,ty,
+ scaledWidth, scaledHeight,xSign,ySign,rot) == splashOk) {
+ return splashOk;
+ }
+ }
+ }
+
+ /* shear case */
+ SplashError result = splashOk;
+
+ /* calculate inverse matrix */
+ SplashCoord imat[4];
+ double det = mat[0] * mat[3] - mat[1] * mat[2];
+ imat[0] = mat[3]/det;
+ imat[1] = -mat[1]/det;
+ imat[2] = -mat[2]/det;
+ imat[3] = mat[0]/det;
+
+ opvp_fix_t opvpx,opvpy;
+ int opvpbytes, linesize;
+ OPVP_Rectangle opvprect;
+ int width = xMax-xMin+1;
+ int height = yMax-yMin+1;
+ opvp_ctm_t opvpctm;
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ if (srcAlpha) {
+ /* alpha data exists */
+ linesize = w*2;
+ } else {
+ linesize = w;
+ }
+ opvpbytes = (width+3)/4;
+ opvpbytes *= 4;
+ break;
+ case splashModeRGB8:
+ if (srcAlpha) {
+ /* alpha data exists */
+ linesize = w*4;
+ } else {
+ linesize = w*3;
+ }
+ opvpbytes = (width*3+3)/4;
+ opvpbytes *= 4;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ return splashErrOPVP;
+ break;
+ }
+
+ /* read source image */
+ pixBuf = (SplashColorPtr)gmalloc(h * linesize);
+
+ p = pixBuf;
+ for (i = 0; i < h; ++i) {
+ (*src)(srcData, p, NULL);
+ p += linesize;
+ }
+ /* allocate line buffer */
+ Guchar *lineBuf = (Guchar *)gmalloc(opvpbytes);
+ Guchar *onBuf = (Guchar *)gmalloc(width);
+ OPVPSplashClip *clip;
+ opvpctm.a = 1.0;
+ opvpctm.b = 0.0;
+ opvpctm.c = 0.0;
+ opvpctm.d = 1.0;
+ OPVP_i2Fix(0,opvprect.p0.x);
+ OPVP_i2Fix(0,opvprect.p0.y);
+
+ clip = state->clip->copy();
+ if (w < scaledWidth || h < scaledHeight) {
+ OPVPSplashPath cpath;
+
+ cpath.moveTo(tx,ty);
+ cpath.lineTo(mat[0]+tx,mat[1]+ty);
+ cpath.lineTo(mat[0]+mat[2]+tx,mat[1]+mat[3]+ty);
+ cpath.lineTo(mat[2]+tx,mat[3]+ty);
+ clip->clipToPath(&cpath,state->matrix,1.0,gFalse);
+ }
+ for (y = 0;y < height;y++) {
+ int dy = y+yMin-ty;
+ memset(onBuf,0,width);
+ if (srcAlpha) {
+ /* with alpha data */
+ for (x = 0;x < width;x++) {
+ if (!clip->test(x+xMin,y+yMin)) continue;
+ int ox,oy;
+ /* calculate original coordinate */
+ int dx = x+xMin-tx;
+ ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
+ oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
+ if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
+ /* in the image */
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ onBuf[x] = pixBuf[oy*linesize+ox] != 0;
+ lineBuf[x] = pixBuf[oy*linesize+ox+1];
+ break;
+ case splashModeRGB8:
+ p = pixBuf+oy*linesize+ox*4;
+ onBuf[x] = (*p++) != 0;
+ lineBuf[x*3] = *p++;
+ lineBuf[x*3+1] = *p++;
+ lineBuf[x*3+2] = *p;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ result = splashErrOPVP;
+ goto err1;
+ break;
+ }
+ }
+ }
+ } else {
+ for (x = 0;x < width;x++) {
+ if (!clip->test(x+xMin,y+yMin)) continue;
+ int ox,oy;
+ /* calculate original coordinate */
+ int dx = x+xMin-tx;
+ ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
+ oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
+ if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
+ /* in the image */
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ lineBuf[x] = pixBuf[oy*linesize+ox];
+ break;
+ case splashModeRGB8:
+ p = pixBuf+oy*linesize+ox*3;
+ lineBuf[x*3] = *p++;
+ lineBuf[x*3+1] = *p++;
+ lineBuf[x*3+2] = *p;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ result = splashErrOPVP;
+ goto err1;
+ break;
+ }
+ onBuf[x] = 1;
+ }
+ }
+ }
+ /* out pixel */
+ int sx = 0;
+ int ex;
+ while (sx < width) {
+ /* find start pixel */
+ for (;onBuf[sx] == 0 && sx < width;sx++);
+ if (sx >= width) break;
+ /* find end pixel */
+ for (ex = sx+1;onBuf[ex] != 0 && ex < width;ex++);
+ int n = ex-sx;
+ Guchar *bp;
+ int ns;
+
+ switch (colorMode) {
+ case splashModeMono1:
+ case splashModeMono8:
+ bp = lineBuf+sx;
+ ns = n;
+ break;
+ case splashModeRGB8:
+ bp = lineBuf+sx*3;
+ ns = n*3;
+ break;
+ default:
+ OPRS::error("Image: no supported color mode\n");
+ result = splashErrOPVP;
+ goto err1;
+ break;
+ }
+ ns = (ns+3)/4;
+ ns *= 4;
+
+ OPVP_i2Fix(xMin+sx,(opvpx));
+ OPVP_i2Fix(yMin+y,(opvpy));
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ result = splashErrOPVP;
+ goto err1;
+ }
+ OPVP_i2Fix(n,opvprect.p1.x);
+ OPVP_i2Fix(1,opvprect.p1.y);
+ /* canonlisp driver use CTM only, ignores currentPoint */
+ /* So, set start point to CTM */
+ opvpctm.e = xMin+sx;
+ opvpctm.f = yMin+y;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ if (opvp->DrawImage(n,1,ns,OPVP_IFORMAT_RAW,
+ n,1,(void *)(bp)) < 0) {
+ OPRS::error("DrawImage error\n");
+ result = splashErrOPVP;
+ goto err1;
+ }
+
+ /* reset CTM */
+ opvpctm.e = 0.0;
+ opvpctm.f = 0.0;
+ if (opvp->SetCTM(&opvpctm) < 0) {
+ OPRS::error("SetCTM error\n");
+ }
+
+ sx = ex+1;
+ }
+ }
+
+
+err1:
+ delete clip;
+ gfree(pixBuf);
+ gfree(lineBuf);
+ gfree(onBuf);
+ return result;
+}
+
+void OPVPSplash::setColorMode(int colorModeA)
+{
+ colorMode = colorModeA;
+}
+
+void OPVPSplash::drawSpan(int x0, int x1, int y, GBool noClip)
+{
+ int s,e;
+ opvp_point_t points[1];
+ opvp_fix_t opvpx, opvpy;
+ SplashCoord *savedLineDash = 0;
+ int savedLineDashLength;
+ SplashCoord savedLineDashPhase;
+ SplashCoord savedLineWidth;
+ GBool noSpan;
+
+
+ if (opvp->NewPath() < 0) {
+ OPRS::error("NewPath error\n");
+ return;
+ }
+ if (noClip) {
+ noSpan = gFalse;
+ OPVP_i2Fix(x0,opvpx);
+ OPVP_i2Fix(y,opvpy);
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ return;
+ }
+ OPVP_i2Fix(x1+1,points[0].x);
+ OPVP_i2Fix(y,points[0].y);
+ if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
+ OPRS::error("LinePath error\n");
+ return;
+ }
+ } else {
+ noSpan = gTrue;
+ s = x0;
+ while (s < x1) {
+ /* find start point */
+ for (;s < x1;s++) {
+ if (state->clip->test(s, y)) break;
+ }
+ if (s < x1) {
+ /* start point was found */
+ /* then find end point */
+ for (e = s+1;e < x1;e++) {
+ if (!state->clip->test(e, y)) break;
+ }
+ /* do make span */
+ noSpan = gFalse;
+ OPVP_i2Fix(s,opvpx);
+ OPVP_i2Fix(y,opvpy);
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ return;
+ }
+ OPVP_i2Fix(e,points[0].x);
+ OPVP_i2Fix(y,points[0].y);
+ if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
+ OPRS::error("LinePath error\n");
+ return;
+ }
+ s = e;
+ }
+ }
+ }
+ if (opvp->EndPath() < 0) {
+ OPRS::error("EndPath error\n");
+ return;
+ }
+ if (noSpan) return;
+ /* change lins style temporarily */
+ savedLineDashLength = state->lineDashLength;
+ savedLineDashPhase = state->lineDashPhase;
+ if (savedLineDashLength > 0 && state->lineDash != 0) {
+ savedLineDash = new SplashCoord[savedLineDashLength];
+ memcpy(savedLineDash, state->lineDash,
+ savedLineDashLength*sizeof(SplashCoord));
+ }
+ setLineDash(0,0,0);
+ savedLineWidth = state->lineWidth;
+ setLineWidth(0.0);
+
+ if (opvp->StrokePath() < 0) {
+ OPRS::error("StrokePath error\n");
+ return;
+ }
+
+ /* restore line style */
+ setLineDash(savedLineDash,savedLineDashLength,
+ savedLineDashPhase);
+ if (savedLineDash != 0) {
+ delete[] savedLineDash;
+ }
+ setLineWidth(savedLineWidth);
+}
+
+/*
+ draw pixel with StrokePath
+ color is stroke color
+*/
+void OPVPSplash::drawPixel(int x, int y, GBool noClip)
+{
+ opvp_point_t points[1];
+ opvp_fix_t opvpx, opvpy;
+
+ if (noClip || state->clip->test(x, y)) {
+ if (opvp->NewPath() < 0) {
+ OPRS::error("NewPath error\n");
+ return;
+ }
+ OPVP_i2Fix(x,opvpx);
+ OPVP_i2Fix(y,opvpy);
+ if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
+ OPRS::error("NewPath error\n");
+ return;
+ }
+ OPVP_i2Fix(x+1,points[0].x);
+ OPVP_i2Fix(y,points[0].y);
+ if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
+ OPRS::error("LinePath error\n");
+ return;
+ }
+ if (opvp->EndPath() < 0) {
+ OPRS::error("EndPath error\n");
+ return;
+ }
+ if (opvp->StrokePath() < 0) {
+ OPRS::error("StrokePath error\n");
+ return;
+ }
+ }
+}
+
+const char *OPVPSplash::getOption(const char *key, int nOptions,
+ const char *optionKeys[], const char *optionVals[])
+{
+ int i;
+
+ for (i = 0;i < nOptions;i++) {
+ if (strcmp(key,optionKeys[i]) == 0) {
+ return optionVals[i];
+ }
+ }
+ return 0;
+}
+
+void OPVPSplash::endPage()
+{
+ if (clipPath != 0) {
+ delete clipPath;
+ clipPath = 0;
+ }
+}
+
+void OPVPSplash::restoreAllDriverState()
+{
+ for (;saveDriverStateCount > 0;saveDriverStateCount--) {
+ opvp->RestoreGS();
+ }
+}
+
+SplashCoord *OPVPSplash::getMatrix()
+{
+ return state->matrix;
+}
+
+OPVPClipPath *OPVPClipPath::stackTop = 0;
+
+OPVPClipPath::OPVPClipPath(OPVPSplashPath *pathA, GBool eoA)
+{
+ path = pathA;
+ eo = eoA;
+ next = 0;
+ saved = gFalse;
+}
+
+void OPVPClipPath::push()
+{
+ OPVPClipPath *p;
+
+ p = stackTop;
+ stackTop = copy();
+ stackTop->next = p;
+ saved = gTrue;
+}
+
+OPVPClipPath *OPVPClipPath::pop() {
+ OPVPClipPath *p = stackTop;
+ if (stackTop != 0) stackTop = stackTop->next;
+ return p;
+}
+
+OPVPClipPath *OPVPClipPath::copy()
+{
+ OPVPClipPath *p;
+
+ p = new OPVPClipPath(path->copy(),eo);
+ p->saved = saved;
+ return p;
+}
--- /dev/null
+//========================================================================
+//
+// OPVPSplash.h
+//
+//========================================================================
+
+#ifndef OPVPSPLASH_H
+#define OPVPSPLASH_H
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include <typeinfo>
+#include "splash/SplashTypes.h"
+#include "splash/SplashPattern.h"
+#include "splash/SplashErrorCodes.h"
+#include "OPVPSplashPath.h"
+#include "OPVPWrapper.h"
+#include "CharTypes.h"
+
+/* extra error code */
+#define splashErrOPVP 100
+
+#define OPVP_MAX_CLIPPATH_LENGTH 2000
+#define OPVP_MAX_FILLPATH_LENGTH 4000
+#define OPVP_BITMAPCHAR_THRESHOLD 2000
+#define OPVP_ROP_SRCCOPY 0xCC
+#define OPVP_ROP_S 0xCC
+#define OPVP_ROP_P 0xF0
+#define OPVP_ROP_PSDPxax 0xB8
+#define OPVP_ROP_DSPDxax 0xE2
+
+class SplashBitmap;
+class SplashGlyphBitmap;
+class OPVPSplashState;
+class SplashPattern;
+class SplashScreen;
+class OPVPSplashPath;
+class OPVPSplashXPath;
+class OPVPSplashClip;
+class SplashFont;
+
+class OPVPClipPath {
+public:
+ OPVPClipPath(OPVPSplashPath *pathA, GBool eoA);
+ void push();
+ static OPVPClipPath *pop();
+ ~OPVPClipPath() { delete path; }
+ OPVPSplashPath *getPath() { return path; }
+ GBool getEo() { return eo; }
+ GBool getSaved() { return saved; }
+private:
+ OPVPClipPath *copy();
+ OPVPClipPath *next;
+ OPVPSplashPath *path;
+ GBool eo;
+ GBool saved;
+ static OPVPClipPath *stackTop;
+};
+
+//------------------------------------------------------------------------
+// Splash
+//------------------------------------------------------------------------
+
+class OPVPSplash {
+public:
+
+ // Create a new rasterizer object.
+ OPVPSplash(OPVPWrapper *opvpA,
+ int nOptions, const char *optionKeys[], const char *optionVals[]);
+
+ virtual ~OPVPSplash();
+
+ //----- state read
+
+ SplashPattern *getStrokePattern();
+ SplashPattern *getFillPattern();
+ SplashScreen *getScreen();
+ SplashCoord getLineWidth();
+ int getLineCap();
+ int getLineJoin();
+ SplashCoord getMiterLimit();
+ SplashCoord getFlatness();
+ SplashCoord *getLineDash();
+ int getLineDashLength();
+ SplashCoord getLineDashPhase();
+ OPVPSplashClip *getClip();
+
+ //----- state write
+
+ void setStrokePattern(SplashPattern *strokeColor);
+ void setFillPattern(SplashPattern *fillColor);
+ void setScreen(SplashScreen *screen);
+ void setLineWidth(SplashCoord lineWidth);
+ void setLineCap(int lineCap);
+ void setLineJoin(int lineJoin);
+ void setMiterLimit(SplashCoord miterLimit);
+ void setFlatness(SplashCoord flatness);
+ // the <lineDash> array will be copied
+ void setLineDash(SplashCoord *lineDash, int lineDashLength,
+ SplashCoord lineDashPhase);
+ void clipResetToRect(SplashCoord x0, SplashCoord y0,
+ SplashCoord x1, SplashCoord y1);
+ SplashError clipToPath(OPVPSplashPath *path, GBool eo);
+
+ //----- state save/restore
+
+ void saveState();
+ SplashError restoreState();
+ void restoreAllDriverState();
+
+ //----- drawing operations
+
+ // Fill the bitmap with <color>. This is not subject to clipping.
+ void clear(SplashColor color);
+
+ // Stroke a path using the current stroke pattern.
+ SplashError stroke(OPVPSplashPath *path);
+
+ // Fill a path using the current fill pattern.
+ SplashError fill(OPVPSplashPath *path, GBool eo);
+
+ // Draw a character, using the current fill pattern.
+ SplashError fillChar(SplashCoord x, SplashCoord y, int c,
+ SplashFont *font, Unicode *u, double *fontMat);
+
+ // Draw a glyph, using the current fill pattern. This function does
+ // not free any data, i.e., it ignores glyph->freeData.
+ // not used in vector mode
+ void fillGlyph(SplashCoord x, SplashCoord y,
+ SplashGlyphBitmap *glyph);
+
+ // Draws an image mask using the fill color. This will read <w>*<h>
+ // pixels from <src>, in raster order, starting with the top line.
+ // "1" pixels will be drawn with the current fill color; "0" pixels
+ // are transparent. The matrix:
+ // [ mat[0] mat[1] 0 ]
+ // [ mat[2] mat[3] 0 ]
+ // [ mat[4] mat[5] 1 ]
+ // maps a unit square to the desired destination for the image, in
+ // PostScript style:
+ // [x' y' 1] = [x y 1] * mat
+ // Note that the Splash y axis points downward, and the image source
+ // is assumed to produce pixels in raster order, starting from the
+ // top line.
+ SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
+ int w, int h, SplashCoord *mat, GBool glyphMode);
+
+ // Draw an image. This will read <w>*<h> pixels from <src>, in
+ // raster order, starting with the top line. These pixels are
+ // assumed to be in the source mode, <srcMode>. The following
+ // combinations of source and target modes are supported:
+ // source target
+ // ------ ------
+ // Mono1 Mono1
+ // Mono8 Mono1 -- with dithering
+ // Mono8 Mono8
+ // RGB8 RGB8
+ // BGR8packed BGR8Packed
+ // The matrix behaves as for fillImageMask.
+ SplashError drawImage(SplashImageSource src, void *srcData,
+ SplashColorMode srcMode, GBool srcAlpha,
+ int w, int h, SplashCoord *mat);
+
+ //~ drawMaskedImage
+
+ //----- misc
+
+ // Return the associated bitmap.
+ SplashBitmap *getBitmap() { return 0; }
+
+ // Toggle debug mode on or off.
+ void setDebugMode(GBool debugModeA) { debugMode = debugModeA; }
+
+ void setColorMode(int colorModeA);
+ void setStateBypass(GBool bypass) {stateBypass = bypass;}
+ void endPage();
+ SplashCoord *getMatrix();
+ void drawSpan(int x0, int x1, int y, GBool noClip);
+#ifdef OLD_DRAW_IMAGE
+ void drawPixel(int x, int y, SplashColor *color, GBool noClip);
+#endif
+ void drawPixel(int x, int y, GBool noClip);
+ void arcToCurve(SplashCoord x0, SplashCoord y0,
+ SplashCoord x3, SplashCoord y3,
+ SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
+ SplashCoord *rx2, SplashCoord *ry2);
+
+private:
+ void makeBrush(SplashPattern *pattern, opvp_brush_t *brush);
+ SplashError doClipPath(OPVPSplashPath *path, GBool eo,
+ OPVPClipPath *prevClip);
+ opvp_cspace_t getOPVPColorSpace();
+ GBool equalPattern(SplashPattern *pt1, SplashPattern *pt2);
+ SplashError makeRectanglePath(SplashCoord x0, SplashCoord y0,
+ SplashCoord x1, SplashCoord y1, OPVPSplashPath **p);
+ SplashError drawImageFastWithCTM(SplashImageSource src, void *srcData,
+ int w, int h, int tx, int ty,
+ SplashCoord *mat);
+ SplashError drawImageNotShear(SplashImageSource src,
+ void *srcData,
+ int w, int h,
+ int tx, int ty,
+ int scaledWidth, int scaledHeight,
+ int xSign, int ySign, GBool rot);
+ SplashError fillImageMaskFastWithCTM(SplashImageMaskSource src,
+ void *srcData, int w, int h, int tx, int ty,SplashCoord *mat);
+ SplashError strokeByMyself(OPVPSplashPath *path);
+ SplashError fillByMyself(OPVPSplashPath *path, GBool eo);
+ OPVPSplashXPath *makeDashedPath(OPVPSplashXPath *xPath);
+ void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
+ SplashCoord *xo, SplashCoord *yo);
+
+ const char *getOption(const char *key, int nOptions, const char *optionKeys[],
+ const char *optionVals[]);
+
+ OPVPWrapper *opvp;
+ int printerContext;
+
+ OPVPSplashState *state;
+ GBool debugMode;
+ int colorMode;
+ GBool stateBypass;
+ OPVPClipPath *clipPath;
+
+ GBool oldLipsDriver;
+ GBool clipPathNotSaved;
+ GBool noShearImage;
+ GBool noLineStyle;
+ GBool noClipPath;
+ GBool noMiterLimit;
+ GBool ignoreMiterLimit;
+ GBool savedNoClipPath;
+ GBool noImageMask;
+ int bitmapCharThreshold;
+ int maxClipPathLength;
+ int maxFillPathLength;
+ int saveDriverStateCount;
+};
+
+#endif
--- /dev/null
+#include <config.h>
+#include "splash/SplashXPathScanner.h"
+#include "OPVPSplashClip.h"
+
+void OPVPSplashClip::getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA)
+{
+ int i;
+ int cxMin = splashRound(xMin), cyMin = splashRound(yMin);
+ int cxMax = splashRound(xMax), cyMax = splashRound(yMax);
+ int txMin, tyMin, txMax, tyMax;
+
+ for (i = 0; i < length; ++i) {
+ scanners[i]->getBBox(&txMin,&tyMin,&txMax,&tyMax);
+ if (txMin > cxMin) cxMin = txMin;
+ if (tyMin > cyMin) cyMin = tyMin;
+ if (txMax < cxMax) cxMax = txMax;
+ if (tyMax < cyMax) cyMax = tyMax;
+ }
+ *xMinA = cxMin;
+ *yMinA = cyMin;
+ *xMaxA = cxMax;
+ *yMaxA = cyMax;
+}
+
+OPVPSplashPath *OPVPSplashClip::makePath()
+{
+ int i,j;
+ int y, x0, x1;
+ int txMin, tyMin, txMax, tyMax;
+ int tsxMin, tsyMin, tsxMax, tsyMax;
+ Guchar *cbuf,*tbuf;
+ int blen;
+ OPVPSplashPath *p = new OPVPSplashPath();
+
+ getBBox(&txMin,&tyMin,&txMax,&tyMax);
+ if (txMin > txMax || tyMin > tyMax) return p;
+ blen = txMax-txMin+1;
+ cbuf = new Guchar[blen];
+ tbuf = new Guchar[blen];
+
+ /* dummy call to clear state */
+ scanners[0]->getBBox(&tsxMin,&tsyMin,&tsxMax,&tsyMax);
+ scanners[0]->getNextSpan(tsyMin-2,&x0,&x1);
+
+ for (y = tyMin;y <= tyMax;y++) {
+ /* clear buffer */
+ for (i = 0;i < blen;i++) {
+ cbuf[i] = 0;
+ }
+ while (scanners[0]->getNextSpan(y,&x0,&x1)) {
+ if (x0 < txMin) x0 = txMin;
+ if (x1 > txMax) x1 = txMax;
+ for (i = x0;i < x1;i++) {
+ cbuf[i-txMin] = 1;
+ }
+ }
+ for (j = 1; j < length; ++j) {
+ /* clear buffer */
+ for (i = 0;i < blen;i++) {
+ tbuf[i] = 0;
+ }
+ while (scanners[j]->getNextSpan(y,&x0,&x1)) {
+ if (x0 < txMin) x0 = txMin;
+ if (x1 > txMax) x1 = txMax;
+ for (i = x0;i < x1;i++) {
+ tbuf[i-txMin] = 1;
+ }
+ }
+ /* and buffer */
+ for (i = 0;i < blen;i++) {
+ cbuf[i] &= tbuf[i];
+ }
+ }
+ /* scan buffer and add path */
+ for (i = 0;i < blen;i = j) {
+ if (cbuf[i] != 0) {
+ p->moveTo(i+txMin,y);
+ for (j = i+1;j < blen && cbuf[j] != 0;j++);
+ p->lineTo(j-1+txMin,y);
+ p->lineTo(j-1+txMin,y+1);
+ p->lineTo(i+txMin,y+1);
+ p->close();
+ } else {
+ j = i+1;
+ }
+ }
+ }
+ delete[] cbuf;
+ delete[] tbuf;
+ return p;
+}
--- /dev/null
+#ifndef OPVPSPLASHCLIP_H
+#define OPVPSPLASHCLIP_H
+
+#include "splash/SplashClip.h"
+#include "OPVPSplashPath.h"
+
+class OPVPSplashClip : public SplashClip {
+public:
+
+ OPVPSplashClip(SplashCoord x0, SplashCoord y0,
+ SplashCoord x1, SplashCoord y1,
+ GBool antialiasA) :
+ SplashClip(x0,y0,x1,y1,antialiasA) {
+ }
+
+ OPVPSplashClip(SplashClip *sclip) : SplashClip(sclip) {
+ }
+
+ OPVPSplashClip *copy() { return new OPVPSplashClip(this); }
+
+ ~OPVPSplashClip() {}
+
+ void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA);
+ OPVPSplashPath *makePath();
+private:
+ OPVPSplashClip(OPVPSplashClip *clip) : SplashClip(clip) {
+ }
+};
+
+#endif
--- /dev/null
+#include <config.h>
+#include <stdio.h>
+#include "splash/SplashMath.h"
+#include "OPVPSplashPath.h"
+#include "OPVPWrapper.h"
+#include "OPRS.h"
+
+void OPVPSplashPath::getBBox(int *xMinA, int *yMinA, int *xMaxA,
+ int *yMaxA)
+{
+ int i;
+ SplashCoord xMin, yMin, xMax, yMax;
+
+ if (length <= 0) {
+ /* return far away point */
+ *xMinA = *yMinA = *xMaxA = *yMaxA = 0xC0000000;
+ return;
+ }
+ xMin = xMax = pts[0].x;
+ yMin = yMax = pts[0].y;
+ for (i = 1;i < length;i++) {
+ if (pts[i].x > xMax) {
+ xMax = pts[i].x;
+ } else if (pts[i].x < xMin) {
+ xMin = pts[i].x;
+ }
+ if (pts[i].y > yMax) {
+ yMax = pts[i].y;
+ } else if (pts[i].y < yMin) {
+ yMin = pts[i].y;
+ }
+ }
+ *xMinA = splashRound(xMin);
+ *xMaxA = splashRound(xMax);
+ *yMinA = splashRound(yMin);
+ *yMaxA = splashRound(yMax);
+}
+
+GBool OPVPSplashPath::isRectanglePath(
+ SplashCoord *xMin, SplashCoord *yMin, SplashCoord *xMax, SplashCoord *yMax)
+{
+ if (length != 5
+ || pts[0].x != pts[4].x
+ || pts[0].y != pts[4].y
+ || flags[0] != (splashPathFirst | splashPathClosed)
+ || flags[1] != 0
+ || flags[2] != 0
+ || flags[3] != 0
+ || flags[4] != (splashPathLast | splashPathClosed)) {
+ return gFalse;
+ }
+ if (splashRound(pts[0].x) == splashRound(pts[1].x)) {
+ if (splashRound(pts[1].y) != splashRound(pts[2].y)
+ || splashRound(pts[2].x) != splashRound(pts[3].x)
+ || splashRound(pts[3].y) != splashRound(pts[4].y)) {
+ return gFalse;
+ }
+ } else if (splashRound(pts[0].y) == splashRound(pts[1].y)) {
+ if (splashRound(pts[1].x) != splashRound(pts[2].x)
+ || splashRound(pts[2].y) != splashRound(pts[3].y)
+ || splashRound(pts[3].x) != splashRound(pts[4].x)) {
+ return gFalse;
+ }
+ } else {
+ return gFalse;
+ }
+ *xMin = pts[0].x;
+ *yMin = pts[0].y;
+ *xMax = pts[2].x;
+ *yMax = pts[2].y;
+ if (*xMin > *xMax) {
+ SplashCoord t = *xMin;
+
+ *xMin = *xMax;
+ *xMax = t;
+ }
+ if (*yMin > *yMax) {
+ SplashCoord t = *yMin;
+
+ *yMin = *yMax;
+ *yMax = t;
+ }
+ return gTrue;
+}
+
+SplashError OPVPSplashPath::makePath(OPVPWrapper *opvp)
+{
+ int i,j;
+ opvp_fix_t x,y;
+
+ if (opvp->NewPath() < 0) {
+ OPRS::error("NewPath error\n");
+ return splashErrOPVP;
+ }
+ for (i = 0;i < length;i = j) {
+ int curve = 0;
+ int n;
+ opvp_point_t *points;
+ int k;
+
+ if ((flags[i] & splashPathFirst) != 0) {
+ /* first point of a subpath */
+ if ((flags[i] & splashPathLast) == 0
+ || (flags[i] & splashPathClosed) != 0) {
+ OPVP_F2FIX((pts[i].x),(x));
+ OPVP_F2FIX((pts[i].y),(y));
+ if (opvp->SetCurrentPoint(x,y) < 0) {
+ OPRS::error("SetCurrentPoint error\n");
+ return splashErrOPVP;
+ }
+ }
+ j = i+1;
+ continue;
+ }
+ if (i+2 < length && flags[i] == splashPathCurve) {
+ /* curve */
+ curve = 1;
+ for (j = i;j+2 < length
+ && flags[j] == splashPathCurve;j += 3);
+ } else {
+ curve = 0;
+ for (j = i;j < length
+ && (flags[j] & splashPathCurve) == 0
+ && (flags[j] & splashPathFirst) == 0;j++);
+ }
+
+ n = j-i;
+ points = new opvp_point_t[n];
+ /* copy points */
+ for (k = i; k < j;k++) {
+ OPVP_F2FIX((pts[k].x),(points[k-i].x));
+ OPVP_F2FIX((pts[k].y),(points[k-i].y));
+ }
+
+ if (curve) {
+ /* curve */
+ if (opvp->BezierPath(n,points) < 0) {
+ OPRS::error("BezierPath error\n");
+ return splashErrOPVP;
+ }
+ } else {
+ /* line */
+ GBool closed = (flags[j-1] & splashPathClosed) != 0;
+
+ if (closed) {
+ if (opvp->LinePath(OPVP_PATHCLOSE,
+ n,points) < 0) {
+ OPRS::error("LinePath error\n");
+ return splashErrOPVP;
+ }
+ } else {
+ if (opvp->LinePath(OPVP_PATHOPEN,
+ n,points) < 0) {
+ OPRS::error("LinePath error\n");
+ return splashErrOPVP;
+ }
+ }
+ }
+ delete[] points;
+ }
+ if (opvp->EndPath() < 0) {
+ OPRS::error("EndPath error\n");
+ return splashErrOPVP;
+ }
+ return splashOk;
+}
+
+void OPVPSplashPath::closeAllSubPath()
+{
+ int i;
+ int f = 0;
+
+ for (i = 0;i < length;i++) {
+ if ((flags[i] & splashPathFirst) != 0) {
+ f = i;
+ }
+ if ((flags[i] & splashPathLast) != 0) {
+ if (pts[f].x == pts[i].x
+ && pts[f].y == pts[i].y) {
+ flags[f] |= splashPathClosed;
+ flags[i] |= splashPathClosed;
+ }
+ }
+ }
+}
--- /dev/null
+#ifndef OPVPSPLASHPATH_H
+#define OPVPSPLASHPATH_H
+
+#include "splash/SplashPath.h"
+#include "OPVPWrapper.h"
+
+class OPVPSplashPath : public SplashPath {
+public:
+
+ OPVPSplashPath() {};
+
+ OPVPSplashPath(SplashPath *spath) : SplashPath(spath) {
+ }
+
+ // Copy a path.
+ OPVPSplashPath *copy() { return new OPVPSplashPath(this); }
+
+ void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA);
+ GBool isRectanglePath(SplashCoord *xMin, SplashCoord *yMin,
+ SplashCoord *xMax, SplashCoord *yMax);
+ SplashError makePath(OPVPWrapper *opvp);
+ void closeAllSubPath();
+private:
+ OPVPSplashPath(OPVPSplashPath *path) : SplashPath(path) {
+ }
+};
+
+#endif
--- /dev/null
+//========================================================================
+//
+// SplashState.cc
+//
+//========================================================================
+
+#include <config.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <string.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "goo/gmem.h"
+#include "splash/SplashPattern.h"
+#include "splash/SplashScreen.h"
+#include "splash/SplashBitmap.h"
+#include "splash/SplashState.h"
+#include "OPVPSplashState.h"
+#include "OPVPSplashClip.h"
+
+//------------------------------------------------------------------------
+// SplashState
+//------------------------------------------------------------------------
+
+// number of components in each color mode
+static int opvpSplashColorModeNComps[] = {
+ 1, 1, 3, 3, 4
+};
+
+OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
+ SplashScreenParams *screenParams) {
+ SplashColor color;
+
+ matrix[0] = 1; matrix[1] = 0;
+ matrix[2] = 0; matrix[3] = 1;
+ matrix[4] = 0; matrix[5] = 0;
+ memset(&color, 0, sizeof(SplashColor));
+ strokePattern = new SplashSolidColor(color);
+ fillPattern = new SplashSolidColor(color);
+ screen = new SplashScreen(screenParams);
+ blendFunc = NULL;
+ strokeAlpha = 1;
+ fillAlpha = 1;
+ lineWidth = 0;
+ lineCap = splashLineCapButt;
+ lineJoin = splashLineJoinMiter;
+ miterLimit = 10;
+ flatness = 1;
+ lineDash = NULL;
+ lineDashLength = 0;
+ lineDashPhase = 0;
+ strokeAdjust = gFalse;
+ clip = new OPVPSplashClip(0, 0, width - 0.001,
+ height - 0.001, vectorAntialias);
+ softMask = NULL;
+ deleteSoftMask = gFalse;
+ inNonIsolatedGroup = gFalse;
+ next = NULL;
+}
+
+OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
+ SplashScreen *screenA) {
+ SplashColor color;
+
+ matrix[0] = 1; matrix[1] = 0;
+ matrix[2] = 0; matrix[3] = 1;
+ matrix[4] = 0; matrix[5] = 0;
+ memset(&color, 0, sizeof(SplashColor));
+ strokePattern = new SplashSolidColor(color);
+ fillPattern = new SplashSolidColor(color);
+ screen = screenA->copy();
+ blendFunc = NULL;
+ strokeAlpha = 1;
+ fillAlpha = 1;
+ lineWidth = 0;
+ lineCap = splashLineCapButt;
+ lineJoin = splashLineJoinMiter;
+ miterLimit = 10;
+ flatness = 1;
+ lineDash = NULL;
+ lineDashLength = 0;
+ lineDashPhase = 0;
+ strokeAdjust = gFalse;
+ clip = new OPVPSplashClip(0, 0, width - 0.001,
+ height - 0.001, vectorAntialias);
+ softMask = NULL;
+ deleteSoftMask = gFalse;
+ inNonIsolatedGroup = gFalse;
+ next = NULL;
+}
+
+OPVPSplashState::OPVPSplashState(OPVPSplashState *state) {
+ memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
+ strokePattern = state->strokePattern->copy();
+ fillPattern = state->fillPattern->copy();
+ screen = state->screen->copy();
+ blendFunc = state->blendFunc;
+ strokeAlpha = state->strokeAlpha;
+ fillAlpha = state->fillAlpha;
+ lineWidth = state->lineWidth;
+ lineCap = state->lineCap;
+ lineJoin = state->lineJoin;
+ miterLimit = state->miterLimit;
+ flatness = state->flatness;
+ if (state->lineDash) {
+ lineDashLength = state->lineDashLength;
+ lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
+ memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
+ } else {
+ lineDash = NULL;
+ lineDashLength = 0;
+ }
+ lineDashPhase = state->lineDashPhase;
+ strokeAdjust = state->strokeAdjust;
+ clip = state->clip->copy();
+ softMask = state->softMask;
+ deleteSoftMask = gFalse;
+ inNonIsolatedGroup = state->inNonIsolatedGroup;
+ next = NULL;
+}
+
+OPVPSplashState::~OPVPSplashState() {
+ delete strokePattern;
+ delete fillPattern;
+ delete screen;
+ gfree(lineDash);
+ delete clip;
+ if (deleteSoftMask && softMask) {
+ delete softMask;
+ }
+}
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+void OPVPSplashState::setState(Splash *osplash) {
+ osplash->setMatrix(matrix);
+ osplash->setFlatness(flatness);
+ osplash->setLineDash(lineDash,lineDashLength,lineDashPhase);
+ osplash->setLineCap(lineCap);
+ osplash->setStrokeAdjust(strokeAdjust);
+ osplash->setMiterLimit(miterLimit);
+ osplash->setLineJoin(lineJoin);
+}
+#endif
+
+void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) {
+ delete strokePattern;
+ strokePattern = strokePatternA;
+}
+
+void OPVPSplashState::setFillPattern(SplashPattern *fillPatternA) {
+ delete fillPattern;
+ fillPattern = fillPatternA;
+}
+
+void OPVPSplashState::setScreen(SplashScreen *screenA) {
+ delete screen;
+ screen = screenA;
+}
+
+void OPVPSplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
+ SplashCoord lineDashPhaseA) {
+ gfree(lineDash);
+ lineDashLength = lineDashLengthA;
+ if (lineDashLength > 0) {
+ lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
+ memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
+ } else {
+ lineDash = NULL;
+ }
+ lineDashPhase = lineDashPhaseA;
+}
+
+void OPVPSplashState::setSoftMask(SplashBitmap *softMaskA) {
+ if (deleteSoftMask) {
+ delete softMask;
+ }
+ softMask = softMaskA;
+ deleteSoftMask = gTrue;
+}
--- /dev/null
+//========================================================================
+//
+// OPVPSplashState.h
+//
+//========================================================================
+
+#ifndef OPVPSPLASHSTATE_H
+#define OPVPSPLASHSTATE_H
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "splash/SplashTypes.h"
+#include "splash/SplashState.h"
+#include "splash/Splash.h"
+
+class SplashPattern;
+class SplashScreen;
+class OPVPSplashClip;
+class SplashBitmap;
+
+//------------------------------------------------------------------------
+// SplashState
+//------------------------------------------------------------------------
+
+class OPVPSplashState {
+public:
+
+ // Create a new state object, initialized with default settings.
+ OPVPSplashState(int width, int height, GBool vectorAntialias,
+ SplashScreenParams *screenParams);
+ OPVPSplashState(int width, int height, GBool vectorAntialias,
+ SplashScreen *screenA);
+
+ // Copy a state object.
+ OPVPSplashState *copy() { return new OPVPSplashState(this); }
+
+ ~OPVPSplashState();
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ void setState(Splash *osplash);
+#endif
+
+ // Set the stroke pattern. This does not copy <strokePatternA>.
+ void setStrokePattern(SplashPattern *strokePatternA);
+
+ // Set the fill pattern. This does not copy <fillPatternA>.
+ void setFillPattern(SplashPattern *fillPatternA);
+
+ // Set the screen. This does not copy <screenA>.
+ void setScreen(SplashScreen *screenA);
+
+ // Set the line dash pattern. This copies the <lineDashA> array.
+ void setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
+ SplashCoord lineDashPhaseA);
+
+ // Set the soft mask bitmap.
+ void setSoftMask(SplashBitmap *softMaskA);
+
+private:
+
+ OPVPSplashState(OPVPSplashState *state);
+
+ SplashCoord matrix[6];
+ SplashPattern *strokePattern;
+ SplashPattern *fillPattern;
+ SplashScreen *screen;
+ SplashBlendFunc blendFunc;
+ SplashCoord strokeAlpha;
+ SplashCoord fillAlpha;
+ SplashCoord lineWidth;
+ int lineCap;
+ int lineJoin;
+ SplashCoord miterLimit;
+ SplashCoord flatness;
+ SplashCoord *lineDash;
+ int lineDashLength;
+ SplashCoord lineDashPhase;
+ GBool strokeAdjust;
+ OPVPSplashClip *clip;
+ SplashBitmap *softMask;
+ GBool deleteSoftMask;
+ GBool inNonIsolatedGroup;
+
+ OPVPSplashState *next; // used by OPVPSplash class
+
+ friend class OPVPSplash;
+ friend class OPVPSplashXPath;
+};
+
+#endif
--- /dev/null
+#include <config.h>
+#include <stdio.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "splash/Splash.h"
+#include "splash/SplashMath.h"
+#include "OPVPSplashClip.h"
+#include "OPVPSplashXPath.h"
+#include "OPVPWrapper.h"
+#include "OPVPSplash.h"
+
+#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19
+OPVPSplashXPath *OPVPSplashXPath::makeDashedPath(OPVPSplashState *state)
+{
+ OPVPSplashXPath *dPath;
+ GBool lineDashStartOn, lineDashOn;
+ GBool atSegStart, atSegEnd, atDashStart, atDashEnd;
+ int lineDashStartIdx, lineDashIdx, subpathStart;
+ SplashCoord lineDashTotal, lineDashStartPhase, lineDashDist;
+ int segIdx;
+ SplashXPathSeg *seg;
+ SplashCoord sx0, sy0, sx1, sy1, ax0, ay0, ax1, ay1, dist;
+ int i;
+
+ dPath = new OPVPSplashXPath();
+
+ lineDashTotal = 0;
+ for (i = 0; i < state->lineDashLength; ++i) {
+ lineDashTotal += state->lineDash[i];
+ }
+ lineDashStartPhase = state->lineDashPhase;
+ i = splashFloor(lineDashStartPhase / lineDashTotal);
+ lineDashStartPhase -= i * lineDashTotal;
+ lineDashStartOn = gTrue;
+ lineDashStartIdx = 0;
+ while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
+ lineDashStartOn = !lineDashStartOn;
+ lineDashStartPhase -= state->lineDash[lineDashStartIdx];
+ ++lineDashStartIdx;
+ }
+
+ segIdx = 0;
+ seg = segs;
+ sx0 = seg->x0;
+ sy0 = seg->y0;
+ sx1 = seg->x1;
+ sy1 = seg->y1;
+ dist = splashDist(sx0, sy0, sx1, sy1);
+ lineDashOn = lineDashStartOn;
+ lineDashIdx = lineDashStartIdx;
+ lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
+ atSegStart = gTrue;
+ atDashStart = gTrue;
+ subpathStart = dPath->length;
+
+ while (segIdx < length) {
+
+ ax0 = sx0;
+ ay0 = sy0;
+ if (dist <= lineDashDist) {
+ ax1 = sx1;
+ ay1 = sy1;
+ lineDashDist -= dist;
+ dist = 0;
+ atSegEnd = gTrue;
+ atDashEnd = lineDashDist == 0 || (seg->flags & splashXPathLast);
+ } else {
+ ax1 = sx0 + (lineDashDist / dist) * (sx1 - sx0);
+ ay1 = sy0 + (lineDashDist / dist) * (sy1 - sy0);
+ sx0 = ax1;
+ sy0 = ay1;
+ dist -= lineDashDist;
+ lineDashDist = 0;
+ atSegEnd = gFalse;
+ atDashEnd = gTrue;
+ }
+
+ if (lineDashOn) {
+ dPath->addSegment(ax0, ay0, ax1, ay1,
+ atDashStart, atDashEnd,
+ atDashStart, atDashEnd);
+ // end of closed subpath
+ if (atSegEnd &&
+ (seg->flags & splashXPathLast) &&
+ !(seg->flags & splashXPathEnd1)) {
+ dPath->segs[subpathStart].flags &= ~splashXPathEnd0;
+ dPath->segs[dPath->length - 1].flags &= ~splashXPathEnd1;
+ }
+ }
+
+ if (atDashEnd) {
+ lineDashOn = !lineDashOn;
+ if (++lineDashIdx == state->lineDashLength) {
+ lineDashIdx = 0;
+ }
+ lineDashDist = state->lineDash[lineDashIdx];
+ atDashStart = gTrue;
+ } else {
+ atDashStart = gFalse;
+ }
+ if (atSegEnd) {
+ if (++segIdx < length) {
+ ++seg;
+ sx0 = seg->x0;
+ sy0 = seg->y0;
+ sx1 = seg->x1;
+ sy1 = seg->y1;
+ dist = splashDist(sx0, sy0, sx1, sy1);
+ if (seg->flags & splashXPathFirst) {
+ lineDashOn = lineDashStartOn;
+ lineDashIdx = lineDashStartIdx;
+ lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
+ atDashStart = gTrue;
+ subpathStart = dPath->length;
+ }
+ }
+ atSegStart = gTrue;
+ } else {
+ atSegStart = gFalse;
+ }
+ }
+
+ return dPath;
+}
+
+void OPVPSplashXPath::strokeWide(OPVPSplash *splash, OPVPSplashState *state)
+{
+ SplashXPathSeg *seg, *seg2;
+ OPVPSplashPath *widePath;
+ SplashCoord d, dx, dy, wdx, wdy, dxPrev, dyPrev, wdxPrev, wdyPrev;
+ SplashCoord dotprod, miter;
+ SplashCoord x0,y0,x1,y1,x2,y2,x3,y3;
+ int i, j;
+
+ dx = dy = wdx = wdy = 0; // make gcc happy
+ dxPrev = dyPrev = wdxPrev = wdyPrev = 0; // make gcc happy
+
+ for (i = 0, seg = segs; i < length; ++i, ++seg) {
+
+ // save the deltas for the previous segment; if this is the first
+ // segment on a subpath, compute the deltas for the last segment
+ // on the subpath (which may be used to draw a line join)
+ if (seg->flags & splashXPathFirst) {
+ for (j = i + 1, seg2 = &segs[j];
+ j < length; ++j, ++seg2) {
+ if (seg2->flags & splashXPathLast) {
+ d = splashDist(seg2->x0, seg2->y0, seg2->x1, seg2->y1);
+ if (d == 0) {
+ //~ not clear what the behavior should be for joins with d==0
+ dxPrev = 0;
+ dyPrev = 1;
+ } else {
+ d = 1 / d;
+ dxPrev = d * (seg2->x1 - seg2->x0);
+ dyPrev = d * (seg2->y1 - seg2->y0);
+ }
+ wdxPrev = 0.5 * state->lineWidth * dxPrev;
+ wdyPrev = 0.5 * state->lineWidth * dyPrev;
+ break;
+ }
+ }
+ } else {
+ dxPrev = dx;
+ dyPrev = dy;
+ wdxPrev = wdx;
+ wdyPrev = wdy;
+ }
+
+ // compute deltas for this line segment
+ d = splashDist(seg->x0, seg->y0, seg->x1, seg->y1);
+ if (d == 0) {
+ // we need to draw end caps on zero-length lines
+ //~ not clear what the behavior should be for splashLineCapButt with d==0
+ dx = 0;
+ dy = 1;
+ } else {
+ d = 1 / d;
+ dx = d * (seg->x1 - seg->x0);
+ dy = d * (seg->y1 - seg->y0);
+ }
+ wdx = 0.5 * state->lineWidth * dx;
+ wdy = 0.5 * state->lineWidth * dy;
+
+ // initialize the path (which will be filled)
+ widePath = new OPVPSplashPath();
+ widePath->moveTo(seg->x0 - wdy, seg->y0 + wdx);
+
+ // draw the start cap
+ if (seg->flags & splashXPathEnd0) {
+ switch (state->lineCap) {
+ case splashLineCapButt:
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ break;
+ case splashLineCapRound:
+ x0 = seg->x0 - wdy;
+ y0 = seg->y0 + wdx;
+ x3 = seg->x0 - wdx;
+ y3 = seg->y0 - wdy;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x2,y2,x1,y1,x3,y3);
+ x0 = x3;
+ y0 = y3;
+ x3 = seg->x0 + wdy;
+ y3 = seg->y0 - wdx;
+ splash->arcToCurve(x0,y0,x3,y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x2,y2,x1,y1,x3,y3);
+ break;
+ case splashLineCapProjecting:
+ widePath->lineTo(seg->x0 - wdx - wdy, seg->y0 + wdx - wdy);
+ widePath->lineTo(seg->x0 - wdx + wdy, seg->y0 - wdx - wdy);
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ break;
+ }
+ } else {
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ }
+
+ // draw the left side of the segment
+ widePath->lineTo(seg->x1 + wdy, seg->y1 - wdx);
+
+ // draw the end cap
+ if (seg->flags & splashXPathEnd1) {
+ switch (state->lineCap) {
+ case splashLineCapButt:
+ widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
+ break;
+ case splashLineCapRound:
+ x0 = seg->x1 + wdy;
+ y0 = seg->y1 - wdx;
+ x3 = seg->x1 + wdx;
+ y3 = seg->y1 + wdy;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x1, seg->y1, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x2,y2,x1,y1,x3,y3);
+ x0 = x3;
+ y0 = y3;
+ x3 = seg->x1 - wdy;
+ y3 = seg->y1 + wdx;
+ splash->arcToCurve(x0,y0,x3,y3,
+ seg->x1, seg->y1, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x2,y2,x1,y1,x3,y3);
+ break;
+ case splashLineCapProjecting:
+ widePath->lineTo(seg->x1 + wdx + wdy, seg->y1 - wdx + wdy);
+ widePath->lineTo(seg->x1 + wdx - wdy, seg->y1 + wdx + wdy);
+ widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
+ break;
+ }
+ } else {
+ widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
+ }
+
+ // draw the right side of the segment
+ widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
+
+ // fill the segment
+ splash->fill(widePath, gTrue);
+ delete widePath;
+
+ // draw the line join
+ if (!(seg->flags & splashXPathEnd0)) {
+ widePath = NULL;
+ switch (state->lineJoin) {
+ case splashLineJoinMiter:
+ dotprod = -(dx * dxPrev + dy * dyPrev);
+ if (dotprod != 1) {
+ widePath = new OPVPSplashPath();
+ widePath->moveTo(seg->x0, seg->y0);
+ miter = 2 / (1 - dotprod);
+ if (splashSqrt(miter) <= state->miterLimit) {
+ miter = splashSqrt(miter - 1);
+ if (dy * dxPrev > dx * dyPrev) {
+ widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
+ widePath->lineTo(seg->x0 + wdy - miter * wdx,
+ seg->y0 - wdx - miter * wdy);
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ } else {
+ widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
+ widePath->lineTo(seg->x0 - wdy - miter * wdx,
+ seg->y0 + wdx - miter * wdy);
+ widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
+ }
+ } else {
+ if (dy * dxPrev > dx * dyPrev) {
+ widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ } else {
+ widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
+ widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
+ }
+ }
+ }
+ break;
+ case splashLineJoinRound:
+ widePath = new OPVPSplashPath();
+ /* draw circle */
+ widePath->moveTo(seg->x0 + wdy, seg->y0 - wdx);
+ x0 = seg->x0 + wdy;
+ y0 = seg->y0 - wdx;
+ x3 = seg->x0 - wdx;
+ y3 = seg->y0 - wdy;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x1,y1,x2,y2,x3,y3);
+ x0 = x3;
+ y0 = y3;
+ x3 = seg->x0 - wdy;
+ y3 = seg->y0 + wdx;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x1,y1,x2,y2,x3,y3);
+ x0 = x3;
+ y0 = y3;
+ x3 = seg->x0 + wdx;
+ y3 = seg->y0 + wdy;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x1,y1,x2,y2,x3,y3);
+ x0 = x3;
+ y0 = y3;
+ x3 = seg->x0 + wdy;
+ y3 = seg->y0 - wdx;
+ splash->arcToCurve(x0, y0, x3, y3,
+ seg->x0, seg->y0, &x1,&y1,&x2,&y2);
+ widePath->curveTo(x1,y1,x2,y2,x3,y3);
+ break;
+ case splashLineJoinBevel:
+ widePath = new OPVPSplashPath();
+ widePath->moveTo(seg->x0, seg->y0);
+ if (dy * dxPrev > dx * dyPrev) {
+ widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
+ widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
+ } else {
+ widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
+ widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
+ }
+ break;
+ }
+ if (widePath) {
+ splash->fill(widePath, gTrue);
+ delete widePath;
+ }
+ }
+ }
+}
+#endif
+
+void OPVPSplashXPath::strokeNarrow(OPVPSplash *splash, OPVPSplashState *state)
+{
+ SplashXPathSeg *seg;
+ int x0, x1, x2, x3, y0, y1, x, y, t;
+ SplashCoord dx, dy, dxdy;
+ SplashClipResult clipRes;
+ int i;
+
+ for (i = 0, seg = segs; i < length; ++i, ++seg) {
+
+ x0 = splashFloor(seg->x0);
+ x1 = splashFloor(seg->x1);
+ y0 = splashFloor(seg->y0);
+ y1 = splashFloor(seg->y1);
+
+ // horizontal segment
+ if (y0 == y1) {
+ if (x0 > x1) {
+ t = x0; x0 = x1; x1 = t;
+ }
+ if ((clipRes = state->clip->testSpan(x0, x1, y0))
+ != splashClipAllOutside) {
+ splash->drawSpan(x0, x1, y0, clipRes == splashClipAllInside);
+ }
+
+ // segment with |dx| > |dy|
+ } else if (splashAbs(seg->dxdy) > 1) {
+ dx = seg->x1 - seg->x0;
+ dy = seg->y1 - seg->y0;
+ dxdy = seg->dxdy;
+ if (y0 > y1) {
+ t = y0; y0 = y1; y1 = t;
+ t = x0; x0 = x1; x1 = t;
+ dx = -dx;
+ dy = -dy;
+ }
+ if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
+ x0 <= x1 ? x1 : x0, y1))
+ != splashClipAllOutside) {
+ if (dx > 0) {
+ x2 = x0;
+ for (y = y0; y < y1; ++y) {
+ x3 = splashFloor(seg->x0 + (y + 1 - seg->y0) * dxdy);
+ splash->drawSpan(x2, x3 - 1, y, clipRes == splashClipAllInside);
+ x2 = x3;
+ }
+ splash->drawSpan(x2, x1, y, clipRes == splashClipAllInside);
+ } else {
+ x2 = x0;
+ for (y = y0; y < y1; ++y) {
+ x3 = splashFloor(seg->x0 + (y + 1 - seg->y0) * dxdy);
+ splash->drawSpan(x3 + 1, x2, y, clipRes == splashClipAllInside);
+ x2 = x3;
+ }
+ splash->drawSpan(x1, x2, y, clipRes == splashClipAllInside);
+ }
+ }
+
+ // segment with |dy| > |dx|
+ } else {
+ dxdy = seg->dxdy;
+ if (y0 > y1) {
+ t = y0; y0 = y1; y1 = t;
+ }
+ if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
+ x0 <= x1 ? x1 : x0, y1))
+ != splashClipAllOutside) {
+ for (y = y0; y <= y1; ++y) {
+ x = splashFloor(seg->x0 + (y - seg->y0) * dxdy);
+ splash->drawPixel(x, y, clipRes == splashClipAllInside);
+ }
+ }
+ }
+ }
+}
+
--- /dev/null
+#ifndef OPVPSPLASHXPATH_H
+#define OPVPSPLASHXPATH_H
+
+#include <config.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "splash/SplashXPath.h"
+#include "OPVPSplashPath.h"
+#include "OPVPSplashState.h"
+
+class OPVPSplash;
+
+class OPVPSplashXPath : public SplashXPath {
+public:
+ OPVPSplashXPath(OPVPSplashPath *path, SplashCoord *matrix,
+ SplashCoord flatness, GBool closeSubpaths) :
+ SplashXPath(path,matrix,flatness,closeSubpaths) {
+ }
+
+ // Copy an expanded path.
+ OPVPSplashXPath *copy() { return new OPVPSplashXPath(this); }
+
+ OPVPSplashXPath *makeDashedPath(OPVPSplashState *state);
+ void strokeNarrow(OPVPSplash *splash, OPVPSplashState *state);
+#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19
+ void strokeWide(OPVPSplash *splash, OPVPSplashState *state);
+#endif
+private:
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ OPVPSplashXPath() : SplashXPath(new SplashPath(), 0, 0, gFalse) {};
+#else
+ OPVPSplashXPath() {};
+#endif
+ OPVPSplashXPath(OPVPSplashXPath *xPath) : SplashXPath(xPath) {
+ }
+};
+
+#endif
--- /dev/null
+/*
+ OPVPWrapper.cc
+*/
+
+
+#include <config.h>
+#include <stdio.h>
+#include "OPRS.h"
+#include "OPVPWrapper.h"
+#include "OPVPWrapper_0_2.h"
+#include <string.h>
+#include <dlfcn.h>
+
+OPVPWrapper::OPVPWrapper(void *opvpHandleA, opvp_int_t *opvpErrorNoA,
+ opvp_api_procs_t *procsA, opvp_dc_t printerContextA)
+{
+ procs = procsA;
+ opvpHandle = opvpHandleA;
+ opvpErrorNo = opvpErrorNoA;
+ printerContext = printerContextA;
+ version[0] = 1;
+ version[1] = 0;
+ supportClosePrinter = (procs->opvpClosePrinter != 0);
+ supportStartJob = (procs->opvpStartJob != 0);
+ supportEndJob = (procs->opvpEndJob != 0);
+ supportAbortJob = (procs->opvpAbortJob != 0);
+ supportStartDoc = (procs->opvpStartDoc != 0);
+ supportEndDoc = (procs->opvpEndDoc != 0);
+ supportStartPage = (procs->opvpStartPage != 0);
+ supportEndPage = (procs->opvpEndPage != 0);
+ supportResetCTM = (procs->opvpResetCTM != 0);
+ supportSetCTM = (procs->opvpSetCTM != 0);
+ supportGetCTM = (procs->opvpGetCTM != 0);
+ supportInitGS = (procs->opvpInitGS != 0);
+ supportSaveGS = (procs->opvpSaveGS != 0);
+ supportRestoreGS = (procs->opvpRestoreGS != 0);
+ supportQueryColorSpace = (procs->opvpQueryColorSpace != 0);
+ supportSetColorSpace = (procs->opvpSetColorSpace != 0);
+ supportGetColorSpace = (procs->opvpGetColorSpace != 0);
+ supportSetFillMode = (procs->opvpSetFillMode != 0);
+ supportGetFillMode = (procs->opvpGetFillMode != 0);
+ supportSetAlphaConstant = (procs->opvpSetAlphaConstant != 0);
+ supportGetAlphaConstant = (procs->opvpGetAlphaConstant != 0);
+ supportSetLineWidth = (procs->opvpSetLineWidth != 0);
+ supportGetLineWidth = (procs->opvpGetLineWidth != 0);
+ supportSetLineDash = (procs->opvpSetLineDash != 0);
+ supportGetLineDash = (procs->opvpGetLineDash != 0);
+ supportSetLineDashOffset = (procs->opvpSetLineDashOffset != 0);
+ supportGetLineDashOffset = (procs->opvpGetLineDashOffset != 0);
+ supportSetLineStyle = (procs->opvpSetLineStyle != 0);
+ supportGetLineStyle = (procs->opvpGetLineStyle != 0);
+ supportSetLineCap = (procs->opvpSetLineCap != 0);
+ supportGetLineCap = (procs->opvpGetLineCap != 0);
+ supportSetLineJoin = (procs->opvpSetLineJoin != 0);
+ supportGetLineJoin = (procs->opvpGetLineJoin != 0);
+ supportSetMiterLimit = (procs->opvpSetMiterLimit != 0);
+ supportGetMiterLimit = (procs->opvpGetMiterLimit != 0);
+ supportSetPaintMode = (procs->opvpSetPaintMode != 0);
+ supportGetPaintMode = (procs->opvpGetPaintMode != 0);
+ supportSetStrokeColor = (procs->opvpSetStrokeColor != 0);
+ supportSetFillColor = (procs->opvpSetFillColor != 0);
+ supportSetBgColor = (procs->opvpSetBgColor != 0);
+ supportNewPath = (procs->opvpNewPath != 0);
+ supportEndPath = (procs->opvpEndPath != 0);
+ supportStrokePath = (procs->opvpStrokePath != 0);
+ supportFillPath = (procs->opvpFillPath != 0);
+ supportStrokeFillPath = (procs->opvpStrokeFillPath != 0);
+ supportSetClipPath = (procs->opvpSetClipPath != 0);
+ supportSetCurrentPoint = (procs->opvpSetCurrentPoint != 0);
+ supportLinePath = (procs->opvpLinePath != 0);
+ supportPolygonPath = (procs->opvpPolygonPath != 0);
+ supportRectanglePath = (procs->opvpRectanglePath != 0);
+ supportRoundRectanglePath = (procs->opvpRoundRectanglePath != 0);
+ supportBezierPath = (procs->opvpBezierPath != 0);
+ supportArcPath = (procs->opvpArcPath != 0);
+ supportDrawImage = (procs->opvpDrawImage != 0);
+ supportStartDrawImage = (procs->opvpStartDrawImage != 0);
+ supportTransferDrawImage = (procs->opvpTransferDrawImage != 0);
+ supportEndDrawImage = (procs->opvpEndDrawImage != 0);
+ supportStartScanline = (procs->opvpStartScanline != 0);
+ supportScanline = (procs->opvpScanline != 0);
+ supportEndScanline = (procs->opvpEndScanline != 0);
+ supportStartRaster = (procs->opvpStartRaster != 0);
+ supportTransferRasterData = (procs->opvpTransferRasterData != 0);
+ supportSkipRaster = (procs->opvpSkipRaster != 0);
+ supportEndRaster = (procs->opvpEndRaster != 0);
+ supportStartStream = (procs->opvpStartStream != 0);
+ supportTransferStreamData = (procs->opvpTransferStreamData != 0);
+ supportEndStream = (procs->opvpEndStream != 0);
+ supportQueryDeviceCapability = (procs->opvpQueryDeviceCapability != 0);
+ supportQueryDeviceInfo = (procs->opvpQueryDeviceInfo != 0);
+ supportResetClipPath = (procs->opvpResetClipPath != 0);
+}
+
+OPVPWrapper::~OPVPWrapper()
+{
+ unloadDriver(opvpHandle);
+ opvpHandle = 0;
+}
+
+opvp_result_t OPVPWrapper::ClosePrinter()
+{
+ if (!supportClosePrinter) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpClosePrinter(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartJob(const opvp_char_t *jobInfo)
+{
+ if (!supportStartJob) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartJob(printerContext,jobInfo);
+}
+
+opvp_result_t OPVPWrapper::EndJob()
+{
+ if (!supportEndJob) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndJob(printerContext);
+}
+
+opvp_result_t OPVPWrapper::AbortJob()
+{
+ if (!supportAbortJob) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpAbortJob(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartDoc(const opvp_char_t *docInfo)
+{
+ if (!supportStartDoc) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartDoc(printerContext,docInfo);
+}
+
+opvp_result_t OPVPWrapper::EndDoc()
+{
+ if (!supportEndDoc) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndDoc(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartPage(const opvp_char_t *pageInfo)
+{
+ if (!supportStartPage) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartPage(printerContext,pageInfo);
+}
+
+opvp_result_t OPVPWrapper::EndPage()
+{
+ if (!supportEndPage) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndPage(printerContext);
+}
+
+opvp_result_t OPVPWrapper::QueryDeviceCapability(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf)
+{
+ if (!supportQueryDeviceCapability) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpQueryDeviceCapability(printerContext,queryflag,
+ buflen,infoBuf);
+}
+
+opvp_result_t OPVPWrapper::QueryDeviceInfo(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf)
+{
+ if (!supportQueryDeviceInfo) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpQueryDeviceInfo(printerContext,queryflag,
+ buflen,infoBuf);
+}
+
+opvp_result_t OPVPWrapper::ResetCTM()
+{
+ if (!supportResetCTM) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpResetCTM(printerContext);
+}
+
+opvp_result_t OPVPWrapper::SetCTM(const opvp_ctm_t *pCTM)
+{
+ if (!supportSetCTM) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetCTM(printerContext,pCTM);
+}
+
+opvp_result_t OPVPWrapper::GetCTM(opvp_ctm_t *pCTM)
+{
+ if (!supportGetCTM) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetCTM(printerContext,pCTM);
+}
+
+opvp_result_t OPVPWrapper::InitGS()
+{
+ if (!supportInitGS) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpInitGS(printerContext);
+}
+
+opvp_result_t OPVPWrapper::SaveGS()
+{
+ if (!supportSaveGS) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSaveGS(printerContext);
+}
+
+opvp_result_t OPVPWrapper::RestoreGS()
+{
+ if (!supportRestoreGS) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpRestoreGS(printerContext);
+}
+
+opvp_result_t OPVPWrapper::QueryColorSpace(opvp_int_t *pnum,
+ opvp_cspace_t *pcspace)
+{
+ if (!supportQueryColorSpace) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpQueryColorSpace(printerContext,pnum,pcspace);
+}
+
+opvp_result_t OPVPWrapper::SetColorSpace(opvp_cspace_t cspace)
+{
+ if (!supportSetColorSpace) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetColorSpace(printerContext,cspace);
+}
+
+opvp_result_t OPVPWrapper::GetColorSpace(opvp_cspace_t *pcspace)
+{
+ if (!supportGetColorSpace) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetColorSpace(printerContext,pcspace);
+}
+
+opvp_result_t OPVPWrapper::SetFillMode(opvp_fillmode_t fillmode)
+{
+ if (!supportSetFillMode) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetFillMode(printerContext,fillmode);
+}
+
+opvp_result_t OPVPWrapper::GetFillMode(opvp_fillmode_t *pfillmode)
+{
+ if (!supportGetFillMode) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetFillMode(printerContext,pfillmode);
+}
+
+opvp_result_t OPVPWrapper::SetAlphaConstant(opvp_float_t alpha)
+{
+ if (!supportSetAlphaConstant) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetAlphaConstant(printerContext,alpha);
+}
+
+opvp_result_t OPVPWrapper::GetAlphaConstant(opvp_float_t *palpha)
+{
+ if (!supportGetAlphaConstant) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetAlphaConstant(printerContext,palpha);
+}
+
+opvp_result_t OPVPWrapper::SetLineWidth(opvp_fix_t width)
+{
+ if (!supportSetLineWidth) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineWidth(printerContext,width);
+}
+
+opvp_result_t OPVPWrapper::GetLineWidth(opvp_fix_t *pwidth)
+{
+ if (!supportGetLineWidth) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineWidth(printerContext,pwidth);
+}
+
+opvp_result_t OPVPWrapper::SetLineDash(opvp_int_t num,
+ const opvp_fix_t *pdash)
+{
+ if (!supportSetLineDash) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineDash(printerContext,num,pdash);
+}
+
+opvp_result_t OPVPWrapper::GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash)
+{
+ if (!supportGetLineDash) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineDash(printerContext,pnum,pdash);
+}
+
+opvp_result_t OPVPWrapper::SetLineDashOffset(opvp_fix_t offset)
+{
+ if (!supportSetLineDashOffset) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineDashOffset(printerContext,offset);
+}
+
+opvp_result_t OPVPWrapper::GetLineDashOffset(opvp_fix_t *poffset)
+{
+ if (!supportGetLineDashOffset) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineDashOffset(printerContext,poffset);
+}
+
+opvp_result_t OPVPWrapper::SetLineStyle(opvp_linestyle_t linestyle)
+{
+ if (!supportSetLineStyle) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineStyle(printerContext,linestyle);
+}
+
+opvp_result_t OPVPWrapper::GetLineStyle(opvp_linestyle_t *plinestyle)
+{
+ if (!supportGetLineStyle) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineStyle(printerContext,plinestyle);
+}
+
+opvp_result_t OPVPWrapper::SetLineCap(opvp_linecap_t linecap)
+{
+ if (!supportSetLineCap) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineCap(printerContext,linecap);
+}
+
+opvp_result_t OPVPWrapper::GetLineCap(opvp_linecap_t *plinecap)
+{
+ if (!supportGetLineCap) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineCap(printerContext,plinecap);
+}
+
+opvp_result_t OPVPWrapper::SetLineJoin(opvp_linejoin_t linejoin)
+{
+ if (!supportSetLineJoin) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetLineJoin(printerContext,linejoin);
+}
+
+opvp_result_t OPVPWrapper::GetLineJoin(opvp_linejoin_t *plinejoin)
+{
+ if (!supportGetLineJoin) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetLineJoin(printerContext,plinejoin);
+}
+
+opvp_result_t OPVPWrapper::SetMiterLimit(opvp_fix_t miterlimit)
+{
+ if (!supportSetMiterLimit) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetMiterLimit(printerContext,miterlimit);
+}
+
+opvp_result_t OPVPWrapper::GetMiterLimit(opvp_fix_t *pmiterlimit)
+{
+ if (!supportGetMiterLimit) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetMiterLimit(printerContext,pmiterlimit);
+}
+
+opvp_result_t OPVPWrapper::SetPaintMode(opvp_paintmode_t paintmode)
+{
+ if (!supportSetPaintMode) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetPaintMode(printerContext,paintmode);
+}
+
+opvp_result_t OPVPWrapper::GetPaintMode(opvp_paintmode_t *ppaintmode)
+{
+ if (!supportGetPaintMode) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpGetPaintMode(printerContext,ppaintmode);
+}
+
+opvp_result_t OPVPWrapper::SetStrokeColor(const opvp_brush_t *brush)
+{
+ if (!supportSetStrokeColor) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetStrokeColor(printerContext,brush);
+}
+
+opvp_result_t OPVPWrapper::SetFillColor(const opvp_brush_t *brush)
+{
+ if (!supportSetFillColor) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetFillColor(printerContext,brush);
+}
+
+opvp_result_t OPVPWrapper::SetBgColor(const opvp_brush_t *brush)
+{
+ if (!supportSetBgColor) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetBgColor(printerContext,brush);
+}
+
+opvp_result_t OPVPWrapper::NewPath()
+{
+ if (!supportNewPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpNewPath(printerContext);
+}
+
+opvp_result_t OPVPWrapper::EndPath()
+{
+ if (!supportEndPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndPath(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StrokePath()
+{
+ if (!supportStrokePath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStrokePath(printerContext);
+}
+
+opvp_result_t OPVPWrapper::FillPath()
+{
+ if (!supportFillPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpFillPath(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StrokeFillPath()
+{
+ if (!supportStrokeFillPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStrokeFillPath(printerContext);
+}
+
+opvp_result_t OPVPWrapper::SetClipPath(opvp_cliprule_t clipRule)
+{
+ if (!supportSetClipPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetClipPath(printerContext,clipRule);
+}
+
+opvp_result_t OPVPWrapper::SetCurrentPoint(opvp_fix_t x, opvp_fix_t y)
+{
+ if (!supportSetCurrentPoint) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSetCurrentPoint(printerContext,x,y);
+}
+
+opvp_result_t OPVPWrapper::LinePath(opvp_pathmode_t flag,
+ opvp_int_t npoints, const opvp_point_t *points)
+{
+ if (!supportLinePath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpLinePath(printerContext,flag,npoints,points);
+}
+
+opvp_result_t OPVPWrapper::PolygonPath(opvp_int_t npolygons,
+ const opvp_int_t *nvertexes, const opvp_point_t *points)
+{
+ if (!supportPolygonPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpPolygonPath(printerContext,npolygons,nvertexes,points);
+}
+
+opvp_result_t OPVPWrapper::RectanglePath(opvp_int_t nrectangles,
+ const opvp_rectangle_t *rectangles)
+{
+ if (!supportRectanglePath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpRectanglePath(printerContext,nrectangles,rectangles);
+}
+
+opvp_result_t OPVPWrapper::RoundRectanglePath(opvp_int_t nrectangles,
+ const opvp_roundrectangle_t *rectangles)
+{
+ if (!supportRoundRectanglePath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpRoundRectanglePath(printerContext,nrectangles,rectangles);
+}
+
+opvp_result_t OPVPWrapper::BezierPath(opvp_int_t npoints,
+ const opvp_point_t *points)
+{
+ if (!supportBezierPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpBezierPath(printerContext,npoints,points);
+}
+
+opvp_result_t OPVPWrapper::ArcPath(opvp_arcmode_t kind,
+ opvp_arcdir_t dir, opvp_fix_t bbx0,
+ opvp_fix_t bby0, opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
+ opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1)
+{
+ if (!supportArcPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpArcPath(printerContext,kind,dir,bbx0,bby0,
+ bbx1,bby1,x0,y0,x1,y1);
+}
+
+opvp_result_t OPVPWrapper::DrawImage(
+ opvp_int_t sourceWidth, opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
+ opvp_int_t destinationHeight, const void *imagedata)
+{
+ if (!supportDrawImage) {
+ int result;
+
+ if ((result = StartDrawImage(sourceWidth,sourceHeight,sourcePitch,
+ imageFormat,destinationWidth,destinationHeight)) < 0) {
+ return result;
+ }
+ if ((result = TransferDrawImage(sourcePitch*sourceHeight,
+ imagedata)) < 0) {
+ return result;
+ }
+ return EndDrawImage();
+ }
+ return procs->opvpDrawImage(printerContext,sourceWidth, sourceHeight,
+ sourcePitch, imageFormat, destinationWidth, destinationHeight,
+ imagedata);
+}
+
+opvp_result_t OPVPWrapper::StartDrawImage(
+ opvp_int_t sourceWidth, opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
+ opvp_int_t destinationHeight)
+{
+ if (!supportStartDrawImage) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartDrawImage(printerContext,sourceWidth,
+ sourceHeight,sourcePitch,imageFormat,
+ destinationWidth,destinationHeight);
+}
+
+opvp_result_t OPVPWrapper::TransferDrawImage(opvp_int_t count,
+ const void *imagedata)
+{
+ if (!supportTransferDrawImage) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpTransferDrawImage(printerContext,count,imagedata);
+}
+
+opvp_result_t OPVPWrapper::EndDrawImage()
+{
+ if (!supportEndDrawImage) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndDrawImage(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartScanline(opvp_int_t yposition)
+{
+ if (!supportStartScanline) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartScanline(printerContext,yposition);
+}
+
+opvp_result_t OPVPWrapper::Scanline(opvp_int_t nscanpairs,
+ const opvp_int_t *scanpairs)
+{
+ if (!supportScanline) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpScanline(printerContext,nscanpairs,scanpairs);
+}
+
+opvp_result_t OPVPWrapper::EndScanline()
+{
+ if (!supportEndScanline) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndScanline(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartRaster(
+ opvp_int_t rasterWidth)
+{
+ if (!supportStartRaster) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartRaster(printerContext,rasterWidth);
+}
+
+opvp_result_t OPVPWrapper::TransferRasterData(opvp_int_t count,
+ const opvp_byte_t *data)
+{
+ if (!supportTransferRasterData) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpTransferRasterData(printerContext,count,
+ data);
+}
+
+opvp_result_t OPVPWrapper::SkipRaster(opvp_int_t count)
+{
+ if (!supportSkipRaster) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpSkipRaster(printerContext,count);
+}
+
+opvp_result_t OPVPWrapper::EndRaster()
+{
+ if (!supportEndRaster) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndRaster(printerContext);
+}
+
+opvp_result_t OPVPWrapper::StartStream()
+{
+ if (!supportStartStream) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpStartStream(printerContext);
+}
+
+opvp_result_t OPVPWrapper::TransferStreamData(opvp_int_t count,
+ const void *data)
+{
+ if (!supportTransferStreamData) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpTransferStreamData(printerContext,count,data);
+}
+
+opvp_result_t OPVPWrapper::EndStream()
+{
+ if (!supportEndStream) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpEndStream(printerContext);
+}
+
+opvp_result_t OPVPWrapper::ResetClipPath()
+{
+ if (!supportResetClipPath) {
+ *opvpErrorNo = OPVP_NOTSUPPORTED;
+ return -1;
+ }
+ return procs->opvpResetClipPath(printerContext);
+}
+
+char *OPVPWrapper::allocString(char **destin, unsigned int size)
+{
+ if (!destin) return 0;
+
+ if (*destin != 0) delete[] *destin;
+ if (size > 0) {
+ *destin = new char[size];
+ }
+
+ return *destin;
+}
+
+char **OPVPWrapper::genDynamicLibName(const char *name)
+{
+ static char *buff[5] = {0,0,0,0,0};
+
+ allocString(&(buff[0]), strlen(name)+1);
+ strcpy(buff[0], name);
+ allocString(&(buff[1]), strlen(name)+3+1);
+ strcpy(buff[1], name);
+ strcat(buff[1], ".so");
+ allocString(&(buff[2]), strlen(name)+4+1);
+ strcpy(buff[2], name);
+ strcat(buff[2], ".dll");
+ allocString(&(buff[3]), strlen(name)+6+1);
+ strcpy(buff[3], "lib");
+ strcat(buff[3], name);
+ strcat(buff[3], ".so");
+ buff[4] = 0;
+
+ return buff;
+}
+
+OPVPWrapper *OPVPWrapper::loadDriver(const char *driverName,
+ int outputFD, const char *printerModel)
+{
+ char **list = 0;
+ int i;
+ void *h;
+ int nApiEntry;
+ int (*opvpOpenPrinter)(opvp_int_t outputFD,
+ const opvp_char_t * printerModel, const opvp_int_t version[2],
+ opvp_api_procs_t **apiEntry) = 0;
+ int (*opvpOpenPrinter_0_2)(int outputFD, char* printerModel,
+ int *nApiEntry, OPVP_api_procs **apiEntry) = 0;
+ opvp_api_procs_t *opvpProcs;
+ OPVP_api_procs *opvpProcs_0_2;
+ opvp_dc_t opvpContext;
+ int opvpContext_0_2 = 0;
+ opvp_int_t *opvpErrorNo = 0;
+ int *opvpErrorNo_0_2 = 0;
+ void *handle = 0;
+ OPVPWrapper *opvp = 0;
+
+ list = genDynamicLibName(driverName);
+
+ if (list) {
+ i = 0;
+ while (list[i]) {
+ if ((h = dlopen(list[i],RTLD_NOW))) {
+ opvpOpenPrinter = (int (*)(opvp_int_t,
+ const opvp_char_t *, const opvp_int_t[2],
+ opvp_api_procs_t **))dlsym(h,"opvpOpenPrinter");
+ opvpErrorNo = (opvp_int_t *)dlsym(h,"opvpErrorNo");
+ if (opvpOpenPrinter && opvpErrorNo) {
+ handle = h;
+ break;
+ }
+ opvpOpenPrinter = 0;
+ opvpErrorNo = 0;
+ /* try version 0.2 driver */
+ opvpOpenPrinter_0_2 = (int (*)(int, char*, int *,
+ OPVP_api_procs **))dlsym(h,"OpenPrinter");
+ opvpErrorNo_0_2 = (int *)dlsym(h,"errorno");
+ if (opvpOpenPrinter_0_2 && opvpErrorNo_0_2) {
+ handle = h;
+ break;
+ }
+ opvpOpenPrinter_0_2 = 0;
+ opvpErrorNo_0_2 = 0;
+ }
+ i++;
+ }
+ for (i = 0;list[i] != 0;i++) {
+ delete[] (list[i]);
+ list[i] = 0;
+ }
+ }
+ if (handle == 0) {
+ OPRS::error("Loading vector printer driver (%s) fail\n",driverName);
+ return 0;
+ }
+ if (opvpOpenPrinter != 0) {
+ opvp_int_t apiVersion[2];
+
+ /* require version 1.0 */
+ apiVersion[0] = 1;
+ apiVersion[1] = 0;
+ if ((opvpContext = (*opvpOpenPrinter)(outputFD,
+ (const opvp_char_t *)printerModel,apiVersion,&opvpProcs)) < 0) {
+ OPRS::error("OpenPrinter fail\n",driverName);
+ unloadDriver(handle);
+ return 0;
+ }
+ opvp = new OPVPWrapper(handle, opvpErrorNo, opvpProcs, opvpContext);
+ } else if (opvpOpenPrinter_0_2) {
+ if ((opvpContext_0_2 = (*opvpOpenPrinter_0_2)(outputFD,
+ (char *)printerModel,&nApiEntry,&opvpProcs_0_2)) < 0) {
+ OPRS::error("OpenPrinter fail\n",driverName);
+ unloadDriver(handle);
+ return 0;
+ }
+ opvp = (OPVPWrapper *)new OPVPWrapper_0_2(handle, opvpErrorNo_0_2,
+ opvpProcs_0_2, opvpContext_0_2);
+ }
+ return opvp;
+}
+
+/*
+ * unload vector-driver
+ */
+int OPVPWrapper::unloadDriver(void *opvpHandleA)
+{
+ if (opvpHandleA != 0) {
+ dlclose(opvpHandleA);
+ }
+ return 0;
+}
+
+opvp_int_t OPVPWrapper::getErrorNo()
+{
+ return *opvpErrorNo;
+}
+
--- /dev/null
+/*
+ OPVPWrapper.h
+*/
+
+#ifndef OPVPWRAPPER_H
+#define OPVPWRAPPER_H
+
+#include "opvp_common.h"
+
+class OPVPWrapper {
+public:
+ static OPVPWrapper *loadDriver(const char *driverName, int outputFD,
+ const char *printerModel);
+ static int unloadDriver(void *opvpHandleA);
+private:
+ static char *allocString(char **destin, unsigned int size);
+ static char **genDynamicLibName(const char *name);
+public:
+ OPVPWrapper() {};
+ OPVPWrapper(void *opvpHandleA, opvp_int_t *opvpErrorNoA,
+ opvp_api_procs_t *procsA, opvp_dc_t printerContextA);
+ virtual ~OPVPWrapper();
+
+ virtual opvp_int_t getErrorNo();
+
+ void getVersion(opvp_int_t versionA[2])
+ {
+ versionA[0] = version[0];
+ versionA[1] = version[1];
+ }
+
+ virtual opvp_result_t ClosePrinter();
+ virtual opvp_result_t StartJob(const opvp_char_t *jobInfo);
+ virtual opvp_result_t EndJob();
+ virtual opvp_result_t AbortJob();
+ virtual opvp_result_t StartDoc(const opvp_char_t *docInfo);
+ virtual opvp_result_t EndDoc();
+ virtual opvp_result_t StartPage(const opvp_char_t *pageInfo);
+ virtual opvp_result_t EndPage();
+ virtual opvp_result_t QueryDeviceCapability(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf);
+ virtual opvp_result_t QueryDeviceInfo(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf);
+ virtual opvp_result_t ResetCTM();
+ virtual opvp_result_t SetCTM(const opvp_ctm_t *pCTM);
+ virtual opvp_result_t GetCTM(opvp_ctm_t *pCTM);
+ virtual opvp_result_t InitGS();
+ virtual opvp_result_t SaveGS();
+ virtual opvp_result_t RestoreGS();
+ virtual opvp_result_t QueryColorSpace(opvp_int_t *pnum,
+ opvp_cspace_t *pcspace);
+ virtual opvp_result_t SetColorSpace(opvp_cspace_t cspace);
+ virtual opvp_result_t GetColorSpace(opvp_cspace_t *pcspace);
+ virtual opvp_result_t SetFillMode(opvp_fillmode_t fillmode);
+ virtual opvp_result_t GetFillMode(opvp_fillmode_t *pfillmode);
+ virtual opvp_result_t SetAlphaConstant(opvp_float_t alpha);
+ virtual opvp_result_t GetAlphaConstant(opvp_float_t *palpha);
+ virtual opvp_result_t SetLineWidth(opvp_fix_t width);
+ virtual opvp_result_t GetLineWidth(opvp_fix_t *pwidth);
+ virtual opvp_result_t SetLineDash(opvp_int_t num, const opvp_fix_t *pdash);
+ virtual opvp_result_t GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash);
+ virtual opvp_result_t SetLineDashOffset(opvp_fix_t offset);
+ virtual opvp_result_t GetLineDashOffset(opvp_fix_t *poffset);
+ virtual opvp_result_t SetLineStyle(opvp_linestyle_t linestyle);
+ virtual opvp_result_t GetLineStyle(opvp_linestyle_t *plinestyle);
+ virtual opvp_result_t SetLineCap(opvp_linecap_t linecap);
+ virtual opvp_result_t GetLineCap(opvp_linecap_t *plinecap);
+ virtual opvp_result_t SetLineJoin(opvp_linejoin_t linejoin);
+ virtual opvp_result_t GetLineJoin(opvp_linejoin_t *plinejoin);
+ virtual opvp_result_t SetMiterLimit(opvp_fix_t miterlimit);
+ virtual opvp_result_t GetMiterLimit(opvp_fix_t *pmiterlimit);
+ virtual opvp_result_t SetPaintMode(opvp_paintmode_t paintmode);
+ virtual opvp_result_t GetPaintMode(opvp_paintmode_t *ppaintmode);
+ virtual opvp_result_t SetStrokeColor(const opvp_brush_t *brush);
+ virtual opvp_result_t SetFillColor(const opvp_brush_t *brush);
+ virtual opvp_result_t SetBgColor(const opvp_brush_t *brush);
+ virtual opvp_result_t NewPath();
+ virtual opvp_result_t EndPath();
+ virtual opvp_result_t StrokePath();
+ virtual opvp_result_t FillPath();
+ virtual opvp_result_t StrokeFillPath();
+ virtual opvp_result_t SetClipPath(opvp_cliprule_t clipRule);
+ virtual opvp_result_t SetCurrentPoint(opvp_fix_t x, opvp_fix_t y);
+ virtual opvp_result_t LinePath(opvp_pathmode_t flag,
+ opvp_int_t npoints, const opvp_point_t *points);
+ virtual opvp_result_t PolygonPath(opvp_int_t npolygons,
+ const opvp_int_t *nvertexes, const opvp_point_t *points);
+ virtual opvp_result_t RectanglePath(opvp_int_t nrectangles,
+ const opvp_rectangle_t *reclangles);
+ virtual opvp_result_t RoundRectanglePath(opvp_int_t nrectangles,
+ const opvp_roundrectangle_t *reclangles);
+ virtual opvp_result_t BezierPath(opvp_int_t npoints,
+ const opvp_point_t *points);
+ virtual opvp_result_t ArcPath(opvp_arcmode_t kind,
+ opvp_arcdir_t dir, opvp_fix_t bbx0, opvp_fix_t bby0,
+ opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
+ opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1);
+ virtual opvp_result_t DrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat,
+ opvp_int_t destinationWidth, opvp_int_t destinationHeight,
+ const void *imageData);
+ virtual opvp_result_t StartDrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat,
+ opvp_int_t destinationWidth, opvp_int_t destinationHeight);
+ virtual opvp_result_t TransferDrawImage(opvp_int_t count,
+ const void *imageData);
+ virtual opvp_result_t EndDrawImage();
+ virtual opvp_result_t StartScanline(opvp_int_t yposition);
+ virtual opvp_result_t Scanline(opvp_int_t nscanpairs,
+ const opvp_int_t *scanpairs);
+ virtual opvp_result_t EndScanline();
+ virtual opvp_result_t StartRaster(opvp_int_t rasterWidth);
+ virtual opvp_result_t TransferRasterData(opvp_int_t count,
+ const opvp_byte_t *data);
+ virtual opvp_result_t SkipRaster(opvp_int_t count);
+ virtual opvp_result_t EndRaster();
+ virtual opvp_result_t StartStream();
+ virtual opvp_result_t TransferStreamData(opvp_int_t count,
+ const void *data);
+ virtual opvp_result_t EndStream();
+ virtual opvp_result_t ResetClipPath();
+
+ bool supportClosePrinter;
+ bool supportStartJob;
+ bool supportEndJob;
+ bool supportAbortJob;
+ bool supportStartDoc;
+ bool supportEndDoc;
+ bool supportStartPage;
+ bool supportEndPage;
+ bool supportResetCTM;
+ bool supportSetCTM;
+ bool supportGetCTM;
+ bool supportInitGS;
+ bool supportSaveGS;
+ bool supportRestoreGS;
+ bool supportQueryColorSpace;
+ bool supportSetColorSpace;
+ bool supportGetColorSpace;
+ bool supportSetFillMode;
+ bool supportGetFillMode;
+ bool supportSetAlphaConstant;
+ bool supportGetAlphaConstant;
+ bool supportSetLineWidth;
+ bool supportGetLineWidth;
+ bool supportSetLineDash;
+ bool supportGetLineDash;
+ bool supportSetLineDashOffset;
+ bool supportGetLineDashOffset;
+ bool supportSetLineStyle;
+ bool supportGetLineStyle;
+ bool supportSetLineCap;
+ bool supportGetLineCap;
+ bool supportSetLineJoin;
+ bool supportGetLineJoin;
+ bool supportSetMiterLimit;
+ bool supportGetMiterLimit;
+ bool supportSetPaintMode;
+ bool supportGetPaintMode;
+ bool supportSetStrokeColor;
+ bool supportSetFillColor;
+ bool supportSetBgColor;
+ bool supportNewPath;
+ bool supportEndPath;
+ bool supportStrokePath;
+ bool supportFillPath;
+ bool supportStrokeFillPath;
+ bool supportSetClipPath;
+ bool supportSetCurrentPoint;
+ bool supportLinePath;
+ bool supportPolygonPath;
+ bool supportRectanglePath;
+ bool supportRoundRectanglePath;
+ bool supportBezierPath;
+ bool supportArcPath;
+ bool supportDrawImage;
+ bool supportStartDrawImage;
+ bool supportTransferDrawImage;
+ bool supportEndDrawImage;
+ bool supportStartScanline;
+ bool supportScanline;
+ bool supportEndScanline;
+ bool supportStartRaster;
+ bool supportTransferRasterData;
+ bool supportSkipRaster;
+ bool supportEndRaster;
+ bool supportStartStream;
+ bool supportTransferStreamData;
+ bool supportEndStream;
+ bool supportQueryDeviceCapability;
+ bool supportQueryDeviceInfo;
+ bool supportResetClipPath;
+
+protected:
+ void *opvpHandle;
+ opvp_int_t version[2];
+private:
+ opvp_api_procs_t *procs;
+ opvp_int_t *opvpErrorNo;
+ opvp_dc_t printerContext;
+};
+
+#endif
--- /dev/null
+/*
+ OPVPWrapper_0_2.cc
+*/
+
+
+#include <config.h>
+#include "OPVPWrapper_0_2.h"
+#include <string.h>
+
+/* color space mapping 0.2 to 1.0 */
+opvp_cspace_t OPVPWrapper_0_2::cspace_0_2_to_1_0[] = {
+ OPVP_CSPACE_BW,
+ OPVP_CSPACE_DEVICEGRAY,
+ OPVP_CSPACE_DEVICECMY,
+ OPVP_CSPACE_DEVICECMYK,
+ OPVP_CSPACE_DEVICERGB,
+ OPVP_CSPACE_STANDARDRGB,
+ OPVP_CSPACE_STANDARDRGB64
+};
+
+/* color space mapping 1.0 to 0.2 */
+OPVP_ColorSpace OPVPWrapper_0_2::cspace_1_0_to_0_2[] = {
+ OPVP_cspaceBW,
+ OPVP_cspaceDeviceGray,
+ OPVP_cspaceDeviceCMY,
+ OPVP_cspaceDeviceCMYK,
+ OPVP_cspaceDeviceRGB,
+ (OPVP_ColorSpace)0, /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
+ OPVP_cspaceStandardRGB,
+ OPVP_cspaceStandardRGB64,
+};
+
+/* image format mapping 1.0 to 0.2 */
+OPVP_ImageFormat OPVPWrapper_0_2::iformat_1_0_to_0_2[] = {
+ OPVP_iformatRaw,
+ /* OPVP_IFORMAT_MASK use iformat raw in 0.2 */
+ OPVP_iformatRaw,
+ OPVP_iformatRLE,
+ OPVP_iformatJPEG,
+ OPVP_iformatPNG,
+};
+
+/* image colorDepth needed in 0.2 */
+int OPVPWrapper_0_2::colorDepth_0_2[] = {
+ 1, /* OPVP_CSPACE_BW */
+ 8, /* OPVP_CSPACE_DEVICEGRAY */
+ 24, /* OPVP_CSPACE_DEVICECMY */
+ 32, /* OPVP_CSPACE_DEVICECMYK */
+ 24, /* OPVP_CSPACE_DEVICERGB */
+ 32, /* OPVP_CSPACE_DEVICEKRGB */
+ 24, /* OPVP_CSPACE_STANDARDRGB */
+ 64, /* OPVP_CSPACE_STANDARDRGB64 */
+};
+
+OPVPWrapper_0_2::OPVPWrapper_0_2(void *opvpHandleA, int *opvpErrorNoA,
+ OPVP_api_procs *procsA, int printerContextA)
+{
+ procs_0_2 = procsA;
+ opvpHandle = opvpHandleA;
+ opvpErrorNo_0_2 = opvpErrorNoA;
+ printerContext_0_2 = printerContextA;
+ version[0] = 0;
+ version[1] = 2;
+ supportClosePrinter = (procs_0_2->ClosePrinter != 0);
+ supportStartJob = (procs_0_2->StartJob != 0);
+ supportEndJob = (procs_0_2->EndJob != 0);
+ supportAbortJob = false;
+ supportStartDoc = (procs_0_2->StartDoc != 0);
+ supportEndDoc = (procs_0_2->EndDoc != 0);
+ supportStartPage = (procs_0_2->StartPage != 0);
+ supportEndPage = (procs_0_2->EndPage != 0);
+ supportResetCTM = (procs_0_2->ResetCTM != 0);
+ supportSetCTM = (procs_0_2->SetCTM != 0);
+ supportGetCTM = (procs_0_2->GetCTM != 0);
+ supportInitGS = (procs_0_2->InitGS != 0);
+ supportSaveGS = (procs_0_2->SaveGS != 0);
+ supportRestoreGS = (procs_0_2->RestoreGS != 0);
+ supportQueryColorSpace = (procs_0_2->QueryColorSpace != 0);
+ supportSetColorSpace = (procs_0_2->SetColorSpace != 0);
+ supportGetColorSpace = (procs_0_2->GetColorSpace != 0);
+ supportSetFillMode = (procs_0_2->SetFillMode != 0);
+ supportGetFillMode = (procs_0_2->GetFillMode != 0);
+ supportSetAlphaConstant = (procs_0_2->SetAlphaConstant != 0);
+ supportGetAlphaConstant = (procs_0_2->GetAlphaConstant != 0);
+ supportSetLineWidth = (procs_0_2->SetLineWidth != 0);
+ supportGetLineWidth = (procs_0_2->GetLineWidth != 0);
+ supportSetLineDash = (procs_0_2->SetLineDash != 0);
+ supportGetLineDash = (procs_0_2->GetLineDash != 0);
+ supportSetLineDashOffset = (procs_0_2->SetLineDashOffset != 0);
+ supportGetLineDashOffset = (procs_0_2->GetLineDashOffset != 0);
+ supportSetLineStyle = (procs_0_2->SetLineStyle != 0);
+ supportGetLineStyle = (procs_0_2->GetLineStyle != 0);
+ supportSetLineCap = (procs_0_2->SetLineCap != 0);
+ supportGetLineCap = (procs_0_2->GetLineCap != 0);
+ supportSetLineJoin = (procs_0_2->SetLineJoin != 0);
+ supportGetLineJoin = (procs_0_2->GetLineJoin != 0);
+ supportSetMiterLimit = (procs_0_2->SetMiterLimit != 0);
+ supportGetMiterLimit = (procs_0_2->GetMiterLimit != 0);
+ supportSetPaintMode = (procs_0_2->SetPaintMode != 0);
+ supportGetPaintMode = (procs_0_2->GetPaintMode != 0);
+ supportSetStrokeColor = (procs_0_2->SetStrokeColor != 0);
+ supportSetFillColor = (procs_0_2->SetFillColor != 0);
+ supportSetBgColor = (procs_0_2->SetBgColor != 0);
+ supportNewPath = (procs_0_2->NewPath != 0);
+ supportEndPath = (procs_0_2->EndPath != 0);
+ supportStrokePath = (procs_0_2->StrokePath != 0);
+ supportFillPath = (procs_0_2->FillPath != 0);
+ supportStrokeFillPath = (procs_0_2->StrokeFillPath != 0);
+ supportSetClipPath = (procs_0_2->SetClipPath != 0);
+ supportSetCurrentPoint = (procs_0_2->SetCurrentPoint != 0);
+ supportLinePath = (procs_0_2->LinePath != 0);
+ supportPolygonPath = (procs_0_2->PolygonPath != 0);
+ supportRectanglePath = (procs_0_2->RectanglePath != 0);
+ supportRoundRectanglePath = (procs_0_2->RoundRectanglePath != 0);
+ supportBezierPath = (procs_0_2->BezierPath != 0);
+ supportArcPath = (procs_0_2->ArcPath != 0);
+ supportDrawImage = (procs_0_2->DrawImage != 0);
+ supportStartDrawImage = (procs_0_2->StartDrawImage != 0);
+ supportTransferDrawImage = (procs_0_2->TransferDrawImage != 0);
+ supportEndDrawImage = (procs_0_2->EndDrawImage != 0);
+ supportStartScanline = (procs_0_2->StartScanline != 0);
+ supportScanline = (procs_0_2->Scanline != 0);
+ supportEndScanline = (procs_0_2->EndScanline != 0);
+ supportStartRaster = (procs_0_2->StartRaster != 0);
+ supportTransferRasterData = (procs_0_2->TransferRasterData != 0);
+ supportSkipRaster = (procs_0_2->SkipRaster != 0);
+ supportEndRaster = (procs_0_2->EndRaster != 0);
+ supportStartStream = (procs_0_2->StartStream != 0);
+ supportTransferStreamData = (procs_0_2->TransferStreamData != 0);
+ supportEndStream = (procs_0_2->EndStream != 0);
+ supportQueryDeviceCapability = (procs_0_2->QueryDeviceCapability != 0);
+ supportQueryDeviceInfo = (procs_0_2->QueryDeviceInfo != 0);
+ supportResetClipPath = (procs_0_2->ResetClipPath != 0);
+ colorSpace = OPVP_CSPACE_STANDARDRGB;
+ if (supportGetColorSpace) {
+ if (GetColorSpace(&colorSpace) != OPVP_OK) {
+ colorSpace = OPVP_CSPACE_STANDARDRGB;
+ }
+ }
+}
+
+OPVPWrapper_0_2::~OPVPWrapper_0_2()
+{
+}
+
+opvp_result_t OPVPWrapper_0_2::ClosePrinter()
+{
+ if (!supportClosePrinter) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->ClosePrinter(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StartJob(
+ const opvp_char_t *jobInfo)
+{
+ if (!supportStartJob) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StartJob(printerContext_0_2,
+ (char *)jobInfo);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndJob()
+{
+ if (!supportEndJob) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndJob(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::AbortJob()
+{
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+}
+
+opvp_result_t OPVPWrapper_0_2::StartDoc(
+ const opvp_char_t *docInfo)
+{
+ if (!supportStartDoc) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StartDoc(printerContext_0_2,
+ (char *)docInfo);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndDoc()
+{
+ if (!supportEndDoc) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndDoc(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StartPage(
+ const opvp_char_t *pageInfo)
+{
+ int r;
+
+ if (!supportStartPage) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((r = procs_0_2->StartPage(printerContext_0_2,
+ /* discard const */(char *)pageInfo)) != OPVP_OK) {
+ /* error */
+ return (opvp_result_t)r;
+ }
+ /* initialize ROP */
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,
+ OPVP_0_2_ROP_P);
+ }
+ return OPVP_OK;
+}
+
+opvp_result_t OPVPWrapper_0_2::EndPage()
+{
+ if (!supportEndPage) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndPage(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::QueryDeviceCapability(
+ opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
+{
+ if (!supportQueryDeviceCapability) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->
+ QueryDeviceCapability(printerContext_0_2,queryflag,*buflen,
+ (char *)infoBuf);
+}
+
+opvp_result_t OPVPWrapper_0_2::QueryDeviceInfo(
+ opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
+{
+ if (!supportQueryDeviceInfo) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (queryflag & OPVP_QF_MEDIACOPY) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (queryflag & OPVP_QF_PRINTREGION) {
+ queryflag &= ~OPVP_QF_PRINTREGION;
+ queryflag |= 0x0020000;
+ }
+ return (opvp_result_t)procs_0_2->QueryDeviceInfo(printerContext_0_2,
+ queryflag,*buflen,(char *)infoBuf);
+}
+
+opvp_result_t OPVPWrapper_0_2::ResetCTM()
+{
+ if (!supportResetCTM) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->ResetCTM(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetCTM(const opvp_ctm_t *pCTM)
+{
+ if (!supportSetCTM) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetCTM(printerContext_0_2,
+ (OPVP_CTM *)pCTM);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetCTM(opvp_ctm_t *pCTM)
+{
+ if (!supportGetCTM) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->GetCTM(printerContext_0_2,
+ (OPVP_CTM *)pCTM);
+}
+
+opvp_result_t OPVPWrapper_0_2::InitGS()
+{
+ int r;
+
+ if (!supportInitGS) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((r = procs_0_2->InitGS(printerContext_0_2)) != OPVP_OK) {
+ /* error */
+ return (opvp_result_t)r;
+ }
+ /* initialize ROP */
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,
+ OPVP_0_2_ROP_P);
+ }
+ return OPVP_OK;
+}
+
+opvp_result_t OPVPWrapper_0_2::SaveGS()
+{
+ if (!supportSaveGS) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SaveGS(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::RestoreGS()
+{
+ if (!supportRestoreGS) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->RestoreGS(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::QueryColorSpace(
+ opvp_int_t *pnum, opvp_cspace_t *pcspace)
+{
+ int r;
+ int i;
+
+ if (!supportQueryColorSpace) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((r = procs_0_2->QueryColorSpace(printerContext_0_2,
+ (OPVP_ColorSpace *)pcspace,pnum)) != OPVP_OK) {
+ /* error */
+ return (opvp_result_t)r;
+ }
+ /* translate cspaces */
+ for (i = 0;i < *pnum;i++) {
+ if ((unsigned int)pcspace[i]
+ > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
+ /* unknown color space */
+ /* set DEVICERGB instead */
+ pcspace[i] = OPVP_CSPACE_DEVICERGB;
+ } else {
+ pcspace[i] = cspace_0_2_to_1_0[pcspace[i]];
+ }
+ }
+ return OPVP_OK;
+}
+
+opvp_result_t OPVPWrapper_0_2::SetColorSpace(
+ opvp_cspace_t cspace)
+{
+ int r;
+
+ if (!supportSetColorSpace) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (cspace == OPVP_CSPACE_DEVICEKRGB) {
+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((unsigned int)cspace
+ > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ /* unknown color space */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ r = procs_0_2->SetColorSpace(printerContext_0_2,
+ cspace_1_0_to_0_2[cspace]);
+ if (r == OPVP_OK) {
+ colorSpace = cspace;
+ }
+ return (opvp_result_t)r;
+}
+
+opvp_result_t OPVPWrapper_0_2::GetColorSpace(
+ opvp_cspace_t *pcspace)
+{
+ int r;
+
+ if (!supportGetColorSpace) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((r = procs_0_2->GetColorSpace(printerContext_0_2,
+ (OPVP_ColorSpace *)pcspace)) != OPVP_OK) {
+ /* error */
+ return (opvp_result_t)r;
+ }
+ if ((unsigned int)*pcspace
+ > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
+ /* unknown color space */
+ /* set DEVICERGB instead */
+ *pcspace = OPVP_CSPACE_DEVICERGB;
+ } else {
+ *pcspace = cspace_0_2_to_1_0[*pcspace];
+ }
+ return (opvp_result_t)r;
+}
+
+opvp_result_t OPVPWrapper_0_2::SetFillMode(
+ opvp_fillmode_t fillmode)
+{
+ if (!supportSetFillMode) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_FillMode is comaptible with opvp_fillmode_t */
+ return (opvp_result_t)procs_0_2->SetFillMode(printerContext_0_2,
+ (OPVP_FillMode)fillmode);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetFillMode(
+ opvp_fillmode_t *pfillmode)
+{
+ if (!supportGetFillMode) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_FillMode is comaptible with opvp_fillmode_t */
+ return (opvp_result_t)procs_0_2->GetFillMode(printerContext_0_2,
+ (OPVP_FillMode *)pfillmode);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetAlphaConstant(
+ opvp_float_t alpha)
+{
+ if (!supportSetAlphaConstant) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetAlphaConstant(printerContext_0_2,alpha);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetAlphaConstant(
+ opvp_float_t *palpha)
+{
+ if (!supportGetAlphaConstant) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->GetAlphaConstant(printerContext_0_2,palpha);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineWidth(
+ opvp_fix_t width)
+{
+ if (!supportSetLineWidth) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetLineWidth(printerContext_0_2,width);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineWidth(
+ opvp_fix_t *pwidth)
+{
+ if (!supportGetLineWidth) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->GetLineWidth(printerContext_0_2,pwidth);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineDash(opvp_int_t num,
+ const opvp_fix_t *pdash)
+{
+ if (!supportSetLineDash) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetLineDash(printerContext_0_2,
+ /* remove const */ (OPVP_Fix *)pdash,num);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineDash(
+ opvp_int_t *pnum, opvp_fix_t *pdash)
+{
+ if (!supportGetLineDash) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->GetLineDash(printerContext_0_2,
+ pdash,pnum);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineDashOffset(
+ opvp_fix_t offset)
+{
+ if (!supportSetLineDashOffset) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetLineDashOffset(printerContext_0_2,offset);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineDashOffset(
+ opvp_fix_t *poffset)
+{
+ if (!supportGetLineDashOffset) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->GetLineDashOffset(printerContext_0_2,poffset);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineStyle(
+ opvp_linestyle_t linestyle)
+{
+ if (!supportSetLineStyle) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineStyle is compatible with opvp_linestyle_t */
+ return (opvp_result_t)procs_0_2->SetLineStyle(printerContext_0_2,
+ (OPVP_LineStyle)linestyle);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineStyle(
+ opvp_linestyle_t *plinestyle)
+{
+ if (!supportGetLineStyle) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineStyle is compatible with opvp_linestyle_t */
+ return (opvp_result_t)procs_0_2->GetLineStyle(printerContext_0_2,
+ (OPVP_LineStyle *)plinestyle);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineCap(
+ opvp_linecap_t linecap)
+{
+ if (!supportSetLineCap) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineCap is compatible with opvp_cap_t */
+ return (opvp_result_t)procs_0_2->SetLineCap(printerContext_0_2,
+ (OPVP_LineCap)linecap);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineCap(
+ opvp_linecap_t *plinecap)
+{
+ if (!supportGetLineCap) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineCap is compatible with opvp_cap_t */
+ return (opvp_result_t)procs_0_2->GetLineCap(printerContext_0_2,
+ (OPVP_LineCap *)plinecap);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetLineJoin(
+ opvp_linejoin_t linejoin)
+{
+ if (!supportSetLineJoin) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineJoin is compatible with opvp_linejoin_t */
+ return (opvp_result_t)procs_0_2->SetLineJoin(printerContext_0_2,
+ (OPVP_LineJoin)linejoin);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetLineJoin(
+ opvp_linejoin_t *plinejoin)
+{
+ if (!supportGetLineJoin) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_LineJoin is compatible with opvp_linejoin_t */
+ return (opvp_result_t)procs_0_2->GetLineJoin(printerContext_0_2,
+ (OPVP_LineJoin *)plinejoin);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetMiterLimit(
+ opvp_fix_t miterlimit)
+{
+ if (!supportSetMiterLimit) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Fix is compatible with opvp_fix_t */
+ return (opvp_result_t)procs_0_2->SetMiterLimit(printerContext_0_2,
+ (OPVP_Fix)miterlimit);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetMiterLimit(
+ opvp_fix_t *pmiterlimit)
+{
+ if (!supportGetMiterLimit) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Fix is compatible with opvp_fix_t */
+ return (opvp_result_t)procs_0_2->GetMiterLimit(printerContext_0_2,
+ (OPVP_Fix *)pmiterlimit);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetPaintMode(
+ opvp_paintmode_t paintmode)
+{
+ if (!supportSetPaintMode) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_PaintMode is compatible with opvp_paintmode_t */
+ return (opvp_result_t)procs_0_2->SetPaintMode(printerContext_0_2,
+ (OPVP_PaintMode)paintmode);
+}
+
+opvp_result_t OPVPWrapper_0_2::GetPaintMode(
+ opvp_paintmode_t *ppaintmode)
+{
+ if (!supportGetPaintMode) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_PaintMode is compatible with opvp_paintmode_t */
+ return (opvp_result_t)procs_0_2->GetPaintMode(printerContext_0_2,
+ (OPVP_PaintMode *)ppaintmode);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetStrokeColor(
+ const opvp_brush_t *brush)
+{
+ OPVP_Brush brush_0_2;
+
+ if (!supportSetStrokeColor) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (brush == 0) {
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((unsigned int)brush->colorSpace
+ > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ /* unknown color space */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
+ brush_0_2.xorg = brush->xorg;
+ brush_0_2.yorg = brush->yorg;
+ brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
+ memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
+ return (opvp_result_t)procs_0_2->SetStrokeColor(printerContext_0_2,
+ &brush_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetFillColor(
+ const opvp_brush_t *brush)
+{
+ OPVP_Brush brush_0_2;
+
+ if (!supportSetFillColor) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (brush == 0) {
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((unsigned int)brush->colorSpace
+ > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ /* unknown color space */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
+ brush_0_2.xorg = brush->xorg;
+ brush_0_2.yorg = brush->yorg;
+ brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
+ memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
+ return (opvp_result_t)procs_0_2->SetFillColor(printerContext_0_2,
+ &brush_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetBgColor(
+ const opvp_brush_t *brush)
+{
+ OPVP_Brush brush_0_2;
+
+ if (!supportSetBgColor) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (brush == 0) {
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if ((unsigned int)brush->colorSpace
+ > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ /* unknown color space */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
+ brush_0_2.xorg = brush->xorg;
+ brush_0_2.yorg = brush->yorg;
+ brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
+ memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
+ return (opvp_result_t)procs_0_2->SetBgColor(printerContext_0_2,
+ &brush_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::NewPath()
+{
+ if (!supportNewPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->NewPath(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndPath()
+{
+ if (!supportEndPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndPath(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StrokePath()
+{
+ if (!supportStrokePath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StrokePath(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::FillPath()
+{
+ if (!supportFillPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->FillPath(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StrokeFillPath()
+{
+ if (!supportStrokeFillPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StrokeFillPath(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetClipPath(
+ opvp_cliprule_t clipRule)
+{
+ if (!supportSetClipPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_ClipRule is compatible with opvp_cliprule_t */
+ return (opvp_result_t)procs_0_2->SetClipPath(printerContext_0_2,
+ (OPVP_ClipRule)clipRule);
+}
+
+opvp_result_t OPVPWrapper_0_2::SetCurrentPoint(
+ opvp_fix_t x, opvp_fix_t y)
+{
+ if (!supportSetCurrentPoint) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SetCurrentPoint(printerContext_0_2,x,y);
+}
+
+opvp_result_t OPVPWrapper_0_2::LinePath(
+ opvp_pathmode_t flag, opvp_int_t npoints, const opvp_point_t *points)
+{
+ if (!supportLinePath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Point is compatible with opvp_point_t */
+ return (opvp_result_t)procs_0_2->LinePath(printerContext_0_2,flag,npoints,
+ (OPVP_Point *)points);
+}
+
+opvp_result_t OPVPWrapper_0_2::PolygonPath(
+ opvp_int_t npolygons, const opvp_int_t *nvertexes,
+ const opvp_point_t *points)
+{
+ if (!supportPolygonPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Point is compatible with opvp_point_t */
+ return (opvp_result_t)procs_0_2->PolygonPath(printerContext_0_2,
+ (int)npolygons,(int *)nvertexes,(OPVP_Point *)points);
+}
+
+opvp_result_t OPVPWrapper_0_2::RectanglePath(
+ opvp_int_t nrectangles, const opvp_rectangle_t *rectangles)
+{
+ if (!supportRectanglePath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Rectangle is compatible with opvp_rectangle_t */
+ return (opvp_result_t)procs_0_2->RectanglePath(printerContext_0_2,
+ (int)nrectangles,(OPVP_Rectangle *)rectangles);
+}
+
+opvp_result_t OPVPWrapper_0_2::RoundRectanglePath(
+ opvp_int_t nrectangles, const opvp_roundrectangle_t *rectangles)
+{
+ if (!supportRoundRectanglePath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_RoundRectangle is compatible with opvp_roundrectangle_t */
+ return (opvp_result_t)procs_0_2->RoundRectanglePath(printerContext_0_2,
+ (int)nrectangles,(OPVP_RoundRectangle *)rectangles);
+}
+
+opvp_result_t OPVPWrapper_0_2::BezierPath(opvp_int_t npoints,
+ const opvp_point_t *points)
+{
+ if (!supportBezierPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* OPVP_Point is compatible with opvp_point_t */
+ return (opvp_result_t)procs_0_2->BezierPath(printerContext_0_2,(int)npoints,
+ (OPVP_Point *)points);
+}
+
+opvp_result_t OPVPWrapper_0_2::ArcPath(opvp_arcmode_t kind, opvp_arcdir_t dir,
+ opvp_fix_t bbx0, opvp_fix_t bby0, opvp_fix_t bbx1,
+ opvp_fix_t bby1, opvp_fix_t x0, opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1)
+{
+ if (!supportArcPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ /* opvp_arcmode_t is compatible with int */
+ /* opvp_arcdir_t is compatible with int */
+ return (opvp_result_t)procs_0_2->ArcPath(printerContext_0_2,
+ (int)kind,(int)dir,bbx0,bby0,
+ bbx1,bby1,x0,y0,x1,y1);
+}
+
+opvp_result_t OPVPWrapper_0_2::DrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
+ opvp_int_t destinationHeight, const void *imagedata)
+{
+ int r;
+ OPVP_Rectangle rect;
+ OPVP_ImageFormat iformat_0_2;
+ OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
+ int depth;
+
+ if (!supportDrawImage) {
+ int result;
+
+ if ((result = StartDrawImage(sourceWidth,
+ sourceHeight,sourcePitch,imageFormat,destinationWidth,
+ destinationHeight)) < 0) {
+ return result;
+ }
+ if ((result = TransferDrawImage(sourcePitch*sourceHeight,
+ imagedata)) < 0) {
+ return result;
+ }
+ return EndDrawImage();
+ }
+
+ if (imageFormat == OPVP_IFORMAT_MASK) {
+ if (procs_0_2->GetPaintMode != 0) {
+ procs_0_2->GetPaintMode(printerContext_0_2,
+ &paintmode_0_2);
+ }
+ if (paintmode_0_2 != OPVP_paintModeTransparent) {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,
+ OPVP_0_2_ROP_S);
+ }
+ }
+ else {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,
+ OPVP_0_2_ROP_OR);
+ }
+ }
+ depth = 1;
+ } else {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
+ }
+ depth = colorDepth_0_2[colorSpace];
+ }
+
+ OPVP_I2FIX(0,rect.p0.x);
+ OPVP_I2FIX(0,rect.p0.y);
+ OPVP_I2FIX(destinationWidth,rect.p1.x);
+ OPVP_I2FIX(destinationHeight,rect.p1.y);
+ if ((unsigned int)imageFormat
+ > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
+ /* illegal image format */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
+ r = procs_0_2->DrawImage(printerContext_0_2,sourceWidth,sourceHeight,
+ depth,iformat_0_2,rect,
+ sourcePitch*sourceHeight,
+ /* remove const */ (void *)imagedata);
+
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
+ }
+
+ return (opvp_result_t)r;
+}
+
+opvp_result_t OPVPWrapper_0_2::StartDrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
+ opvp_int_t destinationHeight)
+{
+ int r;
+ OPVP_Rectangle rect;
+ OPVP_ImageFormat iformat_0_2;
+ OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
+ int depth;
+
+ if (!supportStartDrawImage) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ if (imageFormat == OPVP_IFORMAT_MASK) {
+ if (procs_0_2->GetPaintMode != 0) {
+ procs_0_2->GetPaintMode(printerContext_0_2,
+ &paintmode_0_2);
+ }
+ if (paintmode_0_2 != OPVP_paintModeTransparent) {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
+ }
+ }
+ else {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_OR);
+ }
+ }
+ depth = 1;
+ } else {
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
+ }
+ depth = colorDepth_0_2[colorSpace];
+ }
+
+ OPVP_I2FIX(0,rect.p0.x);
+ OPVP_I2FIX(0,rect.p0.y);
+ OPVP_I2FIX(destinationWidth,rect.p1.x);
+ OPVP_I2FIX(destinationHeight,rect.p1.y);
+ if ((unsigned int)imageFormat
+ > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
+ /* illegal image format */
+ *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
+ return -1;
+ }
+ iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
+ r = procs_0_2->StartDrawImage(printerContext_0_2,
+ sourceWidth,sourceHeight,
+ depth,iformat_0_2,rect);
+
+ return (opvp_result_t)r;
+}
+
+opvp_result_t OPVPWrapper_0_2::TransferDrawImage(opvp_int_t count,
+ const void *imagedata)
+{
+ if (!supportTransferDrawImage) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->TransferDrawImage(printerContext_0_2,
+ count,(void *)imagedata);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndDrawImage()
+{
+ int r;
+
+ if (!supportEndDrawImage) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ r = procs_0_2->EndDrawImage(printerContext_0_2);
+
+ /* make sure rop is pattern copy */
+ if (procs_0_2->SetROP != 0) {
+ procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
+ }
+
+ return (opvp_result_t)r;
+}
+
+opvp_result_t OPVPWrapper_0_2::StartScanline(opvp_int_t yposition)
+{
+ if (!supportStartScanline) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StartScanline(printerContext_0_2,yposition);
+}
+
+opvp_result_t OPVPWrapper_0_2::Scanline(opvp_int_t nscanpairs,
+ const opvp_int_t *scanpairs)
+{
+ if (!supportScanline) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->Scanline(printerContext_0_2,
+ (int)nscanpairs,(int *)scanpairs);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndScanline()
+{
+ if (!supportEndScanline) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndScanline(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StartRaster(opvp_int_t rasterWidth)
+{
+ if (!supportStartRaster) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StartRaster(printerContext_0_2,rasterWidth);
+}
+
+opvp_result_t OPVPWrapper_0_2::TransferRasterData(opvp_int_t count,
+ const opvp_byte_t *data)
+{
+ if (!supportTransferRasterData) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->TransferRasterData(printerContext_0_2,
+ (int)count, (unsigned char *)data);
+}
+
+opvp_result_t OPVPWrapper_0_2::SkipRaster(opvp_int_t count)
+{
+ if (!supportSkipRaster) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->SkipRaster(printerContext_0_2,count);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndRaster()
+{
+ if (!supportEndRaster) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndRaster(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::StartStream()
+{
+ if (!supportStartStream) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->StartStream(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::TransferStreamData(opvp_int_t count,
+ const void *data)
+{
+ if (!supportTransferStreamData) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->TransferStreamData(printerContext_0_2,
+ count,(void *)data);
+}
+
+opvp_result_t OPVPWrapper_0_2::EndStream()
+{
+ if (!supportEndStream) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->EndStream(printerContext_0_2);
+}
+
+opvp_result_t OPVPWrapper_0_2::ResetClipPath()
+{
+ if (!supportResetClipPath) {
+ *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
+ return -1;
+ }
+ return (opvp_result_t)procs_0_2->ResetClipPath(printerContext_0_2);
+}
+
+/* translate error code */
+opvp_int_t OPVPWrapper_0_2::getErrorNo()
+{
+ switch(*opvpErrorNo_0_2) {
+ case OPVP_FATALERROR_0_2:
+ return OPVP_FATALERROR;
+ break;
+ case OPVP_BADREQUEST_0_2:
+ return OPVP_BADREQUEST;
+ break;
+ case OPVP_BADCONTEXT_0_2:
+ return OPVP_BADCONTEXT;
+ break;
+ case OPVP_NOTSUPPORTED_0_2:
+ return OPVP_NOTSUPPORTED;
+ break;
+ case OPVP_JOBCANCELED_0_2:
+ return OPVP_JOBCANCELED;
+ break;
+ case OPVP_PARAMERROR_0_2:
+ return OPVP_PARAMERROR;
+ break;
+ default:
+ break;
+ }
+ /* unknown error no */
+ /* return FATALERROR instead */
+ return OPVP_FATALERROR;
+}
--- /dev/null
+/*
+ OPVPWrapper_0_2.h
+*/
+
+#ifndef OPVPWRAPPER_0_2_H
+#define OPVPWRAPPER_0_2_H
+
+#include "OPVPWrapper.h"
+
+/* ROP */
+#define OPVP_0_2_ROP_S 0xCC
+#define OPVP_0_2_ROP_P 0xF0
+#define OPVP_0_2_ROP_OR 0xB8
+
+class OPVPWrapper_0_2: public OPVPWrapper {
+private:
+ static opvp_cspace_t cspace_0_2_to_1_0[];
+ static OPVP_ColorSpace cspace_1_0_to_0_2[];
+ static OPVP_ImageFormat iformat_1_0_to_0_2[];
+ static int colorDepth_0_2[];
+public:
+ OPVPWrapper_0_2(void *opvpHandleA, int *opvpErrorNoA,
+ OPVP_api_procs *procsA, int printerContextA);
+ virtual ~OPVPWrapper_0_2();
+ virtual opvp_int_t getErrorNo();
+
+ virtual opvp_result_t ClosePrinter();
+ virtual opvp_result_t StartJob(const opvp_char_t *jobInfo);
+ virtual opvp_result_t EndJob();
+ virtual opvp_result_t AbortJob();
+ virtual opvp_result_t StartDoc(const opvp_char_t *docInfo);
+ virtual opvp_result_t EndDoc();
+ virtual opvp_result_t StartPage(const opvp_char_t *pageInfo);
+ virtual opvp_result_t EndPage();
+ virtual opvp_result_t QueryDeviceCapability(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf);
+ virtual opvp_result_t QueryDeviceInfo(opvp_flag_t queryflag,
+ opvp_int_t *buflen, opvp_byte_t *infoBuf);
+ virtual opvp_result_t ResetCTM();
+ virtual opvp_result_t SetCTM(const opvp_ctm_t *pCTM);
+ virtual opvp_result_t GetCTM(opvp_ctm_t *pCTM);
+ virtual opvp_result_t InitGS();
+ virtual opvp_result_t SaveGS();
+ virtual opvp_result_t RestoreGS();
+ virtual opvp_result_t QueryColorSpace(opvp_int_t *pnum,
+ opvp_cspace_t *pcspace);
+ virtual opvp_result_t SetColorSpace(opvp_cspace_t cspace);
+ virtual opvp_result_t GetColorSpace(opvp_cspace_t *pcspace);
+ virtual opvp_result_t SetFillMode(opvp_fillmode_t fillmode);
+ virtual opvp_result_t GetFillMode(opvp_fillmode_t *pfillmode);
+ virtual opvp_result_t SetAlphaConstant(opvp_float_t alpha);
+ virtual opvp_result_t GetAlphaConstant(opvp_float_t *palpha);
+ virtual opvp_result_t SetLineWidth(opvp_fix_t width);
+ virtual opvp_result_t GetLineWidth(opvp_fix_t *pwidth);
+ virtual opvp_result_t SetLineDash(opvp_int_t num, const opvp_fix_t *pdash);
+ virtual opvp_result_t GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash);
+ virtual opvp_result_t SetLineDashOffset(opvp_fix_t offset);
+ virtual opvp_result_t GetLineDashOffset(opvp_fix_t *poffset);
+ virtual opvp_result_t SetLineStyle(opvp_linestyle_t linestyle);
+ virtual opvp_result_t GetLineStyle(opvp_linestyle_t *plinestyle);
+ virtual opvp_result_t SetLineCap(opvp_linecap_t linecap);
+ virtual opvp_result_t GetLineCap(opvp_linecap_t *plinecap);
+ virtual opvp_result_t SetLineJoin(opvp_linejoin_t linejoin);
+ virtual opvp_result_t GetLineJoin(opvp_linejoin_t *plinejoin);
+ virtual opvp_result_t SetMiterLimit(opvp_fix_t miterlimit);
+ virtual opvp_result_t GetMiterLimit(opvp_fix_t *pmiterlimit);
+ virtual opvp_result_t SetPaintMode(opvp_paintmode_t paintmode);
+ virtual opvp_result_t GetPaintMode(opvp_paintmode_t *ppaintmode);
+ virtual opvp_result_t SetStrokeColor(const opvp_brush_t *brush);
+ virtual opvp_result_t SetFillColor(const opvp_brush_t *brush);
+ virtual opvp_result_t SetBgColor(const opvp_brush_t *brush);
+ virtual opvp_result_t NewPath();
+ virtual opvp_result_t EndPath();
+ virtual opvp_result_t StrokePath();
+ virtual opvp_result_t FillPath();
+ virtual opvp_result_t StrokeFillPath();
+ virtual opvp_result_t SetClipPath(opvp_cliprule_t clipRule);
+ virtual opvp_result_t SetCurrentPoint(opvp_fix_t x, opvp_fix_t y);
+ virtual opvp_result_t LinePath(opvp_pathmode_t flag,
+ opvp_int_t npoints, const opvp_point_t *points);
+ virtual opvp_result_t PolygonPath(opvp_int_t npolygons,
+ const opvp_int_t *nvertexes, const opvp_point_t *points);
+ virtual opvp_result_t RectanglePath(opvp_int_t nrectangles,
+ const opvp_rectangle_t *reclangles);
+ virtual opvp_result_t RoundRectanglePath(opvp_int_t nrectangles,
+ const opvp_roundrectangle_t *reclangles);
+ virtual opvp_result_t BezierPath(opvp_int_t npoints,
+ const opvp_point_t *points);
+ virtual opvp_result_t ArcPath(opvp_arcmode_t kind,
+ opvp_arcdir_t dir, opvp_fix_t bbx0, opvp_fix_t bby0,
+ opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
+ opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1);
+ virtual opvp_result_t DrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat,
+ opvp_int_t destinationWidth, opvp_int_t destinationHeight,
+ const void *imageData);
+ virtual opvp_result_t StartDrawImage(opvp_int_t sourceWidth,
+ opvp_int_t sourceHeight, opvp_int_t sourcePitch,
+ opvp_imageformat_t imageFormat,
+ opvp_int_t destinationWidth, opvp_int_t destinationHeight);
+ virtual opvp_result_t TransferDrawImage(opvp_int_t count,
+ const void *imageData);
+ virtual opvp_result_t EndDrawImage();
+ virtual opvp_result_t StartScanline(opvp_int_t yposition);
+ virtual opvp_result_t Scanline(opvp_int_t nscanpairs,
+ const opvp_int_t *scanpairs);
+ virtual opvp_result_t EndScanline();
+ virtual opvp_result_t StartRaster(opvp_int_t rasterWidth);
+ virtual opvp_result_t TransferRasterData(opvp_int_t count,
+ const opvp_byte_t *data);
+ virtual opvp_result_t SkipRaster(opvp_int_t count);
+ virtual opvp_result_t EndRaster();
+ virtual opvp_result_t StartStream();
+ virtual opvp_result_t TransferStreamData(opvp_int_t count,
+ const void *data);
+ virtual opvp_result_t EndStream();
+ virtual opvp_result_t ResetClipPath();
+
+private:
+ OPVP_api_procs *procs_0_2;
+ int *opvpErrorNo_0_2;
+ int printerContext_0_2;
+ opvp_cspace_t colorSpace;
+};
+
+#endif
--- /dev/null
+/*
+ * OpenPrinting Vector Printer Driver API Definitions [opvp.h]
+ *
+ * Copyright (c) 2006 Free Standards Group
+ * Copyright (c) 2006 Fuji Xerox Printing Systems Co., Ltd.
+ * Copyright (c) 2006 Canon Inc.
+ * Copyright (c) 2003-2006 AXE Inc.
+ *
+ * All Rights Reserverd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation.
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ /*
+ 2007 Modified for OPVP 1.0 by BBR Inc.
+ */
+
+#ifndef _OPVP_H_
+#define _OPVP_H_
+
+/* Return Values and Error Codes */
+#define OPVP_OK 0 /* -1 for errors */
+#define OPVP_FATALERROR -1 /* error: cannot be recovered */
+#define OPVP_BADREQUEST -2 /* error: called where it should
+ not be called */
+#define OPVP_BADCONTEXT -3 /* error: invalid printer context */
+#define OPVP_NOTSUPPORTED -4 /* error: combination of
+ parameters are set
+ which cannot be handled
+ by driver or printer */
+#define OPVP_JOBCANCELED -5 /* error: job has been canceled
+ by some cause */
+#define OPVP_PARAMERROR -6 /* error: invalid parameter */
+#define OPVP_VERSIONERROR -7 /* error: invalid API version */
+
+/* Basic Types */
+typedef int opvp_dc_t; /* driver/device context */
+typedef int opvp_result_t; /* return value */
+typedef unsigned char opvp_byte_t; /* BYTE */
+typedef unsigned char opvp_char_t; /* character (string) */
+typedef int opvp_int_t; /* integer */
+typedef int opvp_fix_t; /* fixed integer */
+typedef float opvp_float_t; /* float */
+typedef unsigned int opvp_flag_t; /* flags */
+typedef unsigned int opvp_rop_t; /* raster operation */
+
+/* for opvp_fix_t */
+#define OPVP_FIX_FRACT_WIDTH 8
+#define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH)
+#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
+
+/* convert macro */
+#define OPVP_I2FIX(i,fix) (fix=(i)<<OPVP_FIX_FRACT_WIDTH)
+#define OPVP_F2FIX(f,fix) (fix=((int)floor(f)<<OPVP_FIX_FRACT_WIDTH)\
+ |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
+ &(OPVP_FIX_FRACT_DENOM-1)))
+
+/* graphic elements */
+typedef struct _opvp_point {
+ opvp_fix_t x, y;
+} opvp_point_t;
+
+typedef struct _opvp_rectangle {
+ opvp_point_t p0; /* start point */
+ opvp_point_t p1; /* diagonal point */
+} opvp_rectangle_t;
+
+typedef struct _opvp_roundrectangle {
+ opvp_point_t p0; /* start point */
+ opvp_point_t p1; /* diagonal point */
+ opvp_fix_t xellipse, yellipse;
+} opvp_roundrectangle_t;
+
+/* Image Formats */
+typedef enum _opvp_imageformat {
+ OPVP_IFORMAT_RAW = 0,
+ OPVP_IFORMAT_MASK = 1,
+ OPVP_IFORMAT_RLE = 2,
+ OPVP_IFORMAT_JPEG = 3,
+ OPVP_IFORMAT_PNG = 4
+} opvp_imageformat_t;
+
+/* Color Presentation */
+typedef enum _opvp_colormapping {
+ OPVP_CMAP_DIRECT = 0,
+ OPVP_CMAP_INDEXED = 1
+} opvp_colormapping_t;
+
+typedef enum _opvp_cspace {
+ OPVP_CSPACE_BW = 0,
+ OPVP_CSPACE_DEVICEGRAY = 1,
+ OPVP_CSPACE_DEVICECMY = 2,
+ OPVP_CSPACE_DEVICECMYK = 3,
+ OPVP_CSPACE_DEVICERGB = 4,
+ OPVP_CSPACE_DEVICEKRGB = 5,
+ OPVP_CSPACE_STANDARDRGB = 6,
+ OPVP_CSPACE_STANDARDRGB64 = 7
+} opvp_cspace_t;
+
+/* Fill, Paint, Clip */
+typedef enum _opvp_fillmode {
+ OPVP_FILLMODE_EVENODD = 0,
+ OPVP_FILLMODE_WINDING = 1
+} opvp_fillmode_t;
+
+typedef enum _opvp_paintmode {
+ OPVP_PAINTMODE_OPAQUE = 0,
+ OPVP_PAINTMODE_TRANSPARENT = 1
+} opvp_paintmode_t;
+
+typedef enum _opvp_cliprule {
+ OPVP_CLIPRULE_EVENODD = 0,
+ OPVP_CLIPRULE_WINDING = 1
+} opvp_cliprule_t;
+
+/* Line */
+typedef enum _opvp_linestyle {
+ OPVP_LINESTYLE_SOLID = 0,
+ OPVP_LINESTYLE_DASH = 1
+} opvp_linestyle_t;
+
+typedef enum _opvp_linecap {
+ OPVP_LINECAP_BUTT = 0,
+ OPVP_LINECAP_ROUND = 1,
+ OPVP_LINECAP_SQUARE = 2
+} opvp_linecap_t;
+
+typedef enum _opvp_linejoin {
+ OPVP_LINEJOIN_MITER = 0,
+ OPVP_LINEJOIN_ROUND = 1,
+ OPVP_LINEJOIN_BEVEL = 2
+} opvp_linejoin_t;
+
+/* Brush */
+typedef enum _opvp_bdtype {
+ OPVP_BDTYPE_NORMAL = 0
+} opvp_bdtype_t;
+
+typedef struct _opvp_brushdata {
+ opvp_bdtype_t type;
+ opvp_int_t width, height, pitch;
+ opvp_byte_t data[1];
+
+} opvp_brushdata_t;
+
+typedef struct _opvp_brush {
+ opvp_cspace_t colorSpace;
+ opvp_int_t color[4]; /* aRGB quadruplet */
+ opvp_int_t xorg, yorg; /* brush origin */
+ /* ignored for opvpSetBgColor */
+ opvp_brushdata_t *pbrush; /* pointer to brush data */
+ /* solid brush used, if NULL */
+} opvp_brush_t;
+
+/* Misc. Flags */
+typedef enum _opvp_arcmode {
+ OPVP_ARC = 0,
+ OPVP_CHORD = 1,
+ OPVP_PIE = 2
+} opvp_arcmode_t;
+
+typedef enum _opvp_arcdir {
+ OPVP_CLOCKWISE = 0,
+ OPVP_COUNTERCLOCKWISE = 1
+} opvp_arcdir_t;
+
+typedef enum _opvp_pathmode {
+ OPVP_PATHCLOSE = 0,
+ OPVP_PATHOPEN = 1
+} opvp_pathmode_t;
+
+/* CTM */
+typedef struct _opvp_ctm {
+ opvp_float_t a, b, c, d, e, f;
+} opvp_ctm_t;
+
+/* Device Information and Capabilites */
+typedef enum _opvp_queryinfoflags {
+ OPVP_QF_DEVICERESOLUTION = 0x00000001,
+ OPVP_QF_MEDIASIZE = 0x00000002,
+ OPVP_QF_PAGEROTATION = 0x00000004,
+ OPVP_QF_MEDIANUP = 0x00000008,
+ OPVP_QF_MEDIADUPLEX = 0x00000010,
+ OPVP_QF_MEDIASOURCE = 0x00000020,
+ OPVP_QF_MEDIADESTINATION = 0x00000040,
+ OPVP_QF_MEDIATYPE = 0x00000080,
+ OPVP_QF_MEDIACOPY = 0x00000100, /* Maximum copy number
+ supported */
+ OPVP_QF_PRINTREGION = 0x00010000 /* only for opvpQueryDeviceInfo */
+} opvp_queryinfoflags_t;
+
+
+/* API Procedure Entries */
+typedef struct _opvp_api_procs {
+ opvp_dc_t (*opvpOpenPrinter)(opvp_int_t,const opvp_char_t*,const opvp_int_t[2],struct _opvp_api_procs**);
+ opvp_result_t (*opvpClosePrinter)(opvp_dc_t);
+ opvp_result_t (*opvpStartJob)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndJob)(opvp_dc_t);
+ opvp_result_t (*opvpAbortJob)(opvp_dc_t);
+ opvp_result_t (*opvpStartDoc)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndDoc)(opvp_dc_t);
+ opvp_result_t (*opvpStartPage)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndPage)(opvp_dc_t);
+ opvp_result_t (*opvpQueryDeviceCapability)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_byte_t*);
+ opvp_result_t (*opvpQueryDeviceInfo)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_char_t*);
+ opvp_result_t (*opvpResetCTM)(opvp_dc_t);
+ opvp_result_t (*opvpSetCTM)(opvp_dc_t,const opvp_ctm_t*);
+ opvp_result_t (*opvpGetCTM)(opvp_dc_t,opvp_ctm_t*);
+ opvp_result_t (*opvpInitGS)(opvp_dc_t);
+ opvp_result_t (*opvpSaveGS)(opvp_dc_t);
+ opvp_result_t (*opvpRestoreGS)(opvp_dc_t);
+ opvp_result_t (*opvpQueryColorSpace)(opvp_dc_t,opvp_int_t*,opvp_cspace_t*);
+ opvp_result_t (*opvpSetColorSpace)(opvp_dc_t,opvp_cspace_t);
+ opvp_result_t (*opvpGetColorSpace)(opvp_dc_t,opvp_cspace_t*);
+ opvp_result_t (*opvpSetFillMode)(opvp_dc_t,opvp_fillmode_t);
+ opvp_result_t (*opvpGetFillMode)(opvp_dc_t,opvp_fillmode_t*);
+ opvp_result_t (*opvpSetAlphaConstant)(opvp_dc_t,opvp_float_t);
+ opvp_result_t (*opvpGetAlphaConstant)(opvp_dc_t,opvp_float_t*);
+ opvp_result_t (*opvpSetLineWidth)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetLineWidth)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineDash)(opvp_dc_t,opvp_int_t,const opvp_fix_t*);
+ opvp_result_t (*opvpGetLineDash)(opvp_dc_t,opvp_int_t*,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineDashOffset)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetLineDashOffset)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineStyle)(opvp_dc_t,opvp_linestyle_t);
+ opvp_result_t (*opvpGetLineStyle)(opvp_dc_t,opvp_linestyle_t*);
+ opvp_result_t (*opvpSetLineCap)(opvp_dc_t,opvp_linecap_t);
+ opvp_result_t (*opvpGetLineCap)(opvp_dc_t,opvp_linecap_t*);
+ opvp_result_t (*opvpSetLineJoin)(opvp_dc_t,opvp_linejoin_t);
+ opvp_result_t (*opvpGetLineJoin)(opvp_dc_t,opvp_linejoin_t*);
+ opvp_result_t (*opvpSetMiterLimit)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetMiterLimit)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetPaintMode)(opvp_dc_t,opvp_paintmode_t);
+ opvp_result_t (*opvpGetPaintMode)(opvp_dc_t,opvp_paintmode_t*);
+ opvp_result_t (*opvpSetStrokeColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpSetFillColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpSetBgColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpNewPath)(opvp_dc_t);
+ opvp_result_t (*opvpEndPath)(opvp_dc_t);
+ opvp_result_t (*opvpStrokePath)(opvp_dc_t);
+ opvp_result_t (*opvpFillPath)(opvp_dc_t);
+ opvp_result_t (*opvpStrokeFillPath)(opvp_dc_t);
+ opvp_result_t (*opvpSetClipPath)(opvp_dc_t,opvp_cliprule_t);
+ opvp_result_t (*opvpResetClipPath)(opvp_dc_t);
+ opvp_result_t (*opvpSetCurrentPoint)(opvp_dc_t,opvp_fix_t,opvp_fix_t);
+ opvp_result_t (*opvpLinePath)(opvp_dc_t,opvp_pathmode_t,opvp_int_t,const opvp_point_t*);
+ opvp_result_t (*opvpPolygonPath)(opvp_dc_t,opvp_int_t,const opvp_int_t*,const opvp_point_t*);
+ opvp_result_t (*opvpRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_rectangle_t*);
+ opvp_result_t (*opvpRoundRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_roundrectangle_t*);
+ opvp_result_t (*opvpBezierPath)(opvp_dc_t,opvp_int_t,const opvp_point_t*);
+ opvp_result_t (*opvpArcPath)(opvp_dc_t,opvp_arcmode_t,opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t);
+ opvp_result_t (*opvpDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t ,const void*);
+ opvp_result_t (*opvpStartDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t);
+ opvp_result_t (*opvpTransferDrawImage)(opvp_dc_t,opvp_int_t,const void*);
+ opvp_result_t (*opvpEndDrawImage)(opvp_dc_t);
+ opvp_result_t (*opvpStartScanline)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpScanline)(opvp_dc_t,opvp_int_t,const opvp_int_t*);
+ opvp_result_t (*opvpEndScanline)(opvp_dc_t);
+ opvp_result_t (*opvpStartRaster)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpTransferRasterData)(opvp_dc_t,opvp_int_t,const opvp_byte_t*);
+ opvp_result_t (*opvpSkipRaster)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpEndRaster)(opvp_dc_t);
+ opvp_result_t (*opvpStartStream)(opvp_dc_t);
+ opvp_result_t (*opvpTransferStreamData)(opvp_dc_t,opvp_int_t,const void*);
+ opvp_result_t (*opvpEndStream)(opvp_dc_t);
+} opvp_api_procs_t;
+
+/* Function prototype */
+opvp_dc_t opvpOpenPrinter(
+ opvp_int_t outputFD,
+ const opvp_char_t *printerModel,
+ const opvp_int_t apiVersion[2],
+ opvp_api_procs_t **apiProcs);
+
+/* error no */
+extern opvp_int_t opvpErrorNo;
+
+#endif /* _OPVP_H_ */
--- /dev/null
+/*
+
+Copyright (c) 2003-2004, AXE, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/* $Id: opvp_0_2_0.h 85 2007-02-15 08:48:56Z sho-otani $ */
+/* opvp_common.h ver.1.00 rel.1.0 26 Nov 2004 */
+/* OpenPrinting Vector Printer Driver Glue Code */
+
+#ifndef _FSGPD_0_2_0_H
+#define _FSGPD_0_2_0_H
+
+#define _PDAPI_VERSION_MAJOR_ 0
+#define _PDAPI_VERSION_MINOR_ 2
+
+/* Return Values */
+#define OPVP_OK 0 /* error is -1 */
+
+/* Error Codes */
+#define OPVP_FATALERROR -101 /* unrecoverable error occurred within the */
+ /* library */
+#define OPVP_BADREQUEST -102 /* invalid function parameters */
+#define OPVP_BADCONTEXT -103 /* bad parameter precontext */
+#define OPVP_NOTSUPPORTED -104 /* printer or driver request not supported */
+#define OPVP_JOBCANCELED -105 /* job cancelled */
+#define OPVP_PARAMERROR -106 /* illegal parameter combination */
+
+/* Info params */
+#define OPVP_INFO_PREFIX "updf:"
+
+/* Fix */
+#define OPVP_FIX_FRACT_WIDTH 8
+#define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH)
+#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
+#if 0
+typedef struct {
+ unsigned int fract : OPVP_FIX_FRACT_WIDTH;
+ signed int floor : OPVP_FIX_FLOOR_WIDTH;
+} OPVP_Fix;
+#define OPVP_i2Fix(i,fix) (fix.fract=0,fix.floor=i)
+#define OPVP_Fix2f(fix,f) (f=(double)fix.floor\
+ +(double)(fix.fract)/OPVP_FIX_FRACT_DENOM)
+#define OPVP_f2Fix(f,fix) (fix.fract=(f-floor(f))*OPVP_FIX_FRACT_DENOM,\
+ fix.floor=floor(f))
+#else
+typedef int OPVP_Fix;
+#define OPVP_i2Fix(i,fix) (fix=(i)<<8)
+#define OPVP_f2Fix(f,fix) (fix=((int)floor(f)<<8)\
+ |((int)(((f)-floor(f))*OPVP_FIX_FRACT_DENOM)\
+ &0x000000ff))
+#endif
+
+/* Basic Types */
+typedef struct _OPVP_Point {
+ OPVP_Fix x;
+ OPVP_Fix y;
+} OPVP_Point;
+
+typedef struct _OPVP_Rectangle {
+ OPVP_Point p0; /* start point */
+ OPVP_Point p1; /* end point */
+} OPVP_Rectangle;
+
+typedef struct _OPVP_RoundRectangle {
+ OPVP_Point p0; /* start point */
+ OPVP_Point p1; /* end point */
+ OPVP_Fix xellipse;
+ OPVP_Fix yellipse;
+} OPVP_RoundRectangle;
+
+/* Image Formats */
+typedef enum _OPVP_ImageFormat {
+ OPVP_iformatRaw = 0,
+ OPVP_iformatRLE = 1,
+ OPVP_iformatJPEG = 2,
+ OPVP_iformatPNG = 3
+} OPVP_ImageFormat;
+
+/* Color Presentation */
+typedef enum _OPVP_ColorMapping {
+ OPVP_cmapDirect = 0,
+ OPVP_cmapIndexed = 1
+} OPVP_ColorMapping;
+
+typedef enum _OPVP_ColorSpace {
+ OPVP_cspaceBW = 0,
+ OPVP_cspaceDeviceGray = 1,
+ OPVP_cspaceDeviceCMY = 2,
+ OPVP_cspaceDeviceCMYK = 3,
+ OPVP_cspaceDeviceRGB = 4,
+ OPVP_cspaceStandardRGB = 5,
+ OPVP_cspaceStandardRGB64 = 6
+} OPVP_ColorSpace;
+
+/* Raster Operation modes */
+typedef enum _OPVP_ROP {
+ OPVP_ropPset = 0,
+ OPVP_ropPreset = 1,
+ OPVP_ropOr = 2,
+ OPVP_ropAnd = 3,
+ OPVP_ropXor = 4
+} OPVP_ROP;
+
+/* Fill, Paint, Clip */
+typedef enum _OPVP_FillMode {
+ OPVP_fillModeEvenOdd = 0,
+ OPVP_fillModeWinding = 1
+} OPVP_FillMode;
+
+typedef enum _OPVP_PaintMode {
+ OPVP_paintModeOpaque = 0,
+ OPVP_paintModeTransparent = 1
+} OPVP_PaintMode;
+
+typedef enum _OPVP_ClipRule {
+ OPVP_clipRuleEvenOdd = 0,
+ OPVP_clipRuleWinding = 1
+} OPVP_ClipRule;
+
+/* Line */
+typedef enum _OPVP_LineStyle {
+ OPVP_lineStyleSolid = 0,
+ OPVP_lineStyleDash = 1
+} OPVP_LineStyle;
+
+typedef enum _OPVP_LineCap {
+ OPVP_lineCapButt = 0,
+ OPVP_lineCapRound = 1,
+ OPVP_lineCapSquare = 2
+} OPVP_LineCap;
+
+typedef enum _OPVP_LineJoin {
+ OPVP_lineJoinMiter = 0,
+ OPVP_lineJoinRound = 1,
+ OPVP_lineJoinBevel = 2
+} OPVP_LineJoin;
+
+/* Brush */
+typedef enum _OPVP_BrushDataType {
+ OPVP_bdtypeNormal = 0
+} OPVP_BrushDataType;
+
+typedef struct _OPVP_BrushData {
+ OPVP_BrushDataType type;
+ int width;
+ int height;
+ int pitch;
+#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
+ void *data; /* pointer to actual data */
+#else
+ char data[1];
+#endif
+} OPVP_BrushData;
+
+typedef struct _OPVP_Brush {
+ OPVP_ColorSpace colorSpace;
+ int color[4]; /* aRGB quadruplet */
+#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
+ OPVP_BrushData *pbrush; /* pointer to brush data */
+ /* solid brush used, if null */
+ int xorg; /* brush origin */
+ int yorg; /* ignored for SetBgColor */
+#else
+ int xorg; /* brush origin */
+ int yorg; /* ignored for SetBgColor */
+ OPVP_BrushData *pbrush; /* pointer to brush data */
+ /* solid brush used, if null */
+#endif
+} OPVP_Brush;
+
+/* Misc. Flags */
+#define OPVP_Arc 0 /* circular arc */
+#define OPVP_Chord 1 /* arch */
+#define OPVP_Pie 2 /* pie section */
+#define OPVP_Clockwise 0 /* clockwise */
+#define OPVP_Counterclockwise 1 /* counter-clockwise */
+#define OPVP_PathClose 0 /* Close path when using LinePath */
+#define OPVP_PathOpen 1 /* Do not close path when using LinePath */
+
+/* CTM */
+typedef struct _OPVP_CTM {
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
+} OPVP_CTM;
+
+/* Vector Driver API Proc. Entries */
+typedef struct _OPVP_api_procs {
+ int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **);
+ int (*ClosePrinter)(int);
+ int (*StartJob)(int,char *);
+ int (*EndJob)(int);
+ int (*StartDoc)(int,char *);
+ int (*EndDoc)(int);
+ int (*StartPage)(int,char *);
+ int (*EndPage)(int);
+#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
+ int (*QueryDeviceCapability)(int,int,int,char *);
+ int (*QueryDeviceInfo)(int,int,int,char *);
+#endif
+ int (*ResetCTM)(int);
+ int (*SetCTM)(int,OPVP_CTM *);
+ int (*GetCTM)(int,OPVP_CTM *);
+ int (*InitGS)(int);
+ int (*SaveGS)(int);
+ int (*RestoreGS)(int);
+ int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *);
+ int (*SetColorSpace)(int,OPVP_ColorSpace);
+ int (*GetColorSpace)(int,OPVP_ColorSpace *);
+ int (*QueryROP)(int,int *,int *);
+ int (*SetROP)(int,int);
+ int (*GetROP)(int,int *);
+ int (*SetFillMode)(int,OPVP_FillMode);
+ int (*GetFillMode)(int,OPVP_FillMode *);
+ int (*SetAlphaConstant)(int,float);
+ int (*GetAlphaConstant)(int,float *);
+ int (*SetLineWidth)(int,OPVP_Fix);
+ int (*GetLineWidth)(int,OPVP_Fix *);
+ int (*SetLineDash)(int,OPVP_Fix *,int);
+ int (*GetLineDash)(int,OPVP_Fix *,int *);
+ int (*SetLineDashOffset)(int,OPVP_Fix);
+ int (*GetLineDashOffset)(int,OPVP_Fix *);
+ int (*SetLineStyle)(int,OPVP_LineStyle);
+ int (*GetLineStyle)(int,OPVP_LineStyle *);
+ int (*SetLineCap)(int,OPVP_LineCap);
+ int (*GetLineCap)(int,OPVP_LineCap *);
+ int (*SetLineJoin)(int,OPVP_LineJoin);
+ int (*GetLineJoin)(int,OPVP_LineJoin *);
+ int (*SetMiterLimit)(int,OPVP_Fix);
+ int (*GetMiterLimit)(int,OPVP_Fix *);
+ int (*SetPaintMode)(int,OPVP_PaintMode);
+ int (*GetPaintMode)(int,OPVP_PaintMode *);
+ int (*SetStrokeColor)(int,OPVP_Brush *);
+ int (*SetFillColor)(int,OPVP_Brush *);
+ int (*SetBgColor)(int,OPVP_Brush *);
+ int (*NewPath)(int);
+ int (*EndPath)(int);
+ int (*StrokePath)(int);
+ int (*FillPath)(int);
+ int (*StrokeFillPath)(int);
+ int (*SetClipPath)(int,OPVP_ClipRule);
+#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
+ int (*ResetClipPath)(int);
+#endif
+ int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix);
+ int (*LinePath)(int,int,int,OPVP_Point *);
+ int (*PolygonPath)(int,int,int *,OPVP_Point *);
+ int (*RectanglePath)(int,int,OPVP_Rectangle *);
+ int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *);
+#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
+ int (*BezierPath)(int,int *,OPVP_Point *);
+#else
+ int (*BezierPath)(int,int,OPVP_Point *);
+#endif
+ int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix,
+ OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix);
+ int (*DrawBitmapText)(int,int,int,int,void *);
+ int (*DrawImage)(int,int,int,int,
+ OPVP_ImageFormat,OPVP_Rectangle,int,void *);
+ int (*StartDrawImage)(int,int,int,int,
+ OPVP_ImageFormat,OPVP_Rectangle);
+ int (*TransferDrawImage)(int,int,void *);
+ int (*EndDrawImage)(int);
+ int (*StartScanline)(int,int);
+ int (*Scanline)(int,int,int *);
+ int (*EndScanline)(int);
+ int (*StartRaster)(int,int);
+ int (*TransferRasterData)(int,int,unsigned char *);
+ int (*SkipRaster)(int,int);
+ int (*EndRaster)(int);
+ int (*StartStream)(int);
+ int (*TransferStreamData)(int,int,void *);
+ int (*EndStream)(int);
+} OPVP_api_procs;
+
+#endif /* _OPVP_COMMON_H_ */
+
--- /dev/null
+/*
+
+Copyright (c) 2003-2004, AXE, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/* OpenPrinting Vector Printer Driver Glue Code */
+
+#ifndef _OPVP_COMMON_H_
+#define _OPVP_COMMON_H_
+
+#include "opvp_0_2_0.h"
+#undef _PDAPI_VERSION_MAJOR_
+#undef _PDAPI_VERSION_MINOR_
+/* undefine conflicted macros */
+#undef OPVP_INFO_PREFIX
+#undef OPVP_OK
+#undef OPVP_FATALERROR
+#undef OPVP_BADREQUEST
+#undef OPVP_BADCONTEXT
+#undef OPVP_NOTSUPPORTED
+#undef OPVP_JOBCANCELED
+#undef OPVP_PARAMERROR
+/* define 0_2 error no as different macros */
+#define OPVP_FATALERROR_0_2 -101
+#define OPVP_BADREQUEST_0_2 -102
+#define OPVP_BADCONTEXT_0_2 -103
+#define OPVP_NOTSUPPORTED_0_2 -104
+#define OPVP_JOBCANCELED_0_2 -105
+#define OPVP_PARAMERROR_0_2 -106
+
+#include "opvp.h"
+#define OPVP_INFO_PREFIX ""
+
+#endif /* _OPVP_COMMON_H_ */
+
--- /dev/null
+//========================================================================
+//
+// pdftoopvp.cc
+//
+// Copyright 2005 AXE,Inc.
+//
+// 2007,2008,2009 Modified by BBR Inc.
+//========================================================================
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <math.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "goo/GooString.h"
+#define GSTRING_H // for old GooString.h
+#include "goo/gmem.h"
+#include "GlobalParams.h"
+#include "Object.h"
+#include "PDFDoc.h"
+#include "splash/SplashBitmap.h"
+#include "OPRS.h"
+#include "OPVPOutputDev.h"
+#include "Gfx.h"
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include "OPVPError.h"
+
+#define MMPERINCH (25.4)
+
+static int resolution = 300;
+static int hResolution = 0;
+static int vResolution = 0;
+static GBool mono = gFalse;
+static GBool reverse = gFalse;
+static GBool gray = gFalse;
+static char enableFreeTypeStr[16] = "";
+static GBool quiet = gFalse;
+static char outputOrderStr[256] = "";
+static GBool oldLipsDriver = gFalse;
+static GBool HPDriver = gFalse;
+static GBool NECDriver = gFalse;
+static GBool clipPathNotSaved = gFalse;
+static GBool noShearImage = gFalse;
+static GBool noLineStyle = gFalse;
+static GBool noImageMask = gFalse;
+static GBool noClipPath = gFalse;
+static GBool ignoreMiterLimit = gFalse;
+static GBool noMiterLimit = gFalse;
+static char printerDriver[1024] = "";
+static char printerModel[1024] = "";
+static char jobInfo[4096] = "";
+static char docInfo[1024] = "";
+static char pageInfo[1024] = "";
+static GBool noBitmapChar = gFalse;
+static char bitmapCharThreshold[20] = "2000";
+static char maxClipPathLength[20] = "2000";
+static char maxFillPathLength[20] = "4000";
+static int pageWidth = -1;
+static int pageHeight = -1;
+
+static int outOnePage(PDFDoc *doc, OPVPOutputDev *opvpOut, int pg)
+{
+ char buf[1024];
+ char *p;
+ double pw = doc->getPageMediaWidth(pg);
+ double ph = doc->getPageMediaHeight(pg);
+ int paperWidth;
+ int paperHeight;
+
+ if (pw != pageWidth || ph != pageHeight) {
+ if (pageInfo[0] != '\0') {
+ snprintf(buf,sizeof(buf),"%s;MediaSize=%dx%dmm",pageInfo,
+ (int)(pw*MMPERINCH/72),
+ (int)(ph*MMPERINCH/72));
+ } else {
+ snprintf(buf,sizeof(buf),"MediaSize=%dx%dmm",
+ (int)(pw*MMPERINCH/72),
+ (int)(ph*MMPERINCH/72));
+ }
+ p = buf;
+ } else {
+ pw = pageWidth;
+ ph = pageHeight;
+ p = pageInfo;
+ }
+
+ paperWidth = (int)(pw*hResolution/72+0.5);
+ paperHeight = (int)(ph*vResolution/72+0.5);
+ if (opvpOut->OPVPStartPage(p,paperWidth,paperHeight) < 0) {
+ opvpError(-1,"Start Page failed");
+ return 2;
+ }
+ opvpOut->setScale(1.0,1.0,0,0,0,0,paperHeight);
+ doc->displayPage(opvpOut, pg, resolution, resolution,
+ 0, gTrue, gTrue, gFalse);
+ if (opvpOut->outSlice() < 0) {
+ opvpError(-1,"OutSlice failed");
+ return 2;
+ }
+ if (opvpOut->OPVPEndPage() < 0) {
+ opvpError(-1,"End Page failed");
+ return 2;
+ }
+ return 0;
+}
+
+#define MAX_OPVP_OPTIONS 20
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+void CDECL myErrorFun(void *data, ErrorCategory category,
+ int pos, char *msg)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ fprintf(stderr, "%s\n",msg);
+ fflush(stderr);
+}
+#else
+void CDECL myErrorFun(int pos, char *msg, va_list args)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ vfprintf(stderr, msg, args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+}
+#endif
+
+static GBool getColorProfilePath(ppd_file_t *ppd, GooString *path)
+{
+ // get color profile path
+ const char *colorModel;
+ const char *cupsICCQualifier2;
+ const char *cupsICCQualifier2Choice;
+ const char *cupsICCQualifier3;
+ const char *cupsICCQualifier3Choice;
+ ppd_attr_t *attr;
+ ppd_choice_t *choice;
+
+ if ((attr = ppdFindAttr(ppd,"ColorModel",NULL)) != NULL) {
+ colorModel = attr->value;
+ } else {
+ colorModel = NULL;
+ }
+ if ((attr = ppdFindAttr(ppd,"cupsICCQualifier2",NULL)) != NULL) {
+ cupsICCQualifier2 = attr->value;
+ } else {
+ cupsICCQualifier2 = "MediaType";
+ }
+ if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier2)) != NULL) {
+ cupsICCQualifier2Choice = choice->choice;
+ } else {
+ cupsICCQualifier2Choice = NULL;
+ }
+ if ((attr = ppdFindAttr(ppd,"cupsICCQualifier3",NULL)) != NULL) {
+ cupsICCQualifier3 = attr->value;
+ } else {
+ cupsICCQualifier3 = "Resolution";
+ }
+ if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier3)) != NULL) {
+ cupsICCQualifier3Choice = choice->choice;
+ } else {
+ cupsICCQualifier3Choice = NULL;
+ }
+
+ for (attr = ppdFindAttr(ppd,"cupsICCProfile",NULL);attr != NULL;
+ attr = ppdFindNextAttr(ppd,"cupsICCProfile",NULL)) {
+ // check color model
+ char buf[PPD_MAX_NAME];
+ char *p, *r;
+
+ strncpy(buf,attr->spec,sizeof(buf));
+ if ((p = strchr(buf,'.')) != NULL) {
+ *p = '\0';
+ }
+ if (colorModel != NULL && buf[0] != '\0'
+ && strcasecmp(buf,colorModel) != 0) continue;
+ if (p == NULL) {
+ break;
+ } else {
+ p++;
+ if ((r = strchr(p,'.')) != 0) {
+ *r = '\0';
+ }
+ }
+ if (cupsICCQualifier2Choice != NULL && p[0] != '\0'
+ && strcasecmp(p,cupsICCQualifier2Choice) != 0) continue;
+ if (r == NULL) {
+ break;
+ } else {
+ r++;
+ if ((p = strchr(r,'.')) != 0) {
+ *p = '\0';
+ }
+ }
+ if (cupsICCQualifier3Choice == NULL || r[0] == '\0'
+ || strcasecmp(r,cupsICCQualifier3Choice) == 0) break;
+ }
+ if (attr != NULL) {
+ // matched
+ path->clear();
+ if (attr->value[0] != '/') {
+ path->append(CUPS_DATADIR);
+ path->append("/profiles/");
+ }
+ path->append(attr->value);
+ return gTrue;
+ }
+ return gFalse;
+}
+
+int main(int argc, char *argv[]) {
+/* mtrace(); */
+ int exitCode;
+{
+ PDFDoc *doc;
+ SplashColor paperColor;
+ OPVPOutputDev *opvpOut;
+ GBool ok = gTrue;
+ int pg;
+ const char *optionKeys[MAX_OPVP_OPTIONS];
+ const char *optionVals[MAX_OPVP_OPTIONS];
+ int nOptions = 0;
+ int numPages;
+ int i;
+ GooString fileName;
+ GooString colorProfilePath("opvp.icc");
+
+ exitCode = 99;
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ setErrorCallback(::myErrorFun,NULL);
+#else
+ setErrorFunction(::myErrorFun);
+#endif
+
+ // parse args
+ int num_options;
+ cups_option_t *options;
+ const char *val;
+ char *ppdFileName;
+ ppd_file_t *ppd = 0;
+ ppd_attr_t *attr;
+ GooString jobInfoStr;
+ GooString docInfoStr;
+ GooString pageInfoStr;
+ GBool colorProfile = gFalse;
+
+
+ if (argc < 6 || argc > 7) {
+ opvpError(-1,"ERROR: %s job-id user title copies options [file]",
+ argv[0]);
+ return (1);
+ }
+
+ if ((ppdFileName = getenv("PPD")) != 0) {
+ if ((ppd = ppdOpenFile(ppdFileName)) != 0) {
+ /* get attributes from PPD File */
+ if ((attr = ppdFindAttr(ppd,"opvpJobInfo",0)) != 0) {
+ jobInfoStr.append(attr->value);
+ }
+ if ((attr = ppdFindAttr(ppd,"opvpDocInfo",0)) != 0) {
+ docInfoStr.append(attr->value);
+ }
+ if ((attr = ppdFindAttr(ppd,"opvpPageInfo",0)) != 0) {
+ pageInfoStr.append(attr->value);
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpOldLipsDriver",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ oldLipsDriver = gTrue;
+ } else {
+ oldLipsDriver = gFalse;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpHPDriver",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ HPDriver = gTrue;
+ } else {
+ HPDriver = gFalse;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpNECDriver",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ NECDriver = gTrue;
+ } else {
+ NECDriver = gFalse;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpClipPathNotSaved",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ clipPathNotSaved = gTrue;
+ } else {
+ clipPathNotSaved = gFalse;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpShearImage",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noShearImage = gFalse;
+ } else {
+ noShearImage = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpLineStyle",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noLineStyle = gFalse;
+ } else {
+ noLineStyle = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpImageMask",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noImageMask = gFalse;
+ } else {
+ noImageMask = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpClipPath",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noClipPath = gFalse;
+ } else {
+ noClipPath = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpMiterLimit",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noMiterLimit = gFalse;
+ } else {
+ noMiterLimit = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpIgnoreMiterLimit",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ ignoreMiterLimit = gTrue;
+ } else {
+ ignoreMiterLimit = gFalse;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpBitmapCharThreshold",0)) != 0) {
+ strncpy(bitmapCharThreshold,attr->value,
+ sizeof(bitmapCharThreshold)-1);
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpMaxClipPathLength",0)) != 0) {
+ strncpy(maxClipPathLength,attr->value,
+ sizeof(maxClipPathLength)-1);
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpMaxFillPathLength",0)) != 0) {
+ strncpy(maxFillPathLength,attr->value,
+ sizeof(maxFillPathLength)-1);
+ }
+ if ((attr = ppdFindAttr(ppd,"pdftoopvpBitmapChar",0)) != 0) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ noBitmapChar = gFalse;
+ } else {
+ noBitmapChar = gTrue;
+ }
+ }
+ if ((attr = ppdFindAttr(ppd,"opvpDriver",0)) != 0) {
+ strncpy(printerDriver,attr->value,sizeof(printerDriver)-1);
+ printerDriver[sizeof(printerDriver)-1] = '\0';
+ }
+ if ((attr = ppdFindAttr(ppd,"opvpModel",0)) != 0) {
+ strncpy(printerModel,attr->value,sizeof(printerModel)-1);
+ printerModel[sizeof(printerModel)-1] = '\0';
+ }
+ ppdMarkDefaults(ppd);
+ }
+ }
+ /* get attributes and options from command line option */
+ num_options = cupsParseOptions(argv[5],0,&options);
+ cupsMarkOptions(ppd,num_options,options);
+
+ for (i = 0;i < num_options;i++) {
+ if (strcasecmp(options[i].name,"Resolution") == 0) {
+ resolution = atoi(options[i].value);
+ } else if (strcasecmp(options[i].name,"pdftoopvpOldLipsDriver") == 0) {
+ oldLipsDriver = gTrue;
+ } else if (strcasecmp(options[i].name,"pdftoopvpHPDriver") == 0) {
+ HPDriver = gTrue;
+ } else if (strcasecmp(options[i].name,"pdftoopvpNECDriver") == 0) {
+ NECDriver = gTrue;
+ } else if (strcasecmp(options[i].name,"pdftoopvpClipPathNotSaved") == 0) {
+ clipPathNotSaved = gTrue;
+ } else if (strcasecmp(options[i].name,"pdftoopvpShearImage") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noShearImage = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpLineStyle") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noLineStyle = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpImageMask") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noImageMask = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpClipPath") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noClipPath = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpMiterLimit") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noMiterLimit = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpIgnoreMiterLimit") == 0) {
+ if (strcasecmp(options[i].value,"true") == 0) {
+ ignoreMiterLimit = gTrue;
+ }
+ }
+ else if (strcasecmp(options[i].name,"pdftoopvpBitmapChar") == 0) {
+ if (strcasecmp(options[i].value,"false") == 0) {
+ noBitmapChar = gTrue;
+ }
+ } else if (strcasecmp(options[i].name,"pdftoopvpBitmapCharThreshold") == 0) {
+ strncpy(bitmapCharThreshold,options[i].value,
+ sizeof(bitmapCharThreshold)-1);
+ } else if (strcasecmp(options[i].name,"pdftoopvpMaxClipPathLength") == 0) {
+ strncpy(maxClipPathLength,options[i].value,
+ sizeof(maxClipPathLength)-1);
+ } else if (strcasecmp(options[i].name,"pdftoopvpMaxFillPathLength") == 0) {
+ strncpy(maxFillPathLength,options[i].value,
+ sizeof(maxFillPathLength)-1);
+ } else if (strcasecmp(options[i].name,"opvpDriver") == 0) {
+ strncpy(printerDriver,options[i].value,sizeof(printerDriver)-1);
+ printerDriver[sizeof(printerDriver)-1] = '\0';
+ } else if (strcasecmp(options[i].name,"opvpModel") == 0) {
+ strncpy(printerModel,options[i].value,sizeof(printerModel)-1);
+ printerModel[sizeof(printerModel)-1] = '\0';
+ } else if (strcasecmp(options[i].name,"opvpJobInfo") == 0) {
+ /* do nothing here */;
+ } else if (strcasecmp(options[i].name,"opvpDocInfo") == 0) {
+ /* do nothing here */;
+ } else if (strcasecmp(options[i].name,"opvpPageInfo") == 0) {
+ /* do nothing here */;
+ }
+ }
+ if (ppd != 0) {
+ int section;
+ ppd_choice_t **choices;
+ ppd_size_t *pagesize;
+
+ if ((pagesize = ppdPageSize(ppd,0)) != 0) {
+ pageWidth = (int)pagesize->width;
+ pageHeight = (int)pagesize->length;
+ }
+ for (section = (int)PPD_ORDER_ANY;
+ section <= (int)PPD_ORDER_PROLOG;section++) {
+ int n;
+
+ n = ppdCollect(ppd,(ppd_section_t)section,&choices);
+ for (i = 0;i < n;i++) {
+
+ if (strcasecmp(((ppd_option_t *)(choices[i]->option))->keyword,
+ "Resolution") == 0) {
+ resolution = atoi(choices[i]->choice);
+ }
+ }
+ if (choices != 0) free(choices);
+ }
+
+ strncpy(jobInfo,jobInfoStr.getCString(),sizeof(jobInfo)-1);
+ jobInfo[sizeof(jobInfo)-1] = '\0';
+ strncpy(docInfo,docInfoStr.getCString(),sizeof(docInfo)-1);
+ docInfo[sizeof(docInfo)-1] = '\0';
+ strncpy(pageInfo,pageInfoStr.getCString(),sizeof(pageInfo)-1);
+ pageInfo[sizeof(pageInfo)-1] = '\0';
+
+ colorProfile = getColorProfilePath(ppd,&colorProfilePath);
+
+ ppdClose(ppd);
+ }
+ if ((val = cupsGetOption("opvpJobInfo",num_options, options)) != 0) {
+ /* override ppd value */
+ strncpy(jobInfo,val,sizeof(jobInfo)-1);
+ jobInfo[sizeof(jobInfo)-1] = '\0';
+ }
+ if ((val = cupsGetOption("opvpDocInfo",num_options, options)) != 0) {
+ /* override ppd value */
+ strncpy(docInfo,val,sizeof(docInfo)-1);
+ docInfo[sizeof(docInfo)-1] = '\0';
+ }
+ if ((val = cupsGetOption("opvpPageInfo",num_options, options)) != 0) {
+ /* override ppd value */
+ strncpy(pageInfo,val,sizeof(pageInfo)-1);
+ pageInfo[sizeof(pageInfo)-1] = '\0';
+ }
+
+ cupsFreeOptions(num_options,options);
+#if 0
+ /* for debug parameters */
+ fprintf(stderr,"WARNING:resolution=%d\n",resolution);
+ fprintf(stderr,"WARNING:sliceHeight=%d\n",sliceHeight);
+ fprintf(stderr,"WARNING:oldLipsDriver=%d\n",oldLipsDriver);
+ fprintf(stderr,"WARNING:HPDriver=%d\n",HPDriver);
+ fprintf(stderr,"WARNING:NECDriver=%d\n",NECDriver);
+ fprintf(stderr,"WARNING:clipPathNotSaved=%d\n",clipPathNotSaved);
+ fprintf(stderr,"WARNING:noShearImage=%d\n",noShearImage);
+ fprintf(stderr,"WARNING:noLineStyle=%d\n",noLineStyle);
+ fprintf(stderr,"WARNING:noClipPath=%d\n",noClipPath);
+ fprintf(stderr,"WARNING:noMiterLimit=%d\n",noMiterLimit);
+ fprintf(stderr,"WARNING:printerDriver=%s\n",printerDriver);
+ fprintf(stderr,"WARNING:printerModel=%s\n",printerModel);
+ fprintf(stderr,"WARNING:jobInfo=%s\n",jobInfo);
+ fprintf(stderr,"WARNING:docInfo=%s\n",docInfo);
+ fprintf(stderr,"WARNING:pageInfo=%s\n",pageInfo);
+ fprintf(stderr,"WARNING:noBitmapChar=%d\n",noBitmapChar);
+ fprintf(stderr,"WARNING:bitmapCharThreshold=%s\n",bitmapCharThreshold);
+ fprintf(stderr,"WARNING:maxClipPathLength=%s\n",maxClipPathLength);
+ fprintf(stderr,"WARNING:maxFillPathLength=%s\n",maxFillPathLength);
+exit(0);
+#endif
+
+ if (oldLipsDriver) {
+ optionKeys[nOptions] = "OPVP_OLDLIPSDRIVER";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ clipPathNotSaved = gTrue;
+ noShearImage = gTrue;
+ }
+ if (HPDriver) {
+ noClipPath = gTrue;
+ noLineStyle = gTrue;
+ noShearImage = gTrue;
+ }
+ if (NECDriver) {
+ noMiterLimit = gTrue;
+ strcpy(maxClipPathLength,"6");
+ noShearImage = gTrue;
+ }
+ if (clipPathNotSaved) {
+ optionKeys[nOptions] = "OPVP_CLIPPATHNOTSAVED";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noShearImage) {
+ optionKeys[nOptions] = "OPVP_NOSHEARIMAGE";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noLineStyle) {
+ optionKeys[nOptions] = "OPVP_NOLINESTYLE";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noImageMask) {
+ optionKeys[nOptions] = "OPVP_NOIMAGEMASK";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noClipPath) {
+ optionKeys[nOptions] = "OPVP_NOCLIPPATH";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noMiterLimit) {
+ optionKeys[nOptions] = "OPVP_NOMITERLIMIT";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (noBitmapChar) {
+ optionKeys[nOptions] = "OPVP_NOBITMAPCHAR";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ if (ignoreMiterLimit) {
+ optionKeys[nOptions] = "OPVP_IGNOREMITERLIMIT";
+ optionVals[nOptions] = "1";
+ nOptions++;
+ }
+ optionKeys[nOptions] = "OPVP_BITMAPCHARTHRESHOLD";
+ optionVals[nOptions] = bitmapCharThreshold;
+ nOptions++;
+ optionKeys[nOptions] = "OPVP_MAXCLIPPATHLENGTH";
+ optionVals[nOptions] = maxClipPathLength;
+ nOptions++;
+ optionKeys[nOptions] = "OPVP_MAXFILLPATHLENGTH";
+ optionVals[nOptions] = maxFillPathLength;
+ nOptions++;
+ if (hResolution == 0) hResolution = resolution;
+ if (hResolution == 0) hResolution = resolution;
+ if (vResolution == 0) vResolution = resolution;
+ if (strcasecmp(outputOrderStr,"reverse") == 0) {
+ reverse = gTrue;
+ }
+
+ if (argc > 6) {
+ fileName.append(argv[6]);
+ } else {
+ fileName.append("-");
+ }
+
+ // read config file
+ globalParams = new GlobalParams();
+ if (enableFreeTypeStr[0]) {
+ if (!globalParams->setEnableFreeType(enableFreeTypeStr)) {
+ opvpError(-1,"Bad '-freetype' value on command line");
+ ok = gFalse;
+ }
+ }
+ globalParams->setAntialias("no");
+ if (quiet) {
+ globalParams->setErrQuiet(quiet);
+ }
+ if (!ok) {
+ exitCode = 2;
+ goto err0;
+ }
+
+ if (fileName.cmp("-") == 0) {
+ /* stdin */
+ char *s;
+ GooString name;
+ int fd;
+ Object obj;
+ BaseStream *str;
+ FILE *fp;
+ char buf[4096];
+ int n;
+
+ /* create a tmp file */
+ if ((s = getenv("TMPDIR")) != 0) {
+ name.append(s);
+ } else {
+ name.append("/tmp");
+ }
+ name.append("/XXXXXX");
+ fd = mkstemp(name.getCString());
+ /* remove name */
+ unlink(name.getCString());
+ if (fd < 0) {
+ opvpError(-1,"Can't create temporary file");
+ exitCode = 2;
+ goto err0;
+ }
+
+ /* check JCL */
+ while (fgets(buf,sizeof(buf)-1,stdin) != NULL
+ && strncmp(buf,"%PDF",4) != 0) {
+ if (strncmp(buf,"pdftoopvp jobInfo:",18) == 0) {
+ /* JCL jobInfo exists, override jobInfo */
+ strncpy(jobInfo,buf+18,sizeof(jobInfo)-1);
+ for (i = sizeof(jobInfo)-2;i >= 0
+ && (jobInfo[i] == 0 || jobInfo[i] == '\n' || jobInfo[i] == ';')
+ ;i--);
+ jobInfo[i+1] = 0;
+ }
+ }
+ if (strncmp(buf,"%PDF",4) != 0) {
+ opvpError(-1,"Can't find PDF header");
+ exitCode = 2;
+ goto err0;
+ }
+ /* copy PDF header */
+ n = strlen(buf);
+ if (write(fd,buf,n) != n) {
+ opvpError(-1,"Can't copy stdin to temporary file");
+ close(fd);
+ exitCode = 2;
+ goto err0;
+ }
+ /* copy rest stdin to the tmp file */
+ while ((n = fread(buf,1,sizeof(buf),stdin)) > 0) {
+ if (write(fd,buf,n) != n) {
+ opvpError(-1,"Can't copy stdin to temporary file");
+ close(fd);
+ exitCode = 2;
+ goto err0;
+ }
+ }
+ if (lseek(fd,0,SEEK_SET) < 0) {
+ opvpError(-1,"Can't rewind temporary file");
+ close(fd);
+ exitCode = 2;
+ goto err0;
+ }
+
+ if ((fp = fdopen(fd,"rb")) == 0) {
+ opvpError(-1,"Can't fdopen temporary file");
+ close(fd);
+ exitCode = 2;
+ goto err0;
+ }
+
+ obj.initNull();
+ str = new FileStream(fp,0,gFalse,0,&obj);
+ doc = new PDFDoc(str);
+ } else {
+ /* no jcl check */
+ doc = new PDFDoc(fileName.copy());
+ }
+ if (!doc->isOk()) {
+ opvpError(-1," Parsing PDF failed: error code %d",
+ doc->getErrorCode());
+ exitCode = 2;
+ goto err05;
+ }
+
+ if (doc->isEncrypted() && !doc->okToPrint()) {
+ opvpError(-1,"Print Permission Denied");
+ exitCode = 2;
+ goto err05;
+ }
+
+ /* paperColor is white */
+ paperColor[0] = 255;
+ paperColor[1] = 255;
+ paperColor[2] = 255;
+#ifdef USE_CMS
+ /* set color profile file name */
+ GfxColorSpace::setDisplayProfileName(&colorProfilePath);
+#endif
+ opvpOut = new OPVPOutputDev();
+ if (opvpOut->init(mono ? splashModeMono1 :
+ gray ? splashModeMono8 :
+ splashModeRGB8,
+ colorProfile,
+ gFalse, paperColor,
+ printerDriver,1,printerModel,
+ nOptions,optionKeys,optionVals) < 0) {
+ opvpError(-1,"OPVPOutputDev Initialize fail");
+ exitCode = 2;
+ goto err1;
+ }
+
+ opvpOut->startDoc(doc->getXRef());
+
+#if 0
+fprintf(stderr,"JobInfo=%s\n",jobInfo);
+#endif
+ if (opvpOut->OPVPStartJob(jobInfo) < 0) {
+ opvpError(-1,"Start job failed");
+ exitCode = 2;
+ goto err1;
+ }
+ if (opvpOut->OPVPStartDoc(docInfo) < 0) {
+ opvpError(-1,"Start Document failed");
+ exitCode = 2;
+ goto err2;
+ }
+ numPages = doc->getNumPages();
+ for (pg = 1; pg <= numPages; ++pg) {
+ if ((exitCode = outOnePage(doc,opvpOut,pg)) != 0) break;
+ }
+ if (opvpOut->OPVPEndDoc() < 0) {
+ opvpError(-1,"End Document failed");
+ exitCode = 2;
+ }
+err2:
+ if (opvpOut->OPVPEndJob() < 0) {
+ opvpError(-1,"End job failed");
+ exitCode = 2;
+ }
+
+ // clean up
+ err1:
+ delete opvpOut;
+ err05:
+ delete doc;
+ err0:
+ delete globalParams;
+
+ // check for memory leaks
+ Object::memCheck(stderr);
+ gMemReport(stderr);
+
+}
+/* muntrace(); */
+ return exitCode;
+}
+
+/* for memory debug */
+void *operator new(size_t size) throw (std::bad_alloc)
+{
+ void *p = malloc(size);
+ return p;
+}
+
+void operator delete(void *p) throw ()
+{
+ free(p);
+}
--- /dev/null
+#include "intervalset.h"
+#include <stdio.h>
+#include <assert.h>
+#include <limits>
+#include <algorithm>
+
+const IntervalSet::key_t IntervalSet::npos=std::numeric_limits<IntervalSet::key_t>::max();
+
+void IntervalSet::clear() // {{{
+{
+ data.clear();
+}
+// }}}
+
+void IntervalSet::add(key_t start,key_t end) // {{{
+{
+ if (start<end) {
+ data.push_back(std::make_pair(start,end));
+ }
+}
+// }}}
+
+void IntervalSet::finish() // {{{
+{
+ data_t::iterator it=data.begin(),end=data.end(),pos=it;
+ if (it==end) {
+ return;
+ }
+
+ std::sort(it,end);
+
+ while (1) {
+ ++it;
+ if (it==end) {
+ ++pos;
+ break;
+ }
+ if (pos->second>=it->first) {
+ pos->second=it->second;
+ } else {
+ ++pos;
+ if (pos!=it) {
+ *pos=*it;
+ }
+ }
+ }
+
+ data.erase(pos,data.end());
+}
+// }}}
+
+bool IntervalSet::contains(key_t val) const // {{{
+{
+ data_t::const_iterator it=std::upper_bound(data.begin(),data.end(),std::make_pair(val,npos));
+ if (it==data.begin()) {
+ return false;
+ }
+ --it;
+ return (val<it->second);
+}
+// }}}
+
+IntervalSet::key_t IntervalSet::next(key_t val) const // {{{
+{
+ val++;
+ data_t::const_iterator it=std::upper_bound(data.begin(),data.end(),std::make_pair(val,npos));
+ if (it==data.begin()) {
+ if (it==data.end()) { // empty
+ return npos;
+ }
+ return it->first;
+ }
+ --it;
+ if (val<it->second) {
+ return val;
+ }
+ ++it;
+ if (it==data.end()) {
+ return npos;
+ }
+ return it->first;
+}
+// }}}
+
+bool IntervalSet::intersect(const value_t &a,const value_t &b) const // {{{
+{
+ return ( (a.first>=b.first)&&(a.first<b.second) )||
+ ( (b.first>=a.first)&&(b.first<a.second) );
+}
+// }}}
+
+void IntervalSet::unite(value_t &aret,const value_t &b) const // {{{
+{
+ assert(intersect(aret,b));
+ if (b.first<aret.first) {
+ aret.first=b.first;
+ }
+ if (b.second>aret.second) {
+ aret.second=b.second;
+ }
+}
+// }}}
+
+void IntervalSet::dump() const // {{{
+{
+ int len=data.size();
+ if (len==0) {
+ fprintf(stderr,"(empty)\n");
+ return;
+ }
+ len--;
+ for (int iA=0;iA<len;iA++) {
+ fprintf(stderr,"[%d,%d),",data[iA].first,data[iA].second);
+ }
+ if (data[len].second==npos) {
+ fprintf(stderr,"[%d,inf)\n",data[len].first);
+ } else {
+ fprintf(stderr,"[%d,%d)\n",data[len].first,data[len].second);
+ }
+}
+// }}}
+
--- /dev/null
+#ifndef INTERVALSET_H_
+#define INTERVALSET_H_
+
+#include <stddef.h>
+#include <vector>
+
+class IntervalSet {
+ typedef int key_t; // TODO?! template <typename T>
+ typedef std::pair<key_t,key_t> value_t;
+ typedef std::vector<value_t> data_t;
+public:
+ static const key_t npos;
+
+ void clear();
+ // [start;end) !
+ void add(key_t start,key_t end=npos);
+ void finish();
+
+ size_t size() const { return data.size(); }
+
+ // only after finish() has been called:
+ bool contains(key_t val) const;
+ key_t next(key_t val) const;
+
+ void dump() const;
+private:
+ // currently not used
+ bool intersect(const value_t &a,const value_t &b) const;
+ void unite(value_t &aret,const value_t &b) const;
+private:
+ data_t data;
+};
+
+#endif
--- /dev/null
+#include "nup.h"
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <utility>
+
+void NupParameters::dump() const // {{{
+{
+ fprintf(stderr,"NupX: %d, NupY: %d\n"
+ "width: %f, height: %f\n",
+ nupX,nupY,
+ width,height);
+
+ int opos=-1,fpos=-1,spos=-1;
+ if (xstart==Position::LEFT) { // or Bottom
+ fpos=0;
+ } else if (xstart==Position::RIGHT) { // or Top
+ fpos=1;
+ }
+ if (ystart==Position::LEFT) { // or Bottom
+ spos=0;
+ } else if (ystart==Position::RIGHT) { // or Top
+ spos=1;
+ }
+ if (first==Axis::X) {
+ fprintf(stderr,"First Axis: X\n");
+ opos=0;
+ } else if (first==Axis::Y) {
+ fprintf(stderr,"First Axis: Y\n");
+ opos=2;
+ std::swap(fpos,spos);
+ }
+
+ if ( (opos==-1)||(fpos==-1)||(spos==-1) ) {
+ fprintf(stderr,"Bad Spec: %d; start: %d, %d\n\n",
+ first,xstart,ystart);
+ } else {
+ static const char *order[4]={"lr","rl","bt","tb"};
+ fprintf(stderr,"Order: %s%s\n",
+ order[opos+fpos],order[(opos+2)%4+spos]);
+ }
+
+ fputs("Alignment: ",stderr);
+ Position_dump(xalign,Axis::X);
+ fputs("/",stderr);
+ Position_dump(yalign,Axis::Y);
+ fputs("\n",stderr);
+}
+// }}}
+
+bool NupParameters::possible(int nup) // {{{
+{
+ // 1 2 3 4 6 8 9 10 12 15 16
+ return (nup>=1)&&(nup<=16)&&
+ ( (nup!=5)||(nup!=7)||(nup!=11)||(nup!=13)||(nup!=14) );
+}
+// }}}
+
+void NupParameters::preset(int nup,NupParameters &ret) // {{{
+{
+ switch (nup) {
+ case 1:
+ ret.nupX=1;
+ ret.nupY=1;
+ break;
+ case 2:
+ ret.nupX=2;
+ ret.nupY=1;
+ ret.landscape=true;
+ break;
+ case 3:
+ ret.nupX=3;
+ ret.nupY=1;
+ ret.landscape=true;
+ break;
+ case 4:
+ ret.nupX=2;
+ ret.nupY=2;
+ break;
+ case 6:
+ ret.nupX=3;
+ ret.nupY=2;
+ ret.landscape=true;
+ break;
+ case 8:
+ ret.nupX=4;
+ ret.nupY=2;
+ ret.landscape=true;
+ break;
+ case 9:
+ ret.nupX=3;
+ ret.nupY=3;
+ break;
+ case 10:
+ ret.nupX=5;
+ ret.nupY=2;
+ ret.landscape=true;
+ break;
+ case 12:
+ ret.nupX=3;
+ ret.nupY=4;
+ break;
+ case 15:
+ ret.nupX=5;
+ ret.nupY=3;
+ ret.landscape=true;
+ break;
+ case 16:
+ ret.nupX=4;
+ ret.nupY=4;
+ break;
+ }
+}
+// }}}
+
+
+NupState::NupState(const NupParameters ¶m) // {{{
+ : param(param),
+ in_pages(0),out_pages(0),
+ nup(param.nupX*param.nupY),
+ subpage(nup)
+{
+ assert( (param.nupX>0)&&(param.nupY>0) );
+}
+// }}}
+
+void NupState::reset() // {{{
+{
+ in_pages=0;
+ out_pages=0;
+// nup=param.nupX*param.nupY;
+ subpage=nup;
+}
+// }}}
+
+void NupPageEdit::dump() const // {{{
+{
+ fprintf(stderr,"xpos: %f, ypos: %f, scale: %f\n",
+ xpos,ypos,scale);
+ sub.dump();
+}
+// }}}
+
+std::pair<int,int> NupState::convert_order(int subpage) const // {{{
+{
+ int subx,suby;
+ if (param.first==Axis::X) {
+ subx=subpage%param.nupX;
+ suby=subpage/param.nupX;
+ } else {
+ subx=subpage/param.nupY;
+ suby=subpage%param.nupY;
+ }
+
+ subx=(param.nupX-1)*(param.xstart+1)/2-param.xstart*subx;
+ suby=(param.nupY-1)*(param.ystart+1)/2-param.ystart*suby;
+
+ return std::make_pair(subx,suby);
+}
+// }}}
+
+static inline float lin(Position pos,float size) // {{{
+{
+ if (pos==-1) return 0;
+ else if (pos==0) return size/2;
+ else if (pos==1) return size;
+ return size*(pos+1)/2;
+}
+// }}}
+
+void NupState::calculate_edit(int subx,int suby,NupPageEdit &ret) const // {{{
+{
+ // dimensions of a "nup cell"
+ const float width=param.width/param.nupX,
+ height=param.height/param.nupY;
+
+ // first calculate only for bottom-left corner
+ ret.xpos=subx*width;
+ ret.ypos=suby*height;
+
+ const float scalex=width/ret.sub.width,
+ scaley=height/ret.sub.height;
+ float subwidth=ret.sub.width*scaley,
+ subheight=ret.sub.height*scalex;
+
+ // TODO? if ( (!fitPlot)&&(ret.scale>1) ) ret.scale=1.0;
+ if (scalex>scaley) {
+ ret.scale=scaley;
+ subheight=height;
+ ret.xpos+=lin(param.xalign,width-subwidth);
+ } else {
+ ret.scale=scalex;
+ subwidth=width;
+ ret.ypos+=lin(param.yalign,height-subheight);
+ }
+
+ ret.sub.left=ret.xpos;
+ ret.sub.bottom=ret.ypos;
+ ret.sub.right=ret.sub.left+subwidth;
+ ret.sub.top=ret.sub.bottom+subheight;
+}
+// }}}
+
+bool NupState::nextPage(float in_width,float in_height,NupPageEdit &ret) // {{{
+{
+ in_pages++;
+ subpage++;
+ if (subpage>=nup) {
+ subpage=0;
+ out_pages++;
+ }
+
+ ret.sub.width=in_width;
+ ret.sub.height=in_height;
+
+ auto sub=convert_order(subpage);
+ calculate_edit(sub.first,sub.second,ret);
+
+ return (subpage==0);
+}
+// }}}
+
+
+static std::pair<Axis,Position> parsePosition(char a,char b) // {{{ returns ,CENTER(0) on invalid
+{
+ a|=0x20; // make lowercase
+ b|=0x20;
+ if ( (a=='l')&&(b=='r') ) {
+ return std::make_pair(Axis::X,Position::LEFT);
+ } else if ( (a=='r')&&(b=='l') ) {
+ return std::make_pair(Axis::X,Position::RIGHT);
+ } else if ( (a=='t')&&(b=='b') ) {
+ return std::make_pair(Axis::Y,Position::TOP);
+ } else if ( (a=='b')&&(b=='t') ) {
+ return std::make_pair(Axis::Y,Position::BOTTOM);
+ }
+ return std::make_pair(Axis::X,Position::CENTER);
+}
+// }}}
+
+bool parseNupLayout(const char *val,NupParameters &ret) // {{{
+{
+ assert(val);
+ auto pos0=parsePosition(val[0],val[1]);
+ if (pos0.second==CENTER) {
+ return false;
+ }
+ auto pos1=parsePosition(val[2],val[3]);
+ if ( (pos1.second==CENTER)||(pos0.first==pos1.first) ) {
+ return false;
+ }
+
+ ret.first=pos0.first;
+ if (ret.first==Axis::X) {
+ ret.xstart=pos0.second;
+ ret.ystart=pos1.second;
+ } else {
+ ret.xstart=pos1.second;
+ ret.ystart=pos0.second;
+ }
+
+ return (val[4]==0); // everything seen?
+}
+// }}}
+
--- /dev/null
+#ifndef NUP_H_
+#define NUP_H_
+
+#include "pptypes.h"
+#include <utility>
+
+// you have to provide this
+struct NupParameters {
+ NupParameters()
+ : nupX(1),nupY(1),
+ width(NAN),height(NAN),
+ landscape(false),
+ first(X),
+ xstart(LEFT),ystart(TOP),
+ xalign(CENTER),yalign(CENTER)
+ {}
+
+ // --- "calculated" parameters ---
+ int nupX,nupY;
+ float width,height;
+ bool landscape; // post-rotate!
+
+ // --- other settings ---
+ // ordering
+ Axis first;
+ Position xstart,ystart;
+
+ Position xalign,yalign;
+
+ static bool possible(int nup); // TODO? float in_ratio,float out_ratio
+ static void preset(int nup,NupParameters &ret);
+ static float calculate(int nup, float in_ratio, float out_ratio,NupParameters &ret); // returns "quality", 1 is best
+
+ void dump() const;
+};
+
+// you get this
+struct NupPageEdit {
+ // required transformation: first translate, then scale
+ float xpos,ypos; // TODO: already given by sub.left,sub.bottom [but for rotation?]
+ float scale; // uniform
+
+// ? "landscape" e.g. to rotate labels
+
+ // for border, clip, ...
+ // also stores in_width/in_height, unscaled!
+ // everything in "outer"-page coordinates
+ PageRect sub;
+
+ void dump() const;
+};
+
+/*
+ This class does the number-up calculation. Example:
+
+ NupParameters param;
+ param.xyz=...; // fill it with your data!
+
+ NupState nup(param);
+ NupPageEdit edit;
+ for (auto page : your_pages) {
+ bool newPage=nup.nextPage(page.w,page.h,edit); // w,h from input page
+ // create newPage, if required; then place current page as specified in edit
+ }
+*/
+class NupState {
+public:
+ NupState(const NupParameters ¶m);
+
+ void reset();
+
+ // will overwrite ret with the new parameters
+ // returns true, if a new output page should be started first
+ bool nextPage(float in_width,float in_height,NupPageEdit &ret);
+
+private:
+ std::pair<int,int> convert_order(int subpage) const;
+ void calculate_edit(int subx,int suby,NupPageEdit &ret) const;
+private:
+ NupParameters param;
+
+ int in_pages,out_pages;
+ int nup; // max. per page (==nupX*nupY)
+ int subpage; // on the current output-page
+};
+
+// TODO? elsewhere
+// parsing functions for cups parameters (will not calculate nupX,nupY!)
+bool parseNupLayout(const char *val,NupParameters &ret); // lrtb, btlr, ...
+
+#endif
--- /dev/null
+// Copyright (c) 2012 Tobias Hoffmann
+//
+// Copyright (c) 2006-2011, BBR Inc. All rights reserved.
+// MIT Licensed.
+
+// TODO: check ppd==NULL (?)
+
+#include <stdio.h>
+#include <assert.h>
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <memory>
+
+#include "pdftopdf_processor.h"
+#include "pdftopdf_jcl.h"
+
+#include <stdarg.h>
+static void error(const char *fmt,...) // {{{
+{
+ va_list ap;
+ va_start(ap,fmt);
+
+ fputs("Error: ",stderr);
+ vfprintf(stderr,fmt,ap);
+ fputs("\n",stderr);
+
+ va_end(ap);
+}
+// }}}
+
+// namespace {}
+
+void setFinalPPD(ppd_file_t *ppd,const ProcessingParameters ¶m)
+{
+ if ( (param.booklet==BOOKLET_ON)&&(ppdFindOption(ppd,"Duplex")) ) {
+ // TODO: elsewhere, better
+ ppdMarkOption(ppd,"Duplex","DuplexTumble");
+ // TODO? sides=two-sided-short-edge
+ }
+
+ // for compatibility
+ if ( (param.setDuplex)&&(ppdFindOption(ppd,"Duplex")!=NULL) ) {
+ ppdMarkOption(ppd,"Duplex","True");
+ ppdMarkOption(ppd,"Duplex","On");
+ }
+
+ // we do it, printer should not
+ ppd_choice_t *choice;
+ if ( (choice=ppdFindMarkedChoice(ppd,"MirrorPrint")) != NULL) {
+ choice->marked=0;
+ }
+
+ // TODO: FIXME: unify code with emitJCLOptions, which does this "by-hand" now (and makes this code superfluous)
+ if (param.deviceCopies==1) {
+ // make sure any hardware copying is disabled
+ ppdMarkOption(ppd,"Copies","1");
+ ppdMarkOption(ppd,"JCLCopies","1");
+ }
+}
+
+// for choice, only overwrites ret if found in ppd
+static bool ppdGetInt(ppd_file_t *ppd,const char *name,int *ret) // {{{
+{
+ assert(ret);
+ ppd_choice_t *choice=ppdFindMarkedChoice(ppd,name); // !ppd is ok.
+ if (choice) {
+ *ret=atoi(choice->choice);
+ return true;
+ }
+ return false;
+}
+// }}}
+
+static bool optGetInt(const char *name,int num_options,cups_option_t *options,int *ret) // {{{
+{
+ assert(ret);
+ const char *val=cupsGetOption(name,num_options,options);
+ if (val) {
+ *ret=atoi(val);
+ return true;
+ }
+ return false;
+}
+// }}}
+
+static bool optGetFloat(const char *name,int num_options,cups_option_t *options,float *ret) // {{{
+{
+ assert(ret);
+ const char *val=cupsGetOption(name,num_options,options);
+ if (val) {
+ *ret=atof(val);
+ return true;
+ }
+ return false;
+}
+// }}}
+
+static bool is_false(const char *value) // {{{
+{
+ if (!value) {
+ return false;
+ }
+ return (strcasecmp(value,"no")==0)||
+ (strcasecmp(value,"off")==0)||
+ (strcasecmp(value,"false")==0);
+}
+// }}}
+
+static bool is_true(const char *value) // {{{
+{
+ if (!value) {
+ return false;
+ }
+ return (strcasecmp(value,"yes")==0)||
+ (strcasecmp(value,"on")==0)||
+ (strcasecmp(value,"true")==0);
+}
+// }}}
+
+static bool ppdGetDuplex(ppd_file_t *ppd) // {{{
+{
+ return ppdIsMarked(ppd,"Duplex","DuplexNoTumble")||
+ ppdIsMarked(ppd,"Duplex","DuplexTumble")||
+ ppdIsMarked(ppd,"JCLDuplex","DuplexNoTumble")||
+ ppdIsMarked(ppd,"JCLDuplex","DuplexTumble")||
+ ppdIsMarked(ppd,"EFDuplex","DuplexNoTumble")||
+ ppdIsMarked(ppd,"EFDuplex","DuplexTumble")||
+ ppdIsMarked(ppd,"KD03Duplex","DuplexNoTumble")||
+ ppdIsMarked(ppd,"KD03Duplex","DuplexTumble");
+}
+// }}}
+
+// TODO: enum
+static bool ppdDefaultOrder(ppd_file_t *ppd) // {{{ -- is reverse?
+{
+ ppd_choice_t *choice;
+ ppd_attr_t *attr;
+ const char *val=NULL;
+
+ // Figure out the right default output order from the PPD file...
+ if ( (choice=ppdFindMarkedChoice(ppd,"OutputOrder")) != NULL) {
+ val=choice->choice;
+ } else if ( ( (choice=ppdFindMarkedChoice(ppd,"OutputBin")) != NULL)&&
+ ( (attr=ppdFindAttr(ppd,"PageStackOrder",choice->choice)) != NULL) ) {
+ val=attr->value;
+ } else if ( (attr=ppdFindAttr(ppd,"DefaultOutputOrder",0)) != NULL) {
+ val=attr->value;
+ }
+ if ( (!val)||(strcasecmp(val,"Normal")==0) ) {
+ return false;
+ } else if (strcasecmp(val,"Reverse")==0) {
+ return true;
+ }
+ error("Unsupported output-order value %s, using 'normal'!",val);
+ return false;
+}
+// }}}
+
+static bool optGetCollate(int num_options,cups_option_t *options) // {{{
+{
+ if (is_true(cupsGetOption("Collate",num_options,options))) {
+ return true;
+ }
+
+ const char *val=NULL;
+ if ( (val=cupsGetOption("multiple-document-handling",num_options,options)) != NULL) {
+ /* This IPP attribute is unnecessarily complicated:
+ * single-document, separate-documents-collated-copies, single-document-new-sheet:
+ * -> collate (true)
+ * separate-documents-uncollated-copies:
+ * -> can be uncollated (false)
+ */
+ return (strcasecmp(val,"separate-documents-uncollated-copies")!=0);
+ }
+ return false;
+}
+// }}}
+
+static bool parsePosition(const char *value,Position &xpos,Position &ypos) // {{{
+{
+ // ['center','top','left','right','top-left','top-right','bottom','bottom-left','bottom-right']
+ xpos=Position::CENTER;
+ ypos=Position::CENTER;
+ int next=0;
+ if (strcasecmp(value,"center")==0) {
+ return true;
+ } else if (strncasecmp(value,"top",3)==0) {
+ ypos=Position::TOP;
+ next=3;
+ } else if (strncasecmp(value,"bottom",6)==0) {
+ ypos=Position::BOTTOM;
+ next=6;
+ }
+ if (next) {
+ if (value[next]==0) {
+ return true;
+ } else if (value[next]!='-') {
+ return false;
+ }
+ value+=next+1;
+ }
+ if (strcasecmp(value,"left")==0) {
+ xpos=Position::LEFT;
+ } else if (strcasecmp(value,"right")==0) {
+ xpos=Position::RIGHT;
+ } else {
+ return false;
+ }
+ return true;
+}
+// }}}
+
+#include <ctype.h>
+static void parseRanges(const char *range,IntervalSet &ret) // {{{
+{
+ ret.clear();
+ if (!range) {
+ ret.add(1); // everything
+ ret.finish();
+ return;
+ }
+
+ int lower,upper;
+ while (*range) {
+ if (*range=='-') {
+ range++;
+ upper=strtol(range,(char **)&range,10);
+ if (upper>=2147483647) { // see also cups/encode.c
+ ret.add(1);
+ } else {
+ ret.add(1,upper+1);
+ }
+ } else {
+ lower=strtol(range,(char **)&range,10);
+ if (*range=='-') {
+ range++;
+ if (!isdigit(*range)) {
+ ret.add(lower);
+ } else {
+ upper=strtol(range,(char **)&range,10);
+ if (upper>=2147483647) {
+ ret.add(1);
+ } else {
+ ret.add(lower,upper+1);
+ }
+ }
+ } else {
+ ret.add(lower,lower+1);
+ }
+ }
+
+ if (*range!=',') {
+ break;
+ }
+ range++;
+ }
+ ret.finish();
+}
+// }}}
+
+static bool parseBorder(const char *val,BorderType &ret) // {{{
+{
+ assert(val);
+ if (strcasecmp(val,"none")==0) {
+ ret=BorderType::NONE;
+ } else if (strcasecmp(val,"single")==0) {
+ ret=BorderType::ONE_THIN;
+ } else if (strcasecmp(val,"single-thick")==0) {
+ ret=BorderType::ONE_THICK;
+ } else if (strcasecmp(val,"double")==0) {
+ ret=BorderType::TWO_THIN;
+ } else if (strcasecmp(val,"double-thick")==0) {
+ ret=BorderType::TWO_THICK;
+ } else {
+ return false;
+ }
+ return true;
+}
+// }}}
+
+void getParameters(ppd_file_t *ppd,int num_options,cups_option_t *options,ProcessingParameters ¶m) // {{{
+{
+ // param.numCopies initially from commandline
+ if (param.numCopies==1) {
+ ppdGetInt(ppd,"Copies",¶m.numCopies);
+ }
+ if (param.numCopies==0) {
+ param.numCopies=1;
+ }
+
+ const char *val;
+ if ( (val=cupsGetOption("fitplot",num_options,options)) == NULL) {
+ if ( (val=cupsGetOption("fit-to-page",num_options,options)) == NULL) {
+ val=cupsGetOption("ipp-attribute-fidelity",num_options,options);
+ }
+ }
+// TODO? pstops checks =="true", pdftops !is_false ... pstops says: fitplot only for PS (i.e. not for PDF, cmp. cgpdftopdf)
+ param.fitplot=(val)&&(!is_false(val));
+
+ if ( (ppd)&&(ppd->landscape>0) ) { // direction the printer rotates landscape (90 or -90)
+ param.normal_landscape=ROT_90;
+ } else {
+ param.normal_landscape=ROT_270;
+ }
+
+ int ipprot;
+ param.orientation=ROT_0;
+ if ( (val=cupsGetOption("landscape",num_options,options)) != NULL) {
+ if (!is_false(val)) {
+ param.orientation=param.normal_landscape;
+ }
+ } else if (optGetInt("orientation-requested",num_options,options,&ipprot)) {
+ /* IPP orientation values are:
+ * 3: 0 degrees, 4: 90 degrees, 5: -90 degrees, 6: 180 degrees
+ */
+ if ( (ipprot<3)||(ipprot>6) ) {
+ error("Bad value (%d) for orientation-requested, using 0 degrees",ipprot);
+ } else {
+ static const Rotation ipp2rot[4]={ROT_0, ROT_90, ROT_270, ROT_180};
+ param.orientation=ipp2rot[ipprot-3];
+ }
+ }
+
+ ppd_size_t *pagesize;
+ // param.page default is letter, border 36,18
+ if ( (pagesize=ppdPageSize(ppd,0)) != NULL) { // "already rotated"
+ param.page.top=pagesize->top;
+ param.page.left=pagesize->left;
+ param.page.right=pagesize->right;
+ param.page.bottom=pagesize->bottom;
+ param.page.width=pagesize->width;
+ param.page.height=pagesize->length;
+ }
+ param.paper_is_landscape=(param.page.width>param.page.height);
+
+ PageRect tmp; // borders (before rotation)
+
+ optGetFloat("page-top",num_options,options,&tmp.top);
+ optGetFloat("page-left",num_options,options,&tmp.left);
+ optGetFloat("page-right",num_options,options,&tmp.right);
+ optGetFloat("page-bottom",num_options,options,&tmp.bottom);
+
+ if ( (param.orientation==ROT_90)||(param.orientation==ROT_270) ) { // unrotate page
+ // NaN stays NaN
+ tmp.right=param.page.height-tmp.right;
+ tmp.top=param.page.width-tmp.top;
+ tmp.rotate_move(param.orientation,param.page.height,param.page.width);
+ } else {
+ tmp.right=param.page.width-tmp.right;
+ tmp.top=param.page.height-tmp.top;
+ tmp.rotate_move(param.orientation,param.page.width,param.page.height);
+ }
+
+ param.page.set(tmp); // replace values, where tmp.* != NaN (because tmp needed rotation, param.page not!)
+
+ if (ppdGetDuplex(ppd)) {
+ param.duplex=true;
+ } else if (is_true(cupsGetOption("Duplex",num_options,options))) {
+ param.duplex=true;
+ param.setDuplex=true;
+ } else if ( (val=cupsGetOption("sides",num_options,options)) != NULL) {
+ if ( (strcasecmp(val,"two-sided-long-edge")==0)||
+ (strcasecmp(val,"two-sided-short-edge")==0) ) {
+ param.duplex=true;
+ param.setDuplex=true;
+ } else if (strcasecmp(val,"one-sided")!=0) {
+ error("Unsupported sides value %s, using sides=one-sided!",val);
+ }
+ }
+
+ // default nup is 1
+ int nup=1;
+ if (optGetInt("number-up",num_options,options,&nup)) {
+ if (!NupParameters::possible(nup)) {
+ error("Unsupported number-up value %d, using number-up=1!",nup);
+ nup=1;
+ }
+// TODO ; TODO? nup enabled? ... fitplot
+// NupParameters::calculate(nup,param.nup);
+ NupParameters::preset(nup,param.nup);
+ }
+
+ if ( (val=cupsGetOption("number-up-layout",num_options,options)) != NULL) {
+ if (!parseNupLayout(val,param.nup)) {
+ error("Unsupported number-up-layout %s, using number-up-layout=lrtb!",val);
+ param.nup.first=Axis::X;
+ param.nup.xstart=Position::LEFT;
+ param.nup.ystart=Position::TOP;
+ }
+ }
+
+ if ( (val=cupsGetOption("page-border",num_options,options)) != NULL) {
+ if (!parseBorder(val,param.border)) {
+ error("Unsupported page-border value %s, using page-border=none!",val);
+ param.border=BorderType::NONE;
+ }
+ }
+
+ if ( (val=cupsGetOption("OutputOrder",num_options,options)) != NULL) {
+ param.reverse=(strcasecmp(val,"Reverse")==0);
+ } else if (ppd) {
+ param.reverse=ppdDefaultOrder(ppd);
+ }
+
+ // TODO: pageLabel (not used)
+ // param.pageLabel=cupsGetOption("page-label",num_options,options); // strdup?
+
+ if ( (val=cupsGetOption("page-set",num_options,options)) != NULL) {
+ if (strcasecmp(val,"even")==0) {
+ param.oddPages=false;
+ } else if (strcasecmp(val,"odd")==0) {
+ param.evenPages=false;
+ } else if (strcasecmp(val,"all")!=0) {
+ error("Unsupported page-set value %s, using page-set=all!",val);
+ }
+ }
+
+ if ( (val=cupsGetOption("page-ranges",num_options,options)) != NULL) {
+ parseRanges(val,param.pageRange);
+ }
+
+ ppd_choice_t *choice;
+ if ( (choice=ppdFindMarkedChoice(ppd,"MirrorPrint")) != NULL) {
+ val=choice->choice;
+ } else {
+ val=cupsGetOption("mirror",num_options,options);
+ }
+ param.mirror=is_true(val);
+
+ if ( (val=cupsGetOption("emit-jcl",num_options,options)) != NULL) {
+ param.emitJCL=!is_false(val)&&(strcmp(val,"0")!=0);
+ }
+
+ param.booklet=BookletMode::BOOKLET_OFF;
+ if ( (val=cupsGetOption("booklet",num_options,options)) != NULL) {
+ if (strcasecmp(val,"shuffle-only")==0) {
+ param.booklet=BookletMode::BOOKLET_JUSTSHUFFLE;
+ } else if (is_true(val)) {
+ param.booklet=BookletMode::BOOKLET_ON;
+ } else if (!is_false(val)) {
+ error("Unsupported booklet value %s, using booklet=off!",val);
+ }
+ }
+ param.bookSignature=-1;
+ if (optGetInt("booklet-signature",num_options,options,¶m.bookSignature)) {
+ if (param.bookSignature==0) {
+ error("Unsupported booklet-signature value, using booklet-signature=-1 (all)!",val);
+ param.bookSignature=-1;
+ }
+ }
+
+ if ( (val=cupsGetOption("position",num_options,options)) != NULL) {
+ if (!parsePosition(val,param.xpos,param.ypos)) {
+ error("Unrecognized position value %s, using position=center!",val);
+ param.xpos=Position::CENTER;
+ param.ypos=Position::CENTER;
+ }
+ }
+
+ param.collate=optGetCollate(num_options,options);
+ // FIXME? pdftopdf also considers if ppdCollate is set (only when cupsGetOption is /not/ given) [and if is_true overrides param.collate=true] -- pstops does not
+
+/*
+ // TODO: scaling
+ // TODO: natural-scaling
+
+ scaling
+
+
+ if ((val = cupsGetOption("scaling",num_options,options)) != 0) {
+ scaling = atoi(val) * 0.01;
+ fitplot = gTrue;
+ } else if (fitplot) {
+ scaling = 1.0;
+ }
+ if ((val = cupsGetOption("natural-scaling",num_options,options)) != 0) {
+ naturalScaling = atoi(val) * 0.01;
+ }
+
+bool checkFeature(const char *feature, int num_options, cups_option_t *options) // {{{
+{
+ const char *val;
+ ppd_attr_t *attr;
+
+ return ( (val=cupsGetOption(feature,num_options,options)) != NULL && is_true(val)) ||
+ ( (attr=ppdFindAttr(ppd,feature,0)) != NULL && is_true(attr->val));
+}
+// }}}
+*/
+
+ // make pages a multiple of two (only considered when duplex is on).
+ // i.e. printer has hardware-duplex, but needs pre-inserted filler pages
+ // FIXME? pdftopdf also supports it as cmdline option (via checkFeature())
+ ppd_attr_t *attr;
+ if ( (attr=ppdFindAttr(ppd,"cupsEvenDuplex",0)) != NULL) {
+ param.evenDuplex=is_true(attr->value);
+ }
+
+ // TODO? pdftopdf* ?
+ // TODO?! pdftopdfAutoRotate
+
+ // TODO?! choose default by whether pdfautoratate filter has already been run (e.g. by mimetype)
+ param.autoRotate=( !is_false(cupsGetOption("pdfAutoRotate",num_options,options)) &&
+ !is_false(cupsGetOption("pdftopdfAutoRotate",num_options,options)) );
+}
+// }}}
+
+static bool printerWillCollate(ppd_file_t *ppd) // {{{
+{
+ ppd_choice_t *choice;
+
+ if ( ( (choice=ppdFindMarkedChoice(ppd,"Collate")) != NULL)&&
+ (is_true(choice->choice)) ) {
+
+ // printer can collate, but also for the currently marked ppd features?
+ ppd_option_t *opt=ppdFindOption(ppd,"Collate");
+ return (opt)&&(!opt->conflicted);
+ }
+ return false;
+}
+// }}}
+
+void calculate(ppd_file_t *ppd,ProcessingParameters ¶m) // {{{
+{
+ param.deviceReverse=false;
+ if (param.reverse) {
+ // test OutputOrder of hardware (ppd)
+ if (ppdFindOption(ppd,"OutputOrder") != NULL) {
+ param.deviceReverse=true;
+ param.reverse=false;
+ } else {
+ // Enable evenDuplex or the first page may be empty.
+ param.evenDuplex=true; // disabled later, if non-duplex
+ }
+ }
+
+ if (param.numCopies==1) {
+ // collate is not needed
+ param.collate=false; // does not make a big difference for us
+ }
+/* TODO? instead:
+ if (...numOutputPages==1 [after nup,evenDuplex!]) {
+ param.collate=false; // does not make a big difference for us
+ }
+*/
+
+#if 0 // for now
+ // enable hardware copy generation
+ if (ppd) {
+ if (!ppd->manual_copies) {
+ // use hardware copying
+ param.deviceCopies=param.numCopies;
+ param.numCopies=1;
+ } else {
+ param.deviceCopies=1;
+ }
+ }
+#endif
+
+ setFinalPPD(ppd,param);
+
+ // check collate device, with current ppd settings
+ if (param.collate) {
+ if (param.deviceCopies==1) { // e.g. ppd->manual_copies
+ param.deviceCollate=false;
+ } else {
+ param.deviceCollate=printerWillCollate(ppd);
+ }
+
+ if (!param.deviceCollate) {
+ ppdMarkOption(ppd,"Collate","False"); // disable any hardware-collate
+ param.evenDuplex=true; // software collate always needs fillers
+ }
+ }
+
+ if (!param.duplex) {
+ param.evenDuplex=false;
+ }
+}
+// }}}
+
+// reads from stdin into temporary file. returns FILE * or NULL on error
+// TODO? to extra file (also used in pdftoijs, e.g.)
+FILE *copy_stdin_to_temp() // {{{
+{
+ char buf[BUFSIZ];
+ int n;
+
+ // FIXME: what does >buf mean here?
+ int fd=cupsTempFd(buf,sizeof(buf));
+ if (fd<0) {
+ error("Can't create temporary file");
+ return NULL;
+ }
+ // remove name
+ unlink(buf);
+
+ // copy stdin to the tmp file
+ while ( (n=read(0,buf,BUFSIZ)) > 0) {
+ if (write(fd,buf,n) != n) {
+ error("Can't copy stdin to temporary file");
+ close(fd);
+ return NULL;
+ }
+ }
+ if (lseek(fd,0,SEEK_SET) < 0) {
+ error("Can't rewind temporary file");
+ close(fd);
+ return NULL;
+ }
+
+ FILE *f;
+ if ( (f=fdopen(fd,"rb")) == 0) {
+ error("Can't fdopen temporary file");
+ close(fd);
+ return NULL;
+ }
+ return f;
+}
+// }}}
+
+int main(int argc,char **argv)
+{
+ if ( (argc<6)||(argc>7) ) {
+ fprintf(stderr,"Usage: %s job-id user title copies options [file]\n",argv[0]);
+#ifdef DEBUG
+ProcessingParameters param;
+std::unique_ptr<PDFTOPDF_Processor> proc1(PDFTOPDF_Factory::processor());
+ param.page.width=595.276; // A4
+ param.page.height=841.89;
+
+ param.page.top=param.page.bottom=36.0;
+ param.page.right=param.page.left=18.0;
+ param.page.right=param.page.width-param.page.right;
+ param.page.top=param.page.height-param.page.top;
+
+// param.nup.calculate(4,0.707,0.707,param.nup);
+ param.nup.nupX=2;
+ param.nup.nupY=2;
+/*
+*/
+//param.nup.yalign=TOP;
+param.border=BorderType::ONE;
+//param.mirror=true;
+//param.reverse=true;
+//param.numCopies=3;
+if (!proc1->loadFilename("in.pdf")) return 2;
+ param.dump();
+if (!processPDFTOPDF(*proc1,param)) return 3;
+ emitComment(*proc1,param);
+proc1->emitFilename("out.pdf");
+#endif
+ return 1;
+ }
+
+ try {
+ ProcessingParameters param;
+
+ param.jobId=atoi(argv[1]);
+ param.user=argv[2];
+ param.title=argv[3];
+ param.numCopies=atoi(argv[4]);
+
+ // TODO?! sanity checks
+
+ int num_options=0;
+ cups_option_t *options=NULL;
+ num_options=cupsParseOptions(argv[5],num_options,&options);
+
+ ppd_file_t *ppd=NULL;
+ ppd=ppdOpenFile(getenv("PPD")); // getenv (and thus ppd) may be null. This will not cause problems.
+ ppdMarkDefaults(ppd);
+
+ cupsMarkOptions(ppd,num_options,options);
+
+ getParameters(ppd,num_options,options,param);
+ calculate(ppd,param);
+
+#ifdef DEBUG
+ param.dump();
+#endif
+
+ cupsFreeOptions(num_options,options);
+
+ std::unique_ptr<PDFTOPDF_Processor> proc(PDFTOPDF_Factory::processor());
+
+ if (argc==7) {
+ if (!proc->loadFilename(argv[6])) {
+ ppdClose(ppd);
+ return 1;
+ }
+ } else {
+ FILE *f=copy_stdin_to_temp();
+ if ( (!f)||
+ (!proc->loadFile(f,TakeOwnership)) ) {
+ ppdClose(ppd);
+ return 1;
+ }
+ }
+
+/* TODO
+ // color management
+--- PPD:
+ copyPPDLine_(fp_dest, fp_src, "*PPD-Adobe: ");
+ copyPPDLine_(fp_dest, fp_src, "*cupsICCProfile ");
+ copyPPDLine_(fp_dest, fp_src, "*Manufacturer:");
+ copyPPDLine_(fp_dest, fp_src, "*ColorDevice:");
+ copyPPDLine_(fp_dest, fp_src, "*DefaultColorSpace:");
+ if (cupsICCProfile) {
+ proc.addCM(...,...);
+ }
+*/
+
+ if (!processPDFTOPDF(*proc,param)) {
+ ppdClose(ppd);
+ return 2;
+ }
+
+ emitPreamble(ppd,param); // ppdEmit, JCL stuff
+ emitComment(*proc,param); // pass information to subsequent filters viia PDF comments
+
+// proc->emitFile(stdout);
+ proc->emitFilename(NULL);
+
+ emitPostamble(ppd,param);
+ ppdClose(ppd);
+ } catch (std::exception &e) {
+ // TODO? exception type
+ fprintf(stderr,"Exception: %s\n",e.what());
+ return 5;
+ } catch (...) {
+ fprintf(stderr,"Unknown exception caught. Exiting.\n");
+ return 6;
+ }
+
+ return 0;
+}
--- /dev/null
+#include <ctype.h>
+#include "pdftopdf_processor.h"
+#include <cups/ppd.h>
+
+#include <string.h>
+
+// TODO: -currently changes ppd. (Copies)
+//
+static void emitJCLOptions(FILE *fp, ppd_file_t *ppd, int deviceCopies) // {{{
+{
+ int section;
+ ppd_choice_t **choices;
+ int i;
+ char buf[1024];
+ ppd_attr_t *attr;
+ bool withJCL=false,
+ datawritten=false;
+
+ if (!ppd) return;
+
+ if ((attr = ppdFindAttr(ppd,"pdftopdfJCLBegin",NULL)) != NULL) {
+ withJCL=true;
+ const int n=strlen(attr->value);
+ for (i = 0;i < n;i++) {
+ if (attr->value[i] == '\r' || attr->value[i] == '\n') {
+ // skip new line
+ continue;
+ }
+ fputc(attr->value[i],fp);
+ datawritten=true;
+ }
+ }
+
+ snprintf(buf,sizeof(buf),"%d",deviceCopies);
+ if (ppdFindOption(ppd,"Copies") != NULL) {
+ ppdMarkOption(ppd,"Copies",buf);
+ } else {
+ if ((attr = ppdFindAttr(ppd,"pdftopdfJCLCopies",buf)) != NULL) {
+ fputs(attr->value,fp);
+ datawritten=true;
+ } else if (withJCL) {
+ fprintf(fp,"Copies=%d;",deviceCopies);
+ datawritten=true;
+ }
+ }
+ for (section = (int)PPD_ORDER_ANY;
+ section <= (int)PPD_ORDER_PROLOG;section++) {
+ int n = ppdCollect(ppd,(ppd_section_t)section,&choices);
+ for (i = 0;i < n;i++) {
+ snprintf(buf,sizeof(buf),"pdftopdfJCL%s",
+ ((ppd_option_t *)(choices[i]->option))->keyword);
+ if ((attr = ppdFindAttr(ppd,buf,choices[i]->choice)) != NULL) {
+ fputs(attr->value,fp);
+ datawritten=true;
+ } else if (withJCL) {
+ fprintf(fp,"%s=%s;",
+ ((ppd_option_t *)(choices[i]->option))->keyword,
+ choices[i]->choice);
+ datawritten=true;
+ }
+ }
+ }
+ if (datawritten) {
+ fputc('\n',fp);
+ }
+}
+// }}}
+
+/* Copied ppd_decode() from CUPS which is not exported to the API; needed in emitPreamble() */
+// {{{ static int ppd_decode(char *string)
+static int /* O - Length of decoded string */
+ppd_decode(char *string) /* I - String to decode */
+{
+ char *inptr, /* Input pointer */
+ *outptr; /* Output pointer */
+
+
+ inptr = string;
+ outptr = string;
+
+ while (*inptr != '\0')
+ if (*inptr == '<' && isxdigit(inptr[1] & 255))
+ {
+ /*
+ * Convert hex to 8-bit values...
+ */
+
+ inptr ++;
+ while (isxdigit(*inptr & 255))
+ {
+ if (isalpha(*inptr))
+ *outptr = (tolower(*inptr) - 'a' + 10) << 4;
+ else
+ *outptr = (*inptr - '0') << 4;
+
+ inptr ++;
+
+ if (!isxdigit(*inptr & 255))
+ break;
+
+ if (isalpha(*inptr))
+ *outptr |= tolower(*inptr) - 'a' + 10;
+ else
+ *outptr |= *inptr - '0';
+
+ inptr ++;
+ outptr ++;
+ }
+
+ while (*inptr != '>' && *inptr != '\0')
+ inptr ++;
+ while (*inptr == '>')
+ inptr ++;
+ }
+ else
+ *outptr++ = *inptr++;
+
+ *outptr = '\0';
+
+ return ((int)(outptr - string));
+}
+// }}}
+
+void emitPreamble(ppd_file_t *ppd,const ProcessingParameters ¶m) // {{{
+{
+ if (ppd == 0) return;
+
+ ppdEmit(ppd,stdout,PPD_ORDER_EXIT);
+
+ if (param.emitJCL) {
+ /* pdftopdf only adds JCL to the job if the printer is a native PDF
+ printer and the PPD is for this mode, having the "*JCLToPDFInterpreter:"
+ keyword. We need to read this keyword manually from the PPD and replace
+ the content of ppd->jcl_ps by the value of this keyword, so that
+ ppdEmitJCL() actually adds JCL based on the presence on
+ "*JCLToPDFInterpreter:". */
+ ppd_attr_t *attr;
+ if ( (attr=ppdFindAttr(ppd,"JCLToPDFInterpreter",NULL)) != NULL) {
+ ppd->jcl_ps=strdup(attr->value);
+ ppd_decode(ppd->jcl_ps);
+ } else {
+ ppd->jcl_ps=NULL;
+ }
+ ppdEmitJCL(ppd,stdout,param.jobId,param.user,param.title);
+ emitJCLOptions(stdout,ppd,param.deviceCopies);
+ }
+}
+// }}}
+
+void emitPostamble(ppd_file_t *ppd,const ProcessingParameters ¶m) // {{{
+{
+ if (param.emitJCL) {
+ ppdEmitJCLEnd(ppd,stdout);
+ }
+}
+// }}}
+
+// pass information to subsequent filters via PDF comments
+void emitComment(PDFTOPDF_Processor &proc,const ProcessingParameters ¶m) // {{{
+{
+ std::vector<std::string> output;
+
+ output.push_back("% This file was generated by pdftopdf");
+
+ // This is not standard, but like PostScript.
+ if (param.deviceCopies>0) {
+ char buf[256];
+ snprintf(buf,sizeof(buf),"%d",param.deviceCopies);
+ output.push_back(std::string("%%PDFTOPDFNumCopies : ")+buf);
+
+ if (param.deviceCollate) {
+ output.push_back("%%PDFTOPDFCollate : true");
+ } else {
+ output.push_back("%%PDFTOPDFCollate : false");
+ }
+ }
+
+ proc.setComments(output);
+}
+// }}}
--- /dev/null
+#ifndef PDFTOPDF_JCL_H
+#define PDFTOPDF_JCL_H
+
+struct ProcessingParameters;
+class PDFTOPDF_Processor;
+
+void emitPreamble(ppd_file_t *ppd,const ProcessingParameters ¶m);
+void emitPostamble(ppd_file_t *ppd,const ProcessingParameters ¶m);
+
+void emitComment(PDFTOPDF_Processor &proc,const ProcessingParameters ¶m);
+
+#endif
--- /dev/null
+#include "pdftopdf_processor.h"
+#include "qpdf_pdftopdf_processor.h"
+#include <stdio.h>
+#include <assert.h>
+#include <numeric>
+
+void BookletMode_dump(BookletMode bkm) // {{{
+{
+ static const char *bstr[3]={"Off","On","Shuffle-Only"};
+ if ( (bkm<BOOKLET_OFF)||(bkm>BOOKLET_JUSTSHUFFLE) ) {
+ fprintf(stderr,"(bad booklet mode: %d)",bkm);
+ } else {
+ fputs(bstr[bkm],stderr);
+ }
+}
+// }}}
+
+bool ProcessingParameters::withPage(int outno) const // {{{
+{
+ if (outno%2 == 0) { // 1-based
+ if (!evenPages) {
+ return false;
+ }
+ } else if (!oddPages) {
+ return false;
+ }
+ return pageRange.contains(outno);
+}
+// }}}
+
+void ProcessingParameters::dump() const // {{{
+{
+ fprintf(stderr,"jobId: %d, numCopies: %d\n",
+ jobId,numCopies);
+ fprintf(stderr,"user: %s, title: %s\n",
+ (user)?user:"(null)",(title)?title:"(null)");
+ fprintf(stderr,"fitplot: %s\n",
+ (fitplot)?"true":"false");
+
+ page.dump();
+
+ fprintf(stderr,"Rotation(CCW): ");
+ Rotation_dump(orientation);
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"paper_is_landscape: %s\n",
+ (paper_is_landscape)?"true":"false");
+
+ fprintf(stderr,"duplex: %s\n",
+ (duplex)?"true":"false");
+
+ fprintf(stderr,"Border: ");
+ BorderType_dump(border);
+ fprintf(stderr,"\n");
+
+ nup.dump();
+
+ fprintf(stderr,"reverse: %s\n",
+ (reverse)?"true":"false");
+
+ fprintf(stderr,"evenPages: %s, oddPages: %s\n",
+ (evenPages)?"true":"false",
+ (oddPages)?"true":"false");
+
+ fprintf(stderr,"page range: ");
+ pageRange.dump();
+
+ fprintf(stderr,"mirror: %s\n",
+ (mirror)?"true":"false");
+
+ fprintf(stderr,"Position: ");
+ Position_dump(xpos,Axis::X);
+ fprintf(stderr,"/");
+ Position_dump(ypos,Axis::Y);
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"collate: %s\n",
+ (collate)?"true":"false");
+
+ fprintf(stderr,"evenDuplex: %s\n",
+ (evenDuplex)?"true":"false");
+
+/*
+ // std::string pageLabel; // or NULL? must stay/dup!
+ ...
+ ...
+
+*/
+
+ fprintf(stderr,"bookletMode: ");
+ BookletMode_dump(booklet);
+ fprintf(stderr,"\nbooklet signature: %d\n",
+ bookSignature);
+
+ fprintf(stderr,"autoRotate: %s\n",
+ (autoRotate)?"true":"false");
+
+ fprintf(stderr,"emitJCL: %s\n",
+ (emitJCL)?"true":"false");
+ fprintf(stderr,"deviceCopies: %d\n",
+ deviceCopies);
+ fprintf(stderr,"deviceReverse: %s\n",
+ (deviceReverse)?"true":"false");
+ fprintf(stderr,"deviceCollate: %s\n",
+ (deviceCollate)?"true":"false");
+ fprintf(stderr,"setDuplex: %s\n",
+ (setDuplex)?"true":"false");
+}
+// }}}
+
+
+PDFTOPDF_Processor *PDFTOPDF_Factory::processor()
+{
+ return new QPDF_PDFTOPDF_Processor();
+}
+
+// (1-based)
+// 9: [*] [1] [2] [*] [*] [3] [4] [9] [8] [5] [6] [7] -> signature = 12 = 3*4 = ((9+3)/4)*4
+// 1 2 3 4 5 6 7 8 9 10 11 12
+// NOTE: psbook always fills the sig completely (results in completely white pages (4-set), depending on the input)
+
+// empty pages must be added for output values >=numPages
+std::vector<int> bookletShuffle(int numPages,int signature) // {{{
+{
+ if (signature<0) {
+ signature=(numPages+3)&~0x3;
+ }
+ assert(signature%4==0);
+
+ std::vector<int> ret;
+ ret.reserve(numPages+signature-1);
+
+ int curpage=0;
+ while (curpage<numPages) {
+ // as long as pages to be done -- i.e. multiple times the signature
+ int firstpage=curpage,
+ lastpage=curpage+signature-1;
+ // one signature
+ while (firstpage<lastpage) {
+ ret.push_back(lastpage--);
+ ret.push_back(firstpage++);
+ ret.push_back(firstpage++);
+ ret.push_back(lastpage--);
+ }
+ curpage+=signature;
+ }
+ return ret;
+}
+// }}}
+
+bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters ¶m) // {{{
+{
+ if (!proc.check_print_permissions()) {
+ fprintf(stderr,"Not allowed to print\n");
+ return false;
+ }
+
+ if (param.autoRotate) {
+ const bool dst_lscape=( param.paper_is_landscape==( (param.orientation==ROT_0)||(param.orientation==ROT_180) ) );
+ proc.autoRotateAll(dst_lscape,param.normal_landscape);
+ }
+
+ std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> pages=proc.get_pages();
+ const int numOrigPages=pages.size();
+
+ // TODO FIXME? elsewhere
+ std::vector<int> shuffle;
+ if (param.booklet!=BOOKLET_OFF) {
+ shuffle=bookletShuffle(numOrigPages,param.bookSignature);
+ if (param.booklet==BOOKLET_ON) { // override options
+ // TODO? specifically "sides=two-sided-short-edge" / DuplexTumble
+// param.duplex=true; // param.setDuplex=true; ? currently done in setFinalPPD()
+ NupParameters::preset(2,param.nup); // TODO?! better
+ }
+ } else { // 0 1 2 3 ...
+ shuffle.resize(numOrigPages);
+ std::iota(shuffle.begin(),shuffle.end(),0);
+ }
+ const int numPages=std::max(shuffle.size(),pages.size());
+
+ std::shared_ptr<PDFTOPDF_PageHandle> curpage;
+ int outputno=0;
+
+ if ( (param.nup.nupX==1)&&(param.nup.nupY==1)&&(!param.fitplot) ) {
+ // TODO? fitplot also without xobject?
+ /*
+ param.nup.width=param.page.width;
+ param.nup.height=param.page.height;
+ */
+
+ for (int iA=0;iA<numPages;iA++) {
+ if (!param.withPage(iA+1)) {
+ continue;
+ }
+
+ if (shuffle[iA]>=numOrigPages) {
+ // add empty page as filler
+ proc.add_page(proc.new_page(param.page.width,param.page.height),param.reverse);
+ continue; // no border, etc.
+ }
+ auto page=pages[shuffle[iA]];
+
+ page->rotate(param.orientation);
+
+ if (param.mirror) {
+ page->mirror();
+ }
+
+ // place border
+ if ( (param.border!=BorderType::NONE)&&(iA<numOrigPages) ) {
+#if 0 // would be nice, but is not possible
+ PageRect rect=page->getRect();
+
+ rect.left+=param.page.left;
+ rect.bottom+=param.page.bottom;
+ rect.top-=param.page.top;
+ rect.right-=param.page.right;
+ // width,height not needed for add_border_rect (FIXME?)
+
+ page->add_border_rect(rect,param.border,1.0);
+#else // this is what pstops does
+ page->add_border_rect(param.page,param.border,1.0);
+#endif
+ }
+
+ proc.add_page(page,param.reverse); // reverse -> insert at beginning
+ }
+ outputno=numPages;
+ } else {
+ param.nup.width=param.page.right-param.page.left;
+ param.nup.height=param.page.top-param.page.bottom;
+
+ double xpos=param.page.left,
+ ypos=param.page.bottom; // for whole page... TODO from position...
+
+const bool origls=param.nup.landscape;
+ if ( (param.orientation==ROT_90)||(param.orientation==ROT_270) ) {
+ std::swap(param.nup.nupX,param.nup.nupY);
+ param.nup.landscape=!param.nup.landscape;
+ param.orientation=param.orientation-param.normal_landscape;
+ }
+ if (param.nup.landscape) {
+// pages[iA]->rotate(param.normal_landscape);
+ param.orientation=param.orientation+param.normal_landscape;
+ // TODO? better
+ std::swap(param.page.width,param.page.height);
+ std::swap(param.nup.width,param.nup.height);
+ }
+
+ NupState nupstate(param.nup);
+ NupPageEdit pgedit;
+ for (int iA=0;iA<numPages;iA++) {
+ std::shared_ptr<PDFTOPDF_PageHandle> page;
+ if (shuffle[iA]>=numOrigPages) {
+ // add empty page as filler
+ page=proc.new_page(param.page.width,param.page.height);
+ } else {
+ page=pages[shuffle[iA]];
+ }
+
+ PageRect rect;
+ if (param.fitplot) {
+ rect=page->getRect();
+ } else {
+ rect.width=param.page.width;
+ rect.height=param.page.height;
+
+ // TODO: better
+ if (!origls) {
+ if ( (param.orientation==ROT_90)||(param.orientation==ROT_270) ) {
+ std::swap(rect.width,rect.height);
+ }
+ } else {
+ if ( (param.orientation==ROT_0)||(param.orientation==ROT_180) ) {
+ std::swap(rect.width,rect.height);
+ }
+ }
+
+// TODO?
+ rect.left=0;
+ rect.bottom=0;
+ rect.right=rect.width;
+ rect.top=rect.height;
+
+ rect.rotate_move(param.orientation,rect.width,rect.height);
+ }
+// rect.dump();
+
+ bool newPage=nupstate.nextPage(rect.width,rect.height,pgedit);
+ if (newPage) {
+ if ( (param.withPage(outputno))&&(curpage) ) {
+ curpage->rotate(param.orientation);
+ if (param.mirror) {
+ curpage->mirror();
+// TODO? update rect? --- not needed any more
+ }
+ proc.add_page(curpage,param.reverse); // reverse -> insert at beginning
+ }
+ outputno++;
+ curpage=proc.new_page(param.page.width,param.page.height);
+ }
+ if (shuffle[iA]>=numOrigPages) {
+ continue;
+ }
+
+ if (param.border!=BorderType::NONE) {
+ // TODO FIXME... border gets cutted away, if orignal page had wrong size
+ // page->"uncrop"(rect); // page->setMedia()
+ // Note: currently "fixed" in add_subpage(...&rect);
+ page->add_border_rect(rect,param.border,1.0/pgedit.scale);
+ }
+
+ if (!param.fitplot) {
+ curpage->add_subpage(page,pgedit.xpos+xpos,pgedit.ypos+ypos,pgedit.scale,&rect);
+ } else {
+ curpage->add_subpage(page,pgedit.xpos+xpos,pgedit.ypos+ypos,pgedit.scale);
+ }
+
+#ifdef DEBUG
+ if (auto dbg=dynamic_cast<QPDF_PDFTOPDF_PageHandle *>(curpage.get())) {
+// dbg->debug(pgedit.sub,xpos,ypos);
+ }
+#endif
+
+// pgedit.dump();
+ }
+ if ( (param.withPage(outputno))&&(curpage) ) {
+ curpage->rotate(param.orientation);
+ if (param.mirror) {
+ curpage->mirror();
+ }
+ outputno++;
+ proc.add_page(curpage,param.reverse); // reverse -> insert at beginning
+ }
+ }
+
+ if ( (param.evenDuplex)&&(outputno&1) ) {
+ // need to output empty page to not confuse duplex
+ proc.add_page(proc.new_page(param.page.width,param.page.height),param.reverse);
+ }
+
+ proc.multiply(param.numCopies,param.collate);
+
+ return true;
+}
+// }}}
+
--- /dev/null
+#ifndef PDFTOPDF_PROCESSOR_H
+#define PDFTOPDF_PROCESSOR_H
+
+#include "pptypes.h"
+#include "nup.h"
+#include "intervalset.h"
+#include <vector>
+#include <string>
+
+enum BookletMode { BOOKLET_OFF, BOOKLET_ON, BOOKLET_JUSTSHUFFLE };
+
+struct ProcessingParameters {
+ ProcessingParameters()
+ : jobId(0),numCopies(1),
+ user(0),title(0),
+ fitplot(false),
+ orientation(ROT_0),normal_landscape(ROT_270),
+ paper_is_landscape(false),
+ duplex(false),
+ border(NONE),
+ reverse(false),
+
+// pageLabel(NULL),
+ evenPages(true),oddPages(true),
+
+ mirror(false),
+
+ xpos(CENTER),ypos(CENTER),
+
+ collate(false),
+ evenDuplex(false),
+
+ booklet(BOOKLET_OFF),bookSignature(-1),
+
+ autoRotate(false),
+
+ emitJCL(true),deviceCopies(1),deviceReverse(false),
+ deviceCollate(false),setDuplex(false)
+ {
+ page.width=612.0; // letter
+ page.height=792.0;
+ page.top=page.height-36.0;
+ page.bottom=36.0;
+ page.left=18.0;
+ page.right=page.width-18.0;
+
+ // everything
+ pageRange.add(1);
+ pageRange.finish();
+ }
+
+ int jobId, numCopies;
+ const char *user, *title; // will stay around
+ bool fitplot;
+ PageRect page;
+ Rotation orientation,normal_landscape; // normal_landscape (i.e. default direction) is e.g. needed for number-up=2
+ bool paper_is_landscape;
+ bool duplex;
+ BorderType border;
+ NupParameters nup;
+ bool reverse;
+
+ // std::string pageLabel; // or NULL? must stay/dup!
+ bool evenPages,oddPages;
+ IntervalSet pageRange;
+
+ bool mirror;
+
+ Position xpos,ypos;
+
+ bool collate;
+
+ bool evenDuplex; // make number of pages a multiple of 2
+
+ BookletMode booklet;
+ int bookSignature;
+
+ bool autoRotate;
+
+ // ppd/jcl changes
+ bool emitJCL;
+ int deviceCopies;
+ bool deviceReverse;
+ bool deviceCollate;
+ bool setDuplex;
+ // unsetMirror (always)
+
+ // helper functions
+ bool withPage(int outno) const; // 1 based
+ void dump() const;
+};
+
+#include <stdio.h>
+#include <memory>
+
+enum ArgOwnership { WillStayAlive,MustDuplicate,TakeOwnership };
+
+class PDFTOPDF_PageHandle {
+public:
+ virtual ~PDFTOPDF_PageHandle() {}
+ virtual PageRect getRect() const =0;
+ // fscale: inverse_scale (from nup, fitplot)
+ virtual void add_border_rect(const PageRect &rect,BorderType border,float fscale) =0;
+ // TODO?! add standalone crop(...) method (not only for subpages)
+ virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL) =0;
+ virtual void mirror() =0;
+ virtual void rotate(Rotation rot) =0;
+};
+
+// TODO: ... error output?
+class PDFTOPDF_Processor { // abstract interface
+public:
+ virtual ~PDFTOPDF_Processor() {}
+
+// TODO: ... qpdf wants password at load time
+ virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive) =0;
+ virtual bool loadFilename(const char *name) =0;
+
+// TODO? virtual bool may_modify/may_print/?
+ virtual bool check_print_permissions() =0;
+
+ virtual std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> get_pages() =0; // shared_ptr because of type erasure (deleter)
+
+ virtual std::shared_ptr<PDFTOPDF_PageHandle> new_page(float width,float height) =0;
+
+ virtual void add_page(std::shared_ptr<PDFTOPDF_PageHandle> page,bool front) =0; // at back/front -- either from get_pages() or new_page()+add_subpage()-calls (or [also allowed]: empty)
+
+// void remove_page(std::shared_ptr<PDFTOPDF_PageHandle> ph); // not needed: we construct from scratch, at least conceptually.
+
+ virtual void multiply(int copies,bool collate) =0;
+
+ virtual void autoRotateAll(bool dst_lscape,Rotation normal_landscape) =0; // TODO elsewhere?!
+ virtual void addCM(const char *defaulticc,const char *outputicc) =0;
+
+ virtual void setComments(const std::vector<std::string> &comments) =0;
+
+ virtual void emitFile(FILE *dst,ArgOwnership take=WillStayAlive) =0;
+ virtual void emitFilename(const char *name) =0; // NULL -> stdout
+};
+
+
+class PDFTOPDF_Factory {
+public:
+ // never NULL, but may throw.
+ static PDFTOPDF_Processor *processor();
+};
+
+//bool checkBookletSignature(int signature) { return (signature%4==0); }
+std::vector<int> bookletShuffle(int numPages,int signature=-1);
+
+// This is all we want:
+bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters ¶m);
+
+
+#endif
--- /dev/null
+#include "pptypes.h"
+#include <utility>
+#include <stdio.h>
+#include <assert.h>
+
+void Position_dump(Position pos) // {{{
+{
+ static const char *pstr[3]={"Left/Bottom","Center","Right/Top"};
+ if ( (pos<LEFT)||(pos>RIGHT) ) {
+ fprintf(stderr,"(bad position: %d)",pos);
+ } else {
+ fputs(pstr[pos+1],stderr);
+ }
+}
+// }}}
+
+void Position_dump(Position pos,Axis axis) // {{{
+{
+ assert( (axis==Axis::X)||(axis==Axis::Y) );
+ if ( (pos<LEFT)||(pos>RIGHT) ) {
+ fprintf(stderr,"(bad position: %d)",pos);
+ return;
+ }
+ if (axis==Axis::X) {
+ static const char *pxstr[3]={"Left","Center","Right"};
+ fputs(pxstr[pos+1],stderr);
+ } else {
+ static const char *pystr[3]={"Bottom","Center","Top"};
+ fputs(pystr[pos+1],stderr);
+ }
+}
+// }}}
+
+
+void Rotation_dump(Rotation rot) // {{{
+{
+ static const char *rstr[4]={"0 deg","90 deg","180 deg","270 deg"}; // CCW
+ if ( (rot<ROT_0)||(rot>ROT_270) ) {
+ fprintf(stderr,"(bad rotation: %d)",rot);
+ } else {
+ fputs(rstr[rot],stderr);
+ }
+}
+// }}}
+
+Rotation operator+(Rotation lhs,Rotation rhs) // {{{
+{
+ return (Rotation)(((int)lhs+(int)rhs)%4);
+}
+// }}}
+
+Rotation operator-(Rotation lhs,Rotation rhs) // {{{
+{
+ return (Rotation)((((int)lhs-(int)rhs)%4+4)%4);
+}
+// }}}
+
+Rotation operator-(Rotation rhs) // {{{
+{
+ return (Rotation)((4-(int)rhs)%4);
+}
+// }}}
+
+
+void BorderType_dump(BorderType border) // {{{
+{
+ if ( (border<NONE)||(border==1)||(border>TWO_THICK) ) {
+ fprintf(stderr,"(bad border: %d)",border);
+ } else {
+ static const char *bstr[6]={"None",NULL,"one thin","one thick","two thin","two thick"};
+ fputs(bstr[border],stderr);
+ }
+}
+// }}}
+
+
+void PageRect::rotate_move(Rotation r,float pwidth,float pheight) // {{{
+{
+#if 1
+ if (r>=ROT_180) {
+ std::swap(top,bottom);
+ std::swap(left,right);
+ }
+ if ( (r==ROT_90)||(r==ROT_270) ) {
+ const float tmp=bottom;
+ bottom=left;
+ left=top;
+ top=right;
+ right=tmp;
+
+ std::swap(width,height);
+ std::swap(pwidth,pheight);
+ }
+ if ( (r==ROT_90)||(r==ROT_180) ) {
+ left=pwidth-left;
+ right=pwidth-right;
+ }
+ if ( (r==ROT_270)||(r==ROT_180) ) {
+ top=pheight-top;
+ bottom=pheight-bottom;
+ }
+#else
+ switch (r) {
+ case ROT_0: // no-op
+ break;
+ case ROT_90:
+ const float tmp0=bottom;
+ bottom=left;
+ left=pheight-top;
+ top=right;
+ right=pheight-tmp0;
+
+ std::swap(width,height);
+ break;
+ case ROT_180:
+ const float tmp1=left;
+ left=width-right;
+ right=width-left;
+
+ const float tmp2=top;
+ top=pheight-bottom;
+ bottom=pheight-tmp2;
+ break;
+ case ROT_270:
+ const float tmp3=top;
+ top=pwidth-left;
+ left=bottom;
+ bottom=pwidth-right;
+ right=tmp3;
+
+ std::swap(width,height);
+ break;
+ }
+#endif
+}
+// }}}
+
+void PageRect::scale(float mult) // {{{
+{
+ if (mult==1.0) {
+ return;
+ }
+ assert(mult!=0.0);
+
+ bottom*=mult;
+ left*=mult;
+ top*=mult;
+ right*=mult;
+
+ width*=mult;
+ height*=mult;
+}
+// }}}
+
+void PageRect::translate(float tx,float ty) // {{{
+{
+ left+=tx;
+ bottom+=ty;
+ right+=tx;
+ top+=ty;
+}
+// }}}
+
+void PageRect::set(const PageRect &rhs) // {{{
+{
+ if (!std::isnan(rhs.top)) top=rhs.top;
+ if (!std::isnan(rhs.left)) left=rhs.left;
+ if (!std::isnan(rhs.right)) right=rhs.right;
+ if (!std::isnan(rhs.bottom)) bottom=rhs.bottom;
+}
+// }}}
+
+void PageRect::dump() const // {{{
+{
+ fprintf(stderr,"top: %f, left: %f, right: %f, bottom: %f\n"
+ "width: %f, height: %f\n",
+ top,left,right,bottom,
+ width,height);
+}
+// }}}
+
--- /dev/null
+#ifndef PPTYPES_H_
+#define PPTYPES_H_
+
+#include <cmath> // NAN
+
+// namespace PPTypes {} TODO?
+
+enum Axis { X, Y };
+enum Position { CENTER=0, LEFT=-1, RIGHT=1, TOP=1, BOTTOM=-1 }; // PS order
+void Position_dump(Position pos);
+void Position_dump(Position pos,Axis axis);
+
+enum Rotation { ROT_0, ROT_90, ROT_180, ROT_270 }; // CCW
+void Rotation_dump(Rotation rot);
+Rotation operator+(Rotation lhs,Rotation rhs);
+Rotation operator-(Rotation lhs,Rotation rhs);
+Rotation operator-(Rotation rhs);
+//Rotation operator+=(Rotation &lhs,Rotation rhs);
+
+enum BorderType { NONE=0, ONE_THIN=2, ONE_THICK=3, TWO_THIN=4, TWO_THICK=5,
+ ONE=0x02, TWO=0x04, THICK=0x01};
+void BorderType_dump(BorderType border);
+
+struct PageRect {
+ PageRect() : top(NAN),left(NAN),right(NAN),bottom(NAN),width(NAN),height(NAN) {}
+ float top,left,right,bottom; // i.e. margins
+ float width,height;
+
+ void rotate_move(Rotation r,float pwidth,float pheight); // pwidth original "page size" (i.e. before rotation)
+ void scale(float mult);
+ void translate(float tx,float ty);
+
+ void set(const PageRect &rhs); // only for rhs.* != NAN
+ void dump() const;
+};
+
+// bool parseBorder(const char *val,BorderType &ret); // none,single,...,double-thick
+
+#endif
--- /dev/null
+#include "qpdf_cm.h"
+#include <stdio.h>
+#include <assert.h>
+
+#include <stdexcept>
+
+// TODO? instead use qpdf's StreamDataProvider, FileInputSource, Buffer etc.
+static std::string load_file(const char *filename) // {{{
+{
+ if (!filename) {
+ throw std::invalid_argument("NULL filename not allowed");
+ }
+
+ FILE *f=fopen(filename,"r");
+ if (!f) {
+ throw std::runtime_error(std::string("file ") + filename + " could not be opened");
+ }
+
+ const int bsize=2048;
+ int pos=0;
+
+ std::string ret;
+ while (!feof(f)) {
+ ret.resize(pos+bsize);
+ int res=fread(&ret[pos],1,bsize,f);
+ pos+=res;
+ if (res<bsize) {
+ ret.resize(pos);
+ break;
+ }
+ }
+
+ fclose(f);
+ return ret;
+}
+// }}}
+
+
+// TODO?
+// TODO? test
+bool hasOutputIntent(QPDF &pdf) // {{{
+{
+ auto catalog=pdf.getRoot();
+ if (!catalog.hasKey("/OutputIntents")) {
+ return false;
+ }
+ return true; // TODO?
+}
+// }}}
+
+// TODO: test
+ // TODO? find existing , replace and return (?)
+void addOutputIntent(QPDF &pdf,const char *filename) // {{{
+{
+ std::string icc=load_file(filename);
+ // TODO: check icc fitness
+ // ICC data, subject to "version limitations" per pdf version...
+
+ QPDFObjectHandle outicc=QPDFObjectHandle::newStream(&pdf,icc);
+
+ auto sdict=outicc.getDict();
+ sdict.replaceKey("/N",QPDFObjectHandle::newInteger(4)); // must match ICC
+ // /Range ? // must match ICC, default [0.0 1.0 ...]
+ // /Alternate ? (/DeviceCMYK for N=4)
+
+ auto intent=QPDFObjectHandle::parse(
+ "<<"
+ " /Type /OutputIntent" // Must be so (the standard requires).
+ " /S /GTS_PDFX" // Must be so (the standard requires).
+ " /OutputCondition (Commercial and specialty printing)" // TODO: Customize [optional(?)]
+ " /Info (none)" // TODO: Customize
+ " /OutputConditionIdentifier (CGATS TR001)" // TODO: FIXME: Customize
+ " /RegistryName (http://www.color.org)" // Must be so (the standard requires).
+ " /DestOutputProfile null "
+ ">>");
+ intent.replaceKey("/DestOutputProfile",outicc);
+
+ auto catalog=pdf.getRoot();
+ if (!catalog.hasKey("/OutputIntents")) {
+ catalog.replaceKey("/OutputIntents",QPDFObjectHandle::newArray());
+ }
+ catalog.getKey("/OutputIntents").appendItem(intent);
+}
+// }}}
+
+
+/* for color management:
+ Use /DefaultGray, /DefaultRGB, /DefaultCMYK ... from *current* resource dictionary ...
+ i.e. set
+ /Resources <<
+ /ColorSpace << --- can use just one indirect ref for this (probably)
+ /DefaultRGB [/ICCBased 5 0 R] ... sensible use is sRGB for DefaultRGB, etc.
+ >>
+ >>
+ for every page (what with form /XObjects?) and most importantly RGB (leave CMYK, Gray for now, as this is already printer native(?))
+
+? also every form XObject, pattern, type3 font, annotation appearance stream(=form xobject +X)
+
+? what if page already defines /Default? -- probably keep!
+
+*/
+
+// TODO? test
+void addDefaultRGB(QPDF &pdf,QPDFObjectHandle srcicc) // {{{
+{
+ srcicc.assertStream();
+
+ auto pages=pdf.getAllPages();
+ for (auto it=pages.begin(),end=pages.end();it!=end;++it) {
+ if (!it->hasKey("/Resources")) {
+ it->replaceKey("/Resources",QPDFObjectHandle::newDictionary());
+ }
+ auto rdict=it->getKey("/Resources");
+
+ if (!rdict.hasKey("/ColorSpace")) {
+ rdict.replaceKey("/ColorSpace",QPDFObjectHandle::newDictionary());
+ }
+ auto cdict=rdict.getKey("/ColorSpace");
+
+ if (!cdict.hasKey("/DefaultRGB")) {
+ cdict.replaceKey("/DefaultRGB",QPDFObjectHandle::parse("[/ICCBased ]"));
+ cdict.getKey("/DefaultRGB").appendItem(srcicc);
+ }
+ }
+}
+// }}}
+
+// TODO? test
+ // TODO: find existing , replace and return (?)
+ // TODO: check icc fitness
+QPDFObjectHandle setDefaultICC(QPDF &pdf,const char *filename) // {{{
+{
+ // TODO: find existing , replace and return (?)
+
+ std::string icc=load_file(filename);
+ // TODO: check icc fitness
+ // ICC data, subject to "version limitations" per pdf version...
+
+ QPDFObjectHandle ret=QPDFObjectHandle::newStream(&pdf,icc);
+
+ auto sdict=ret.getDict();
+ sdict.replaceKey("/N",QPDFObjectHandle::newInteger(3)); // must match ICC
+ // /Range ? // must match ICC, default [0.0 1.0 ...]
+ // /Alternate ? (/DeviceRGB for N=3)
+
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef QPDF_CM_H_
+#define QPDF_CM_H_
+
+#include <qpdf/QPDF.hh>
+
+bool hasOutputIntent(QPDF &pdf);
+void addOutputIntent(QPDF &pdf,const char *filename);
+
+void addDefaultRGB(QPDF &pdf,QPDFObjectHandle srcicc);
+QPDFObjectHandle setDefaultICC(QPDF &pdf,const char *filename);
+
+#endif
--- /dev/null
+#include "qpdf_pdftopdf.h"
+#include <assert.h>
+#include <stdexcept>
+
+PageRect getBoxAsRect(QPDFObjectHandle box) // {{{
+{
+ PageRect ret;
+
+ ret.left=box.getArrayItem(0).getNumericValue();
+ ret.bottom=box.getArrayItem(1).getNumericValue();
+ ret.right=box.getArrayItem(2).getNumericValue();
+ ret.top=box.getArrayItem(3).getNumericValue();
+
+ ret.width=ret.right-ret.left;
+ ret.height=ret.top-ret.bottom;
+
+ return ret;
+}
+// }}}
+
+Rotation getRotate(QPDFObjectHandle page) // {{{
+{
+ if (!page.hasKey("/Rotate")) {
+ return ROT_0;
+ }
+ double rot=page.getKey("/Rotate").getNumericValue();
+ if (rot==90.0) { // CW
+ return ROT_270; // CCW
+ } else if (rot==180.0) {
+ return ROT_180;
+ } else if (rot==270.0) {
+ return ROT_90;
+ } else {
+ assert(rot==0.0);
+ }
+ return ROT_0;
+}
+// }}}
+
+double getUserUnit(QPDFObjectHandle page) // {{{
+{
+ if (!page.hasKey("/UserUnit")) {
+ return 1.0;
+ }
+ return page.getKey("/UserUnit").getNumericValue();
+}
+// }}}
+
+QPDFObjectHandle makeRotate(Rotation rot) // {{{
+{
+ switch (rot) {
+ case ROT_0:
+ return QPDFObjectHandle::newNull();
+ case ROT_90: // CCW
+ return QPDFObjectHandle::newInteger(270); // CW
+ case ROT_180:
+ return QPDFObjectHandle::newInteger(180);
+ case ROT_270:
+ return QPDFObjectHandle::newInteger(90);
+ default:
+ throw std::invalid_argument("Bad rotation");
+ }
+}
+// }}}
+
+#include "qpdf_tools.h"
+
+QPDFObjectHandle getRectAsBox(const PageRect &rect) // {{{
+{
+ return makeBox(rect.left,rect.bottom,rect.right,rect.top);
+}
+// }}}
+
+#include <qpdf/QUtil.hh>
+
+Matrix::Matrix() // {{{
+ : ctm{1,0,0,1,0,0}
+{
+}
+// }}}
+
+Matrix::Matrix(QPDFObjectHandle ar) // {{{
+{
+ if (ar.getArrayNItems()!=6) {
+ throw std::runtime_error("Not a ctm matrix");
+ }
+ for (int iA=0;iA<6;iA++) {
+ ctm[iA]=ar.getArrayItem(iA).getNumericValue();
+ }
+}
+// }}}
+
+Matrix &Matrix::rotate(Rotation rot) // {{{
+{
+ switch (rot) {
+ case ROT_0:
+ break;
+ case ROT_90:
+ std::swap(ctm[0],ctm[2]);
+ std::swap(ctm[1],ctm[3]);
+ ctm[2]=-ctm[2];
+ ctm[3]=-ctm[3];
+ break;
+ case ROT_180:
+ ctm[0]=-ctm[0];
+ ctm[3]=-ctm[3];
+ break;
+ case ROT_270:
+ std::swap(ctm[0],ctm[2]);
+ std::swap(ctm[1],ctm[3]);
+ ctm[0]=-ctm[0];
+ ctm[1]=-ctm[1];
+ break;
+ default:
+ assert(0);
+ }
+ return *this;
+}
+// }}}
+
+// TODO: test
+Matrix &Matrix::rotate_move(Rotation rot,double width,double height) // {{{
+{
+ rotate(rot);
+ switch (rot) {
+ case ROT_0:
+ break;
+ case ROT_90:
+ translate(width,0);
+ break;
+ case ROT_180:
+ translate(width,height);
+ break;
+ case ROT_270:
+ translate(0,height);
+ break;
+ }
+ return *this;
+}
+// }}}
+
+Matrix &Matrix::rotate(double rad) // {{{
+{
+ Matrix tmp;
+
+ tmp.ctm[0]=cos(rad);
+ tmp.ctm[1]=sin(rad);
+ tmp.ctm[2]=-sin(rad);
+ tmp.ctm[3]=cos(rad);
+
+ return (*this*=tmp);
+}
+// }}}
+
+Matrix &Matrix::translate(double tx,double ty) // {{{
+{
+ ctm[4]+=ctm[0]*tx+ctm[2]*ty;
+ ctm[5]+=ctm[1]*tx+ctm[3]*ty;
+ return *this;
+}
+// }}}
+
+Matrix &Matrix::scale(double sx,double sy) // {{{
+{
+ ctm[0]*=sx;
+ ctm[1]*=sx;
+ ctm[2]*=sy;
+ ctm[3]*=sy;
+ return *this;
+}
+// }}}
+
+Matrix &Matrix::operator*=(const Matrix &rhs) // {{{
+{
+ double tmp[6];
+ std::copy(ctm,ctm+6,tmp);
+
+ ctm[0] = tmp[0]*rhs.ctm[0] + tmp[2]*rhs.ctm[1];
+ ctm[1] = tmp[1]*rhs.ctm[0] + tmp[3]*rhs.ctm[1];
+
+ ctm[2] = tmp[0]*rhs.ctm[2] + tmp[2]*rhs.ctm[3];
+ ctm[3] = tmp[1]*rhs.ctm[2] + tmp[3]*rhs.ctm[3];
+
+ ctm[4] = tmp[0]*rhs.ctm[4] + tmp[2]*rhs.ctm[5] + tmp[4];
+ ctm[5] = tmp[1]*rhs.ctm[4] + tmp[3]*rhs.ctm[5] + tmp[5];
+
+ return *this;
+}
+// }}}
+
+QPDFObjectHandle Matrix::get() const // {{{
+{
+ QPDFObjectHandle ret=QPDFObjectHandle::newArray();
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[0]));
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[1]));
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[2]));
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[3]));
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[4]));
+ ret.appendItem(QPDFObjectHandle::newReal(ctm[5]));
+ return ret;
+}
+// }}}
+
+std::string Matrix::get_string() const // {{{
+{
+ std::string ret;
+ ret.append(QUtil::double_to_string(ctm[0]));
+ ret.append(" ");
+ ret.append(QUtil::double_to_string(ctm[1]));
+ ret.append(" ");
+ ret.append(QUtil::double_to_string(ctm[2]));
+ ret.append(" ");
+ ret.append(QUtil::double_to_string(ctm[3]));
+ ret.append(" ");
+ ret.append(QUtil::double_to_string(ctm[4]));
+ ret.append(" ");
+ ret.append(QUtil::double_to_string(ctm[5]));
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef QPDF_PDFTOPDF_H
+#define QPDF_PDFTOPDF_H
+
+#include <qpdf/QPDFObjectHandle.hh>
+#include "pptypes.h"
+
+// helper functions
+
+PageRect getBoxAsRect(QPDFObjectHandle box);
+QPDFObjectHandle getRectAsBox(const PageRect &rect);
+
+// Note that PDF specification is CW, but our Rotation is CCW
+Rotation getRotate(QPDFObjectHandle page);
+QPDFObjectHandle makeRotate(Rotation rot); // Integer
+
+double getUserUnit(QPDFObjectHandle page);
+
+// PDF CTM
+class Matrix {
+public:
+ Matrix(); // identity
+ Matrix(QPDFObjectHandle ar);
+
+ Matrix &rotate(Rotation rot);
+ Matrix &rotate_move(Rotation rot,double width,double height);
+ Matrix &rotate(double rad);
+// Matrix &rotate_deg(double deg);
+
+ Matrix &translate(double tx,double ty);
+ Matrix &scale(double sx,double sy);
+ Matrix &scale(double s) { return scale(s,s); }
+
+ Matrix &operator*=(const Matrix &rhs);
+
+ QPDFObjectHandle get() const;
+ std::string get_string() const;
+private:
+ double ctm[6];
+};
+
+#endif
--- /dev/null
+#include "qpdf_pdftopdf_processor.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <stdexcept>
+#include <qpdf/QPDFWriter.hh>
+#include <qpdf/QUtil.hh>
+#include "qpdf_tools.h"
+#include "qpdf_xobject.h"
+#include "qpdf_pdftopdf.h"
+
+// Use: content.append(debug_box(pe.sub,xpos,ypos));
+static std::string debug_box(const PageRect &box,float xshift,float yshift) // {{{
+{
+ return std::string("q 1 w 0.1 G\n ")+
+ QUtil::double_to_string(box.left+xshift)+" "+QUtil::double_to_string(box.bottom+yshift)+" m "+
+ QUtil::double_to_string(box.right+xshift)+" "+QUtil::double_to_string(box.top+yshift)+" l "+"S \n "+
+
+ QUtil::double_to_string(box.right+xshift)+" "+QUtil::double_to_string(box.bottom+yshift)+" m "+
+ QUtil::double_to_string(box.left+xshift)+" "+QUtil::double_to_string(box.top+yshift)+" l "+"S \n "+
+
+ QUtil::double_to_string(box.left+xshift)+" "+QUtil::double_to_string(box.bottom+yshift)+" "+
+ QUtil::double_to_string(box.right-box.left)+" "+QUtil::double_to_string(box.top-box.bottom)+" re "+"S Q\n";
+}
+// }}}
+
+QPDF_PDFTOPDF_PageHandle::QPDF_PDFTOPDF_PageHandle(QPDFObjectHandle page,int orig_no) // {{{
+ : page(page),
+ no(orig_no),
+ rotation(ROT_0)
+{
+}
+// }}}
+
+QPDF_PDFTOPDF_PageHandle::QPDF_PDFTOPDF_PageHandle(QPDF *pdf,float width,float height) // {{{
+ : no(0),
+ rotation(ROT_0)
+{
+ assert(pdf);
+ page=QPDFObjectHandle::parse(
+ "<<"
+ " /Type /Page"
+ " /Resources <<"
+ " /XObject null "
+ " >>"
+ " /MediaBox null "
+ " /Contents null "
+ ">>");
+ page.replaceKey("/MediaBox",makeBox(0,0,width,height));
+ page.replaceKey("/Contents",QPDFObjectHandle::newStream(pdf));
+ // xobjects: later (in get())
+ content.assign("q\n"); // TODO? different/not needed
+
+ page=pdf->makeIndirectObject(page); // stores *pdf
+}
+// }}}
+
+// Note: PDFTOPDF_Processor always works with "/Rotate"d and "/UserUnit"-scaled pages/coordinates/..., having 0,0 at left,bottom of the TrimBox
+PageRect QPDF_PDFTOPDF_PageHandle::getRect() const // {{{
+{
+ page.assertInitialized();
+ PageRect ret=getBoxAsRect(getTrimBox(page));
+ ret.translate(-ret.left,-ret.bottom);
+ ret.rotate_move(getRotate(page),ret.width,ret.height);
+ ret.scale(getUserUnit(page));
+ return ret;
+}
+// }}}
+
+bool QPDF_PDFTOPDF_PageHandle::isExisting() const // {{{
+{
+ page.assertInitialized();
+ return content.empty();
+}
+// }}}
+
+QPDFObjectHandle QPDF_PDFTOPDF_PageHandle::get() // {{{
+{
+ QPDFObjectHandle ret=page;
+ if (!isExisting()) { // finish up page
+ page.getKey("/Resources").replaceKey("/XObject",QPDFObjectHandle::newDictionary(xobjs));
+ content.append("Q\n");
+ page.getKey("/Contents").replaceStreamData(content,QPDFObjectHandle::newNull(),QPDFObjectHandle::newNull());
+ page.replaceOrRemoveKey("/Rotate",makeRotate(rotation));
+ } else {
+ Rotation rot=getRotate(page)+rotation;
+ page.replaceOrRemoveKey("/Rotate",makeRotate(rot));
+ }
+ page=QPDFObjectHandle(); // i.e. uninitialized
+ return ret;
+}
+// }}}
+
+// TODO: we probably need a function "ungetRect()" to transform to page/form space
+// TODO: as member
+static PageRect ungetRect(PageRect rect,const QPDF_PDFTOPDF_PageHandle &ph,Rotation rotation,QPDFObjectHandle page)
+{
+ PageRect pg1=ph.getRect();
+ PageRect pg2=getBoxAsRect(getTrimBox(page));
+
+ // we have to invert /Rotate, /UserUnit and the left,bottom (TrimBox) translation
+//Rotation_dump(rotation);
+//Rotation_dump(getRotate(page));
+ rect.width=pg1.width;
+ rect.height=pg1.height;
+//std::swap(rect.width,rect.height);
+//rect.rotate_move(-rotation,rect.width,rect.height);
+
+ rect.rotate_move(-getRotate(page),pg1.width,pg1.height);
+ rect.scale(1.0/getUserUnit(page));
+
+// PageRect pg2=getBoxAsRect(getTrimBox(page));
+ rect.translate(pg2.left,pg2.bottom);
+//rect.dump();
+
+ return rect;
+}
+
+ // TODO FIXME rotations are strange ... (via ungetRect)
+// TODO? for non-existing (either drop comment or facility to create split streams needed)
+void QPDF_PDFTOPDF_PageHandle::add_border_rect(const PageRect &_rect,BorderType border,float fscale) // {{{
+{
+ assert(isExisting());
+ assert(border!=BorderType::NONE);
+
+ // straight from pstops
+ const double lw=(border&THICK)?0.5:0.24;
+ double line_width=lw*fscale;
+ double margin=2.25*fscale;
+// (PageLeft+margin,PageBottom+margin) rect (PageRight-PageLeft-2*margin,...) ... for nup>1: PageLeft=0,etc.
+ // if (double) margin+=2*fscale ...rect...
+
+ PageRect rect=ungetRect(_rect,*this,rotation,page);
+
+ assert(rect.left<=rect.right);
+ assert(rect.bottom<=rect.top);
+
+ std::string boxcmd="q\n";
+ boxcmd+=" "+QUtil::double_to_string(line_width)+" w 0 G \n";
+ boxcmd+=" "+QUtil::double_to_string(rect.left+margin)+" "+QUtil::double_to_string(rect.bottom+margin)+" "+
+ QUtil::double_to_string(rect.right-rect.left-2*margin)+" "+QUtil::double_to_string(rect.top-rect.bottom-2*margin)+" re S \n";
+ if (border&TWO) {
+ margin+=2*fscale;
+ boxcmd+=" "+QUtil::double_to_string(rect.left+margin)+" "+QUtil::double_to_string(rect.bottom+margin)+" "+
+ QUtil::double_to_string(rect.right-rect.left-2*margin)+" "+QUtil::double_to_string(rect.top-rect.bottom-2*margin)+" re S \n";
+ }
+ boxcmd+="Q\n";
+
+// if (!isExisting()) {
+// // TODO: only after
+// return;
+// }
+
+ assert(page.getOwningQPDF()); // existing pages are always indirect
+#ifdef DEBUG // draw it on top
+ static const char *pre="%pdftopdf q\n"
+ "q\n",
+ *post="%pdftopdf Q\n"
+ "Q\n";
+
+ QPDFObjectHandle stm1=QPDFObjectHandle::newStream(page.getOwningQPDF(),pre),
+ stm2=QPDFObjectHandle::newStream(page.getOwningQPDF(),std::string(post)+boxcmd);
+
+ page.addPageContents(stm1,true); // before
+ page.addPageContents(stm2,false); // after
+#else
+ QPDFObjectHandle stm=QPDFObjectHandle::newStream(page.getOwningQPDF(),boxcmd);
+ page.addPageContents(stm,true); // before
+#endif
+}
+// }}}
+
+// TODO: better cropping
+// TODO: test/fix with qsub rotation
+void QPDF_PDFTOPDF_PageHandle::add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop) // {{{
+{
+ auto qsub=dynamic_cast<QPDF_PDFTOPDF_PageHandle *>(sub.get());
+ assert(qsub);
+
+ std::string xoname="/X"+QUtil::int_to_string((qsub->no!=-1)?qsub->no:++no);
+ if (crop) {
+ PageRect pg=qsub->getRect(),tmp=*crop;
+ // we need to fix a too small cropbox.
+ tmp.width=tmp.right-tmp.left;
+ tmp.height=tmp.top-tmp.bottom;
+ tmp.rotate_move(-getRotate(qsub->page),tmp.width,tmp.height); // TODO TODO (pg.width? / unneeded?)
+ // TODO: better
+ // TODO: we need to obey page./Rotate
+ if (pg.width<tmp.width) {
+ pg.right=pg.left+tmp.width;
+ }
+ if (pg.height<tmp.height) {
+ pg.top=pg.bottom+tmp.height;
+ }
+
+ PageRect rect=ungetRect(pg,*qsub,ROT_0,qsub->page);
+
+ qsub->page.replaceKey("/TrimBox",makeBox(rect.left,rect.bottom,rect.right,rect.top));
+ // TODO? do everything for cropping here?
+ }
+ xobjs[xoname]=makeXObject(qsub->page.getOwningQPDF(),qsub->page); // trick: should be the same as page->getOwningQPDF() [only after it's made indirect]
+
+ Matrix mtx;
+ mtx.translate(xpos,ypos);
+ mtx.scale(scale);
+ mtx.rotate(qsub->rotation); // TODO? -sub.rotation ? // TODO FIXME: this might need another translation!?
+ if (crop) { // TODO? other technique: set trim-box before makeXObject (but this modifies original page)
+ mtx.translate(crop->left,crop->bottom);
+// crop->dump();
+ }
+
+ content.append("q\n ");
+ content.append(mtx.get_string()+" cm\n ");
+ if (crop) {
+ content.append("0 0 "+QUtil::double_to_string(crop->right-crop->left)+" "+QUtil::double_to_string(crop->top-crop->bottom)+" re W n\n ");
+// content.append("0 0 "+QUtil::double_to_string(crop->right-crop->left)+" "+QUtil::double_to_string(crop->top-crop->bottom)+" re S\n ");
+ }
+ content.append(xoname+" Do\n");
+ content.append("Q\n");
+}
+// }}}
+
+void QPDF_PDFTOPDF_PageHandle::mirror() // {{{
+{
+ PageRect orig=getRect();
+
+ if (isExisting()) {
+ // need to wrap in XObject to keep patterns correct
+ // TODO? refactor into internal ..._subpage fn ?
+ std::string xoname="/X"+QUtil::int_to_string(no);
+
+ QPDFObjectHandle subpage=get(); // this->page, with rotation
+
+ // replace all our data
+ *this=QPDF_PDFTOPDF_PageHandle(subpage.getOwningQPDF(),orig.width,orig.height);
+
+ xobjs[xoname]=makeXObject(subpage.getOwningQPDF(),subpage); // we can only now set this->xobjs
+
+// content.append(std::string("1 0 0 1 0 0 cm\n ");
+ content.append(xoname+" Do\n");
+
+ assert(!isExisting());
+ }
+
+ static const char *pre="%pdftopdf cm\n";
+ // Note: we don't change (TODO need to?) the media box
+ std::string mrcmd("-1 0 0 1 "+
+ QUtil::double_to_string(orig.right)+" 0 cm\n");
+
+ content.insert(0,std::string(pre)+mrcmd);
+}
+// }}}
+
+void QPDF_PDFTOPDF_PageHandle::rotate(Rotation rot) // {{{
+{
+ rotation=rot; // "rotation += rot;" ?
+}
+// }}}
+
+void QPDF_PDFTOPDF_PageHandle::debug(const PageRect &rect,float xpos,float ypos) // {{{
+{
+ assert(!isExisting());
+ content.append(debug_box(rect,xpos,ypos));
+}
+// }}}
+
+
+void QPDF_PDFTOPDF_Processor::closeFile() // {{{
+{
+ pdf.reset();
+ hasCM=false;
+}
+// }}}
+
+void QPDF_PDFTOPDF_Processor::error(const char *fmt,...) // {{{
+{
+ va_list ap;
+
+ va_start(ap,fmt);
+ vfprintf(stderr,fmt,ap);
+ fputs("\n",stderr);
+ va_end(ap);
+}
+// }}}
+
+// TODO? try/catch for PDF parsing errors?
+
+bool QPDF_PDFTOPDF_Processor::loadFile(FILE *f,ArgOwnership take) // {{{
+{
+ closeFile();
+ if (!f) {
+ throw std::invalid_argument("loadFile(NULL,...) not allowed");
+ }
+ try {
+ pdf.reset(new QPDF);
+ } catch (...) {
+ if (take==TakeOwnership) {
+ fclose(f);
+ }
+ throw;
+ }
+ switch (take) {
+ case WillStayAlive:
+ try {
+ pdf->processFile("temp file",f,false);
+ } catch (const std::exception &e) {
+ error("loadFile failed: %s",e.what());
+ return false;
+ }
+ break;
+ case TakeOwnership:
+ try {
+ pdf->processFile("temp file",f,true);
+ } catch (const std::exception &e) {
+ error("loadFile failed: %s",e.what());
+ return false;
+ }
+ break;
+ case MustDuplicate:
+ error("loadFile with MustDuplicate is not supported");
+ return false;
+ }
+ start();
+ return true;
+}
+// }}}
+
+bool QPDF_PDFTOPDF_Processor::loadFilename(const char *name) // {{{
+{
+ closeFile();
+ try {
+ pdf.reset(new QPDF);
+ pdf->processFile(name);
+ } catch (const std::exception &e) {
+ error("loadFilename failed: %s",e.what());
+ return false;
+ }
+ start();
+ return true;
+}
+// }}}
+
+
+void QPDF_PDFTOPDF_Processor::start() // {{{
+{
+ assert(pdf);
+
+ pdf->pushInheritedAttributesToPage();
+ orig_pages=pdf->getAllPages();
+
+ // remove them (just unlink, data still there)
+ const int len=orig_pages.size();
+ for (int iA=0;iA<len;iA++) {
+ pdf->removePage(orig_pages[iA]);
+ }
+
+ // we remove stuff that becomes defunct (probably) TODO
+ pdf->getRoot().removeKey("/PageMode");
+ pdf->getRoot().removeKey("/Outlines");
+ pdf->getRoot().removeKey("/OpenAction");
+ pdf->getRoot().removeKey("/PageLabels");
+}
+// }}}
+
+bool QPDF_PDFTOPDF_Processor::check_print_permissions() // {{{
+{
+ if (!pdf) {
+ error("No PDF loaded");
+ return false;
+ }
+ return pdf->allowPrintHighRes() || pdf->allowPrintLowRes(); // from legacy pdftopdf
+}
+// }}}
+
+
+std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> QPDF_PDFTOPDF_Processor::get_pages() // {{{
+{
+ std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> ret;
+ if (!pdf) {
+ error("No PDF loaded");
+ assert(0);
+ return ret;
+ }
+ const int len=orig_pages.size();
+ ret.reserve(len);
+ for (int iA=0;iA<len;iA++) {
+ ret.push_back(std::shared_ptr<PDFTOPDF_PageHandle>(new QPDF_PDFTOPDF_PageHandle(orig_pages[iA],iA+1)));
+ }
+ return ret;
+}
+// }}}
+
+std::shared_ptr<PDFTOPDF_PageHandle> QPDF_PDFTOPDF_Processor::new_page(float width,float height) // {{{
+{
+ if (!pdf) {
+ error("No PDF loaded");
+ assert(0);
+ return std::shared_ptr<PDFTOPDF_PageHandle>();
+ }
+ return std::shared_ptr<QPDF_PDFTOPDF_PageHandle>(new QPDF_PDFTOPDF_PageHandle(pdf.get(),width,height));
+ // return std::make_shared<QPDF_PDFTOPDF_PageHandle>(pdf.get(),width,height); // problem: make_shared not friend
+}
+// }}}
+
+void QPDF_PDFTOPDF_Processor::add_page(std::shared_ptr<PDFTOPDF_PageHandle> page,bool front) // {{{
+{
+ assert(pdf);
+ auto qpage=dynamic_cast<QPDF_PDFTOPDF_PageHandle *>(page.get());
+ if (qpage) {
+ pdf->addPage(qpage->get(),front);
+ }
+}
+// }}}
+
+#if 0
+ // we remove stuff now probably defunct TODO
+ pdf->getRoot().removeKey("/PageMode");
+ pdf->getRoot().removeKey("/Outlines");
+ pdf->getRoot().removeKey("/OpenAction");
+ pdf->getRoot().removeKey("/PageLabels");
+#endif
+
+void QPDF_PDFTOPDF_Processor::multiply(int copies,bool collate) // {{{
+{
+ assert(pdf);
+ assert(copies>0);
+
+ std::vector<QPDFObjectHandle> pages=pdf->getAllPages(); // need copy
+ const int len=pages.size();
+
+ if (collate) {
+ for (int iA=1;iA<copies;iA++) {
+ for (int iB=0;iB<len;iB++) {
+ pdf->addPage(pages[iB].shallowCopy(),false);
+ }
+ }
+ } else {
+ for (int iB=0;iB<len;iB++) {
+ for (int iA=1;iA<copies;iA++) {
+ pdf->addPageAt(pages[iB].shallowCopy(),false,pages[iB]);
+ }
+ }
+ }
+}
+// }}}
+
+// TODO? elsewhere?
+void QPDF_PDFTOPDF_Processor::autoRotateAll(bool dst_lscape,Rotation normal_landscape) // {{{
+{
+ assert(pdf);
+
+ const int len=orig_pages.size();
+ for (int iA=0;iA<len;iA++) {
+ QPDFObjectHandle page=orig_pages[iA];
+
+ Rotation src_rot=getRotate(page);
+
+ // copy'n'paste from QPDF_PDFTOPDF_PageHandle::getRect
+ PageRect ret=getBoxAsRect(getTrimBox(page));
+// ret.translate(-ret.left,-ret.bottom);
+ ret.rotate_move(src_rot,ret.width,ret.height);
+// ret.scale(getUserUnit(page));
+
+ const bool src_lscape=(ret.width>ret.height);
+ if (src_lscape!=dst_lscape) {
+ Rotation rotation=normal_landscape;
+ // TODO? other rotation direction, e.g. if (src_rot==ROT_0)&&(param.orientation==ROT_270) ... etc.
+ // rotation=ROT_270;
+
+ page.replaceOrRemoveKey("/Rotate",makeRotate(src_rot+rotation));
+ }
+ }
+}
+// }}}
+
+#include "qpdf_cm.h"
+
+// TODO
+void QPDF_PDFTOPDF_Processor::addCM(const char *defaulticc,const char *outputicc) // {{{
+{
+ assert(pdf);
+
+ if (hasOutputIntent(*pdf)) {
+ return; // nothing to do
+ }
+
+ QPDFObjectHandle srcicc=setDefaultICC(*pdf,defaulticc);
+ addDefaultRGB(*pdf,srcicc);
+
+ addOutputIntent(*pdf,outputicc);
+
+ hasCM=true;
+}
+// }}}
+
+
+void QPDF_PDFTOPDF_Processor::setComments(const std::vector<std::string> &comments) // {{{
+{
+ extraheader.clear();
+ const int len=comments.size();
+ for (int iA=0;iA<len;iA++) {
+ assert(comments[iA].at(0)=='%');
+ extraheader.append(comments[iA]);
+ extraheader.push_back('\n');
+ }
+}
+// }}}
+
+void QPDF_PDFTOPDF_Processor::emitFile(FILE *f,ArgOwnership take) // {{{
+{
+ if (!pdf) {
+ return;
+ }
+ QPDFWriter out(*pdf);
+ switch (take) {
+ case WillStayAlive:
+ out.setOutputFile("temp file",f,false);
+ break;
+ case TakeOwnership:
+ out.setOutputFile("temp file",f,true);
+ break;
+ case MustDuplicate:
+ error("emitFile with MustDuplicate is not supported");
+ return;
+ }
+ if (hasCM) {
+ out.setMinimumPDFVersion("1.4");
+ } else {
+ out.setMinimumPDFVersion("1.2");
+ }
+ if (!extraheader.empty()) {
+ out.setExtraHeaderText(extraheader);
+ }
+ out.write();
+}
+// }}}
+
+void QPDF_PDFTOPDF_Processor::emitFilename(const char *name) // {{{
+{
+ if (!pdf) {
+ return;
+ }
+ // special case: name==NULL -> stdout
+ QPDFWriter out(*pdf,name);
+ if (hasCM) {
+ out.setMinimumPDFVersion("1.4");
+ } else {
+ out.setMinimumPDFVersion("1.2");
+ }
+ if (!extraheader.empty()) {
+ out.setExtraHeaderText(extraheader);
+ }
+ out.write();
+}
+// }}}
+
+ // TODO:
+ // loadPDF(); success?
--- /dev/null
+#ifndef QPDF_PDFTOPDF_PROCESSOR_H
+#define QPDF_PDFTOPDF_PROCESSOR_H
+
+#include "pdftopdf_processor.h"
+#include <qpdf/QPDF.hh>
+
+class QPDF_PDFTOPDF_PageHandle : public PDFTOPDF_PageHandle {
+public:
+ virtual PageRect getRect() const;
+ virtual void add_border_rect(const PageRect &rect,BorderType border,float fscale);
+ virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL);
+ virtual void mirror();
+ virtual void rotate(Rotation rot);
+
+ void debug(const PageRect &rect,float xpos,float ypos);
+private:
+ bool isExisting() const;
+ QPDFObjectHandle get(); // only once!
+private:
+ friend class QPDF_PDFTOPDF_Processor;
+ // 1st mode: existing
+ QPDF_PDFTOPDF_PageHandle(QPDFObjectHandle page,int orig_no=-1);
+ QPDFObjectHandle page;
+ int no;
+
+ // 2nd mode: create new
+ QPDF_PDFTOPDF_PageHandle(QPDF *pdf,float width,float height);
+ std::map<std::string,QPDFObjectHandle> xobjs;
+ std::string content;
+
+ Rotation rotation;
+};
+
+class QPDF_PDFTOPDF_Processor : public PDFTOPDF_Processor {
+public:
+ virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive);
+ virtual bool loadFilename(const char *name);
+
+// TODO: virtual bool may_modify/may_print/?
+ virtual bool check_print_permissions();
+
+// virtual bool setProcess(const ProcessingParameters ¶m) =0;
+
+ virtual std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> get_pages();
+ virtual std::shared_ptr<PDFTOPDF_PageHandle> new_page(float width,float height);
+
+ virtual void add_page(std::shared_ptr<PDFTOPDF_PageHandle> page,bool front);
+
+ virtual void multiply(int copies,bool collate);
+
+ virtual void autoRotateAll(bool dst_lscape,Rotation normal_landscape);
+ virtual void addCM(const char *defaulticc,const char *outputicc);
+
+ virtual void setComments(const std::vector<std::string> &comments);
+
+ virtual void emitFile(FILE *dst,ArgOwnership take=WillStayAlive);
+ virtual void emitFilename(const char *name);
+
+private:
+ void closeFile();
+ void error(const char *fmt,...);
+ void start();
+private:
+ std::unique_ptr<QPDF> pdf;
+ std::vector<QPDFObjectHandle> orig_pages;
+
+ bool hasCM;
+ std::string extraheader;
+};
+
+#endif
--- /dev/null
+#include "qpdf_tools.h"
+
+QPDFObjectHandle getMediaBox(QPDFObjectHandle page) // {{{
+{
+ return page.getKey("/MediaBox");
+}
+// }}}
+
+QPDFObjectHandle getCropBox(QPDFObjectHandle page) // {{{
+{
+ if (page.hasKey("/CropBox")) {
+ return page.getKey("/CropBox");
+ }
+ return page.getKey("/MediaBox");
+}
+// }}}
+
+QPDFObjectHandle getBleedBox(QPDFObjectHandle page) // {{{
+{
+ if (page.hasKey("/BleedBox")) {
+ return page.getKey("/BleedBox");
+ }
+ return getCropBox(page);
+}
+// }}}
+
+QPDFObjectHandle getTrimBox(QPDFObjectHandle page) // {{{
+{
+ if (page.hasKey("/TrimBox")) {
+ return page.getKey("/TrimBox");
+ }
+ return getCropBox(page);
+}
+// }}}
+
+QPDFObjectHandle getArtBox(QPDFObjectHandle page) // {{{
+{
+ if (page.hasKey("/ArtBox")) {
+ return page.getKey("/ArtBox");
+ }
+ return getCropBox(page);
+}
+// }}}
+
+QPDFObjectHandle makePage(QPDF &pdf,const std::map<std::string,QPDFObjectHandle> &xobjs,QPDFObjectHandle mediabox,const std::string &content) // {{{
+{
+ QPDFObjectHandle ret=QPDFObjectHandle::newDictionary();
+ ret.replaceKey("/Type",QPDFObjectHandle::newName("/Page"));
+
+ auto resdict=QPDFObjectHandle::newDictionary();
+ resdict.replaceKey("/XObject",QPDFObjectHandle::newDictionary(xobjs));
+ ret.replaceKey("/Resources",resdict);
+ ret.replaceKey("/MediaBox",mediabox);
+ ret.replaceKey("/Contents",QPDFObjectHandle::newStream(&pdf,content));
+
+ return ret;
+}
+// }}}
+
+QPDFObjectHandle makeBox(double x1,double y1,double x2,double y2) // {{{
+{
+ QPDFObjectHandle ret=QPDFObjectHandle::newArray();
+ ret.appendItem(QPDFObjectHandle::newReal(x1));
+ ret.appendItem(QPDFObjectHandle::newReal(y1));
+ ret.appendItem(QPDFObjectHandle::newReal(x2));
+ ret.appendItem(QPDFObjectHandle::newReal(y2));
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef QPDF_TOOLS_H_
+#define QPDF_TOOLS_H_
+
+#include <qpdf/QPDFObjectHandle.hh>
+#include <map>
+#include <string>
+
+QPDFObjectHandle getMediaBox(QPDFObjectHandle page);
+QPDFObjectHandle getCropBox(QPDFObjectHandle page);
+QPDFObjectHandle getBleedBox(QPDFObjectHandle page);
+QPDFObjectHandle getTrimBox(QPDFObjectHandle page);
+QPDFObjectHandle getArtBox(QPDFObjectHandle page);
+
+QPDFObjectHandle makePage(QPDF &pdf,const std::map<std::string,QPDFObjectHandle> &xobjs,QPDFObjectHandle mediabox,const std::string &content);
+
+QPDFObjectHandle makeBox(double x1,double y1,double x2,double y2);
+
+#endif
--- /dev/null
+#include "qpdf_xobject.h"
+//#include <qpdf/Types.h>
+#include <qpdf/QPDF.hh>
+#include <qpdf/Pl_Discard.hh>
+#include <qpdf/Pl_Count.hh>
+#include <qpdf/Pl_Concatenate.hh>
+#include "qpdf_tools.h"
+#include "qpdf_pdftopdf.h"
+
+// TODO: need to remove Struct Parent stuff (or fix)
+
+// NOTE: use /TrimBox to position content inside Nup cell, /BleedBox to clip against
+
+class CombineFromContents_Provider : public QPDFObjectHandle::StreamDataProvider {
+public:
+ CombineFromContents_Provider(const std::vector<QPDFObjectHandle> &contents);
+
+ void provideStreamData(int objid, int generation, Pipeline* pipeline);
+private:
+ std::vector<QPDFObjectHandle> contents;
+};
+
+CombineFromContents_Provider::CombineFromContents_Provider(const std::vector<QPDFObjectHandle> &contents)
+ : contents(contents)
+{
+}
+
+void CombineFromContents_Provider::provideStreamData(int objid, int generation, Pipeline* pipeline)
+{
+ Pl_Concatenate concat("concat", pipeline);
+ const int clen=contents.size();
+ for (int iA=0;iA<clen;iA++) {
+ contents[iA].pipeStreamData(&concat, true, false, false);
+ }
+ concat.manualFinish();
+}
+
+/*
+To convert a page to an XObject there are several keys to consider:
+
+/Type /Page -> /Type /XObject (/Type optional for XObject)
+ -> /Subtype /Form
+ -> [/FormType 1] (optional)
+/Parent ? ? R -> remove
+/Resources dict -> copy
+/MediaBox rect [/CropBox /BleedBox /TrimBox /ArtBox]
+ -> /BBox (use TrimBox [+ Bleed consideration?], with fallback to /MediaBox)
+ note that /BBox is in *Form Space*, see /Matrix!
+[/BoxColorInfo dict] (used for guidelines that may be shown by viewer)
+ -> ignore/remove
+[/Contents asfd] -> concatenate into stream data of the XObject (page is a dict, XObject a stream)
+
+[/Rotate 90] ... must be handled (either use CTM where XObject is /used/ -- or set /Matrix)
+[/UserUnit] (PDF 1.6) -> to /Matrix ? -- it MUST be handled.
+
+[/Group dict] -> copy
+[/Thumb stream] -> remove, not needed any more / would have to be regenerated (combined)
+[/B] article beads -- ignore for now
+[/Dur] -> remove (transition duration)
+[/Trans] -> remove (transitions)
+[/AA] -> remove (additional-actions)
+
+[/Metadata] what shall we do?? (kill: we can't combine XML)
+[/PieceInfo] -> remove, we can't combine private app data (?)
+[/LastModified date] (opt except /PieceInfo) -> see there
+
+[/PZ] -> remove, can't combine/keep (preferred zoom level)
+[/SeparationInfo] -> remove, no way to keep this (needed for separation)
+
+[/ID] related to web capture -- ignore/kill?
+[/StructParents] (opt except pdf contains "structural content items")
+ -> copy (is this correct?)
+
+[/Annots] annotations -- ignore for now
+[/Tabs] tab order for annotations (/R row, /C column, /S structure order) -- see /Annots
+
+[/TemplateInstantiated] (reqd, if page was created from named page obj, 1.5) -- ? just ignore?
+[/PresSteps] -> remove (sub-page navigation for presentations) [no subpage navigation for printing / nup]
+[/VP] viewport rects -- ignore/drop or recalculate into new page
+
+*/
+QPDFObjectHandle makeXObject(QPDF *pdf,QPDFObjectHandle page)
+{
+ page.assertPageObject();
+
+ QPDFObjectHandle ret=QPDFObjectHandle::newStream(pdf);
+ QPDFObjectHandle dict=ret.getDict();
+
+ dict.replaceKey("/Type",QPDFObjectHandle::newName("/XObject")); // optional
+ dict.replaceKey("/Subtype",QPDFObjectHandle::newName("/Form")); // required
+// dict.replaceKey("/FormType",QPDFObjectHandle::newInteger(1)); // optional
+
+ QPDFObjectHandle box=getTrimBox(page); // already in "form space"
+ dict.replaceKey("/BBox",box); // reqd
+
+ // [/Matrix .] ... default is [1 0 0 1 0 0]; we incorporate /UserUnit and /Rotate here
+ Matrix mtx;
+ if (page.hasKey("/UserUnit")) {
+ mtx.scale(page.getKey("/UserUnit").getNumericValue());
+ }
+
+ // transform, so that bbox is [0 0 w h] (in outer space, but after UserUnit)
+ Rotation rot=getRotate(page);
+
+ // calculate rotation effect on [0 0 w h]
+ PageRect bbox=getBoxAsRect(box),tmp;
+ tmp.left=0;
+ tmp.bottom=0;
+ tmp.right=0;
+ tmp.top=0;
+ tmp.rotate_move(rot,bbox.width,bbox.height);
+ // tmp.rotate_move moves the bbox; we must achieve this move with the matrix.
+ mtx.translate(tmp.left,tmp.bottom); // 1. move origin to end up at left,bottom after rotation
+
+ mtx.rotate(rot); // 2. rotate coordinates according to /Rotate
+ mtx.translate(-bbox.left,-bbox.bottom); // 3. move origin from 0,0 to "form space"
+
+ dict.replaceKey("/Matrix",mtx.get());
+
+ dict.replaceKey("/Resources",page.getKey("/Resources"));
+ if (page.hasKey("/Group")) {
+ dict.replaceKey("/Group",page.getKey("/Group")); // (transparency); opt, copy if there
+ }
+
+// ?? /StructParents ... can basically copy from page, but would need fixup in Structure Tree
+// FIXME: remove (globally) Tagged spec (/MarkInfo), and Structure Tree
+
+ // Note: [/Name] (reqd. only in 1.0 -- but there we even can't use our normal img/patter procedures)
+
+// none:
+// QPDFObjectHandle filter=QPDFObjectHandle::newArray();
+// QPDFObjectHandle decode_parms=QPDFObjectHandle::newArray();
+ // null leads to use of "default filters" from qpdf's settings
+ QPDFObjectHandle filter=QPDFObjectHandle::newNull();
+ QPDFObjectHandle decode_parms=QPDFObjectHandle::newNull();
+
+ std::vector<QPDFObjectHandle> contents=page.getPageContents(); // (will assertPageObject)
+
+ auto ph=PointerHolder<QPDFObjectHandle::StreamDataProvider>(new CombineFromContents_Provider(contents));
+ ret.replaceStreamData(ph,filter,decode_parms);
+
+ return ret;
+}
+
+/*
+ we will have to fix up the structure tree (e.g. /K in element), when copying /StructParents;
+ (there is /Pg, which has to point to the containing page, /Stm when it's not part of the page's content stream
+ i.e. when it is in our XObject!; then there is /StmOwn ...)
+ when not copying, we have to remove the structure tree completely (also /MarkInfo dict)
+ Still this might not be sufficient(?), as there are probably BDC and EMC operators in the stream.
+*/
+
+/* /XObject /Form has
+[/Type /XObject]
+/Subtype /Form
+[/FormType 1]
+/BBox rect from crop box, or recalculate
+[/Matrix .] ... default is [1 0 0 1 0 0] --- we have to incorporate /UserUnit here?!
+[/Resources dict] from page.
+[/Group dict] used for transparency -- can copy from page
+[/Ref dict] not needed; for external reference
+[/Metadata] not, as long we can not combine.
+[/PieceInfo] can copy, but not combine
+[/LastModified date] copy if /PieceInfo there
+[/StructParent] . don't want to be one ... have to read more spec
+[/StructParents] . copy from page!
+[/OPI] no opi version. don't set
+[/OC] is this optional content? NO! not needed.
+[/Name] (only reqd. in 1.0 -- but there we even can't use our normal img/patter procedures)
+*/
+
+
--- /dev/null
+#ifndef QPDF_XOBJECT_H_
+#define QPDF_XOBJECT_H_
+
+#include <qpdf/QPDFObjectHandle.hh>
+
+QPDFObjectHandle makeXObject(QPDF *pdf,QPDFObjectHandle page);
+
+#endif
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * PDF to PostScript filter front-end for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
+ * Copyright 2011-2012 by Till Kamppeter
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * main() - Main entry for filter...
+ * cancel_job() - Flag the job as canceled.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <cups/file.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <config.h>
+#include <cupsfilters/image-private.h>
+
+#define MAX_CHECK_COMMENT_LINES 20
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned renderer_t;
+enum renderer_e {GS = 0, PDFTOPS = 1, ACROREAD = 2};
+
+/*
+ * Local functions...
+ */
+
+static void cancel_job(int sig);
+
+
+/*
+ * Local globals...
+ */
+
+static int job_canceled = 0;
+int pdftopdfapplied = 0;
+char deviceCopies[32] = "1";
+int deviceCollate = 0;
+
+
+/*
+ * When calling the "pstops" filter we exclude the following options from its
+ * command line as we have applied these options already to the PDF input,
+ * either on the "pdftops"/Ghostscript call in this filter or by use of the
+ * "pdftopdf" filter before this filter.
+ */
+
+const char *pstops_exclude_general[] = {
+ "fitplot",
+ "fit-to-page",
+ "landscape",
+ "orientation-requested",
+ NULL
+};
+
+const char *pstops_exclude_page_management[] = {
+ "brightness",
+ "Collate",
+ "cupsEvenDuplex",
+ "gamma",
+ "hue",
+ "ipp-attribute-fidelity",
+ "MirrorPrint",
+ "mirror",
+ "multiple-document-handling",
+ "natural-scaling",
+ "number-up",
+ "number-up-layout",
+ "OutputOrder",
+ "page-border",
+ "page-bottom",
+ "page-label",
+ "page-left",
+ "page-ranges",
+ "page-right",
+ "page-set",
+ "page-top",
+ "position",
+ "saturation",
+ "scaling",
+ NULL
+};
+
+
+/*
+ * Check whether we were called after the "pdftopdf" filter and extract
+ * parameters passed over by "pdftopdf" in the header comments of the PDF
+ * file
+ */
+
+static void parsePDFTOPDFComment(char *filename)
+{
+ char buf[4096];
+ int i;
+ FILE *fp;
+
+ if ((fp = fopen(filename,"rb")) == 0) {
+ fprintf(stderr, "ERROR: pdftops - cannot open print file \"%s\"\n",
+ filename);
+ return;
+ }
+
+ /* skip until PDF start header */
+ while (fgets(buf,sizeof(buf),fp) != 0) {
+ if (strncmp(buf,"%PDF",4) == 0) {
+ break;
+ }
+ }
+ for (i = 0;i < MAX_CHECK_COMMENT_LINES;i++) {
+ if (fgets(buf,sizeof(buf),fp) == 0) break;
+ if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) {
+ char *p;
+
+ p = strchr(buf+19,':') + 1;
+ while (*p == ' ' || *p == '\t') p++;
+ strncpy(deviceCopies, p, sizeof(deviceCopies));
+ deviceCopies[sizeof(deviceCopies) - 1] = '\0';
+ p = deviceCopies + strlen(deviceCopies) - 1;
+ while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p--;
+ *(p + 1) = '\0';
+ pdftopdfapplied = 1;
+ } else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
+ char *p;
+
+ p = strchr(buf+17,':') + 1;
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ deviceCollate = 1;
+ } else {
+ deviceCollate = 0;
+ }
+ pdftopdfapplied = 1;
+ } else if (strcmp(buf,"% This file was generated by pdftopdf") == 0) {
+ pdftopdfapplied = 1;
+ }
+ }
+
+ fclose(fp);
+}
+
+
+/*
+ * Remove all options in option_list from the string option_str, including
+ * option values after an "=" sign and preceded "no" before boolean options
+ */
+
+void remove_options(char *options_str, const char **option_list)
+{
+ const char **option; /* Option to be removed now */
+ char *option_start, /* Start of option in string */
+ *option_end; /* End of option in string */
+
+ for (option = option_list; *option; option ++)
+ {
+ option_start = options_str;
+
+ while ((option_start = strcasestr(option_start, *option)) != NULL)
+ {
+ if (!option_start[strlen(*option)] ||
+ isspace(option_start[strlen(*option)] & 255) ||
+ option_start[strlen(*option)] == '=')
+ {
+ /*
+ * Strip option...
+ */
+
+ option_end = option_start + strlen(*option);
+
+ /* Remove preceding "no" of boolean option */
+ if ((option_start - options_str) >= 2 &&
+ !strncasecmp(option_start - 2, "no", 2))
+ option_start -= 2;
+
+ /* Is match of the searched option name really at the beginning of
+ the name of the option in the command line? */
+ if ((option_start > options_str) &&
+ (!isspace(*(option_start - 1) & 255)))
+ {
+ /* Prevent the same option to be found again. */
+ option_start += 1;
+ /* Skip */
+ continue;
+ }
+
+ /* Remove "=" and value */
+ while (*option_end && !isspace(*option_end & 255))
+ option_end ++;
+
+ /* Remove spaces up to next option */
+ while (*option_end && isspace(*option_end & 255))
+ option_end ++;
+
+ memmove(option_start, option_end, strlen(option_end) + 1);
+ } else {
+ /* Prevent the same option to be found again. */
+ option_start += 1;
+ }
+ }
+ }
+}
+
+
+/*
+ * 'main()' - Main entry for filter...
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line args */
+ char *argv[]) /* I - Command-line arguments */
+{
+ renderer_t renderer = CUPS_PDFTOPS_RENDERER; /* Renderer: gs or pdftops or acroread */
+ int fd = 0; /* Copy file descriptor */
+ char *filename, /* PDF file to convert */
+ tempfile[1024]; /* Temporary file */
+ char buffer[8192]; /* Copy buffer */
+ int bytes; /* Bytes copied */
+ int num_options; /* Number of options */
+ cups_option_t *options; /* Options */
+ const char *val; /* Option value */
+ int orientation, /* Output orientation */
+ fit; /* Fit output to default page size? */
+ ppd_file_t *ppd; /* PPD file */
+ ppd_size_t *size; /* Current page size */
+ char resolution[128] = "300";/* Output resolution */
+ int xres = 0, yres = 0, /* resolution values */
+ maxres = CUPS_PDFTOPS_MAX_RESOLUTION,
+ /* Maximum image rendering resolution */
+ numvalues; /* Number of values actually read */
+ ppd_choice_t *choice;
+ ppd_attr_t *attr;
+ cups_page_header2_t header;
+ cups_file_t *fp; /* Post-processing input file */
+ int pdf_pid, /* Process ID for pdftops */
+ pdf_argc, /* Number of args for pdftops */
+ pstops_pid, /* Process ID of pstops filter */
+ pstops_pipe[2], /* Pipe to pstops filter */
+ need_post_proc = 0, /* Post-processing needed? */
+ post_proc_pid = 0, /* Process ID of post-processing */
+ post_proc_pipe[2], /* Pipe to post-processing */
+ wait_children, /* Number of child processes left */
+ wait_pid, /* Process ID from wait() */
+ wait_status, /* Status from child */
+ exit_status = 0; /* Exit status */
+ char *pdf_argv[100], /* Arguments for pdftops/gs */
+ pdf_width[255], /* Paper width */
+ pdf_height[255], /* Paper height */
+ pdf_widthxheight[255], /* Paper width x height */
+ pstops_path[1024], /* Path to pstops program */
+ *pstops_argv[7], /* Arguments for pstops filter */
+ *pstops_options, /* Options for pstops filter */
+ *pstops_end; /* End of pstops filter option */
+ const char *cups_serverbin; /* CUPS_SERVERBIN environment variable */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Ignore broken pipe signals...
+ */
+
+ signal(SIGPIPE, SIG_IGN);
+
+ /*
+ * Make sure we have the right number of arguments for CUPS!
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job user title copies options [file]\n",
+ argv[0]);
+ return (1);
+ }
+
+ /*
+ * Register a signal handler to cleanly cancel a job.
+ */
+
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, cancel_job);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = cancel_job;
+ sigaction(SIGTERM, &action, NULL);
+#else
+ signal(SIGTERM, cancel_job);
+#endif /* HAVE_SIGSET */
+
+ /*
+ * Copy stdin if needed...
+ */
+
+ if (argc == 6)
+ {
+ /*
+ * Copy stdin to a temp file...
+ */
+
+ if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
+ {
+ perror("DEBUG: Unable to copy PDF file");
+ return (1);
+ }
+
+ fprintf(stderr, "DEBUG: pdftops - copying to temp print file \"%s\"\n",
+ tempfile);
+
+ while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
+ bytes = write(fd, buffer, bytes);
+
+ close(fd);
+
+ filename = tempfile;
+ }
+ else
+ {
+ /*
+ * Use the filename on the command-line...
+ */
+
+ filename = argv[6];
+ tempfile[0] = '\0';
+ }
+
+ /*
+ * Read out copy counts and collate setting passed over by pdftopdf
+ */
+
+ parsePDFTOPDFComment(filename);
+
+ /*
+ * Load the PPD file and mark options...
+ */
+
+ ppd = ppdOpenFile(getenv("PPD"));
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ ppdMarkDefaults(ppd);
+ cupsMarkOptions(ppd, num_options, options);
+
+ /*
+ * Select the PDF renderer: Ghostscript (gs) or Poppler (pdftops)
+ */
+
+ if ((val = cupsGetOption("pdftops-renderer", num_options, options)) != NULL)
+ {
+ if (strcasecmp(val, "gs") == 0)
+ renderer = GS;
+ else if (strcasecmp(val, "pdftops") == 0)
+ renderer = PDFTOPS;
+ else if (strcasecmp(val, "acroread") == 0)
+ renderer = ACROREAD;
+ else
+ fprintf(stderr,
+ "WARNING: Invalid value for \"pdftops-renderer\": \"%s\"\n", val);
+ }
+
+ /*
+ * Build the pstops command-line...
+ */
+
+ if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
+ cups_serverbin = CUPS_SERVERBIN;
+
+ snprintf(pstops_path, sizeof(pstops_path), "%s/filter/pstops",
+ cups_serverbin);
+
+ pstops_options = strdup(argv[5]);
+
+ /*
+ * Strip options which "pstops" does not need to apply any more
+ */
+ remove_options(pstops_options, pstops_exclude_general);
+ if (pdftopdfapplied)
+ remove_options(pstops_options, pstops_exclude_page_management);
+
+ if (pdftopdfapplied && deviceCollate)
+ {
+ /*
+ * Add collate option to the pstops call if pdftopdf has found out that the
+ * printer does hardware collate.
+ */
+
+ pstops_options = realloc(pstops_options, strlen(pstops_options) + 9);
+ if (!pstops_options) {
+ fprintf(stderr, "ERROR: Can't allocate pstops_options\n");
+ exit(2);
+ }
+ pstops_end = pstops_options + strlen(pstops_options);
+ strcpy(pstops_end, " Collate");
+ }
+
+ pstops_argv[0] = argv[0]; /* Printer */
+ pstops_argv[1] = argv[1]; /* Job */
+ pstops_argv[2] = argv[2]; /* User */
+ pstops_argv[3] = argv[3]; /* Title */
+ if (pdftopdfapplied)
+ pstops_argv[4] = deviceCopies; /* Copies */
+ else
+ pstops_argv[4] = argv[4]; /* Copies */
+ pstops_argv[5] = pstops_options; /* Options */
+ pstops_argv[6] = NULL;
+
+ /*
+ * Build the command-line for the pdftops or gs filter...
+ */
+
+ if (renderer == PDFTOPS)
+ {
+ pdf_argv[0] = (char *)"pdftops";
+ pdf_argc = 1;
+ }
+ else if (renderer == GS)
+ {
+ pdf_argv[0] = (char *)"gs";
+ pdf_argv[1] = (char *)"-q";
+ pdf_argv[2] = (char *)"-dNOPAUSE";
+ pdf_argv[3] = (char *)"-dBATCH";
+ pdf_argv[4] = (char *)"-dSAFER";
+# ifdef HAVE_GHOSTSCRIPT_PS2WRITE
+ pdf_argv[5] = (char *)"-sDEVICE=ps2write";
+# else
+ pdf_argv[5] = (char *)"-sDEVICE=pswrite";
+# endif /* HAVE_GHOSTSCRIPT_PS2WRITE */
+ pdf_argv[6] = (char *)"-sOUTPUTFILE=%stdout";
+ pdf_argc = 7;
+ }
+ else
+ {
+ pdf_argv[0] = (char *)"acroread";
+ pdf_argv[1] = (char *)"-toPostScript";
+ pdf_argc = 2;
+ }
+
+ if (ppd)
+ {
+ /*
+ * Set language level and TrueType font handling...
+ */
+
+ if (ppd->language_level == 1)
+ {
+ if (renderer == PDFTOPS)
+ {
+ pdf_argv[pdf_argc++] = (char *)"-level1";
+ pdf_argv[pdf_argc++] = (char *)"-noembtt";
+ }
+ else if (renderer == GS)
+ pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=1";
+ else
+ fprintf(stderr, "WARNING: Level 1 PostScript not supported by acroread.");
+ }
+ else if (ppd->language_level == 2)
+ {
+ if (renderer == PDFTOPS)
+ {
+ pdf_argv[pdf_argc++] = (char *)"-level2";
+ if (!ppd->ttrasterizer)
+ pdf_argv[pdf_argc++] = (char *)"-noembtt";
+ }
+ else if (renderer == GS)
+ pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=2";
+ else
+ pdf_argv[pdf_argc++] = (char *)"-level2";
+ }
+ else
+ {
+ if (renderer == PDFTOPS)
+ /* Do not emit PS Level 3 with Poppler, some HP PostScript printers
+ do not like it. See https://bugs.launchpad.net/bugs/277404. */
+ pdf_argv[pdf_argc++] = (char *)"-level2";
+ else if (renderer == GS)
+ pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=3";
+ else
+ pdf_argv[pdf_argc++] = (char *)"-level3";
+ }
+
+ if ((val = cupsGetOption("fitplot", num_options, options)) == NULL)
+ val = cupsGetOption("fit-to-page", num_options, options);
+
+ if (val && strcasecmp(val, "no") && strcasecmp(val, "off") &&
+ strcasecmp(val, "false"))
+ fit = 1;
+ else
+ fit = 0;
+
+ /*
+ * Set output page size...
+ */
+
+ size = ppdPageSize(ppd, NULL);
+ if (size && fit)
+ {
+ /*
+ * Got the size, now get the orientation...
+ */
+
+ orientation = 0;
+
+ if ((val = cupsGetOption("landscape", num_options, options)) != NULL)
+ {
+ if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 &&
+ strcasecmp(val, "false") != 0)
+ orientation = 1;
+ }
+ else if ((val = cupsGetOption("orientation-requested", num_options,
+ options)) != NULL)
+ {
+ /*
+ * Map IPP orientation values to 0 to 3:
+ *
+ * 3 = 0 degrees = 0
+ * 4 = 90 degrees = 1
+ * 5 = -90 degrees = 3
+ * 6 = 180 degrees = 2
+ */
+
+ orientation = atoi(val) - 3;
+ if (orientation >= 2)
+ orientation ^= 1;
+ }
+
+ if (renderer == PDFTOPS)
+ {
+ if (orientation & 1)
+ {
+ snprintf(pdf_width, sizeof(pdf_width), "%.0f", size->length);
+ snprintf(pdf_height, sizeof(pdf_height), "%.0f", size->width);
+ }
+ else
+ {
+ snprintf(pdf_width, sizeof(pdf_width), "%.0f", size->width);
+ snprintf(pdf_height, sizeof(pdf_height), "%.0f", size->length);
+ }
+
+ pdf_argv[pdf_argc++] = (char *)"-paperw";
+ pdf_argv[pdf_argc++] = pdf_width;
+ pdf_argv[pdf_argc++] = (char *)"-paperh";
+ pdf_argv[pdf_argc++] = pdf_height;
+ pdf_argv[pdf_argc++] = (char *)"-expand";
+
+ }
+ else if (renderer == GS)
+ {
+ if (orientation & 1)
+ {
+ snprintf(pdf_width, sizeof(pdf_width), "-dDEVICEWIDTHPOINTS=%.0f",
+ size->length);
+ snprintf(pdf_height, sizeof(pdf_height), "-dDEVICEHEIGHTPOINTS=%.0f",
+ size->width);
+ }
+ else
+ {
+ snprintf(pdf_width, sizeof(pdf_width), "-dDEVICEWIDTHPOINTS=%.0f",
+ size->width);
+ snprintf(pdf_height, sizeof(pdf_height), "-dDEVICEHEIGHTPOINTS=%.0f",
+ size->length);
+ }
+
+ pdf_argv[pdf_argc++] = pdf_width;
+ pdf_argv[pdf_argc++] = pdf_height;
+ }
+ else
+ {
+ if (orientation & 1)
+ snprintf(pdf_widthxheight, sizeof(pdf_widthxheight), "%.0fx%.0f",
+ size->length, size->width);
+ else
+ snprintf(pdf_widthxheight, sizeof(pdf_widthxheight), "%.0fx%.0f",
+ size->width, size->length);
+
+ pdf_argv[pdf_argc++] = (char *)"-size";
+ pdf_argv[pdf_argc++] = pdf_widthxheight;
+ }
+ }
+#ifdef HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES
+ else if (renderer == PDFTOPS)
+ {
+ /*
+ * Use the page sizes of the original PDF document, this way documents
+ * which contain pages of different sizes can be printed correctly
+ */
+
+ pdf_argv[pdf_argc++] = (char *)"-origpagesizes";
+ }
+#endif /* HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES */
+ else if (renderer == ACROREAD)
+ {
+ /*
+ * Use the page sizes of the original PDF document, this way documents
+ * which contain pages of different sizes can be printed correctly
+ */
+
+ pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize";
+ }
+
+ /*
+ * Set output resolution ...
+ */
+
+ /* Ignore error exits of cupsRasterInterpretPPD(), if it found a resolution
+ setting before erroring it is OK for us */
+ cupsRasterInterpretPPD(&header, ppd, num_options, options, NULL);
+ /* 100 dpi is default, this means that if we have 100 dpi here this
+ method failed to find the printing resolution */
+ if (header.HWResolution[0] > 100 && header.HWResolution[1] > 100)
+ {
+ xres = header.HWResolution[0];
+ yres = header.HWResolution[1];
+ }
+ else if ((choice = ppdFindMarkedChoice(ppd, "Resolution")) != NULL)
+ strncpy(resolution, choice->choice, sizeof(resolution));
+ else if ((attr = ppdFindAttr(ppd,"DefaultResolution",NULL)) != NULL)
+ strncpy(resolution, attr->value, sizeof(resolution));
+ }
+
+ resolution[sizeof(resolution)-1] = '\0';
+ if ((xres > 0) || (yres > 0) ||
+ ((numvalues = sscanf(resolution, "%dx%d", &xres, &yres)) > 0))
+ {
+ if ((yres > 0) && (xres > yres)) xres = yres;
+ }
+ else
+ xres = 300;
+
+ /*
+ * Get the ceiling for the image rendering resolution
+ */
+
+ if ((val = cupsGetOption("pdftops-max-image-resolution", num_options, options)) != NULL)
+ {
+ if ((numvalues = sscanf(val, "%d", &yres)) > 0)
+ maxres = yres;
+ else
+ fprintf(stderr,
+ "WARNING: Invalid value for \"pdftops-max-image-resolution\": \"%s\"\n", val);
+ }
+
+ /*
+ * Reduce the image rendering resolution to not exceed a given maximum
+ * to make processing of jobs by the PDF->PS converter and the printer faster
+ *
+ * maxres = 0 means no limit
+ */
+
+ if (maxres)
+ while (xres > maxres)
+ xres = xres / 2;
+
+ if (renderer == PDFTOPS)
+ {
+#ifdef HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION
+ /*
+ * Set resolution to avoid slow processing by the printer when the
+ * resolution of embedded images does not match the printer's resolution
+ */
+ pdf_argv[pdf_argc++] = (char *)"-r";
+ snprintf(resolution, sizeof(resolution), "%d", xres);
+ pdf_argv[pdf_argc++] = resolution;
+ fprintf(stderr, "DEBUG: Using image rendering resolution %d dpi\n", xres);
+#endif /* HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION */
+ pdf_argv[pdf_argc++] = filename;
+ pdf_argv[pdf_argc++] = (char *)"-";
+ }
+ else if (renderer == GS)
+ {
+ /*
+ * Set resolution to avoid slow processing by the printer when the
+ * resolution of embedded images does not match the printer's resolution
+ */
+ snprintf(resolution, 127, "-r%d", xres);
+ pdf_argv[pdf_argc++] = resolution;
+ fprintf(stderr, "DEBUG: Using image rendering resolution %d dpi\n", xres);
+ /*
+ * PostScript debug mode: If you send a job with "lpr -o psdebug" Ghostscript
+ * will not compress the pages, so that the PostScript code can get
+ * analysed. This is especially important if a PostScript printer errors or
+ * misbehaves on Ghostscript's output.
+ * On Kyocera printers we always suppress page compression, to avoid slow
+ * processing of raster images.
+ */
+ val = cupsGetOption("psdebug", num_options, options);
+ if ((val && strcasecmp(val, "no") && strcasecmp(val, "off") &&
+ strcasecmp(val, "false")) ||
+ (ppd && ppd->manufacturer &&
+ !strncasecmp(ppd->manufacturer, "Kyocera", 7)))
+ {
+ fprintf(stderr, "DEBUG: Deactivated compression of pages in Ghostscript's PostScript output (\"psdebug\" debug mode or Kyocera printer)\n");
+ pdf_argv[pdf_argc++] = (char *)"-dCompressPages=false";
+ }
+ /*
+ * The PostScript interpreters on many printers have bugs which make
+ * the interpreter crash, error out, or otherwise misbehave on too
+ * heavily compressed input files, especially if code with compressed
+ * elements is compressed again. Therefore we reduce compression here.
+ */
+ pdf_argv[pdf_argc++] = (char *)"-dCompressFonts=false";
+ pdf_argv[pdf_argc++] = (char *)"-dNoT3CCITT";
+ if (ppd && ppd->manufacturer &&
+ !strncasecmp(ppd->manufacturer, "Brother", 7))
+ {
+ fprintf(stderr, "DEBUG: Deactivation of Ghostscript's image compression for Brother printers to workarounmd PS interpreter bug\n");
+ pdf_argv[pdf_argc++] = (char *)"-dEncodeMonoImages=false";
+ pdf_argv[pdf_argc++] = (char *)"-dEncodeColorImages=false";
+ }
+ pdf_argv[pdf_argc++] = (char *)"-c";
+ pdf_argv[pdf_argc++] = (char *)"save pop";
+ pdf_argv[pdf_argc++] = (char *)"-f";
+ pdf_argv[pdf_argc++] = filename;
+ }
+ /* acroread has to read from stdin */
+
+ pdf_argv[pdf_argc] = NULL;
+
+ /*
+ * Do we need post-processing of the PostScript output to work around bugs
+ * of the printer's PostScript interpreter?
+ */
+
+ if (renderer == PDFTOPS)
+ need_post_proc = 0;
+ else if (renderer == GS)
+ need_post_proc =
+ (ppd && ppd->manufacturer &&
+ (!strncasecmp(ppd->manufacturer, "Kyocera", 7) ||
+ !strncasecmp(ppd->manufacturer, "Brother", 7)) ? 1 : 0);
+ else
+ need_post_proc = 1;
+
+ /*
+ * Execute "pdftops/gs | pstops [ | post-processing ]"...
+ */
+
+ if (pipe(pstops_pipe))
+ {
+ perror("DEBUG: Unable to create pipe for pstops");
+
+ exit_status = 1;
+ goto error;
+ }
+
+ if (need_post_proc)
+ {
+ if (pipe(post_proc_pipe))
+ {
+ perror("DEBUG: Unable to create pipe for post-processing");
+
+ exit_status = 1;
+ goto error;
+ }
+ }
+
+ if ((pdf_pid = fork()) == 0)
+ {
+ /*
+ * Child comes here...
+ */
+
+ if (need_post_proc)
+ {
+ dup2(post_proc_pipe[1], 1);
+ close(post_proc_pipe[0]);
+ close(post_proc_pipe[1]);
+ }
+ else
+ dup2(pstops_pipe[1], 1);
+ close(pstops_pipe[0]);
+ close(pstops_pipe[1]);
+
+ if (renderer == PDFTOPS)
+ {
+ execv(CUPS_POPPLER_PDFTOPS, pdf_argv);
+ perror("DEBUG: Unable to execute pdftops program");
+ }
+ else if (renderer == GS)
+ {
+ execv(CUPS_GHOSTSCRIPT, pdf_argv);
+ perror("DEBUG: Unable to execute gs program");
+ }
+ else
+ {
+ /*
+ * use filename as stdin for acroread to force output to stdout
+ */
+
+ if ((fd = open(filename, O_RDONLY)))
+ {
+ dup2(fd, 0);
+ close(fd);
+ }
+
+ execv(CUPS_ACROREAD, pdf_argv);
+ perror("DEBUG: Unable to execute acroread program");
+ }
+
+ exit(1);
+ }
+ else if (pdf_pid < 0)
+ {
+ /*
+ * Unable to fork!
+ */
+
+ if (renderer == PDFTOPS)
+ perror("DEBUG: Unable to execute pdftops program");
+ else if (renderer == GS)
+ perror("DEBUG: Unable to execute gs program");
+ else
+ perror("DEBUG: Unable to execute acroread program");
+
+ exit_status = 1;
+ goto error;
+ }
+
+ fprintf(stderr, "DEBUG: Started filter %s (PID %d)\n", pdf_argv[0], pdf_pid);
+
+ if (need_post_proc)
+ {
+ if ((post_proc_pid = fork()) == 0)
+ {
+ /*
+ * Child comes here...
+ */
+
+ dup2(post_proc_pipe[0], 0);
+ close(post_proc_pipe[0]);
+ close(post_proc_pipe[1]);
+ dup2(pstops_pipe[1], 1);
+ close(pstops_pipe[0]);
+ close(pstops_pipe[1]);
+
+ fp = cupsFileStdin();
+
+ if (renderer == ACROREAD)
+ {
+ /*
+ * Set %Title and %For from filter arguments since acroread inserts
+ * garbage for these when using -toPostScript
+ */
+
+ while ((bytes = cupsFileGetLine(fp, buffer, sizeof(buffer))) > 0 &&
+ strncmp(buffer, "%%BeginProlog", 13))
+ {
+ if (strncmp(buffer, "%%Title", 7) == 0)
+ printf("%%%%Title: %s\n", argv[3]);
+ else if (strncmp(buffer, "%%For", 5) == 0)
+ printf("%%%%For: %s\n", argv[2]);
+ else
+ printf("%s", buffer);
+ }
+
+ /*
+ * Copy the rest of the file
+ */
+ while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
+ fwrite(buffer, 1, bytes, stdout);
+ }
+ else
+ {
+
+ /*
+ * Copy everything until after initial comments (Prolog section)
+ */
+ while ((bytes = cupsFileGetLine(fp, buffer, sizeof(buffer))) > 0 &&
+ strncmp(buffer, "%%BeginProlog", 13) &&
+ strncmp(buffer, "%%EndProlog", 11) &&
+ strncmp(buffer, "%%BeginSetup", 12) &&
+ strncmp(buffer, "%%Page:", 7))
+ printf("%s", buffer);
+
+ if (bytes > 0)
+ {
+ /*
+ * Insert PostScript interpreter bug fix code in the beginning of
+ * the Prolog section (before the first active PostScript code)
+ */
+ if (strncmp(buffer, "%%BeginProlog", 13))
+ {
+ /* No Prolog section, create one */
+ fprintf(stderr, "DEBUG: Adding Prolog section for workaround PostScript code\n");
+ puts("%%BeginProlog");
+ }
+ else
+ printf("%s", buffer);
+
+ if (renderer == GS && ppd && ppd->manufacturer)
+ {
+
+ /*
+ * Kyocera printers have a bug in their PostScript interpreter
+ * making them crashing on PostScript input data generated by
+ * Ghostscript's "ps2write" output device.
+ *
+ * The problem can be simply worked around by preceding the PostScript
+ * code with some extra bits.
+ *
+ * See https://bugs.launchpad.net/bugs/951627
+ *
+ * In addition, at least some of Kyocera's PostScript printers are
+ * very slow on rendering images which request interpolation. So we
+ * also add some code to eliminate interpolation requests.
+ *
+ * See https://bugs.launchpad.net/bugs/1026974
+ */
+
+ if (!strncasecmp(ppd->manufacturer, "Kyocera", 7))
+ {
+ fprintf(stderr, "DEBUG: Inserted workaround PostScript code for Kyocera printers\n");
+ puts("% ===== Workaround insertion by pdftops CUPS filter =====");
+ puts("% Kyocera's PostScript interpreter crashes on early name binding,");
+ puts("% so eliminate all \"bind\"s by redifining \"bind\" to no-op");
+ puts("/bind {} bind def");
+ puts("% Some Kyocera printers have an unacceptably slow implementation");
+ puts("% of image interpolation.");
+ puts("/image");
+ puts("{");
+ puts(" dup /Interpolate known");
+ puts(" {");
+ puts(" dup /Interpolate undef");
+ puts(" } if");
+ puts(" systemdict /image get exec");
+ puts("} def");
+ puts("% =====");
+ }
+
+ /*
+ * Brother printers have a bug in their PostScript interpreter
+ * making them printing one blank page if PostScript input data
+ * generated by Ghostscript's "ps2write" output device is used.
+ *
+ * The problem can be simply worked around by preceding the PostScript
+ * code with some extra bits.
+ *
+ * See https://bugs.launchpad.net/bugs/950713
+ */
+
+ else if (!strncasecmp(ppd->manufacturer, "Brother", 7))
+ {
+ fprintf(stderr, "DEBUG: Inserted workaround PostScript code for Brother printers\n");
+ puts("% ===== Workaround insertion by pdftops CUPS filter =====");
+ puts("% Brother's PostScript interpreter spits out the current page");
+ puts("% and aborts the job on the \"currenthalftone\" operator, so redefine");
+ puts("% it to null");
+ puts("/currenthalftone {//null} bind def");
+ puts("/orig.sethalftone systemdict /sethalftone get def");
+ puts("/sethalftone {dup //null eq not {//orig.sethalftone}{pop} ifelse} bind def");
+ puts("% =====");
+ }
+ }
+
+ if (strncmp(buffer, "%%BeginProlog", 13))
+ {
+ /* Close newly created Prolog section */
+ if (strncmp(buffer, "%%EndProlog", 11))
+ puts("%%EndProlog");
+ printf("%s", buffer);
+ }
+
+ /*
+ * Copy the rest of the file
+ */
+ while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
+ fwrite(buffer, 1, bytes, stdout);
+ }
+ }
+
+ exit(0);
+ }
+ else if (post_proc_pid < 0)
+ {
+ /*
+ * Unable to fork!
+ */
+
+ perror("DEBUG: Unable to execute post-processing process");
+
+ exit_status = 1;
+ goto error;
+ }
+
+ fprintf(stderr, "DEBUG: Started post-processing (PID %d)\n", post_proc_pid);
+ }
+
+ if ((pstops_pid = fork()) == 0)
+ {
+ /*
+ * Child comes here...
+ */
+
+ if (need_post_proc)
+ {
+ close(post_proc_pipe[0]);
+ close(post_proc_pipe[1]);
+ }
+ dup2(pstops_pipe[0], 0);
+ close(pstops_pipe[0]);
+ close(pstops_pipe[1]);
+
+ execv(pstops_path, pstops_argv);
+ perror("DEBUG: Unable to execute pstops program");
+
+ exit(1);
+ }
+ else if (pstops_pid < 0)
+ {
+ /*
+ * Unable to fork!
+ */
+
+ perror("DEBUG: Unable to execute pstops program");
+
+ exit_status = 1;
+ goto error;
+ }
+
+ fprintf(stderr, "DEBUG: Started filter pstops (PID %d)\n", pstops_pid);
+
+ close(pstops_pipe[0]);
+ close(pstops_pipe[1]);
+ if (need_post_proc)
+ {
+ close(post_proc_pipe[0]);
+ close(post_proc_pipe[1]);
+ }
+
+ /*
+ * Wait for the child processes to exit...
+ */
+
+ wait_children = 2 + need_post_proc;
+
+ while (wait_children > 0)
+ {
+ /*
+ * Wait until we get a valid process ID or the job is canceled...
+ */
+
+ while ((wait_pid = wait(&wait_status)) < 0 && errno == EINTR)
+ {
+ if (job_canceled)
+ {
+ kill(pdf_pid, SIGTERM);
+ if (need_post_proc)
+ kill(post_proc_pid, SIGTERM);
+ kill(pstops_pid, SIGTERM);
+
+ job_canceled = 0;
+ }
+ }
+
+ if (wait_pid < 0)
+ break;
+
+ wait_children --;
+
+ /*
+ * Report child status...
+ */
+
+ if (wait_status)
+ {
+ if (WIFEXITED(wait_status))
+ {
+ exit_status = WEXITSTATUS(wait_status);
+
+ fprintf(stderr, "DEBUG: PID %d (%s) stopped with status %d!\n",
+ wait_pid,
+ wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
+ (renderer == GS ? "gs" : "acroread")) :
+ (wait_pid == pstops_pid ? "pstops" : "Post-processing"),
+ exit_status);
+ }
+ else if (WTERMSIG(wait_status) == SIGTERM)
+ {
+ fprintf(stderr,
+ "DEBUG: PID %d (%s) was terminated normally with signal %d!\n",
+ wait_pid,
+ wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
+ (renderer == GS ? "gs" : "acroread")) :
+ (wait_pid == pstops_pid ? "pstops" : "Post-processing"),
+ exit_status);
+ }
+ else
+ {
+ exit_status = WTERMSIG(wait_status);
+
+ fprintf(stderr, "DEBUG: PID %d (%s) crashed on signal %d!\n", wait_pid,
+ wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
+ (renderer == GS ? "gs" : "acroread")) :
+ (wait_pid == pstops_pid ? "pstops" : "Post-processing"),
+ exit_status);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "DEBUG: PID %d (%s) exited with no errors.\n", wait_pid,
+ wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
+ (renderer == GS ? "gs" : "acroread")) :
+ (wait_pid == pstops_pid ? "pstops" : "Post-processing"));
+ }
+ }
+
+ /*
+ * Cleanup and exit...
+ */
+
+ error:
+
+ if (tempfile[0])
+ unlink(tempfile);
+
+ return (exit_status);
+}
+
+
+/*
+ * 'cancel_job()' - Flag the job as canceled.
+ */
+
+static void
+cancel_job(int sig) /* I - Signal number (unused) */
+{
+ (void)sig;
+
+ job_canceled = 1;
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+Copyright (c) 2008-2011 BBR Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+/*
+ pdftoraster.cc
+ pdf to raster filter
+*/
+
+#define USE_CMS
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_CPP_POPPLER_VERSION_H
+#include "cpp/poppler-version.h"
+#endif
+#include "goo/GooString.h"
+#include "goo/gmem.h"
+#include "Object.h"
+#include "Stream.h"
+#include "PDFDoc.h"
+#include "SplashOutputDev.h"
+#include "GfxState.h"
+#include <cups/cups.h>
+#include <cups/ppd.h>
+#include <stdarg.h>
+#include "PDFError.h"
+#include "GlobalParams.h"
+#include <cups/raster.h>
+#include <cupsfilters/image.h>
+#include <splash/SplashTypes.h>
+#include <splash/SplashBitmap.h>
+#include <strings.h>
+#include <math.h>
+#ifdef USE_LCMS1
+#include <lcms.h>
+#define cmsColorSpaceSignature icColorSpaceSignature
+#define cmsSetLogErrorHandler cmsSetErrorHandler
+#define cmsSigXYZData icSigXYZData
+#define cmsSigLuvData icSigLuvData
+#define cmsSigLabData icSigLabData
+#define cmsSigYCbCrData icSigYCbCrData
+#define cmsSigYxyData icSigYxyData
+#define cmsSigRgbData icSigRgbData
+#define cmsSigHsvData icSigHsvData
+#define cmsSigHlsData icSigHlsData
+#define cmsSigCmyData icSigCmyData
+#define cmsSig3colorData icSig3colorData
+#define cmsSigGrayData icSigGrayData
+#define cmsSigCmykData icSigCmykData
+#define cmsSig4colorData icSig4colorData
+#define cmsSig2colorData icSig2colorData
+#define cmsSig5colorData icSig5colorData
+#define cmsSig6colorData icSig6colorData
+#define cmsSig7colorData icSig7colorData
+#define cmsSig8colorData icSig8colorData
+#define cmsSig9colorData icSig9colorData
+#define cmsSig10colorData icSig10colorData
+#define cmsSig11colorData icSig11colorData
+#define cmsSig12colorData icSig12colorData
+#define cmsSig13colorData icSig13colorData
+#define cmsSig14colorData icSig14colorData
+#define cmsSig15colorData icSig15colorData
+#else
+#include <lcms2.h>
+#endif
+
+#define MAX_CHECK_COMMENT_LINES 20
+#define MAX_BYTES_PER_PIXEL 32
+
+namespace {
+ typedef unsigned char *(*ConvertLineFunc)(unsigned char *src,
+ unsigned char *dst, unsigned int row, unsigned int plane,
+ unsigned int pixels, unsigned int size);
+ typedef unsigned char *(*ConvertCSpaceFunc)(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y);
+ typedef unsigned char *(*ConvertBitsFunc)(unsigned char *src,
+ unsigned char *dst, unsigned int x, unsigned int y);
+ typedef void (*WritePixelFunc)(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf);
+
+ int exitCode = 0;
+ int deviceCopies = 1;
+ bool deviceCollate = false;
+ cups_page_header2_t header;
+ ppd_file_t *ppd = 0;
+ unsigned int bitmapoffset[2];
+ unsigned int popplerBitsPerPixel;
+ unsigned int popplerNumColors;
+ /* image swapping */
+ bool swap_image_x = false;
+ bool swap_image_y = false;
+ /* margin swapping */
+ bool swap_margin_x = false;
+ bool swap_margin_y = false;
+ bool allocLineBuf = false;
+ ConvertLineFunc convertLineOdd;
+ ConvertLineFunc convertLineEven;
+ ConvertCSpaceFunc convertCSpace;
+ ConvertBitsFunc convertBits;
+ WritePixelFunc writePixel;
+ unsigned int nplanes;
+ unsigned int nbands;
+ unsigned int bytesPerLine; /* number of bytes per line */
+ /* Note: When CUPS_ORDER_BANDED,
+ cupsBytesPerLine = bytesPerLine*cupsNumColors */
+ unsigned char revTable[256] = {
+0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0,0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0,
+0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8,0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8,
+0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4,0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4,
+0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec,0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc,
+0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2,0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2,
+0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea,0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa,
+0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6,0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6,
+0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee,0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe,
+0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1,0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1,
+0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9,0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9,
+0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5,0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5,
+0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed,0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd,
+0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3,0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3,
+0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb,0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb,
+0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7,0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7,
+0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef,0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
+ };
+ unsigned int dither1[16][16] = {
+ {0,128,32,160,8,136,40,168,2,130,34,162,10,138,42,170},
+ {192,64,224,96,200,72,232,104,194,66,226,98,202,74,234,106},
+ {48,176,16,144,56,184,24,152,50,178,18,146,58,186,26,154},
+ {240,112,208,80,248,120,216,88,242,114,210,82,250,122,218,90},
+ {12,140,44,172,4,132,36,164,14,142,46,174,6,134,38,166},
+ {204,76,236,108,196,68,228,100,206,78,238,110,198,70,230,102},
+ {60,188,28,156,52,180,20,148,62,190,30,158,54,182,22,150},
+ {252,124,220,92,244,116,212,84,254,126,222,94,246,118,214,86},
+ {3,131,35,163,11,139,43,171,1,129,33,161,9,137,41,169},
+ {195,67,227,99,203,75,235,107,193,65,225,97,201,73,233,105},
+ {51,179,19,147,59,187,27,155,49,177,17,145,57,185,25,153},
+ {243,115,211,83,251,123,219,91,241,113,209,81,249,121,217,89},
+ {15,143,47,175,7,135,39,167,13,141,45,173,5,133,37,165},
+ {207,79,239,111,199,71,231,103,205,77,237,109,197,69,229,101},
+ {63,191,31,159,55,183,23,151,61,189,29,157,53,181,21,149},
+ {255,127,223,95,247,119,215,87,253,125,221,93,245,117,213,85}
+ };
+ unsigned int dither2[8][8] = {
+ {0,32,8,40,2,34,10,42},
+ {48,16,56,24,50,18,58,26},
+ {12,44,4,36,14,46,6,38},
+ {60,28,52,20,62,30,54,22},
+ {3,35,11,43,1,33,9,41},
+ {51,19,59,27,49,17,57,25},
+ {15,47,7,39,13,45,5,37},
+ {63,31,55,23,61,29,53,21}
+ };
+ unsigned int dither4[4][4] = {
+ {0,8,2,10},
+ {12,4,14,6},
+ {3,11,1,9},
+ {15,7,13,5}
+ };
+ /* for color profiles */
+ cmsHPROFILE colorProfile = NULL;
+ cmsHPROFILE popplerColorProfile = NULL;
+ cmsHTRANSFORM colorTransform = NULL;
+ cmsCIEXYZ D65WhitePoint;
+ int renderingIntent = INTENT_PERCEPTUAL;
+}
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+void CDECL myErrorFun(void *data, ErrorCategory category,
+ int pos, char *msg)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ fprintf(stderr, "%s\n",msg);
+ fflush(stderr);
+}
+#else
+void CDECL myErrorFun(int pos, char *msg, va_list args)
+{
+ if (pos >= 0) {
+ fprintf(stderr, "ERROR (%d): ", pos);
+ } else {
+ fprintf(stderr, "ERROR: ");
+ }
+ vfprintf(stderr, msg, args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+}
+#endif
+
+#ifdef USE_LCMS1
+static int lcmsErrorHandler(int ErrorCode, const char *ErrorText)
+{
+ fprintf(stderr, "ERROR: %s\n",ErrorText);
+ return 1;
+}
+#else
+static void lcmsErrorHandler(cmsContext contextId, cmsUInt32Number ErrorCode,
+ const char *ErrorText)
+{
+ fprintf(stderr, "ERROR: %s\n",ErrorText);
+}
+#endif
+
+static GBool getColorProfilePath(ppd_file_t *ppd, GooString *path)
+{
+ // get color profile path
+ const char *colorModel;
+ const char *cupsICCQualifier2;
+ const char *cupsICCQualifier2Choice;
+ const char *cupsICCQualifier3;
+ const char *cupsICCQualifier3Choice;
+ ppd_attr_t *attr;
+ ppd_choice_t *choice;
+
+ if ((choice = ppdFindMarkedChoice(ppd,"ColorModel")) != NULL) {
+ colorModel = choice->choice;
+ } else {
+ colorModel = NULL;
+ }
+ if ((attr = ppdFindAttr(ppd,"cupsICCQualifier2",NULL)) != NULL) {
+ cupsICCQualifier2 = attr->value;
+ } else {
+ cupsICCQualifier2 = "MediaType";
+ }
+ if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier2)) != NULL) {
+ cupsICCQualifier2Choice = choice->choice;
+ } else {
+ cupsICCQualifier2Choice = NULL;
+ }
+ if ((attr = ppdFindAttr(ppd,"cupsICCQualifier3",NULL)) != NULL) {
+ cupsICCQualifier3 = attr->value;
+ } else {
+ cupsICCQualifier3 = "Resolution";
+ }
+ if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier3)) != NULL) {
+ cupsICCQualifier3Choice = choice->choice;
+ } else {
+ cupsICCQualifier3Choice = NULL;
+ }
+
+ for (attr = ppdFindAttr(ppd,"cupsICCProfile",NULL);attr != NULL;
+ attr = ppdFindNextAttr(ppd,"cupsICCProfile",NULL)) {
+ // check color model
+ char buf[PPD_MAX_NAME];
+ char *p, *r;
+
+ strncpy(buf,attr->spec,sizeof(buf));
+ if ((p = strchr(buf,'.')) != NULL) {
+ *p = '\0';
+ }
+ if (colorModel != NULL && buf[0] != '\0'
+ && strcasecmp(buf,colorModel) != 0) continue;
+ if (p == NULL) {
+ break;
+ } else {
+ p++;
+ if ((r = strchr(p,'.')) != 0) {
+ *r = '\0';
+ }
+ }
+ if (cupsICCQualifier2Choice != NULL && p[0] != '\0'
+ && strcasecmp(p,cupsICCQualifier2Choice) != 0) continue;
+ if (r == NULL) {
+ break;
+ } else {
+ r++;
+ if ((p = strchr(r,'.')) != 0) {
+ *p = '\0';
+ }
+ }
+ if (cupsICCQualifier3Choice == NULL || r[0] == '\0'
+ || strcasecmp(r,cupsICCQualifier3Choice) == 0) break;
+ }
+ if (attr != NULL) {
+ // matched
+ path->clear();
+ if (attr->value[0] != '/') {
+ path->append(CUPS_DATADIR);
+ path->append("/profiles/");
+ }
+ path->append(attr->value);
+ return gTrue;
+ }
+ return gFalse;
+}
+
+static void handleRqeuiresPageRegion() {
+ ppd_choice_t *mf;
+ ppd_choice_t *is;
+ ppd_attr_t *rregions = NULL;
+ ppd_size_t *size;
+
+ if ((size = ppdPageSize(ppd,NULL)) == NULL) return;
+ mf = ppdFindMarkedChoice(ppd,"ManualFeed");
+ if ((is = ppdFindMarkedChoice(ppd,"InputSlot")) != NULL) {
+ rregions = ppdFindAttr(ppd,"RequiresPageRegion",is->choice);
+ }
+ if (rregions == NULL) {
+ rregions = ppdFindAttr(ppd,"RequiresPageRegion","All");
+ }
+ if (!strcasecmp(size->name,"Custom") || (!mf && !is) ||
+ (mf && !strcasecmp(mf->choice,"False") &&
+ (!is || (is->code && !is->code[0]))) ||
+ (!rregions && ppd->num_filters > 0)) {
+ ppdMarkOption(ppd,"PageSize",size->name);
+ } else if (rregions && rregions->value
+ && !strcasecmp(rregions->value,"True")) {
+ ppdMarkOption(ppd,"PageRegion",size->name);
+ } else {
+ ppd_choice_t *page;
+
+ if ((page = ppdFindMarkedChoice(ppd,"PageSize")) != NULL) {
+ page->marked = 0;
+ cupsArrayRemove(ppd->marked,page);
+ }
+ if ((page = ppdFindMarkedChoice(ppd,"PageRegion")) != NULL) {
+ page->marked = 0;
+ cupsArrayRemove(ppd->marked, page);
+ }
+ }
+}
+
+static void parseOpts(int argc, char **argv)
+{
+ int num_options = 0;
+ cups_option_t *options = 0;
+ GooString profilePath;
+ ppd_attr_t *attr;
+
+ if (argc < 6 || argc > 7) {
+ pdfError(-1,const_cast<char *>("%s job-id user title copies options [file]"),
+ argv[0]);
+ exit(1);
+ }
+
+ ppd = ppdOpenFile(getenv("PPD"));
+ if (ppd == NULL) {
+ pdfError(-1,const_cast<char *>("PPD file is not specified"));
+ exit(1);
+ }
+ ppdMarkDefaults(ppd);
+ options = NULL;
+ num_options = cupsParseOptions(argv[5],0,&options);
+ cupsMarkOptions(ppd,num_options,options);
+ handleRqeuiresPageRegion();
+ cupsRasterInterpretPPD(&header,ppd,num_options,options,0);
+ attr = ppdFindAttr(ppd,"pdftorasterRenderingIntent",NULL);
+ if (attr != NULL && attr->value != NULL) {
+ if (strcasecmp(attr->value,"PERCEPTUAL") != 0) {
+ renderingIntent = INTENT_PERCEPTUAL;
+ } else if (strcasecmp(attr->value,"RELATIVE_COLORIMETRIC") != 0) {
+ renderingIntent = INTENT_RELATIVE_COLORIMETRIC;
+ } else if (strcasecmp(attr->value,"SATURATION") != 0) {
+ renderingIntent = INTENT_SATURATION;
+ } else if (strcasecmp(attr->value,"ABSOLUTE_COLORIMETRIC") != 0) {
+ renderingIntent = INTENT_ABSOLUTE_COLORIMETRIC;
+ }
+ }
+ if (header.Duplex) {
+ /* analyze options relevant to Duplex */
+ const char *backside = "";
+ /* APDuplexRequiresFlippedMargin */
+ enum {
+ FM_NO, FM_FALSE, FM_TRUE
+ } flippedMargin = FM_NO;
+
+ attr = ppdFindAttr(ppd,"cupsBackSide",NULL);
+ if (attr != NULL && attr->value != NULL) {
+ ppd->flip_duplex = 0;
+ backside = attr->value;
+ } else if (ppd->flip_duplex) {
+ backside = "Rotated"; /* compatible with Max OS and GS 8.71 */
+ }
+
+ attr = ppdFindAttr(ppd,"APDuplexRequiresFlippedMargin",NULL);
+ if (attr != NULL && attr->value != NULL) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ flippedMargin = FM_TRUE;
+ } else {
+ flippedMargin = FM_FALSE;
+ }
+ }
+ if (strcasecmp(backside,"ManualTumble") == 0 && header.Tumble) {
+ swap_image_x = swap_image_y = true;
+ swap_margin_x = swap_margin_y = true;
+ if (flippedMargin == FM_TRUE) {
+ swap_margin_y = false;
+ }
+ } else if (strcasecmp(backside,"Rotated") == 0 && !header.Tumble) {
+ swap_image_x = swap_image_y = true;
+ swap_margin_x = swap_margin_y = true;
+ if (flippedMargin == FM_TRUE) {
+ swap_margin_y = false;
+ }
+ } else if (strcasecmp(backside,"Flipped") == 0) {
+ if (header.Tumble) {
+ swap_image_x = true;
+ swap_margin_x = swap_margin_y = true;
+ } else {
+ swap_image_y = true;
+ }
+ if (flippedMargin == FM_FALSE) {
+ swap_margin_y = !swap_margin_y;
+ }
+ }
+ }
+ if (getColorProfilePath(ppd,&profilePath)) {
+ /* ICCProfile is specified */
+ colorProfile = cmsOpenProfileFromFile(profilePath.getCString(),"r");
+ }
+}
+
+static void parsePDFTOPDFComment(FILE *fp)
+{
+ char buf[4096];
+ int i;
+
+ /* skip until PDF start header */
+ while (fgets(buf,sizeof(buf),fp) != 0) {
+ if (strncmp(buf,"%PDF",4) == 0) {
+ break;
+ }
+ }
+ for (i = 0;i < MAX_CHECK_COMMENT_LINES;i++) {
+ if (fgets(buf,sizeof(buf),fp) == 0) break;
+ if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) {
+ char *p;
+
+ p = strchr(buf+19,':');
+ deviceCopies = atoi(p+1);
+ } else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
+ char *p;
+
+ p = strchr(buf+17,':');
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ deviceCollate = true;
+ } else {
+ deviceCollate = false;
+ }
+ }
+ }
+}
+
+static unsigned char *reverseLine(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *p = src;
+
+ for (unsigned int j = 0;j < size;j++,p++) {
+ *p = ~*p;
+ }
+ return src;
+}
+
+static unsigned char *reverseLineSwapByte(unsigned char *src,
+ unsigned char *dst, unsigned int row, unsigned int plane,
+ unsigned int pixels, unsigned int size)
+{
+ unsigned char *bp = src+size-1;
+ unsigned char *dp = dst;
+
+ for (unsigned int j = 0;j < size;j++,bp--,dp++) {
+ *dp = ~*bp;
+ }
+ return dst;
+}
+
+
+static unsigned char *reverseLineSwapBit(unsigned char *src,
+ unsigned char *dst, unsigned int row, unsigned int plane,
+ unsigned int pixels, unsigned int size)
+{
+ unsigned char *bp;
+ unsigned char *dp;
+ unsigned int npadbits = (size*8)-pixels;
+
+ if (npadbits == 0) {
+ bp = src+size-1;
+ dp = dst;
+ for (unsigned int j = 0;j < size;j++,bp--,dp++) {
+ *dp = revTable[~*bp];
+ }
+ } else {
+ unsigned int pd,d;
+ unsigned int sw;
+
+ size = (pixels+7)/8;
+ sw = (size*8)-pixels;
+ bp = src+size-1;
+ dp = dst;
+
+ pd = *bp--;
+ for (unsigned int j = 1;j < size;j++,bp--,dp++) {
+ d = *bp;
+ *dp = ~revTable[(((d << 8) | pd) >> sw) & 0xff];
+ pd = d;
+ }
+ *dp = ~revTable[(pd >> sw) & 0xff];
+ }
+ return dst;
+}
+
+static unsigned char *rgbToCMYKLine(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ cupsImageRGBToCMYK(src,dst,pixels);
+ return dst;
+}
+
+static unsigned char *rgbToCMYKLineSwap(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src+(pixels-1)*3;
+ unsigned char *dp = dst;
+
+ for (unsigned int i = 0;i < pixels;i++, bp -= 3, dp += 4) {
+ cupsImageRGBToCMYK(bp,dp,1);
+ }
+ return dst;
+}
+
+static unsigned char *rgbToCMYLine(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ cupsImageRGBToCMY(src,dst,pixels);
+ return dst;
+}
+
+static unsigned char *rgbToCMYLineSwap(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src+size-3;
+ unsigned char *dp = dst;
+
+ for (unsigned int i = 0;i < pixels;i++, bp -= 3, dp += 3) {
+ cupsImageRGBToCMY(bp,dp,1);
+ }
+ return dst;
+}
+
+static unsigned char *rgbToKCMYLine(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src;
+ unsigned char *dp = dst;
+ unsigned char d;
+
+ cupsImageRGBToCMYK(src,dst,pixels);
+ /* CMYK to KCMY */
+ for (unsigned int i = 0;i < pixels;i++, bp += 3, dp += 4) {
+ d = dp[3];
+ dp[3] = dp[2];
+ dp[2] = dp[1];
+ dp[1] = dp[0];
+ dp[0] = d;
+ }
+ return dst;
+}
+
+static unsigned char *rgbToKCMYLineSwap(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src+(pixels-1)*3;
+ unsigned char *dp = dst;
+ unsigned char d;
+
+ for (unsigned int i = 0;i < pixels;i++, bp -= 3, dp += 4) {
+ cupsImageRGBToCMYK(bp,dp,1);
+ /* CMYK to KCMY */
+ d = dp[3];
+ dp[3] = dp[2];
+ dp[2] = dp[1];
+ dp[1] = dp[0];
+ dp[0] = d;
+ }
+ return dst;
+}
+
+static unsigned char *lineNoop(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ /* do nothing */
+ return src;
+}
+
+static unsigned char *lineSwap24(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src+size-3;
+ unsigned char *dp = dst;
+
+ for (unsigned int i = 0;i < pixels;i++, bp -= 3, dp += 3) {
+ dp[0] = bp[0];
+ dp[1] = bp[1];
+ dp[2] = bp[2];
+ }
+ return dst;
+}
+
+static unsigned char *lineSwapByte(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp = src+size-1;
+ unsigned char *dp = dst;
+
+ for (unsigned int j = 0;j < size;j++,bp--,dp++) {
+ *dp = *bp;
+ }
+ return dst;
+}
+
+static unsigned char *lineSwapBit(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ unsigned char *bp;
+ unsigned char *dp;
+ unsigned int npadbits = (size*8)-pixels;
+
+ if (npadbits == 0) {
+ bp = src+size-1;
+ dp = dst;
+ for (unsigned int j = 0;j < size;j++,bp--,dp++) {
+ *dp = revTable[*bp];
+ }
+ } else {
+ unsigned int pd,d;
+ unsigned int sw;
+
+ size = (pixels+7)/8;
+ sw = (size*8)-pixels;
+ bp = src+size-1;
+ dp = dst;
+
+ pd = *bp--;
+ for (unsigned int j = 1;j < size;j++,bp--,dp++) {
+ d = *bp;
+ *dp = revTable[(((d << 8) | pd) >> sw) & 0xff];
+ pd = d;
+ }
+ *dp = revTable[(pd >> sw) & 0xff];
+ }
+ return dst;
+}
+
+typedef struct _funcTable {
+ enum cups_cspace_e cspace;
+ unsigned int bitsPerPixel;
+ unsigned int bitsPerColor;
+ ConvertLineFunc convertLine;
+ bool allocLineBuf;
+ ConvertLineFunc convertLineSwap;
+ bool allocLineBufSwap;
+} FuncTable;
+
+static FuncTable specialCaseFuncs[] = {
+ {CUPS_CSPACE_K,8,8,reverseLine,false,reverseLineSwapByte,true},
+ {CUPS_CSPACE_K,1,1,reverseLine,false,reverseLineSwapBit,true},
+ {CUPS_CSPACE_GOLD,8,8,reverseLine,false,reverseLineSwapByte,true},
+ {CUPS_CSPACE_GOLD,1,1,reverseLine,false,reverseLineSwapBit,true},
+ {CUPS_CSPACE_SILVER,8,8,reverseLine,false,reverseLineSwapByte,true},
+ {CUPS_CSPACE_SILVER,1,1,reverseLine,false,reverseLineSwapBit,true},
+ {CUPS_CSPACE_CMYK,32,8,rgbToCMYKLine,true,rgbToCMYKLineSwap,true},
+ {CUPS_CSPACE_KCMY,32,8,rgbToKCMYLine,true,rgbToKCMYLineSwap,true},
+ {CUPS_CSPACE_CMY,24,8,rgbToCMYLine,true,rgbToCMYLineSwap,true},
+ {CUPS_CSPACE_RGB,24,8,lineNoop,false,lineSwap24,true},
+ {CUPS_CSPACE_W,8,8,lineNoop,false,lineSwapByte,true},
+ {CUPS_CSPACE_W,1,1,lineNoop,false,lineSwapBit,true},
+ {CUPS_CSPACE_WHITE,8,8,lineNoop,false,lineSwapByte,true},
+ {CUPS_CSPACE_WHITE,1,1,lineNoop,false,lineSwapBit,true},
+ {CUPS_CSPACE_RGB,0,0,NULL,false,NULL,false} /* end mark */
+};
+
+static unsigned char *convertCSpaceNone(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ return src;
+}
+
+static unsigned char *convertCSpaceWithProfiles(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ cmsDoTransform(colorTransform,src,pixelBuf,1);
+ return pixelBuf;
+}
+
+static unsigned char *convertCSpaceXYZ8(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ double alab[3];
+
+ cmsDoTransform(colorTransform,src,alab,1);
+ cmsCIELab lab;
+ cmsCIEXYZ xyz;
+
+ lab.L = alab[0];
+ lab.a = alab[1];
+ lab.b = alab[2];
+
+ cmsLab2XYZ(&D65WhitePoint,&xyz,&lab);
+ pixelBuf[0] = 231.8181*xyz.X+0.5;
+ pixelBuf[1] = 231.8181*xyz.Y+0.5;
+ pixelBuf[2] = 231.8181*xyz.Z+0.5;
+ return pixelBuf;
+}
+
+static unsigned char *convertCSpaceXYZ16(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ double alab[3];
+ unsigned short *sd = (unsigned short *)pixelBuf;
+
+ cmsDoTransform(colorTransform,src,alab,1);
+ cmsCIELab lab;
+ cmsCIEXYZ xyz;
+
+ lab.L = alab[0];
+ lab.a = alab[1];
+ lab.b = alab[2];
+
+ cmsLab2XYZ(&D65WhitePoint,&xyz,&lab);
+ sd[0] = 59577.2727*xyz.X+0.5;
+ sd[1] = 59577.2727*xyz.Y+0.5;
+ sd[2] = 59577.2727*xyz.Z+0.5;
+ return pixelBuf;
+}
+
+static unsigned char *convertCSpaceLab8(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ double lab[3];
+ cmsDoTransform(colorTransform,src,lab,1);
+ pixelBuf[0] = 2.55*lab[0]+0.5;
+ pixelBuf[1] = lab[1]+128.5;
+ pixelBuf[2] = lab[2]+128.5;
+ return pixelBuf;
+}
+
+static unsigned char *convertCSpaceLab16(unsigned char *src,
+ unsigned char *pixelBuf, unsigned int x, unsigned int y)
+{
+ double lab[3];
+ cmsDoTransform(colorTransform,src,lab,1);
+ unsigned short *sd = (unsigned short *)pixelBuf;
+ sd[0] = 655.35*lab[0]+0.5;
+ sd[1] = 256*(lab[1]+128)+0.5;
+ sd[2] = 256*(lab[2]+128)+0.5;
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toRGBA(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ unsigned char *dp = pixelBuf;
+
+ for (int i = 0;i < 3;i++) {
+ *dp++ = *src++;
+ }
+ *dp = 255;
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toRGBW(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ unsigned char cmyk[4];
+ unsigned char *dp = pixelBuf;
+
+ cupsImageRGBToCMYK(src,cmyk,1);
+ for (int i = 0;i < 4;i++) {
+ *dp++ = ~cmyk[i];
+ }
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toCMYK(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ cupsImageRGBToCMYK(src,pixelBuf,1);
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toCMY(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ cupsImageRGBToCMY(src,pixelBuf,1);
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toYMC(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ cupsImageRGBToCMY(src,pixelBuf,1);
+ /* swap C and Y */
+ unsigned char d = pixelBuf[0];
+ pixelBuf[0] = pixelBuf[2];
+ pixelBuf[2] = d;
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toKCMY(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ cupsImageRGBToCMYK(src,pixelBuf,1);
+ unsigned char d = pixelBuf[3];
+ pixelBuf[3] = pixelBuf[2];
+ pixelBuf[2] = pixelBuf[1];
+ pixelBuf[1] = pixelBuf[0];
+ pixelBuf[0] = d;
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toKCMYcm(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ unsigned char cmyk[4];
+ unsigned char c;
+ unsigned char d;
+
+ cupsImageRGBToCMYK(src,cmyk,1);
+ c = 0;
+ d = dither1[y & 0xf][x & 0xf];
+ /* K */
+ if (cmyk[3] > d) {
+ c |= 0x20;
+ }
+ /* C */
+ if (cmyk[0] > d) {
+ c |= 0x10;
+ }
+ /* M */
+ if (cmyk[1] > d) {
+ c |= 0x08;
+ }
+ /* Y */
+ if (cmyk[2] > d) {
+ c |= 0x04;
+ }
+ if (c == 0x18) { /* Blue */
+ c = 0x11; /* cyan + light magenta */
+ } else if (c == 0x14) { /* Green */
+ c = 0x06; /* light cyan + yellow */
+ }
+ *pixelBuf = c;
+ return pixelBuf;
+}
+
+static unsigned char *RGB8toYMCK(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ cupsImageRGBToCMYK(src,pixelBuf,1);
+ /* swap C and Y */
+ unsigned char d = pixelBuf[0];
+ pixelBuf[0] = pixelBuf[2];
+ pixelBuf[2] = d;
+ return pixelBuf;
+}
+
+static unsigned char *W8toK8(unsigned char *src, unsigned char *pixelBuf,
+ unsigned int x, unsigned int y)
+{
+ *pixelBuf = ~(*src);
+ return pixelBuf;
+}
+
+static unsigned char *convertBitsNoop(unsigned char *src, unsigned char *dst,
+ unsigned int x, unsigned int y)
+{
+ return src;
+}
+
+static unsigned char *convert8to1(unsigned char *src, unsigned char *dst,
+ unsigned int x, unsigned int y)
+{
+ unsigned char c = 0;
+ /* assumed that max number of colors is 4 */
+ for (unsigned int i = 0;i < header.cupsNumColors;i++) {
+ c <<= 1;
+ /* ordered dithering */
+ if (src[i] > dither1[y & 0xf][x & 0xf]) {
+ c |= 0x1;
+ }
+ }
+ *dst = c;
+ return dst;
+}
+
+static unsigned char *convert8to2(unsigned char *src, unsigned char *dst,
+ unsigned int x, unsigned int y)
+{
+ unsigned char c = 0;
+ /* assumed that max number of colors is 4 */
+ for (unsigned int i = 0;i < header.cupsNumColors;i++) {
+ unsigned int d;
+
+ c <<= 2;
+ /* ordered dithering */
+ d = src[i] + dither2[y & 0x7][x & 0x7];
+ if (d > 255) d = 255;
+ c |= d >> 6;
+ }
+ *dst = c;
+ return dst;
+}
+
+static unsigned char *convert8to4(unsigned char *src, unsigned char *dst,
+ unsigned int x, unsigned int y)
+{
+ unsigned short c = 0;
+
+ /* assumed that max number of colors is 4 */
+ for (unsigned int i = 0;i < header.cupsNumColors;i++) {
+ unsigned int d;
+
+ c <<= 4;
+ /* ordered dithering */
+ d = src[i] + dither4[y & 0x3][x & 0x3];
+ if (d > 255) d = 255;
+ c |= d >> 4;
+ }
+ if (header.cupsNumColors < 3) {
+ dst[0] = c;
+ } else {
+ dst[0] = c >> 8;
+ dst[1] = c;
+ }
+ return dst;
+}
+
+static unsigned char *convert8to16(unsigned char *src, unsigned char *dst,
+ unsigned int x, unsigned int y)
+{
+ /* assumed that max number of colors is 4 */
+ for (unsigned int i = 0;i < header.cupsNumColors;i++) {
+ dst[i*2] = src[i];
+ dst[i*2+1] = src[i];
+ }
+ return dst;
+}
+
+static void writePixel1(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ switch (header.cupsNumColors) {
+ case 1:
+ {
+ unsigned int bo = pixeli & 0x7;
+ if ((pixeli & 7) == 0) dst[pixeli/8] = 0;
+ dst[pixeli/8] |= *pixelBuf << (7-bo);
+ }
+ break;
+ case 6:
+ dst[pixeli] = *pixelBuf;
+ break;
+ case 3:
+ case 4:
+ default:
+ {
+ unsigned int qo = (pixeli & 0x1)*4;
+ if ((pixeli & 1) == 0) dst[pixeli/2] = 0;
+ dst[pixeli/2] |= *pixelBuf << (4-qo);
+ }
+ break;
+ }
+}
+
+static void writePlanePixel1(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ unsigned int bo = pixeli & 0x7;
+ unsigned char so = header.cupsNumColors - plane - 1;
+ if ((pixeli & 7) == 0) dst[pixeli/8] = 0;
+ dst[pixeli/8] |= ((*pixelBuf >> so) & 1) << (7-bo);
+}
+
+static void writePixel2(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ switch (header.cupsNumColors) {
+ case 1:
+ {
+ unsigned int bo = (pixeli & 0x3)*2;
+ if ((pixeli & 3) == 0) dst[pixeli/4] = 0;
+ dst[pixeli/4] |= *pixelBuf << (6-bo);
+ }
+ break;
+ case 3:
+ case 4:
+ default:
+ dst[pixeli] = *pixelBuf;
+ break;
+ }
+}
+
+static void writePlanePixel2(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ unsigned int bo = (pixeli & 0x3)*2;
+ unsigned char so = (header.cupsNumColors - plane - 1)*2;
+ if ((pixeli & 3) == 0) dst[pixeli/4] = 0;
+ dst[pixeli/4] |= ((*pixelBuf >> so) & 3) << (6-bo);
+}
+
+static void writePixel4(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ switch (header.cupsNumColors) {
+ case 1:
+ {
+ unsigned int bo = (pixeli & 0x1)*4;
+ if ((pixeli & 1) == 0) dst[pixeli/2] = 0;
+ dst[pixeli/2] |= *pixelBuf << (4-bo);
+ }
+ break;
+ case 3:
+ case 4:
+ default:
+ dst[pixeli*2] = pixelBuf[0];
+ dst[pixeli*2+1] = pixelBuf[1];
+ break;
+ }
+}
+
+static void writePlanePixel4(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ unsigned short c = (pixelBuf[0] << 8) | pixelBuf[1];
+ unsigned int bo = (pixeli & 0x1)*4;
+ unsigned char so = (header.cupsNumColors - plane - 1)*4;
+ if ((pixeli & 1) == 0) dst[pixeli/2] = 0;
+ dst[pixeli/2] |= ((c >> so) & 0xf) << (4-bo);
+}
+
+static void writePixel8(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ unsigned char *dp = dst + pixeli*header.cupsNumColors;
+ for (unsigned int i = 0;i < header.cupsNumColors;i++) {
+ dp[i] = pixelBuf[i];
+ }
+}
+
+static void writePlanePixel8(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ dst[pixeli] = pixelBuf[plane];
+}
+
+static void writePixel16(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ unsigned char *dp = dst + pixeli*header.cupsNumColors*2;
+ for (unsigned int i = 0;i < header.cupsNumColors*2;i++) {
+ dp[i] = pixelBuf[i];
+ }
+}
+
+static void writePlanePixel16(unsigned char *dst,
+ unsigned int plane, unsigned int pixeli, unsigned char *pixelBuf)
+{
+ dst[pixeli*2] = pixelBuf[plane*2];
+ dst[pixeli*2+1] = pixelBuf[plane*2+1];
+}
+
+static unsigned char *convertLineChunked(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ /* Assumed that BitsPerColor is 8 */
+ for (unsigned int i = 0;i < pixels;i++) {
+ unsigned char pixelBuf1[MAX_BYTES_PER_PIXEL];
+ unsigned char pixelBuf2[MAX_BYTES_PER_PIXEL];
+ unsigned char *pb;
+
+ pb = convertCSpace(src+i*popplerNumColors,pixelBuf1,i,row);
+ pb = convertBits(pb,pixelBuf2,i,row);
+ writePixel(dst,0,i,pb);
+ }
+ return dst;
+}
+
+static unsigned char *convertLineChunkedSwap(unsigned char *src,
+ unsigned char *dst, unsigned int row, unsigned int plane,
+ unsigned int pixels, unsigned int size)
+{
+ /* Assumed that BitsPerColor is 8 */
+ for (unsigned int i = 0;i < pixels;i++) {
+ unsigned char pixelBuf1[MAX_BYTES_PER_PIXEL];
+ unsigned char pixelBuf2[MAX_BYTES_PER_PIXEL];
+ unsigned char *pb;
+
+ pb = convertCSpace(src+(pixels-i-1)*popplerNumColors,pixelBuf1,i,row);
+ pb = convertBits(pb,pixelBuf2,i,row);
+ writePixel(dst,0,i,pb);
+ }
+ return dst;
+}
+
+static unsigned char *convertLinePlane(unsigned char *src, unsigned char *dst,
+ unsigned int row, unsigned int plane, unsigned int pixels,
+ unsigned int size)
+{
+ /* Assumed that BitsPerColor is 8 */
+ for (unsigned int i = 0;i < pixels;i++) {
+ unsigned char pixelBuf1[MAX_BYTES_PER_PIXEL];
+ unsigned char pixelBuf2[MAX_BYTES_PER_PIXEL];
+ unsigned char *pb;
+
+ pb = convertCSpace(src+i*popplerNumColors,pixelBuf1,i,row);
+ pb = convertBits(pb,pixelBuf2,i,row);
+ writePixel(dst,plane,i,pb);
+ }
+ return dst;
+}
+
+static unsigned char *convertLinePlaneSwap(unsigned char *src,
+ unsigned char *dst, unsigned int row, unsigned int plane,
+ unsigned int pixels, unsigned int size)
+{
+ for (unsigned int i = 0;i < pixels;i++) {
+ unsigned char pixelBuf1[MAX_BYTES_PER_PIXEL];
+ unsigned char pixelBuf2[MAX_BYTES_PER_PIXEL];
+ unsigned char *pb;
+
+ pb = convertCSpace(src+(pixels-i-1)*popplerNumColors,pixelBuf1,i,row);
+ pb = convertBits(pb,pixelBuf2,i,row);
+ writePixel(dst,plane,i,pb);
+ }
+ return dst;
+}
+
+/* handle special cases which are appear in gutenprint's PPDs. */
+static bool selectSpecialCase()
+{
+ int i;
+
+ for (i = 0;specialCaseFuncs[i].bitsPerPixel > 0;i++) {
+ if (header.cupsColorSpace == specialCaseFuncs[i].cspace
+ && header.cupsBitsPerPixel == specialCaseFuncs[i].bitsPerPixel
+ && header.cupsBitsPerColor == specialCaseFuncs[i].bitsPerColor) {
+ convertLineOdd = specialCaseFuncs[i].convertLine;
+ if (header.Duplex && swap_image_x) {
+ convertLineEven = specialCaseFuncs[i].convertLineSwap;
+ allocLineBuf = specialCaseFuncs[i].allocLineBufSwap;
+ } else {
+ convertLineEven = specialCaseFuncs[i].convertLine;
+ allocLineBuf = specialCaseFuncs[i].allocLineBuf;
+ }
+ return true; /* found */
+ }
+ }
+ return false;
+}
+
+static unsigned int getCMSColorSpaceType(cmsColorSpaceSignature cs)
+{
+ switch (cs) {
+ case cmsSigXYZData:
+ return PT_XYZ;
+ break;
+ case cmsSigLabData:
+ return PT_Lab;
+ break;
+ case cmsSigLuvData:
+ return PT_YUV;
+ break;
+ case cmsSigYCbCrData:
+ return PT_YCbCr;
+ break;
+ case cmsSigYxyData:
+ return PT_Yxy;
+ break;
+ case cmsSigRgbData:
+ return PT_RGB;
+ break;
+ case cmsSigGrayData:
+ return PT_GRAY;
+ break;
+ case cmsSigHsvData:
+ return PT_HSV;
+ break;
+ case cmsSigHlsData:
+ return PT_HLS;
+ break;
+ case cmsSigCmykData:
+ return PT_CMYK;
+ break;
+ case cmsSigCmyData:
+ return PT_CMY;
+ break;
+ case cmsSig2colorData:
+ case cmsSig3colorData:
+ case cmsSig4colorData:
+ case cmsSig5colorData:
+ case cmsSig6colorData:
+ case cmsSig7colorData:
+ case cmsSig8colorData:
+ case cmsSig9colorData:
+ case cmsSig10colorData:
+ case cmsSig11colorData:
+ case cmsSig12colorData:
+ case cmsSig13colorData:
+ case cmsSig14colorData:
+ case cmsSig15colorData:
+ default:
+ break;
+ }
+ return PT_RGB;
+}
+
+/* select convertLine function */
+static void selectConvertFunc(cups_raster_t *raster)
+{
+ /* select convertLine function */
+
+ if ((colorProfile == NULL || popplerColorProfile == colorProfile)
+ && (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1)) {
+ if (selectSpecialCase()) return;
+ }
+
+ switch (header.cupsColorOrder) {
+ case CUPS_ORDER_BANDED:
+ case CUPS_ORDER_PLANAR:
+ if (header.cupsNumColors > 1) {
+ convertLineEven = convertLinePlaneSwap;
+ convertLineOdd = convertLinePlane;
+ break;
+ }
+ default:
+ case CUPS_ORDER_CHUNKED:
+ convertLineEven = convertLineChunkedSwap;
+ convertLineOdd = convertLineChunked;
+ break;
+ }
+ if (!header.Duplex || !swap_image_x) {
+ convertLineEven = convertLineOdd;
+ }
+ allocLineBuf = true;
+
+ if (colorProfile != NULL && popplerColorProfile != colorProfile) {
+ unsigned int bytes;
+
+ switch (header.cupsColorSpace) {
+ case CUPS_CSPACE_CIELab:
+ case CUPS_CSPACE_ICC1:
+ case CUPS_CSPACE_ICC2:
+ case CUPS_CSPACE_ICC3:
+ case CUPS_CSPACE_ICC4:
+ case CUPS_CSPACE_ICC5:
+ case CUPS_CSPACE_ICC6:
+ case CUPS_CSPACE_ICC7:
+ case CUPS_CSPACE_ICC8:
+ case CUPS_CSPACE_ICC9:
+ case CUPS_CSPACE_ICCA:
+ case CUPS_CSPACE_ICCB:
+ case CUPS_CSPACE_ICCC:
+ case CUPS_CSPACE_ICCD:
+ case CUPS_CSPACE_ICCE:
+ case CUPS_CSPACE_ICCF:
+ if (header.cupsBitsPerColor == 8) {
+ convertCSpace = convertCSpaceLab8;
+ } else {
+ /* 16 bits */
+ convertCSpace = convertCSpaceLab16;
+ }
+ bytes = 0; /* double */
+ break;
+ case CUPS_CSPACE_CIEXYZ:
+ if (header.cupsBitsPerColor == 8) {
+ convertCSpace = convertCSpaceXYZ8;
+ } else {
+ /* 16 bits */
+ convertCSpace = convertCSpaceXYZ16;
+ }
+ bytes = 0; /* double */
+ break;
+ default:
+ convertCSpace = convertCSpaceWithProfiles;
+ bytes = header.cupsBitsPerColor/8;
+ break;
+ }
+ convertBits = convertBitsNoop; /* convert bits in convertCSpace */
+ if (popplerColorProfile == NULL) {
+ popplerColorProfile = cmsCreate_sRGBProfile();
+ }
+ unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(colorProfile));
+ if ((colorTransform = cmsCreateTransform(popplerColorProfile,
+ COLORSPACE_SH(PT_RGB) |CHANNELS_SH(3) | BYTES_SH(1),
+ colorProfile,
+ COLORSPACE_SH(dcst) |
+ CHANNELS_SH(header.cupsNumColors) | BYTES_SH(bytes),
+ renderingIntent,0)) == 0) {
+ pdfError(-1,const_cast<char *>("Can't create color transform"));
+ exit(1);
+ }
+ } else {
+ /* select convertCSpace function */
+ switch (header.cupsColorSpace) {
+ case CUPS_CSPACE_CIELab:
+ case CUPS_CSPACE_ICC1:
+ case CUPS_CSPACE_ICC2:
+ case CUPS_CSPACE_ICC3:
+ case CUPS_CSPACE_ICC4:
+ case CUPS_CSPACE_ICC5:
+ case CUPS_CSPACE_ICC6:
+ case CUPS_CSPACE_ICC7:
+ case CUPS_CSPACE_ICC8:
+ case CUPS_CSPACE_ICC9:
+ case CUPS_CSPACE_ICCA:
+ case CUPS_CSPACE_ICCB:
+ case CUPS_CSPACE_ICCC:
+ case CUPS_CSPACE_ICCD:
+ case CUPS_CSPACE_ICCE:
+ case CUPS_CSPACE_ICCF:
+ case CUPS_CSPACE_CIEXYZ:
+ convertCSpace = convertCSpaceNone;
+ break;
+ case CUPS_CSPACE_CMY:
+ convertCSpace = RGB8toCMY;
+ break;
+ case CUPS_CSPACE_YMC:
+ convertCSpace = RGB8toYMC;
+ break;
+ case CUPS_CSPACE_CMYK:
+ convertCSpace = RGB8toCMYK;
+ break;
+ case CUPS_CSPACE_KCMY:
+ convertCSpace = RGB8toKCMY;
+ break;
+ case CUPS_CSPACE_KCMYcm:
+ if (header.cupsBitsPerColor > 1) {
+ convertCSpace = RGB8toKCMY;
+ } else {
+ convertCSpace = RGB8toKCMYcm;
+ }
+ break;
+ case CUPS_CSPACE_GMCS:
+ case CUPS_CSPACE_GMCK:
+ case CUPS_CSPACE_YMCK:
+ convertCSpace = RGB8toYMCK;
+ break;
+ case CUPS_CSPACE_RGBW:
+ convertCSpace = RGB8toRGBW;
+ break;
+ case CUPS_CSPACE_RGBA:
+ convertCSpace = RGB8toRGBA;
+ break;
+ case CUPS_CSPACE_RGB:
+ convertCSpace = convertCSpaceNone;
+ break;
+ case CUPS_CSPACE_W:
+ case CUPS_CSPACE_WHITE:
+ convertCSpace = convertCSpaceNone;
+ break;
+ case CUPS_CSPACE_K:
+ case CUPS_CSPACE_GOLD:
+ case CUPS_CSPACE_SILVER:
+ convertCSpace = W8toK8;
+ break;
+ default:
+ pdfError(-1,const_cast<char *>("Specified ColorSpace is not supported"));
+ exit(1);
+ break;
+ }
+ /* select convertBits function */
+ switch (header.cupsBitsPerColor) {
+ case 2:
+ convertBits = convert8to2;
+ break;
+ case 4:
+ convertBits = convert8to4;
+ break;
+ case 16:
+ convertBits = convert8to16;
+ break;
+ case 1:
+ if (header.cupsNumColors == 1
+ || header.cupsColorSpace == CUPS_CSPACE_KCMYcm) {
+ convertBits = convertBitsNoop;
+ } else {
+ convertBits = convert8to1;
+ }
+ break;
+ case 8:
+ default:
+ convertBits = convertBitsNoop;
+ break;
+ }
+ }
+ /* select writePixel function */
+ switch (header.cupsBitsPerColor) {
+ case 2:
+ if (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1) {
+ writePixel = writePixel2;
+ } else {
+ writePixel = writePlanePixel2;
+ }
+ break;
+ case 4:
+ if (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1) {
+ writePixel = writePixel4;
+ } else {
+ writePixel = writePlanePixel4;
+ }
+ break;
+ case 16:
+ if (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1) {
+ writePixel = writePixel16;
+ } else {
+ writePixel = writePlanePixel16;
+ }
+ break;
+ case 1:
+ if (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1) {
+ writePixel = writePixel1;
+ } else {
+ writePixel = writePlanePixel1;
+ }
+ break;
+ case 8:
+ default:
+ if (header.cupsColorOrder == CUPS_ORDER_CHUNKED
+ || header.cupsNumColors == 1) {
+ writePixel = writePixel8;
+ } else {
+ writePixel = writePlanePixel8;
+ }
+ break;
+ }
+}
+
+static void writePageImage(cups_raster_t *raster, SplashBitmap *bitmap,
+ int pageNo)
+{
+ ConvertLineFunc convertLine;
+ unsigned char *lineBuf = NULL;
+ unsigned char *dp;
+ unsigned int rowsize = bitmap->getRowSize();
+
+ if (allocLineBuf) lineBuf = new unsigned char [bytesPerLine];
+ if ((pageNo & 1) == 0) {
+ convertLine = convertLineEven;
+ } else {
+ convertLine = convertLineOdd;
+ }
+ if (header.Duplex && (pageNo & 1) == 0 && swap_image_y) {
+ for (unsigned int plane = 0;plane < nplanes;plane++) {
+ unsigned char *bp = (unsigned char *)(bitmap->getDataPtr());
+
+ bp += rowsize * (bitmapoffset[1] + header.cupsHeight - 1) +
+ popplerBitsPerPixel * bitmapoffset[0] / 8;
+ for (unsigned int h = header.cupsHeight;h > 0;h--) {
+ for (unsigned int band = 0;band < nbands;band++) {
+ dp = convertLine(bp,lineBuf,h,plane+band,header.cupsWidth,
+ bytesPerLine);
+ if (cupsRasterWritePixels(raster,dp,bytesPerLine)
+ != bytesPerLine) {
+ pdfError(-1,const_cast<char *>("Can't write page %d image"),pageNo);
+ exit(1);
+ }
+ }
+ bp -= rowsize;
+ }
+ }
+ } else {
+ for (unsigned int plane = 0;plane < nplanes;plane++) {
+ unsigned char *bp = (unsigned char *)(bitmap->getDataPtr());
+
+ bp += rowsize * bitmapoffset[1] +
+ popplerBitsPerPixel * bitmapoffset[0] / 8;
+ for (unsigned int h = 0;h < header.cupsHeight;h++) {
+ for (unsigned int band = 0;band < nbands;band++) {
+ dp = convertLine(bp,lineBuf,h,plane+band,header.cupsWidth,
+ bytesPerLine);
+ if (cupsRasterWritePixels(raster,dp,bytesPerLine)
+ != bytesPerLine) {
+ pdfError(-1,const_cast<char *>("Can't write page %d image"),pageNo);
+ exit(1);
+ }
+ }
+ bp += rowsize;
+ }
+ }
+ }
+ if (allocLineBuf) delete[] lineBuf;
+}
+
+static void outPage(PDFDoc *doc, Catalog *catalog, int pageNo,
+ SplashOutputDev *out, cups_raster_t *raster)
+{
+ SplashBitmap *bitmap;
+ Page *page = catalog->getPage(pageNo);
+ PDFRectangle *mediaBox = page->getMediaBox();
+ double paperdimensions[2], /* Physical size of the paper */
+ margins[4]; /* Physical margins of print */
+ ppd_size_t *size; /* Page size */
+ double l, swap;
+ int i;
+ bool landscape = 0;
+
+ fprintf(stderr, "DEBUG: mediaBox = [ %f %f %f %f ]\n",
+ mediaBox->x1, mediaBox->y1, mediaBox->x2, mediaBox->y2);
+ l = mediaBox->x2 - mediaBox->x1;
+ if (l < 0) l = -l;
+ header.PageSize[0] = (unsigned)l;
+ l = mediaBox->y2 - mediaBox->y1;
+ if (l < 0) l = -l;
+ header.PageSize[1] = (unsigned)l;
+
+ memset(paperdimensions, 0, sizeof(paperdimensions));
+ memset(margins, 0, sizeof(margins));
+ for (i = ppd->num_sizes, size = ppd->sizes;
+ i > 0;
+ i --, size ++) {
+ /* Skip page sizes which conflict with settings of the other options */
+ /* TODO XXX */
+ /* Find size of document's page under the PPD page sizes */
+ if (fabs(header.PageSize[1] - size->length) < 5.0 &&
+ fabs(header.PageSize[0] - size->width) < 5.0)
+ break;
+ }
+ if (i > 0) {
+ /*
+ * Standard size...
+ */
+ fprintf(stderr, "DEBUG: size = %s\n", size->name);
+ landscape = 0;
+ paperdimensions[0] = size->width;
+ paperdimensions[1] = size->length;
+ margins[0] = size->left;
+ margins[1] = size->bottom;
+ margins[2] = size->width - size->right;
+ margins[3] = size->length - size->top;
+ strncpy(header.cupsPageSizeName, size->name, 64);
+ } else {
+ /*
+ * No matching portrait size; look for a matching size in
+ * landscape orientation...
+ */
+
+ for (i = ppd->num_sizes, size = ppd->sizes;
+ i > 0;
+ i --, size ++)
+ if (fabs(header.PageSize[0] - size->length) < 5.0 &&
+ fabs(header.PageSize[1] - size->width) < 5.0)
+ break;
+
+ if (i > 0) {
+ /*
+ * Standard size in landscape orientation...
+ */
+ fprintf(stderr, "DEBUG: landscape size = %s\n", size->name);
+ landscape = 1;
+ paperdimensions[0] = size->width;
+ paperdimensions[1] = size->length;
+ margins[0] = size->left;
+ margins[1] = size->bottom;
+ margins[2] = size->width - size->right;
+ margins[3] = size->length - size->top;
+ strncpy(header.cupsPageSizeName, size->name, 64);
+ } else {
+ /*
+ * Custom size...
+ */
+ fprintf(stderr, "DEBUG: size = Custom\n");
+ landscape = 0;
+ paperdimensions[1] = size->length;
+ for (i = 0; i < 2; i ++)
+ paperdimensions[i] = header.PageSize[i];
+ for (i = 0; i < 4; i ++)
+ margins[i] = ppd->custom_margins[i];
+ header.cupsPageSizeName[0] = '\0';
+ }
+ }
+
+ if (header.Duplex && (pageNo & 1) == 0) {
+ /* backside: change margin if needed */
+ if (swap_margin_x) {
+ swap = margins[2]; margins[2] = margins[0]; margins[0] = swap;
+ }
+ if (swap_margin_y) {
+ swap = margins[3]; margins[3] = margins[1]; margins[1] = swap;
+ }
+ }
+
+ doc->displayPage(out,pageNo,header.HWResolution[0],
+ header.HWResolution[1],(landscape == 0 ? 0 : 90),
+ gTrue,gTrue,gTrue);
+ bitmap = out->getBitmap();
+ bitmapoffset[0] = margins[0] / 72.0 * header.HWResolution[0];
+ bitmapoffset[1] = margins[3] / 72.0 * header.HWResolution[1];
+
+ /* write page header */
+ header.cupsWidth = (paperdimensions[0] - margins[0] - margins[2]) / 72.0 *
+ header.HWResolution[0];
+ header.cupsHeight = (paperdimensions[1] - margins[1] - margins[3]) / 72.0 *
+ header.HWResolution[1];
+ for (i = 0; i < 2; i ++) {
+ header.cupsPageSize[i] = paperdimensions[i];
+ header.PageSize[i] = (unsigned int)header.cupsPageSize[i];
+ header.Margins[i] = margins[i];
+ }
+ header.cupsImagingBBox[0] = margins[0];
+ header.cupsImagingBBox[1] = margins[1];
+ header.cupsImagingBBox[2] = paperdimensions[0]-margins[2];
+ header.cupsImagingBBox[3] = paperdimensions[1]-margins[3];
+ for (i = 0; i < 4; i ++)
+ header.ImagingBoundingBox[i] = (unsigned int)header.cupsImagingBBox[i];
+
+ bytesPerLine = header.cupsBytesPerLine = (header.cupsBitsPerPixel *
+ header.cupsWidth + 7) / 8;
+ if (header.cupsColorOrder == CUPS_ORDER_BANDED) {
+ header.cupsBytesPerLine *= header.cupsNumColors;
+ }
+ if (!cupsRasterWriteHeader2(raster,&header)) {
+ pdfError(-1,const_cast<char *>("Can't write page %d header"),pageNo);
+ exit(1);
+ }
+
+ /* write page image */
+ writePageImage(raster,bitmap,pageNo);
+}
+
+static void setPopplerColorProfile()
+{
+ if (header.cupsBitsPerColor != 8 && header.cupsBitsPerColor != 16) {
+ /* color Profile is not supported */
+ return;
+ }
+ /* set poppler color profile */
+ switch (header.cupsColorSpace) {
+ case CUPS_CSPACE_CIELab:
+ case CUPS_CSPACE_ICC1:
+ case CUPS_CSPACE_ICC2:
+ case CUPS_CSPACE_ICC3:
+ case CUPS_CSPACE_ICC4:
+ case CUPS_CSPACE_ICC5:
+ case CUPS_CSPACE_ICC6:
+ case CUPS_CSPACE_ICC7:
+ case CUPS_CSPACE_ICC8:
+ case CUPS_CSPACE_ICC9:
+ case CUPS_CSPACE_ICCA:
+ case CUPS_CSPACE_ICCB:
+ case CUPS_CSPACE_ICCC:
+ case CUPS_CSPACE_ICCD:
+ case CUPS_CSPACE_ICCE:
+ case CUPS_CSPACE_ICCF:
+ if (colorProfile == NULL) {
+ cmsCIExyY wp;
+#ifdef USE_LCMS1
+ cmsWhitePointFromTemp(6504,&wp); /* D65 White point */
+#else
+ cmsWhitePointFromTemp(&wp,6504); /* D65 White point */
+#endif
+ colorProfile = cmsCreateLab4Profile(&wp);
+ }
+ break;
+ case CUPS_CSPACE_CIEXYZ:
+ if (colorProfile == NULL) {
+ /* tansform color space via CIELab */
+ cmsCIExyY wp;
+#ifdef USE_LCMS1
+ cmsWhitePointFromTemp(6504,&wp); /* D65 White point */
+#else
+ cmsWhitePointFromTemp(&wp,6504); /* D65 White point */
+#endif
+ cmsxyY2XYZ(&D65WhitePoint,&wp);
+ colorProfile = cmsCreateLab4Profile(&wp);
+ }
+ break;
+ case CUPS_CSPACE_RGB:
+ case CUPS_CSPACE_K:
+ case CUPS_CSPACE_W:
+ case CUPS_CSPACE_WHITE:
+ case CUPS_CSPACE_GOLD:
+ case CUPS_CSPACE_SILVER:
+ /* We can set specified profile to poppler profile */
+ popplerColorProfile = colorProfile;
+ break;
+ case CUPS_CSPACE_CMYK:
+ case CUPS_CSPACE_KCMY:
+ case CUPS_CSPACE_KCMYcm:
+ case CUPS_CSPACE_YMCK:
+ case CUPS_CSPACE_RGBA:
+ case CUPS_CSPACE_RGBW:
+ case CUPS_CSPACE_GMCK:
+ case CUPS_CSPACE_GMCS:
+ case CUPS_CSPACE_CMY:
+ case CUPS_CSPACE_YMC:
+ /* use standard RGB */
+ popplerColorProfile = NULL;
+ break;
+ default:
+ pdfError(-1,const_cast<char *>("Specified ColorSpace is not supported"));
+ exit(1);
+ break;
+ }
+ if (popplerColorProfile != NULL) {
+ GfxColorSpace::setDisplayProfile(popplerColorProfile);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ PDFDoc *doc;
+ SplashOutputDev *out;
+ SplashColor paperColor;
+ int i;
+ int npages;
+ cups_raster_t *raster;
+ enum SplashColorMode cmode;
+ int rowpad;
+ Catalog *catalog;
+
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ setErrorCallback(::myErrorFun,NULL);
+#else
+ setErrorFunction(::myErrorFun);
+#endif
+ cmsSetLogErrorHandler(lcmsErrorHandler);
+ globalParams = new GlobalParams();
+ parseOpts(argc, argv);
+
+ if (argc == 6) {
+ /* stdin */
+ int fd;
+ Object obj;
+ BaseStream *str;
+ FILE *fp;
+ char buf[BUFSIZ];
+ int n;
+
+ fd = cupsTempFd(buf,sizeof(buf));
+ if (fd < 0) {
+ pdfError(-1,const_cast<char *>("Can't create temporary file"));
+ exit(1);
+ }
+ /* remove name */
+ unlink(buf);
+
+ /* copy stdin to the tmp file */
+ while ((n = read(0,buf,BUFSIZ)) > 0) {
+ if (write(fd,buf,n) != n) {
+ pdfError(-1,const_cast<char *>("Can't copy stdin to temporary file"));
+ close(fd);
+ exit(1);
+ }
+ }
+ if (lseek(fd,0,SEEK_SET) < 0) {
+ pdfError(-1,const_cast<char *>("Can't rewind temporary file"));
+ close(fd);
+ exit(1);
+ }
+
+ if ((fp = fdopen(fd,"rb")) == 0) {
+ pdfError(-1,const_cast<char *>("Can't fdopen temporary file"));
+ close(fd);
+ exit(1);
+ }
+
+ obj.initNull();
+ parsePDFTOPDFComment(fp);
+ rewind(fp);
+ str = new FileStream(fp,0,gFalse,0,&obj);
+ doc = new PDFDoc(str);
+ } else {
+ GooString *fileName = new GooString(argv[6]);
+ /* argc == 7 filenmae is specified */
+ FILE *fp;
+
+ if ((fp = fopen(argv[6],"rb")) == 0) {
+ pdfError(-1,const_cast<char *>("Can't open input file %s"),argv[6]);
+ exit(1);
+ }
+ parsePDFTOPDFComment(fp);
+ fclose(fp);
+ doc = new PDFDoc(fileName,NULL,NULL);
+ }
+
+ if (!doc->isOk()) {
+ exitCode = 1;
+ goto err1;
+ }
+
+ catalog = doc->getCatalog();
+ npages = doc->getNumPages();
+
+ /* fix NumCopies, Collate ccording to PDFTOPDFComments */
+ header.NumCopies = deviceCopies;
+ header.Collate = deviceCollate ? CUPS_TRUE : CUPS_FALSE;
+ /* fixed other values that pdftopdf handles */
+ header.MirrorPrint = CUPS_FALSE;
+ header.Orientation = CUPS_ORIENT_0;
+
+ if (header.cupsBitsPerColor != 1
+ && header.cupsBitsPerColor != 2
+ && header.cupsBitsPerColor != 4
+ && header.cupsBitsPerColor != 8
+ && header.cupsBitsPerColor != 16) {
+ pdfError(-1,const_cast<char *>("Specified color format is not supported"));
+ exit(1);
+ }
+ if (header.cupsColorOrder == CUPS_ORDER_PLANAR) {
+ nplanes = header.cupsNumColors;
+ } else {
+ nplanes = 1;
+ }
+ if (header.cupsColorOrder == CUPS_ORDER_BANDED) {
+ nbands = header.cupsNumColors;
+ } else {
+ nbands = 1;
+ }
+ /* set image's values */
+ switch (header.cupsColorSpace) {
+ case CUPS_CSPACE_CIELab:
+ case CUPS_CSPACE_ICC1:
+ case CUPS_CSPACE_ICC2:
+ case CUPS_CSPACE_ICC3:
+ case CUPS_CSPACE_ICC4:
+ case CUPS_CSPACE_ICC5:
+ case CUPS_CSPACE_ICC6:
+ case CUPS_CSPACE_ICC7:
+ case CUPS_CSPACE_ICC8:
+ case CUPS_CSPACE_ICC9:
+ case CUPS_CSPACE_ICCA:
+ case CUPS_CSPACE_ICCB:
+ case CUPS_CSPACE_ICCC:
+ case CUPS_CSPACE_ICCD:
+ case CUPS_CSPACE_ICCE:
+ case CUPS_CSPACE_ICCF:
+ case CUPS_CSPACE_CIEXYZ:
+ if (header.cupsColorOrder != CUPS_ORDER_CHUNKED
+ || (header.cupsBitsPerColor != 8
+ && header.cupsBitsPerColor != 16)) {
+ pdfError(-1,const_cast<char *>("Specified color format is not supported"));
+ exit(1);
+ }
+ case CUPS_CSPACE_RGB:
+ case CUPS_CSPACE_CMY:
+ case CUPS_CSPACE_YMC:
+ case CUPS_CSPACE_CMYK:
+ case CUPS_CSPACE_KCMY:
+ case CUPS_CSPACE_KCMYcm:
+ case CUPS_CSPACE_YMCK:
+ case CUPS_CSPACE_RGBA:
+ case CUPS_CSPACE_RGBW:
+ case CUPS_CSPACE_GMCK:
+ case CUPS_CSPACE_GMCS:
+ cmode = splashModeRGB8;
+ rowpad = 4;
+ /* set paper color white */
+ paperColor[0] = 255;
+ paperColor[1] = 255;
+ paperColor[2] = 255;
+ popplerBitsPerPixel = 24;
+ popplerNumColors = 3;
+ break;
+ case CUPS_CSPACE_K:
+ case CUPS_CSPACE_W:
+ case CUPS_CSPACE_WHITE:
+ case CUPS_CSPACE_GOLD:
+ case CUPS_CSPACE_SILVER:
+ if (header.cupsBitsPerColor == 1
+ && header.cupsBitsPerPixel == 1) {
+ cmode = splashModeMono1;
+ popplerBitsPerPixel = 1;
+ } else {
+ cmode = splashModeMono8;
+ popplerBitsPerPixel = 8;
+ }
+ /* set paper color white */
+ paperColor[0] = 255;
+ rowpad = 1;
+ popplerNumColors = 1;
+ break;
+ default:
+ pdfError(-1,const_cast<char *>("Specified ColorSpace is not supported"));
+ exit(1);
+ break;
+ }
+
+ setPopplerColorProfile();
+
+ out = new SplashOutputDev(cmode,rowpad/* row padding */,
+ gFalse,paperColor,gTrue,gFalse);
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+ out->startDoc(doc);
+#else
+ out->startDoc(doc->getXRef());
+#endif
+
+ if ((raster = cupsRasterOpen(1,CUPS_RASTER_WRITE)) == 0) {
+ pdfError(-1,const_cast<char *>("Can't open raster stream"));
+ exit(1);
+ }
+ selectConvertFunc(raster);
+ for (i = 1;i <= npages;i++) {
+ outPage(doc,catalog,i,out,raster);
+ }
+ cupsRasterClose(raster);
+
+ delete out;
+err1:
+ delete doc;
+ if (ppd != NULL) {
+ ppdClose(ppd);
+ }
+ if (colorProfile != NULL) {
+ cmsCloseProfile(colorProfile);
+ }
+ if (popplerColorProfile != NULL && popplerColorProfile != colorProfile) {
+ cmsCloseProfile(popplerColorProfile);
+ }
+ if (colorTransform != NULL) {
+ cmsDeleteTransform(colorTransform);
+ }
+
+ // Check for memory leaks
+ Object::memCheck(stderr);
+ gMemReport(stderr);
+
+ return exitCode;
+}
+
+/* replace memory allocation methods for memory check */
+
+void * operator new(size_t size) throw (std::bad_alloc)
+{
+ return gmalloc(size);
+}
+
+void operator delete(void *p) throw ()
+{
+ gfree(p);
+}
+
+void * operator new[](size_t size) throw (std::bad_alloc)
+{
+ return gmalloc(size);
+}
+
+void operator delete[](void *p) throw ()
+{
+ gfree(p);
+}
--- /dev/null
+/*
+ * PDF file output routines.
+ *
+ * Copyright 2008 by Tobias Hoffmann.
+ *
+ * This file is licensed as noted in "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ */
+#include <stdio.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <memory.h>
+#include <stdlib.h>
+#include "pdfutils.h"
+#include "fontembed/embed.h"
+
+void pdfOut_printf(pdfOut *pdf,const char *fmt,...) // {{{
+{
+ assert(pdf);
+ int len;
+ va_list ap;
+
+ va_start(ap,fmt);
+ len=vprintf(fmt,ap);
+ va_end(ap);
+ pdf->filepos+=len;
+}
+// }}}
+
+void pdfOut_putString(pdfOut *pdf,const char *str,int len) // {{{ - >len==-1: strlen()
+{
+ assert(pdf);
+ assert(str);
+ if (len==-1) {
+ len=strlen(str);
+ }
+ putc('(',stdout);
+ // escape special chars: \0 \\ \( \) -- don't bother about balanced parens
+ int iA=0;
+ for (;len>0;iA++,len--) {
+ if ( (str[iA]<32)||(str[iA]>126) ) {
+ fwrite(str,1,iA,stdout);
+ fprintf(stdout,"\\%03o",str[iA]);
+ pdf->filepos+=iA+4;
+ str+=iA+1;
+ iA=-1;
+ } else if ( (str[iA]=='(')||(str[iA]==')')||(str[iA]=='\\') ) {
+ fwrite(str,1,iA,stdout);
+ fprintf(stdout,"\\%c",str[iA]);
+ pdf->filepos+=iA+2;
+ str+=iA+1;
+ iA=-1;
+ }
+ }
+ pdf->filepos+=iA+2;
+ fwrite(str,1,iA,stdout);
+ putc(')',stdout);
+}
+// }}}
+
+void pdfOut_putHexString(pdfOut *pdf,const char *str,int len) // {{{ - >len==-1: strlen()
+{
+ assert(pdf);
+ assert(str);
+ if (len==-1) {
+ len=strlen(str);
+ }
+ pdf->filepos+=2*len+2;
+ putc('<',stdout);
+ for (;len>0;str++,len--) {
+ fprintf(stdout,"%02x",(unsigned char)*str);
+ }
+ putc('>',stdout);
+}
+// }}}
+
+pdfOut *pdfOut_new() // {{{ - NULL on error
+{
+ pdfOut *ret=malloc(sizeof(pdfOut));
+ if (ret) {
+ memset(ret,0,sizeof(pdfOut));
+ }
+
+ return ret;
+}
+// }}}
+
+// NOTE: uses statically allocated buffer
+const char *pdfOut_to_pdfdate(struct tm *curtm) // {{{
+{
+ static char curdate[250];
+ if (!curtm) {
+ time_t curtime;
+ curtime = time(NULL);
+ curtm = localtime(&curtime);
+ }
+ strftime(curdate, sizeof(curdate), "D:%Y%m%d%H%M%S%z", curtm);
+ curdate[23]=0;
+ curdate[22]='\'';
+ curdate[21]=curdate[18];
+ curdate[20]=curdate[17];
+ curdate[19]='\'';
+ return curdate;
+}
+// }}}
+
+int pdfOut_add_xref(pdfOut *pdf) // {{{ - returns obj_no
+{
+ assert(pdf);
+ assert(pdf->xrefsize<=pdf->xrefalloc);
+
+ if (pdf->xrefsize==pdf->xrefalloc) {
+ long *tmp;
+ pdf->xrefalloc+=50;
+ tmp=realloc(pdf->xref,sizeof(long)*pdf->xrefalloc);
+ if (!tmp) {
+ pdf->xrefalloc=-1;
+ return -1;
+ }
+ pdf->xref=tmp;
+ }
+ pdf->xref[pdf->xrefsize++]=pdf->filepos;
+ return pdf->xrefsize; // xrefsize+1
+}
+// }}}
+
+int pdfOut_add_page(pdfOut *pdf,int obj) // {{{ - returns false on error
+{
+ assert(pdf);
+ assert(obj>0);
+ assert(pdf->pagessize<=pdf->pagesalloc);
+
+ if (pdf->pagessize==pdf->pagesalloc) {
+ int *tmp;
+ pdf->pagesalloc+=10;
+ tmp=realloc(pdf->pages,sizeof(int)*pdf->pagesalloc);
+ if (!tmp) {
+ pdf->pagesalloc=-1;
+ return 0;
+ }
+ pdf->pages=tmp;
+ }
+ pdf->pages[pdf->pagessize++]=obj;
+ return 1;
+}
+// }}}
+
+int pdfOut_add_kv(pdfOut *pdf,const char *key,const char *val) // {{{ - returns false on error
+{
+ assert(pdf);
+ assert(pdf->kvsize<=pdf->kvalloc);
+
+ if (pdf->kvsize==pdf->kvalloc) {
+ struct keyval_t *tmp;
+ pdf->kvalloc+=10;
+ tmp=realloc(pdf->kv,sizeof(struct keyval_t)*pdf->kvalloc);
+ if (!tmp) {
+ pdf->kvalloc=-1;
+ return 0;
+ }
+ pdf->kv=tmp;
+ }
+ pdf->kv[pdf->kvsize].key=strdup(key);
+ pdf->kv[pdf->kvsize].value=strdup(val);
+ if ( (!pdf->kv[pdf->kvsize].key)||(!pdf->kv[pdf->kvsize].value) ) {
+ return 0;
+ }
+ pdf->kvsize++;
+ return 1;
+}
+// }}}
+
+int pdfOut_begin_pdf(pdfOut *pdf) // ,...output_device?...) // {{{ - false on error
+{
+ assert(pdf);
+ assert(pdf->kvsize==0); // otherwise: finish_pdf has not been called
+ int pages_obj;
+
+ pdf->xrefsize=pdf->pagessize=0;
+ pdf->filepos=0;
+ pages_obj=pdfOut_add_xref(pdf); // fixed later
+ if (pages_obj!=1) {
+ return 0;
+ }
+ pdfOut_printf(pdf,"%%PDF-1.3\n");
+ return 1;
+}
+// }}}
+
+void pdfOut_finish_pdf(pdfOut *pdf) // {{{
+{
+ int iA;
+ int root_obj,info_obj=0,xref_start;
+ assert( (pdf)&&(pdf->filepos!=-1) );
+
+ // pages
+ const int pages_obj=1;
+ pdf->xref[0]=pdf->filepos; // now fix it
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Pages\n"
+ " /Count %d\n"
+ " /Kids [",
+ pages_obj,pdf->pagessize);
+ for (iA=0;iA<pdf->pagessize;iA++) {
+ pdfOut_printf(pdf,"%d 0 R ",pdf->pages[iA]);
+ }
+ pdfOut_printf(pdf,"]\n"
+ ">>\n"
+ "endobj\n");
+
+ // rootdict
+ root_obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Catalog\n"
+ " /Pages %d 0 R\n"
+ ">>\n"
+ "endobj\n",
+ root_obj,pages_obj);
+
+ // info
+ if (pdf->kvsize) {
+ info_obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<<\n",
+ info_obj);
+ for (iA=0;iA<pdf->kvsize;iA++) {
+ pdfOut_printf(pdf," /%s ",pdf->kv[iA].key);
+ pdfOut_putString(pdf,pdf->kv[iA].value,-1);
+ pdfOut_printf(pdf,"\n");
+ }
+ pdfOut_printf(pdf,">>\n"
+ "endobj\n");
+ }
+ // TODO: some return-value checking (??)
+
+ // write xref
+ xref_start=pdf->filepos;
+ pdfOut_printf(pdf,"xref\n"
+ "%d %d\n"
+ "%010d 65535 f \n",
+ 0,pdf->xrefsize+1,0);
+ for (iA=0;iA<pdf->xrefsize;iA++) {
+ pdfOut_printf(pdf,"%010d 00000 n \n",
+ pdf->xref[iA]);
+ }
+ pdfOut_printf(pdf,"trailer\n"
+ "<<\n"
+ " /Size %d\n"
+ " /Root %d 0 R\n",
+ pdf->xrefsize+1,
+ root_obj);
+ if (info_obj) {
+ pdfOut_printf(pdf," /Info %d 0 R\n",info_obj);
+ }
+ pdfOut_printf(pdf,">>\n"
+ "startxref\n"
+ "%d\n"
+ "%%%%EOF\n",
+ xref_start);
+
+ // set to done
+ pdf->filepos=-1;
+ for (iA=0;iA<pdf->kvsize;iA++) {
+ free(pdf->kv[iA].key);
+ free(pdf->kv[iA].value);
+ }
+ pdf->kvsize=0;
+}
+// }}}
+
+void pdfOut_free(pdfOut *pdf) // {{{
+{
+ if (pdf) {
+ assert(pdf->kvsize==0); // otherwise: finish_pdf has not been called
+ free(pdf->kv);
+ free(pdf->pages);
+ free(pdf->xref);
+ free(pdf);
+ }
+}
+// }}}
+
+static void pdfOut_outfn(const char *buf,int len,void *context) // {{{
+{
+ pdfOut *pdf=(pdfOut *)context;
+
+ if (fwrite(buf,1,len,stdout)!=len) {
+ perror("Short write");
+ assert(0);
+ return;
+ }
+ pdf->filepos+=len;
+}
+// }}}
+
+int pdfOut_write_font(pdfOut *pdf,EMB_PARAMS *emb) // {{{
+{
+ assert(pdf);
+ assert(emb);
+
+ EMB_PDF_FONTDESCR *fdes=emb_pdf_fontdescr(emb);
+ if (!fdes) {
+ if (emb->outtype==EMB_FMT_STDFONT) { // std-14 font
+ const int f_obj=pdfOut_add_xref(pdf);
+ char *res=emb_pdf_simple_stdfont(emb);
+ if (!res) {
+ return 0;
+ }
+
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%s"
+ "endobj\n"
+ ,f_obj,res);
+ free(res);
+ return f_obj;
+ }
+ return 0;
+ }
+
+ const int ff_obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Length %d 0 R\n"
+ ,ff_obj,ff_obj+1);
+ if (emb_pdf_get_fontfile_subtype(emb)) {
+ pdfOut_printf(pdf," /Subtype /%s\n",
+ emb_pdf_get_fontfile_subtype(emb));
+ }
+ if (emb->outtype==EMB_FMT_TTF) {
+ pdfOut_printf(pdf," /Length1 %d 0 R\n"
+ ,ff_obj+2);
+ } else if (emb->outtype==EMB_FMT_T1) { // TODO
+ pdfOut_printf(pdf," /Length1 ?\n"
+ " /Length2 ?\n"
+ " /Length3 ?\n"
+ );
+ }
+ pdfOut_printf(pdf,">>\n"
+ "stream\n");
+ long streamsize=-pdf->filepos;
+ const int outlen=emb_embed(emb,pdfOut_outfn,pdf);
+ streamsize+=pdf->filepos;
+ pdfOut_printf(pdf,"\nendstream\n"
+ "endobj\n");
+
+ const int l0_obj=pdfOut_add_xref(pdf);
+ assert(l0_obj==ff_obj+1);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%d\n"
+ "endobj\n"
+ ,l0_obj,streamsize);
+
+ if (emb->outtype==EMB_FMT_TTF) {
+ const int l1_obj=pdfOut_add_xref(pdf);
+ assert(l1_obj==ff_obj+2);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%d\n"
+ "endobj\n"
+ ,l1_obj,outlen);
+ }
+
+ const int fd_obj=pdfOut_add_xref(pdf);
+ char *res=emb_pdf_simple_fontdescr(emb,fdes,ff_obj);
+ if (!res) {
+ free(fdes);
+ return 0;
+ }
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%s"
+ "endobj\n"
+ ,fd_obj,res);
+ free(res);
+
+ EMB_PDF_FONTWIDTHS *fwid=emb_pdf_fontwidths(emb);
+ if (!fwid) {
+ free(fdes);
+ return 0;
+ }
+ const int f_obj=pdfOut_add_xref(pdf);
+ res=emb_pdf_simple_font(emb,fdes,fwid,fd_obj);
+ if (!res) {
+ free(fwid);
+ free(fdes);
+ return 0;
+ }
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%s"
+ "endobj\n"
+ ,f_obj,res);
+ free(res);
+ free(fwid);
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ res=emb_pdf_simple_cidfont(emb,fdes->fontname,f_obj);
+ if (!res) {
+ free(fdes);
+ return 0;
+ }
+ const int cf_obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%s"
+ "endobj\n"
+ ,cf_obj,res);
+ free(res);
+ free(fdes);
+ return cf_obj;
+ }
+
+ free(fdes);
+ return f_obj;
+}
+// }}}
+
+#if 0
+one_page(...parent,resources,mediabox,contents);
+{
+// " /Resources %d 0 R\n"
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Page\n"
+ " /Parent 1 0 R\n"
+ " /MediaBox [0 0 %d %d]\n"
+ " /Contents %d 0 R\n"
+ ">>\n"
+ "endobj\n"
+ ,,,PageWidth,PageLength // TODO: into pdf->
+ ...
+}
+
+... pfb_embedder ... pfa?
+#endif
--- /dev/null
+/*
+ * PDF file output routines.
+ *
+ * Copyright 2008 by Tobias Hoffmann.
+ *
+ * This file is licensed as noted in "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ */
+#include <time.h>
+
+struct keyval_t {
+ char *key,*value;
+};
+
+typedef struct {
+ long filepos;
+
+ int pagessize,pagesalloc;
+ int *pages;
+
+ int xrefsize,xrefalloc;
+ long *xref;
+
+ int kvsize,kvalloc;
+ struct keyval_t *kv;
+} pdfOut;
+
+/* allocates a new pdfOut structure
+ * returns NULL on error
+ */
+pdfOut *pdfOut_new();
+void pdfOut_free(pdfOut *pdf);
+
+/* start outputting a pdf
+ * returns false on error
+ */
+int pdfOut_begin_pdf(pdfOut *pdf);
+void pdfOut_finish_pdf(pdfOut *pdf);
+
+/* General output routine for our pdf.
+ * Keeps track of characters actually written out
+ */
+void pdfOut_printf(pdfOut *pdf,const char *fmt,...);
+
+/* write out an escaped pdf string: e.g. (Text \(Test\)\n)
+ * >len==-1: use strlen(str)
+ */
+void pdfOut_putString(pdfOut *pdf,const char *str,int len);
+void pdfOut_putHexString(pdfOut *pdf,const char *str,int len);
+
+/* Format the broken up timestamp according to
+ * pdf requirements for /CreationDate
+ * NOTE: uses statically allocated buffer
+ */
+const char *pdfOut_to_pdfdate(struct tm *curtm);
+
+/* begin a new object at current point of the
+ * output stream and add it to the xref table.
+ * returns the obj number.
+ */
+int pdfOut_add_xref(pdfOut *pdf);
+
+/* adds page dictionary >obj to the global Pages tree
+ * returns false on error
+ */
+int pdfOut_add_page(pdfOut *pdf,int obj);
+
+/* add a >key,>val pair to the document's Info dictionary
+ * returns false on error
+ */
+int pdfOut_add_kv(pdfOut *pdf,const char *key,const char *val);
+
+/* Writes the font >emb including descriptor to the pdf
+ * and returns the object number.
+ * On error 0 is returned.
+ */
+struct _EMB_PARAMS;
+int pdfOut_write_font(pdfOut *pdf,struct _EMB_PARAMS *emb);
--- /dev/null
+#!/bin/sh
+
+# $Id: pstopdf,v 1.3 2003/02/15 15:21:00 gurubert Exp $
+#
+# This is a Postscript to PDF filter for CUPS
+#
+# (C) 2003 Robert Sander <robert.sander@epigenomics.com>
+# (C) 2008-2012 Till Kamppeter <till.kamppeter@gmail.com>
+#
+# Released under GPL
+#
+# NO WARRANTY AT ALL
+#
+
+set -e
+
+PS2PS=`which ps2ps`
+GS=`which gs`
+
+PS2PS_OPTIONS="-dAutoRotatePages=/None -dAutoFilterColorImages=false \
+ -dNOPLATFONTS -dPARANOIDSAFER -dNOINTERPOLATE -sstdout=%stderr"
+PS2PDF_OPTIONS="-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.3"
+PS2PDF_OPTIONS="$PS2PDF_OPTIONS $PS2PS_OPTIONS"
+PS2PDF_OPTIONS="$PS2PDF_OPTIONS -dColorImageFilter=/FlateEncode \
+ -dPDFSETTINGS=/printer \
+ -dColorConversionStrategy=/LeaveColorUnchanged"
+
+echo "DEBUG: pstopdf $# args: $@" >&2
+echo "DEBUG: PPD: $PPD" >&2
+
+if [ $# -lt 5 -o $# -gt 6 ]; then
+
+ echo "ERROR: $0 job-id user title copies options [file]" >&2
+ exit 1
+
+fi
+
+# Read from given file.
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+tempfiles=
+trap 'rm -f $tempfiles' 0 1 2 13 15
+
+infile=$(mktemp -t pstopdf.XXXXXX)
+tempfiles="$tempfiles $infile"
+
+cat >"$infile"
+
+# Did CUPS already take care of the number of copies? If not, we have to do it
+
+donumcopies=
+numcopies="$4"
+if test -z "$numcopies"; then
+ numcopies=1
+fi
+if test "$numcopies" -le "1"; then
+ donumcopies="-dDoNumCopies"
+fi
+
+# Apply PPD settings.
+
+resolution=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultResolution:\s*([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Resolution: $resolution" >&2
+
+if test -n "$resolution"; then
+ # If the resolution is not symmetric, use the lower of the two,
+ # Ghostscript developers recommend to use square resolutions for the
+ # pdfwrite and ps2write output devices.
+ # See http://bugs.ghostscript.com/show_bug.cgi?id=690504
+ xres=
+ yres=
+ eval "$(printf "%s" "$resolution" | sed -nre 's/.*(^|\s)([0-9]+)x([0-9]+).*/xres="\2"; yres="\3"/p')"
+ if test -n "$xres" && test -n "$yres"; then
+ if [ "$xres" -lt "$yres" ]; then
+ resolution=$xres
+ else
+ resolution=$yres
+ fi
+ fi
+fi
+
+width=
+height=
+bl_x=
+bl_y=
+tr_x=
+tr_y=
+margin_l=
+margin_b=
+margin_r=
+margin_t=
+pagesize=
+unit=
+customw=
+customh=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(PageSize|PageRegion)=(\S+).*/pagesize="${pagesize:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultPageSize:\s*(\S+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Page size: $pagesize" >&2
+
+eval "$(printf "%s" "$pagesize" | sed -nre 's/^Custom\.([0-9\.]+)x([0-9\.]+)(\S*)$/customw="\1"; customh="\2"; unit="\3"/p')"
+
+if test -n "$customw" && test -n "$customh"; then
+ echo "DEBUG: Custom page size: $customw x $customh $unit" >&2
+
+ if test "$unit" = "in"; then
+ width="$(printf "scale=0; (%s)*(72.0)/(1.00)\n" "$customw" | bc)"
+ height="$(printf "scale=0; (%s)*(72.0)/(1.00)\n" "$customh" | bc)"
+ elif test "$unit" = "cm"; then
+ width="$(printf "scale=0; (%s)*(72.0)/(2.54)\n" "$customw" | bc)"
+ height="$(printf "scale=0; (%s)*(72.0)/(2.54)\n" "$customh" | bc)"
+ elif test "$unit" = "mm"; then
+ width="$(printf "scale=0; (%s)*(72.0)/(25.4)\n" "$customw" | bc)"
+ height="$(printf "scale=0; (%s)*(72.0)/(25.4)\n" "$customh" | bc)"
+ else
+ width="$(printf "scale=0; (%s)/(1.00)\n" "$customw" | bc)"
+ height="$(printf "scale=0; (%s)/(1.00)\n" "$customh" | bc)"
+ fi
+
+ if test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*HWMargins:\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*|bl_x="\1"; bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
+
+ if test -n "$tr_x"; then
+ tr_x="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
+ fi
+ if test -n "$tr_y"; then
+ tr_y="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
+ fi
+ fi
+elif test -n "$pagesize" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*PaperDimension\s+'"$pagesize"'(/[^:]+\|):\s*"(\S+)\s+(\S+)".*|width="\2"; height="\3"|p' "$PPD")"
+
+ eval "$(sed -nre 's|^\*ImageableArea\s+'"$pagesize"'(/[^:]+\|):\s*"(\S+)\s+(\S+)\s+(\S+)\s+(\S+)".*|bl_x="\2"; bl_y="\3"; tr_x="\4"; tr_y="\5"|p' "$PPD")"
+fi
+
+test -n "$bl_x" || bl_x=0
+test -n "$bl_y" || bl_y=0
+test -n "$tr_x" || tr_x=$width
+test -n "$tr_y" || tr_y=$height
+
+echo "DEBUG: Width: $width, height: $height, absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
+
+if test -n "$width" && test -n "$height" && \
+ test -n "$bl_x" && test -n "$bl_y" && \
+ test -n "$tr_x" && test -n "$tr_y"; then
+ margin_l="$bl_x"
+ margin_b="$bl_y"
+ margin_r="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
+ margin_t="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
+fi
+echo "DEBUG: Relative margins: $margin_l, $margin_b, $margin_r, $margin_t" >&2
+
+if test -n "$margin_l" && test -n "$margin_b" && \
+ test -n "$margin_r" && test -n "$margin_t"; then
+ inject_ps="<</.HWMargins[$margin_l $margin_b $margin_r $margin_t] /Margins[0 0]>>setpagedevice"
+fi
+
+ppd_opts=
+if test -n "$resolution"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-r$resolution"
+fi
+if test -n "$width"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEWIDTHPOINTS=$width"
+fi
+if test -n "$height"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEHEIGHTPOINTS=$height"
+fi
+echo "DEBUG: PPD options: $ppd_opts" >&2
+
+# We do not supply the margins to the ps2pdf process, as this breaks
+# full-bleed printing and also disturbs the printing if PPDs have too
+# conservative margin definitions.
+inject_ps=
+
+# Injection
+echo "DEBUG: PostScript to be injected: $inject_ps" >&2
+if test -n "$inject_ps"; then
+ echo "DEBUG: Injecting PostScript: $inject_ps" >&2
+
+ orig_infile="$infile"
+
+ infile=$(mktemp -t pstopdf.XXXXXX)
+ tempfiles="$tempfiles $infile"
+
+ perl -p -e 'if (! $did) { s:(^%!.*)$:\1\n'"$inject_ps"': && $did++; }' "$orig_infile" > "$infile"
+fi
+
+# DRM
+
+DRM_MATCH='^%.*Removing the following.*lines is illegal.*Digital Copyright Act'
+if egrep -q "$DRM_MATCH" "$infile"; then
+ # This PS is DRM-infested. Normalize it with ps2ps first.
+ echo "DEBUG: Normalizing Adobe Reader PostScript with ps2ps" >&2
+
+ DRMFILTER="$PS2PS $PS2PS_OPTIONS $ppd_opts - -"
+else
+ DRMFILTER=cat
+fi
+
+echo "DEBUG: Running $DRMFILTER | $GS $PS2PDF_OPTIONS $donumcopies $ppd_opts -sOutputFile=- $OPTIONS -c .setpdfwrite -f -" >&2
+cat "$infile" | $DRMFILTER | $GS $PS2PDF_OPTIONS $donumcopies $ppd_opts -sOutputFile=- $OPTIONS -c .setpdfwrite -f -
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Advanced EPSON ESC/P raster driver for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * Setup() - Prepare the printer for graphics output.
+ * StartPage() - Start a page of graphics.
+ * EndPage() - Finish a page of graphics.
+ * Shutdown() - Shutdown a printer.
+ * CancelJob() - Cancel the current job...
+ * CompressData() - Compress a line of graphics.
+ * OutputBand() - Output a band of graphics.
+ * ProcessLine() - Read graphics from the page stream and output
+ * as needed.
+ * main() - Main entry and processing of driver.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cupsfilters/driver.h>
+#include "escp.h"
+#include <signal.h>
+#include <string.h>
+#include <ctype.h>
+
+
+/*
+ * Softweave data...
+ */
+
+typedef struct cups_weave_str
+{
+ struct cups_weave_str *prev, /* Previous band */
+ *next; /* Next band */
+ int x, y, /* Column/Line on the page */
+ plane, /* Color plane */
+ dirty, /* Is this buffer dirty? */
+ row, /* Row in the buffer */
+ count; /* Max rows this pass */
+ unsigned char *buffer; /* Data buffer */
+} cups_weave_t;
+
+
+/*
+ * Globals...
+ */
+
+cups_rgb_t *RGB; /* RGB color separation data */
+cups_cmyk_t *CMYK; /* CMYK color separation data */
+unsigned char *PixelBuffer, /* Pixel buffer */
+ *CMYKBuffer, /* CMYK buffer */
+ *OutputBuffers[7], /* Output buffers */
+ *DotBuffers[7], /* Dot buffers */
+ *CompBuffer; /* Compression buffer */
+short *InputBuffer; /* Color separation buffer */
+cups_weave_t *DotAvailList, /* Available buffers */
+ *DotUsedList, /* Used buffers */
+ *DotBands[128][7]; /* Buffers in use */
+int DotBufferSize, /* Size of dot buffers */
+ DotRowMax, /* Maximum row number in buffer */
+ DotColStep, /* Step for each output column */
+ DotRowStep, /* Step for each output line */
+ DotRowFeed, /* Amount to feed for interleave */
+ DotRowCount, /* Number of rows to output */
+ DotRowOffset[7], /* Offset for each color on print head */
+ DotRowCurrent, /* Current row */
+ DotSize; /* Dot size (Pro 5000 only) */
+int PrinterPlanes, /* # of color planes */
+ BitPlanes, /* # of bit planes per color */
+ PrinterTop, /* Top of page */
+ PrinterLength; /* Length of page */
+cups_lut_t *DitherLuts[7]; /* Lookup tables for dithering */
+cups_dither_t *DitherStates[7]; /* Dither state tables */
+int OutputFeed; /* Number of lines to skip */
+int Canceled; /* Is the job canceled? */
+
+
+/*
+ * Prototypes...
+ */
+
+void Setup(ppd_file_t *);
+void StartPage(ppd_file_t *, cups_page_header2_t *);
+void EndPage(ppd_file_t *, cups_page_header2_t *);
+void Shutdown(ppd_file_t *);
+
+void AddBand(cups_weave_t *band);
+void CancelJob(int sig);
+void CompressData(ppd_file_t *, const unsigned char *, const int,
+ int, int, const int, const int, const int,
+ const int);
+void OutputBand(ppd_file_t *, cups_page_header2_t *,
+ cups_weave_t *band);
+void ProcessLine(ppd_file_t *, cups_raster_t *,
+ cups_page_header2_t *, const int y);
+
+
+/*
+ * 'Setup()' - Prepare a printer for graphics output.
+ */
+
+void
+Setup(ppd_file_t *ppd) /* I - PPD file */
+{
+ /*
+ * Some EPSON printers need an additional command issued at the
+ * beginning of each job to exit from USB "packet" mode...
+ */
+
+ if (ppd->model_number & ESCP_USB)
+ cupsWritePrintData("\000\000\000\033\001@EJL 1284.4\n@EJL \n\033@", 29);
+}
+
+
+/*
+ * 'StartPage()' - Start a page of graphics.
+ */
+
+void
+StartPage(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header) /* I - Page header */
+{
+ int i, y; /* Looping vars */
+ int subrow, /* Current subrow */
+ modrow, /* Subrow modulus */
+ plane; /* Current color plane */
+ unsigned char *ptr; /* Pointer into dot buffer */
+ int bands; /* Number of bands to allocate */
+ int units; /* Units for resolution */
+ cups_weave_t *band; /* Current band */
+ const char *colormodel; /* Color model string */
+ char resolution[PPD_MAX_NAME],
+ /* Resolution string */
+ spec[PPD_MAX_NAME]; /* PPD attribute name */
+ ppd_attr_t *attr; /* Attribute from PPD file */
+ const float default_lut[2] = /* Default dithering lookup table */
+ {
+ 0.0,
+ 1.0
+ };
+
+
+ fprintf(stderr, "DEBUG: StartPage...\n");
+ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
+ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
+ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
+ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
+
+ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
+ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
+ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
+ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
+ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
+ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
+ header->HWResolution[1]);
+ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
+ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
+ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
+ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
+ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
+ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
+ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
+ header->Margins[1]);
+ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
+ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
+ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
+ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
+ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
+ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
+ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
+ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
+ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
+ header->PageSize[1]);
+ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
+ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
+ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
+ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
+ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
+ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
+ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor);
+ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel);
+ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine);
+ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
+ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
+ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
+ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount);
+ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed);
+ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep);
+
+ /*
+ * Figure out the color model and spec strings...
+ */
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_K :
+ colormodel = "Black";
+ break;
+ case CUPS_CSPACE_W :
+ colormodel = "Gray";
+ break;
+ default :
+ case CUPS_CSPACE_RGB :
+ colormodel = "RGB";
+ break;
+ case CUPS_CSPACE_CMYK :
+ colormodel = "CMYK";
+ break;
+ }
+
+ if (header->HWResolution[0] != header->HWResolution[1])
+ snprintf(resolution, sizeof(resolution), "%dx%ddpi",
+ header->HWResolution[0], header->HWResolution[1]);
+ else
+ snprintf(resolution, sizeof(resolution), "%ddpi",
+ header->HWResolution[0]);
+
+ if (!header->MediaType[0])
+ strcpy(header->MediaType, "Plain");
+
+ /*
+ * Load the appropriate color profiles...
+ */
+
+ RGB = NULL;
+ CMYK = NULL;
+
+ fputs("DEBUG: Attempting to load color profiles using the following values:\n", stderr);
+ fprintf(stderr, "DEBUG: ColorModel = %s\n", colormodel);
+ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType);
+ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution);
+
+ if (header->cupsColorSpace == CUPS_CSPACE_RGB ||
+ header->cupsColorSpace == CUPS_CSPACE_W)
+ RGB = cupsRGBLoad(ppd, colormodel, header->MediaType, resolution);
+ else
+ RGB = NULL;
+
+ CMYK = cupsCMYKLoad(ppd, colormodel, header->MediaType, resolution);
+
+ if (RGB)
+ fputs("DEBUG: Loaded RGB separation from PPD.\n", stderr);
+
+ if (CMYK)
+ fputs("DEBUG: Loaded CMYK separation from PPD.\n", stderr);
+ else
+ {
+ fputs("DEBUG: Loading default CMYK separation.\n", stderr);
+ CMYK = cupsCMYKNew(4);
+ }
+
+ PrinterPlanes = CMYK->num_channels;
+
+ fprintf(stderr, "DEBUG: PrinterPlanes = %d\n", PrinterPlanes);
+
+ /*
+ * Get the dithering parameters...
+ */
+
+ switch (PrinterPlanes)
+ {
+ case 1 : /* K */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+
+ case 2 : /* Kk */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightBlack");
+ break;
+
+ case 3 : /* CMY */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ break;
+
+ case 4 : /* CMYK */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ DitherLuts[3] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+
+ case 6 : /* CcMmYK */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightCyan");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[3] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightMagenta");
+ DitherLuts[4] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ DitherLuts[5] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+
+ case 7 : /* CcMmYKk */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightCyan");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[3] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightMagenta");
+ DitherLuts[4] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ DitherLuts[5] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ DitherLuts[6] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightBlack");
+ break;
+ }
+
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ DitherStates[plane] = cupsDitherNew(header->cupsWidth);
+
+ if (!DitherLuts[plane])
+ DitherLuts[plane] = cupsLutNew(2, default_lut);
+ }
+
+ if (DitherLuts[0][4095].pixel > 1)
+ BitPlanes = 2;
+ else
+ BitPlanes = 1;
+
+ /*
+ * Initialize the printer...
+ */
+
+ printf("\033@");
+
+ if (ppd->model_number & ESCP_REMOTE)
+ {
+ /*
+ * Go into remote mode...
+ */
+
+ cupsWritePrintData("\033(R\010\000\000REMOTE1", 13);
+
+ /*
+ * Disable status reporting...
+ */
+
+ cupsWritePrintData("ST\002\000\000\000", 6);
+
+ /*
+ * Enable borderless printing...
+ */
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPFP", NULL)) != NULL && attr->value)
+ {
+ /*
+ * Set horizontal offset...
+ */
+
+ i = atoi(attr->value);
+
+ cupsWritePrintData("FP\003\000\000", 5);
+ putchar(i & 255);
+ putchar(i >> 8);
+ }
+
+ /*
+ * Set media type...
+ */
+
+ if (header->cupsMediaType)
+ {
+ sprintf(spec, "%d", header->cupsMediaType);
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN0", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set feed sequence...
+ */
+
+ cupsWritePrintData("SN\003\000\000\000", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN1", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set platten gap...
+ */
+
+ cupsWritePrintData("SN\003\000\000\001", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN2", spec)) != NULL && attr->value)
+ {
+ /*
+ * Paper feeding/ejecting sequence...
+ */
+
+ cupsWritePrintData("SN\003\000\000\002", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN6", spec)) != NULL && attr->value)
+ {
+ /*
+ * Eject delay...
+ */
+
+ cupsWritePrintData("SN\003\000\000\006", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPMT", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set media type.
+ */
+
+ cupsWritePrintData("MT\003\000\000\000", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPPH", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set paper thickness.
+ */
+
+ cupsWritePrintData("PH\002\000\000", 5);
+ putchar(atoi(attr->value));
+ }
+ }
+
+ sprintf(spec, "%d", header->MediaPosition);
+
+ if (header->MediaPosition)
+ {
+ if ((attr = ppdFindAttr(ppd, "cupsESCPPC", spec)) != NULL && attr->value)
+ {
+ /*
+ * Paper check.
+ */
+
+ cupsWritePrintData("PC\002\000\000", 5);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPPP", spec)) != NULL && attr->value)
+ {
+ /*
+ * Paper path.
+ */
+
+ int a, b;
+
+ a = b = 0;
+ sscanf(attr->value, "%d%d", &a, &b);
+
+ cupsWritePrintData("PP\003\000\000", 5);
+ putchar(a);
+ putchar(b);
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPEX", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set media position.
+ */
+
+ cupsWritePrintData("EX\006\000\000\000\000\000\005", 9);
+ putchar(atoi(attr->value));
+ }
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPMS", spec)) != NULL && attr->value)
+ {
+ /*
+ * Set media size...
+ */
+
+ cupsWritePrintData("MS\010\000\000", 5);
+ putchar(atoi(attr->value));
+
+ switch (header->PageSize[1])
+ {
+ case 1191 : /* A3 */
+ putchar(0x01);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 1032 : /* B4 */
+ putchar(0x02);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 842 : /* A4 */
+ putchar(0x03);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 595 : /* A4.Transverse */
+ putchar(0x03);
+ putchar(0x01);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 729 : /* B5 */
+ putchar(0x04);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 516 : /* B5.Transverse */
+ putchar(0x04);
+ putchar(0x01);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 1369 : /* Super A3/B */
+ putchar(0x20);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 792 : /* Letter */
+ putchar(0x08);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 612 : /* Letter.Transverse */
+ putchar(0x08);
+ putchar(0x01);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 1004 : /* Legal */
+ putchar(0x0a);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ case 1224 : /* Tabloid */
+ putchar(0x2d);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ putchar(0x00);
+ break;
+ default : /* Custom size */
+ putchar(0xff);
+ putchar(0xff);
+ i = 360 * header->PageSize[0] / 72;
+ putchar(i);
+ putchar(i >> 8);
+ i = 360 * header->PageSize[1] / 72;
+ putchar(i);
+ putchar(i >> 8);
+ break;
+ }
+ }
+
+ sprintf(spec, "%d", header->CutMedia);
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPAC", spec)) != NULL && attr->value)
+ {
+ /*
+ * Enable/disable cutter.
+ */
+
+ cupsWritePrintData("AC\002\000\000", 5);
+ putchar(atoi(attr->value));
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN80", header->MediaType)) != NULL && attr->value)
+ {
+ /*
+ * Cutting method...
+ */
+
+ cupsWritePrintData("SN\003\000\000\200", 6);
+ putchar(atoi(attr->value));
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN81", header->MediaType)) != NULL && attr->value)
+ {
+ /*
+ * Cutting pressure...
+ */
+
+ cupsWritePrintData("SN\003\000\000\201", 6);
+ putchar(atoi(attr->value));
+ }
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPCO", spec)) != NULL && attr->value)
+ {
+ /*
+ * Enable/disable cutter.
+ */
+
+ cupsWritePrintData("CO\010\000\000\000", 6);
+ putchar(atoi(attr->value));
+ cupsWritePrintData("\000\000\000\000\000", 5);
+ }
+
+ /*
+ * Exit remote mode...
+ */
+
+ cupsWritePrintData("\033\000\000\000", 4);
+ }
+
+ /*
+ * Enter graphics mode...
+ */
+
+ cupsWritePrintData("\033(G\001\000\001", 6);
+
+ /*
+ * Set the line feed increment...
+ */
+
+ /* TODO: get this from the PPD file... */
+ for (units = 1440; units < header->HWResolution[0]; units *= 2);
+
+ if (ppd->model_number & ESCP_EXT_UNITS)
+ {
+ cupsWritePrintData("\033(U\005\000", 5);
+ putchar(units / header->HWResolution[1]);
+ putchar(units / header->HWResolution[1]);
+ putchar(units / header->HWResolution[0]);
+ putchar(units);
+ putchar(units >> 8);
+ }
+ else
+ {
+ cupsWritePrintData("\033(U\001\000", 5);
+ putchar(3600 / header->HWResolution[1]);
+ }
+
+ /*
+ * Set the page length...
+ */
+
+ PrinterLength = header->PageSize[1] * header->HWResolution[1] / 72;
+
+ if (ppd->model_number & ESCP_PAGE_SIZE)
+ {
+ /*
+ * Set page size (expands bottom margin)...
+ */
+
+ cupsWritePrintData("\033(S\010\000", 5);
+
+ i = header->PageSize[0] * header->HWResolution[1] / 72;
+ putchar(i);
+ putchar(i >> 8);
+ putchar(i >> 16);
+ putchar(i >> 24);
+
+ i = header->PageSize[1] * header->HWResolution[1] / 72;
+ putchar(i);
+ putchar(i >> 8);
+ putchar(i >> 16);
+ putchar(i >> 24);
+ }
+ else
+ {
+ cupsWritePrintData("\033(C\002\000", 5);
+ putchar(PrinterLength & 255);
+ putchar(PrinterLength >> 8);
+ }
+
+ /*
+ * Set the top and bottom margins...
+ */
+
+ PrinterTop = (int)((ppd->sizes[1].length - ppd->sizes[1].top) *
+ header->HWResolution[1] / 72.0);
+
+ if (ppd->model_number & ESCP_EXT_MARGINS)
+ {
+ cupsWritePrintData("\033(c\010\000", 5);
+
+ putchar(PrinterTop);
+ putchar(PrinterTop >> 8);
+ putchar(PrinterTop >> 16);
+ putchar(PrinterTop >> 24);
+
+ putchar(PrinterLength);
+ putchar(PrinterLength >> 8);
+ putchar(PrinterLength >> 16);
+ putchar(PrinterLength >> 24);
+ }
+ else
+ {
+ cupsWritePrintData("\033(c\004\000", 5);
+
+ putchar(PrinterTop & 255);
+ putchar(PrinterTop >> 8);
+
+ putchar(PrinterLength & 255);
+ putchar(PrinterLength >> 8);
+ }
+
+ /*
+ * Set the top position...
+ */
+
+ cupsWritePrintData("\033(V\002\000\000\000", 7);
+
+ /*
+ * Enable unidirectional printing depending on the mode...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsESCPDirection", colormodel,
+ header->MediaType, resolution, spec,
+ sizeof(spec))) != NULL)
+ printf("\033U%c", atoi(attr->value));
+
+ /*
+ * Enable/disable microweaving as needed...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsESCPMicroWeave", colormodel,
+ header->MediaType, resolution, spec,
+ sizeof(spec))) != NULL)
+ printf("\033(i\001%c%c", 0, atoi(attr->value));
+
+ /*
+ * Set the dot size and print speed as needed...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsESCPDotSize", colormodel,
+ header->MediaType, resolution, spec,
+ sizeof(spec))) != NULL)
+ printf("\033(e\002%c%c%c", 0, 0, atoi(attr->value));
+
+ if (ppd->model_number & ESCP_ESCK)
+ {
+ /*
+ * Set the print mode...
+ */
+
+ if (PrinterPlanes == 1)
+ {
+ /*
+ * Fast black printing.
+ */
+
+ cupsWritePrintData("\033(K\002\000\000\001", 7);
+ }
+ else
+ {
+ /*
+ * Color printing.
+ */
+
+ cupsWritePrintData("\033(K\002\000\000\002", 7);
+ }
+ }
+
+ /*
+ * Get softweave settings from header...
+ */
+
+ if (header->cupsRowCount <= 1)
+ {
+ DotRowCount = 1;
+ DotColStep = 1;
+ DotRowStep = 1;
+ DotRowFeed = 1;
+ }
+ else
+ {
+ DotRowCount = header->cupsRowCount;
+ DotRowFeed = header->cupsRowFeed;
+ DotRowStep = header->cupsRowStep % 100;
+ DotColStep = header->cupsRowStep / 100;
+
+ if (DotColStep == 0)
+ DotColStep ++;
+ }
+
+ /*
+ * Setup softweave parameters...
+ */
+
+ DotRowCurrent = 0;
+ DotRowMax = DotRowCount * DotRowStep;
+ DotBufferSize = (header->cupsWidth / DotColStep * BitPlanes + 7) / 8;
+
+ fprintf(stderr, "DEBUG: DotBufferSize = %d\n", DotBufferSize);
+ fprintf(stderr, "DEBUG: DotColStep = %d\n", DotColStep);
+ fprintf(stderr, "DEBUG: DotRowMax = %d\n", DotRowMax);
+ fprintf(stderr, "DEBUG: DotRowStep = %d\n", DotRowStep);
+ fprintf(stderr, "DEBUG: DotRowFeed = %d\n", DotRowFeed);
+ fprintf(stderr, "DEBUG: DotRowCount = %d\n", DotRowCount);
+
+ DotAvailList = NULL;
+ DotUsedList = NULL;
+ DotBuffers[0] = NULL;
+
+ fprintf(stderr, "DEBUG: model_number = %x\n", ppd->model_number);
+
+ if (DotRowMax > 1)
+ {
+ /*
+ * Compute offsets for the color jets on the print head...
+ */
+
+ bands = DotRowStep * DotColStep * PrinterPlanes * 4;
+
+ memset(DotRowOffset, 0, sizeof(DotRowOffset));
+
+ if (PrinterPlanes == 1)
+ {
+ /*
+ * Use full height of print head...
+ */
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPBlack", resolution)) != NULL &&
+ attr->value)
+ {
+ /*
+ * Use custom black head data...
+ */
+
+ sscanf(attr->value, "%d%d", &DotRowCount, &DotRowStep);
+ }
+ }
+ else if (ppd->model_number & ESCP_STAGGER)
+ {
+ /*
+ * Use staggered print head...
+ */
+
+ fputs("DEBUG: Offset head detected...\n", stderr);
+
+ if ((attr = ppdFindAttr(ppd, "cupsESCPOffsets", resolution)) != NULL &&
+ attr->value)
+ {
+ /*
+ * Use only 1/3 of the print head when printing color...
+ */
+
+ sscanf(attr->value, "%d%d%d%d", DotRowOffset + 0,
+ DotRowOffset + 1, DotRowOffset + 2, DotRowOffset + 3);
+ }
+ }
+
+ for (i = 0; i < PrinterPlanes; i ++)
+ fprintf(stderr, "DEBUG: DotRowOffset[%d] = %d\n", i, DotRowOffset[i]);
+
+ /*
+ * Allocate bands...
+ */
+
+ for (i = 0; i < bands; i ++)
+ {
+ band = (cups_weave_t *)calloc(1, sizeof(cups_weave_t));
+ band->next = DotAvailList;
+ DotAvailList = band;
+
+ band->buffer = calloc(DotRowCount, DotBufferSize);
+ }
+
+ if (!DotAvailList)
+ {
+ fputs("ERROR: Unable to allocate band list\n", stderr);
+ exit(1);
+ }
+
+ fputs("DEBUG: Pointer list at start of page...\n", stderr);
+
+ for (band = DotAvailList; band != NULL; band = band->next)
+ fprintf(stderr, "DEBUG: %p\n", band);
+
+ fputs("DEBUG: ----END----\n", stderr);
+
+ /*
+ * Fill the initial bands...
+ */
+
+ modrow = DotColStep * DotRowStep;
+
+ if (DotRowFeed == 0)
+ {
+ /*
+ * Automatically compute the optimal feed value...
+ */
+
+ DotRowFeed = DotRowCount / DotColStep - DotRowStep;
+
+ while ((((DotRowFeed % 2) == 0) == ((DotRowCount % 2) == 0) ||
+ ((DotRowFeed % 3) == 0) == ((DotRowCount % 3) == 0) ||
+ ((DotRowFeed % 5) == 0) == ((DotRowCount % 5) == 0)) &&
+ DotRowFeed > 1)
+ DotRowFeed --;
+
+ if (DotRowFeed < 1)
+ DotRowFeed = 1;
+
+ fprintf(stderr, "DEBUG: Auto DotRowFeed = %d, modrow=%d...\n",
+ DotRowFeed, modrow);
+ }
+
+ memset(DotBands, 0, sizeof(DotBands));
+
+ for (i = modrow, subrow = modrow - 1, y = DotRowFeed;
+ i > 0;
+ i --, y += DotRowFeed)
+ {
+ while (DotBands[subrow][0])
+ {
+ /*
+ * This subrow is already used, move to another one...
+ */
+
+ subrow = (subrow + 1) % modrow;
+ }
+
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ /*
+ * Pull the next available band from the list...
+ */
+
+ band = DotAvailList;
+ DotAvailList = DotAvailList->next;
+ DotBands[subrow][plane] = band;
+
+ /*
+ * Start the band in the first few passes, with the number of rows
+ * varying to allow for a nice interleaved pattern...
+ */
+
+ band->x = subrow / DotRowStep;
+ band->y = (subrow % DotRowStep) + DotRowOffset[plane];
+ band->plane = plane;
+ band->row = 0;
+ band->count = DotRowCount - y / DotRowStep;
+
+ if (band->count < 1)
+ band->count = 1;
+ else if (band->count > DotRowCount)
+ band->count = DotRowCount;
+
+ fprintf(stderr, "DEBUG: DotBands[%d][%d] = %p, x = %d, y = %d, plane = %d, count = %d\n",
+ subrow, plane, band, band->x, band->y, band->plane, band->count);
+ }
+
+ subrow = (subrow + DotRowFeed) % modrow;
+ }
+ }
+ else
+ {
+ /*
+ * Allocate memory for a single line of graphics...
+ */
+
+ ptr = calloc(PrinterPlanes, DotBufferSize);
+
+ for (plane = 0; plane < PrinterPlanes; plane ++, ptr += DotBufferSize)
+ DotBuffers[plane] = ptr;
+ }
+
+ /*
+ * Set the output resolution...
+ */
+
+ cupsWritePrintData("\033(D\004\000", 5);
+ putchar(units);
+ putchar(units >> 8);
+ putchar(units * DotRowStep / header->HWResolution[1]);
+ putchar(units * DotColStep / header->HWResolution[0]);
+
+ /*
+ * Set the top of form...
+ */
+
+ OutputFeed = 0;
+
+ /*
+ * Allocate buffers as needed...
+ */
+
+ PixelBuffer = malloc(header->cupsBytesPerLine);
+ InputBuffer = malloc(header->cupsWidth * PrinterPlanes * 2);
+ OutputBuffers[0] = malloc(PrinterPlanes * header->cupsWidth);
+
+ for (i = 1; i < PrinterPlanes; i ++)
+ OutputBuffers[i] = OutputBuffers[0] + i * header->cupsWidth;
+
+ if (RGB)
+ CMYKBuffer = malloc(header->cupsWidth * PrinterPlanes);
+
+ CompBuffer = malloc(10 * DotBufferSize * DotRowMax);
+}
+
+
+/*
+ * 'EndPage()' - Finish a page of graphics.
+ */
+
+void
+EndPage(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header) /* I - Page header */
+{
+ int i; /* Looping var */
+ cups_weave_t *band, /* Current band */
+ *next; /* Next band in list */
+ int plane; /* Current plane */
+ int subrow; /* Current subrow */
+ int subrows; /* Number of subrows */
+
+
+ /*
+ * Output the last bands of print data as necessary...
+ */
+
+ if (DotRowMax > 1)
+ {
+ /*
+ * Move the remaining bands to the used or avail lists...
+ */
+
+ subrows = DotRowStep * DotColStep;
+
+ for (subrow = 0; subrow < subrows; subrow ++)
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ if (DotBands[subrow][plane]->dirty)
+ {
+ /*
+ * Insert into the used list...
+ */
+
+ DotBands[subrow][plane]->count = DotBands[subrow][plane]->row;
+
+ AddBand(DotBands[subrow][plane]);
+ }
+ else
+ {
+ /*
+ * Nothing here, so move it to the available list...
+ */
+
+ DotBands[subrow][plane]->next = DotAvailList;
+ DotAvailList = DotBands[subrow][plane];
+ }
+
+ DotBands[subrow][plane] = NULL;
+ }
+
+ /*
+ * Loop until all bands are written...
+ */
+
+ fputs("DEBUG: Pointer list at end of page...\n", stderr);
+
+ for (band = DotUsedList; band != NULL; band = band->next)
+ fprintf(stderr, "DEBUG: %p (used)\n", band);
+ for (band = DotAvailList; band != NULL; band = band->next)
+ fprintf(stderr, "DEBUG: %p (avail)\n", band);
+
+ fputs("DEBUG: ----END----\n", stderr);
+
+ for (band = DotUsedList; band != NULL; band = next)
+ {
+ next = band->next;
+
+ OutputBand(ppd, header, band);
+
+ fprintf(stderr, "DEBUG: freeing used band %p, prev = %p, next = %p\n",
+ band, band->prev, band->next);
+
+ free(band->buffer);
+ free(band);
+ }
+
+ /*
+ * Free memory for the available bands, if any...
+ */
+
+ for (band = DotAvailList; band != NULL; band = next)
+ {
+ next = band->next;
+
+ fprintf(stderr, "DEBUG: freeing avail band %p, prev = %p, next = %p\n",
+ band, band->prev, band->next);
+
+ free(band->buffer);
+ free(band);
+ }
+ }
+ else
+ free(DotBuffers[0]);
+
+ /*
+ * Output a page eject sequence...
+ */
+
+ putchar(12);
+
+ /*
+ * Free memory for the page...
+ */
+
+ for (i = 0; i < PrinterPlanes; i ++)
+ {
+ cupsDitherDelete(DitherStates[i]);
+ cupsLutDelete(DitherLuts[i]);
+ }
+
+ free(OutputBuffers[0]);
+
+ free(PixelBuffer);
+ free(InputBuffer);
+ free(CompBuffer);
+
+ cupsCMYKDelete(CMYK);
+
+ if (RGB)
+ {
+ cupsRGBDelete(RGB);
+ free(CMYKBuffer);
+ }
+}
+
+
+/*
+ * 'Shutdown()' - Shutdown a printer.
+ */
+
+void
+Shutdown(ppd_file_t *ppd) /* I - PPD file */
+{
+ /*
+ * Reset the printer...
+ */
+
+ printf("\033@");
+
+ if (ppd->model_number & ESCP_REMOTE)
+ {
+ /*
+ * Go into remote mode...
+ */
+
+ cupsWritePrintData("\033(R\010\000\000REMOTE1", 13);
+
+ /*
+ * Load defaults...
+ */
+
+ cupsWritePrintData("LD\000\000", 4);
+
+ /*
+ * Exit remote mode...
+ */
+
+ cupsWritePrintData("\033\000\000\000", 4);
+ }
+}
+
+
+/*
+ * 'AddBand()' - Add a band of data to the used list.
+ */
+
+void
+AddBand(cups_weave_t *band) /* I - Band to add */
+{
+ cups_weave_t *current, /* Current band */
+ *prev; /* Previous band */
+
+
+ if (band->count < 1)
+ return;
+
+ for (current = DotUsedList, prev = NULL;
+ current != NULL;
+ prev = current, current = current->next)
+ if (band->y < current->y ||
+ (band->y == current->y && band->x < current->x) ||
+ (band->y == current->y && band->x == current->x &&
+ band->plane < current->plane))
+ break;
+
+ if (current != NULL)
+ {
+ /*
+ * Insert the band...
+ */
+
+ band->next = current;
+ band->prev = prev;
+ current->prev = band;
+
+ if (prev != NULL)
+ prev->next = band;
+ else
+ DotUsedList = band;
+ }
+ else if (prev != NULL)
+ {
+ /*
+ * Append the band to the end...
+ */
+
+ band->prev = prev;
+ prev->next = band;
+ band->next = NULL;
+ }
+ else
+ {
+ /*
+ * First band in list...
+ */
+
+ DotUsedList = band;
+ band->prev = NULL;
+ band->next = NULL;
+ }
+}
+
+
+/*
+ * 'CancelJob()' - Cancel the current job...
+ */
+
+void
+CancelJob(int sig) /* I - Signal */
+{
+ (void)sig;
+
+ Canceled = 1;
+}
+
+
+/*
+ * 'CompressData()' - Compress a line of graphics.
+ */
+
+void
+CompressData(ppd_file_t *ppd, /* I - PPD file information */
+ const unsigned char *line, /* I - Data to compress */
+ const int length,/* I - Number of bytes */
+ int plane, /* I - Color plane */
+ int type, /* I - Type of compression */
+ const int rows, /* I - Number of lines to write */
+ const int xstep, /* I - Spacing between columns */
+ const int ystep, /* I - Spacing between lines */
+ const int offset)/* I - Head offset */
+{
+ register const unsigned char *line_ptr,
+ /* Current byte pointer */
+ *line_end, /* End-of-line byte pointer */
+ *start; /* Start of compression sequence */
+ register unsigned char *comp_ptr; /* Pointer into compression buffer */
+ register int count; /* Count of bytes for output */
+ register int bytes; /* Number of bytes per row */
+ static int ctable[7][7] = /* Colors */
+ {
+ { 0, 0, 0, 0, 0, 0, 0 }, /* K */
+ { 0, 16, 0, 0, 0, 0, 0 }, /* Kk */
+ { 2, 1, 4, 0, 0, 0, 0 }, /* CMY */
+ { 2, 1, 4, 0, 0, 0, 0 }, /* CMYK */
+ { 0, 0, 0, 0, 0, 0, 0 },
+ { 2, 18, 1, 17, 4, 0, 0 }, /* CcMmYK */
+ { 2, 18, 1, 17, 4, 0, 16 }, /* CcMmYKk */
+ };
+
+
+ switch (type)
+ {
+ case 0 :
+ /*
+ * Do no compression...
+ */
+
+ line_ptr = (const unsigned char *)line;
+ line_end = (const unsigned char *)line + length;
+ break;
+
+ default :
+ /*
+ * Do TIFF pack-bits encoding...
+ */
+
+ line_ptr = (const unsigned char *)line;
+ line_end = (const unsigned char *)line + length;
+ comp_ptr = CompBuffer;
+
+ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length)
+ {
+ if ((line_ptr + 1) >= line_end)
+ {
+ /*
+ * Single byte on the end...
+ */
+
+ *comp_ptr++ = 0x00;
+ *comp_ptr++ = *line_ptr++;
+ }
+ else if (line_ptr[0] == line_ptr[1])
+ {
+ /*
+ * Repeated sequence...
+ */
+
+ line_ptr ++;
+ count = 2;
+
+ while (line_ptr < (line_end - 1) &&
+ line_ptr[0] == line_ptr[1] &&
+ count < 127)
+ {
+ line_ptr ++;
+ count ++;
+ }
+
+ *comp_ptr++ = 257 - count;
+ *comp_ptr++ = *line_ptr++;
+ }
+ else
+ {
+ /*
+ * Non-repeated sequence...
+ */
+
+ start = line_ptr;
+ line_ptr ++;
+ count = 1;
+
+ while (line_ptr < (line_end - 1) &&
+ line_ptr[0] != line_ptr[1] &&
+ count < 127)
+ {
+ line_ptr ++;
+ count ++;
+ }
+
+ *comp_ptr++ = count - 1;
+
+ memcpy(comp_ptr, start, count);
+ comp_ptr += count;
+ }
+ }
+
+ if ((comp_ptr - CompBuffer) < length)
+ {
+ line_ptr = (const unsigned char *)CompBuffer;
+ line_end = (const unsigned char *)comp_ptr;
+ }
+ else
+ {
+ type = 0;
+ line_ptr = (const unsigned char *)line;
+ line_end = (const unsigned char *)line + length;
+ }
+ break;
+ }
+
+ /*
+ * Position the print head...
+ */
+
+ putchar(0x0d);
+
+ if (offset)
+ {
+ if (BitPlanes == 1)
+ cupsWritePrintData("\033(\\\004\000\240\005", 7);
+ else
+ printf("\033\\");
+
+ putchar(offset);
+ putchar(offset >> 8);
+ }
+
+ /*
+ * Send the graphics...
+ */
+
+ bytes = length / rows;
+
+ if (ppd->model_number & ESCP_RASTER_ESCI)
+ {
+ /*
+ * Send graphics with ESC i command.
+ */
+
+ printf("\033i");
+ putchar(ctable[PrinterPlanes - 1][plane]);
+ putchar(type != 0);
+ putchar(BitPlanes);
+ putchar(bytes & 255);
+ putchar(bytes >> 8);
+ putchar(rows & 255);
+ putchar(rows >> 8);
+ }
+ else
+ {
+ /*
+ * Set the color if necessary...
+ */
+
+ if (PrinterPlanes > 1)
+ {
+ plane = ctable[PrinterPlanes - 1][plane];
+
+ if (plane & 0x10)
+ printf("\033(r%c%c%c%c", 2, 0, 1, plane & 0x0f);
+ else
+ printf("\033r%c", plane);
+ }
+
+ /*
+ * Send graphics with ESC . command.
+ */
+
+ bytes *= 8;
+
+ printf("\033.");
+ putchar(type != 0);
+ putchar(ystep);
+ putchar(xstep);
+ putchar(rows);
+ putchar(bytes & 255);
+ putchar(bytes >> 8);
+ }
+
+ cupsWritePrintData(line_ptr, line_end - line_ptr);
+}
+
+
+/*
+ * 'OutputBand()' - Output a band of graphics.
+ */
+
+void
+OutputBand(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header, /* I - Page header */
+ cups_weave_t *band) /* I - Current band */
+{
+ int xstep, /* Spacing between columns */
+ ystep; /* Spacing between rows */
+
+
+ /*
+ * Interleaved ESC/P2 graphics...
+ */
+
+ OutputFeed = band->y - DotRowCurrent;
+ DotRowCurrent = band->y;
+
+ fprintf(stderr, "DEBUG: Printing band %p, x = %d, y = %d, plane = %d, count = %d, OutputFeed = %d\n",
+ band, band->x, band->y, band->plane, band->count, OutputFeed);
+
+ /*
+ * Compute step values...
+ */
+
+ xstep = 3600 * DotColStep / header->HWResolution[0];
+ ystep = 3600 * DotRowStep / header->HWResolution[1];
+
+ /*
+ * Output the band...
+ */
+
+ if (OutputFeed > 0)
+ {
+ cupsWritePrintData("\033(v\002\000", 5);
+ putchar(OutputFeed & 255);
+ putchar(OutputFeed >> 8);
+
+ OutputFeed = 0;
+ }
+
+ CompressData(ppd, band->buffer, band->count * DotBufferSize, band->plane,
+ header->cupsCompression, band->count, xstep, ystep, band->x);
+
+ /*
+ * Clear the band...
+ */
+
+ memset(band->buffer, 0, band->count * DotBufferSize);
+ band->dirty = 0;
+
+ /*
+ * Flush the output buffers...
+ */
+
+ fflush(stdout);
+}
+
+
+/*
+ * 'ProcessLine()' - Read graphics from the page stream and output as needed.
+ */
+
+void
+ProcessLine(ppd_file_t *ppd, /* I - PPD file */
+ cups_raster_t *ras, /* I - Raster stream */
+ cups_page_header2_t *header, /* I - Page header */
+ const int y) /* I - Current scanline */
+{
+ int plane, /* Current color plane */
+ width, /* Width of line */
+ subwidth, /* Width of interleaved row */
+ subrow, /* Subrow for interleaved output */
+ offset, /* Offset to current line */
+ pass, /* Pass number */
+ xstep, /* X step value */
+ ystep; /* Y step value */
+ cups_weave_t *band; /* Current band */
+
+
+ /*
+ * Read a row of graphics...
+ */
+
+ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine))
+ return;
+
+ /*
+ * Perform the color separation...
+ */
+
+ width = header->cupsWidth;
+ subwidth = header->cupsWidth / DotColStep;
+ xstep = 3600 / header->HWResolution[0];
+ ystep = 3600 / header->HWResolution[1];
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_W :
+ if (RGB)
+ {
+ cupsRGBDoGray(RGB, PixelBuffer, CMYKBuffer, width);
+ cupsCMYKDoCMYK(CMYK, CMYKBuffer, InputBuffer, width);
+ }
+ else
+ cupsCMYKDoGray(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ case CUPS_CSPACE_K :
+ cupsCMYKDoBlack(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ default :
+ case CUPS_CSPACE_RGB :
+ if (RGB)
+ {
+ cupsRGBDoRGB(RGB, PixelBuffer, CMYKBuffer, width);
+ cupsCMYKDoCMYK(CMYK, CMYKBuffer, InputBuffer, width);
+ }
+ else
+ cupsCMYKDoRGB(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ case CUPS_CSPACE_CMYK :
+ cupsCMYKDoCMYK(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+ }
+
+ /*
+ * Dither the pixels...
+ */
+
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ cupsDitherLine(DitherStates[plane], DitherLuts[plane], InputBuffer + plane,
+ PrinterPlanes, OutputBuffers[plane]);
+
+ if (DotRowMax == 1)
+ {
+ /*
+ * Handle microweaved output...
+ */
+
+ if (cupsCheckBytes(OutputBuffers[plane], width))
+ continue;
+
+ if (BitPlanes == 1)
+ cupsPackHorizontal(OutputBuffers[plane], DotBuffers[plane],
+ width, 0, 1);
+ else
+ cupsPackHorizontal2(OutputBuffers[plane], DotBuffers[plane],
+ width, 1);
+
+ if (OutputFeed > 0)
+ {
+ cupsWritePrintData("\033(v\002\000", 5);
+ putchar(OutputFeed & 255);
+ putchar(OutputFeed >> 8);
+ OutputFeed = 0;
+ }
+
+ CompressData(ppd, DotBuffers[plane], DotBufferSize, plane, 1, 1,
+ xstep, ystep, 0);
+ fflush(stdout);
+ }
+ else
+ {
+ /*
+ * Handle softweaved output...
+ */
+
+ for (pass = 0, subrow = y % DotRowStep;
+ pass < DotColStep;
+ pass ++, subrow += DotRowStep)
+ {
+ /*
+ * See if we need to output the band...
+ */
+
+ band = DotBands[subrow][plane];
+ offset = band->row * DotBufferSize;
+
+ if (BitPlanes == 1)
+ cupsPackHorizontal(OutputBuffers[plane] + pass,
+ band->buffer + offset, subwidth, 0, DotColStep);
+ else
+ cupsPackHorizontal2(OutputBuffers[plane] + pass,
+ band->buffer + offset, subwidth, DotColStep);
+
+ band->row ++;
+ band->dirty |= !cupsCheckBytes(band->buffer + offset, DotBufferSize);
+ if (band->row >= band->count)
+ {
+ if (band->dirty)
+ {
+ /*
+ * Dirty band needs to be added to the used list...
+ */
+
+ AddBand(band);
+
+ /*
+ * Then find a new band...
+ */
+
+ if (DotAvailList == NULL)
+ {
+ OutputBand(ppd, header, DotUsedList);
+
+ DotBands[subrow][plane] = DotUsedList;
+ DotUsedList->x = band->x;
+ DotUsedList->y = band->y + band->count * DotRowStep;
+ DotUsedList->plane = band->plane;
+ DotUsedList->row = 0;
+ DotUsedList->count = DotRowCount;
+ DotUsedList = DotUsedList->next;
+ }
+ else
+ {
+ DotBands[subrow][plane] = DotAvailList;
+ DotAvailList->x = band->x;
+ DotAvailList->y = band->y + band->count * DotRowStep;
+ DotAvailList->plane = band->plane;
+ DotAvailList->row = 0;
+ DotAvailList->count = DotRowCount;
+ DotAvailList = DotAvailList->next;
+ }
+ }
+ else
+ {
+ /*
+ * This band isn't dirty, so reuse it...
+ */
+
+ fprintf(stderr, "DEBUG: Blank band %p, x = %d, y = %d, plane = %d, count = %d\n",
+ band, band->x, band->y, band->plane, band->count);
+
+ band->y += band->count * DotRowStep;
+ band->row = 0;
+ band->count = DotRowCount;
+ }
+ }
+ }
+ }
+ }
+
+ if (DotRowMax == 1)
+ OutputFeed ++;
+}
+
+
+/*
+ * 'main()' - Main entry and processing of driver.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int fd; /* File descriptor */
+ cups_raster_t *ras; /* Raster stream for printing */
+ cups_page_header2_t header; /* Page header from file */
+ int page; /* Current page */
+ int y; /* Current line */
+ ppd_file_t *ppd; /* PPD file */
+ int num_options; /* Number of options */
+ cups_option_t *options; /* Options */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ argv[0]);
+ return (1);
+ }
+
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ /*
+ * Open the PPD file...
+ */
+
+ ppd = ppdOpenFile(getenv("PPD"));
+
+ if (!ppd)
+ {
+ ppd_status_t status; /* PPD error */
+ int linenum; /* Line number */
+
+ fputs("ERROR: The PPD file could not be opened.\n", stderr);
+
+ status = ppdLastError(&linenum);
+
+ fprintf(stderr, "DEBUG: %s on line %d.\n", ppdErrorString(status), linenum);
+
+ return (1);
+ }
+
+ ppdMarkDefaults(ppd);
+ cupsMarkOptions(ppd, num_options, options);
+
+ /*
+ * Open the page stream...
+ */
+
+ if (argc == 7)
+ {
+ if ((fd = open(argv[6], O_RDONLY)) == -1)
+ {
+ perror("ERROR: Unable to open raster file");
+ return (1);
+ }
+ }
+ else
+ fd = 0;
+
+ ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
+
+ /*
+ * Register a signal handler to eject the current page if the
+ * job is cancelled.
+ */
+
+ Canceled = 0;
+
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, CancelJob);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = CancelJob;
+ sigaction(SIGTERM, &action, NULL);
+#else
+ signal(SIGTERM, CancelJob);
+#endif /* HAVE_SIGSET */
+
+ /*
+ * Initialize the print device...
+ */
+
+ Setup(ppd);
+
+ /*
+ * Process pages as needed...
+ */
+
+ page = 0;
+
+ while (cupsRasterReadHeader2(ras, &header))
+ {
+ /*
+ * Write a status message with the page number and number of copies.
+ */
+
+ if (Canceled)
+ break;
+
+ page ++;
+
+ fprintf(stderr, "PAGE: %d 1\n", page);
+ fprintf(stderr, "INFO: Starting page %d.\n", page);
+
+ StartPage(ppd, &header);
+
+ for (y = 0; y < header.cupsHeight; y ++)
+ {
+ /*
+ * Let the user know how far we have progressed...
+ */
+
+ if (Canceled)
+ break;
+
+ if ((y & 127) == 0)
+ {
+ fprintf(stderr, "INFO: Printing page %d, %d%% complete.\n",
+ page, 100 * y / header.cupsHeight);
+ fprintf(stderr, "ATTR: job-media-progress=%d\n",
+ 100 * y / header.cupsHeight);
+ }
+
+ /*
+ * Read and write a line of graphics or whitespace...
+ */
+
+ ProcessLine(ppd, ras, &header, y);
+ }
+
+ /*
+ * Eject the page...
+ */
+
+ fprintf(stderr, "INFO: Finished page %d.\n", page);
+
+ EndPage(ppd, &header);
+
+ if (Canceled)
+ break;
+ }
+
+ Shutdown(ppd);
+
+ cupsFreeOptions(num_options, options);
+
+ cupsRasterClose(ras);
+
+ if (fd != 0)
+ close(fd);
+
+ return (page == 0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Advanced HP Page Control Language and Raster Transfer Language
+ * filter for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1993-2005 by Easy Software Products
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * StartPage() - Start a page of graphics.
+ * EndPage() - Finish a page of graphics.
+ * Shutdown() - Shutdown a printer.
+ * CancelJob() - Cancel the current job...
+ * CompressData() - Compress a line of graphics.
+ * OutputLine() - Output the specified number of lines of graphics.
+ * ReadLine() - Read graphics from the page stream.
+ * main() - Main entry and processing of driver.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cupsfilters/driver.h>
+#include "pcl-common.h"
+#include <signal.h>
+
+
+/*
+ * Output modes...
+ */
+
+typedef enum
+{
+ OUTPUT_BITMAP, /* Output bitmap data from RIP */
+ OUTPUT_INVERBIT, /* Output inverted bitmap data */
+ OUTPUT_RGB, /* Output 24-bit RGB data from RIP */
+ OUTPUT_DITHERED /* Output dithered data */
+} pcl_output_t;
+
+
+/*
+ * Globals...
+ */
+
+cups_rgb_t *RGB; /* RGB color separation data */
+cups_cmyk_t *CMYK; /* CMYK color separation data */
+unsigned char *PixelBuffer, /* Pixel buffer */
+ *CMYKBuffer, /* CMYK buffer */
+ *OutputBuffers[6], /* Output buffers */
+ *DotBuffers[6], /* Bit buffers */
+ *CompBuffer, /* Compression buffer */
+ *SeedBuffer, /* Mode 3 seed buffers */
+ BlankValue; /* The blank value */
+short *InputBuffer; /* Color separation buffer */
+cups_lut_t *DitherLuts[6]; /* Lookup tables for dithering */
+cups_dither_t *DitherStates[6]; /* Dither state tables */
+int PrinterPlanes, /* Number of color planes */
+ SeedInvalid, /* Contents of seed buffer invalid? */
+ DotBits[6], /* Number of bits per color */
+ DotBufferSizes[6], /* Size of one row of color dots */
+ DotBufferSize, /* Size of complete line */
+ OutputFeed, /* Number of lines to skip */
+ Page; /* Current page number */
+pcl_output_t OutputMode; /* Output mode - see OUTPUT_ consts */
+const int ColorOrders[7][7] = /* Order of color planes */
+ {
+ { 0, 0, 0, 0, 0, 0, 0 }, /* Black */
+ { 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 1, 2, 0, 0, 0, 0 }, /* CMY */
+ { 3, 0, 1, 2, 0, 0, 0 }, /* KCMY */
+ { 0, 0, 0, 0, 0, 0, 0 },
+ { 5, 0, 1, 2, 3, 4, 0 }, /* KCMYcm */
+ { 5, 0, 1, 2, 3, 4, 6 } /* KCMYcmk */
+ };
+int Canceled; /* Is the job canceled? */
+
+
+/*
+ * Prototypes...
+ */
+
+void StartPage(ppd_file_t *ppd, cups_page_header2_t *header, int job_id,
+ const char *user, const char *title, int num_options,
+ cups_option_t *options);
+void EndPage(ppd_file_t *ppd, cups_page_header2_t *header);
+void Shutdown(ppd_file_t *ppd, int job_id, const char *user,
+ const char *title, int num_options, cups_option_t *options);
+
+void CancelJob(int sig);
+void CompressData(unsigned char *line, int length, int plane, int pend,
+ int type);
+void OutputLine(ppd_file_t *ppd, cups_page_header2_t *header);
+int ReadLine(cups_raster_t *ras, cups_page_header2_t *header);
+
+
+/*
+ * 'StartPage()' - Start a page of graphics.
+ */
+
+void
+StartPage(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header, /* I - Page header */
+ int job_id, /* I - Job ID */
+ const char *user, /* I - User printing job */
+ const char *title, /* I - Title of job */
+ int num_options,
+ /* I - Number of command-line options */
+ cups_option_t *options) /* I - Command-line options */
+{
+ int i; /* Temporary/looping var */
+ int plane; /* Current plane */
+ char s[255]; /* Temporary value */
+ const char *colormodel; /* Color model string */
+ char resolution[PPD_MAX_NAME],
+ /* Resolution string */
+ spec[PPD_MAX_NAME]; /* PPD attribute name */
+ ppd_attr_t *attr; /* Attribute from PPD file */
+ ppd_choice_t *choice; /* Selected option */
+ const int *order; /* Order to use */
+ int xorigin, /* X origin of page */
+ yorigin; /* Y origin of page */
+ static const float default_lut[2] = /* Default dithering lookup table */
+ {
+ 0.0,
+ 1.0
+ };
+
+
+ /*
+ * Debug info...
+ */
+
+ fprintf(stderr, "DEBUG: StartPage...\n");
+ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
+ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
+ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
+ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
+
+ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
+ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
+ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
+ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
+ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
+ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
+ header->HWResolution[1]);
+ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
+ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
+ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
+ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
+ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
+ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
+ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
+ header->Margins[1]);
+ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
+ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
+ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
+ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
+ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
+ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
+ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
+ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
+ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
+ header->PageSize[1]);
+ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
+ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
+ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
+ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
+ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
+ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
+ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor);
+ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel);
+ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine);
+ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
+ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
+ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
+
+#ifdef __APPLE__
+ /*
+ * MacOS X 10.2.x doesn't set most of the page device attributes, so check
+ * the options and set them accordingly...
+ */
+
+ if (ppdIsMarked(ppd, "Duplex", "DuplexNoTumble"))
+ {
+ header->Duplex = CUPS_TRUE;
+ header->Tumble = CUPS_FALSE;
+ }
+ else if (ppdIsMarked(ppd, "Duplex", "DuplexTumble"))
+ {
+ header->Duplex = CUPS_TRUE;
+ header->Tumble = CUPS_TRUE;
+ }
+
+ fprintf(stderr, "DEBUG: num_options=%d\n", num_options);
+
+ for (i = 0; i < num_options; i ++)
+ fprintf(stderr, "DEBUG: options[%d]=[\"%s\" \"%s\"]\n", i,
+ options[i].name, options[i].value);
+#endif /* __APPLE__ */
+
+ /*
+ * Figure out the color model and spec strings...
+ */
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_K :
+ colormodel = "Black";
+ break;
+ case CUPS_CSPACE_W :
+ colormodel = "Gray";
+ break;
+ default :
+ case CUPS_CSPACE_RGB :
+ colormodel = "RGB";
+ break;
+ case CUPS_CSPACE_CMY :
+ colormodel = "CMY";
+ break;
+ case CUPS_CSPACE_CMYK :
+ colormodel = "CMYK";
+ break;
+ }
+
+ if (header->HWResolution[0] != header->HWResolution[1])
+ snprintf(resolution, sizeof(resolution), "%dx%ddpi",
+ header->HWResolution[0], header->HWResolution[1]);
+ else
+ snprintf(resolution, sizeof(resolution), "%ddpi",
+ header->HWResolution[0]);
+
+ if (!header->MediaType[0])
+ strcpy(header->MediaType, "PLAIN");
+
+ /*
+ * Get the dithering parameters...
+ */
+
+ BlankValue = 0x00;
+
+ if (header->cupsBitsPerColor == 1)
+ {
+ /*
+ * Use raw bitmap mode...
+ */
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_K :
+ OutputMode = OUTPUT_BITMAP;
+ PrinterPlanes = 1;
+ break;
+ case CUPS_CSPACE_W :
+ OutputMode = OUTPUT_INVERBIT;
+ PrinterPlanes = 1;
+ break;
+ default :
+ case CUPS_CSPACE_RGB :
+ OutputMode = OUTPUT_INVERBIT;
+ PrinterPlanes = 3;
+ break;
+ case CUPS_CSPACE_CMY :
+ OutputMode = OUTPUT_BITMAP;
+ PrinterPlanes = 3;
+ break;
+ case CUPS_CSPACE_CMYK :
+ OutputMode = OUTPUT_BITMAP;
+ PrinterPlanes = 4;
+ break;
+ }
+
+ if (OutputMode == OUTPUT_INVERBIT)
+ BlankValue = 0xff;
+
+ DotBufferSize = header->cupsBytesPerLine;
+
+ memset(DitherLuts, 0, sizeof(DitherLuts));
+ memset(DitherStates, 0, sizeof(DitherStates));
+ }
+ else if (header->cupsColorSpace == CUPS_CSPACE_RGB &&
+ (ppd->model_number & PCL_RASTER_RGB24))
+ {
+ /*
+ * Use 24-bit RGB output mode...
+ */
+
+ OutputMode = OUTPUT_RGB;
+ PrinterPlanes = 3;
+ DotBufferSize = header->cupsBytesPerLine;
+
+ if (header->cupsCompression == 10)
+ BlankValue = 0xff;
+
+ memset(DitherLuts, 0, sizeof(DitherLuts));
+ memset(DitherStates, 0, sizeof(DitherStates));
+ }
+ else if ((header->cupsColorSpace == CUPS_CSPACE_K ||
+ header->cupsColorSpace == CUPS_CSPACE_W) &&
+ (ppd->model_number & PCL_RASTER_RGB24) &&
+ header->cupsCompression == 10)
+ {
+ /*
+ * Use 24-bit RGB output mode for grayscale/black output...
+ */
+
+ OutputMode = OUTPUT_RGB;
+ PrinterPlanes = 1;
+ DotBufferSize = header->cupsBytesPerLine;
+
+ if (header->cupsColorSpace == CUPS_CSPACE_W)
+ BlankValue = 0xff;
+
+ memset(DitherLuts, 0, sizeof(DitherLuts));
+ memset(DitherStates, 0, sizeof(DitherStates));
+ }
+ else
+ {
+ /*
+ * Use dithered output mode...
+ */
+
+ OutputMode = OUTPUT_DITHERED;
+
+ /*
+ * Load the appropriate color profiles...
+ */
+
+ RGB = NULL;
+ CMYK = NULL;
+
+ fputs("DEBUG: Attempting to load color profiles using the following values:\n", stderr);
+ fprintf(stderr, "DEBUG: ColorModel = %s\n", colormodel);
+ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType);
+ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution);
+
+ if (header->cupsColorSpace == CUPS_CSPACE_RGB ||
+ header->cupsColorSpace == CUPS_CSPACE_W)
+ RGB = cupsRGBLoad(ppd, colormodel, header->MediaType, resolution);
+
+ CMYK = cupsCMYKLoad(ppd, colormodel, header->MediaType, resolution);
+
+ if (RGB)
+ fputs("DEBUG: Loaded RGB separation from PPD.\n", stderr);
+
+ if (CMYK)
+ fputs("DEBUG: Loaded CMYK separation from PPD.\n", stderr);
+ else
+ {
+ fputs("DEBUG: Loading default K separation.\n", stderr);
+ CMYK = cupsCMYKNew(1);
+ }
+
+ PrinterPlanes = CMYK->num_channels;
+
+ /*
+ * Use dithered mode...
+ */
+
+ switch (PrinterPlanes)
+ {
+ case 1 : /* K */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+
+ case 3 : /* CMY */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ break;
+
+ case 4 : /* CMYK */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ DitherLuts[3] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+
+ case 6 : /* CcMmYK */
+ DitherLuts[0] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Cyan");
+ DitherLuts[1] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightCyan");
+ DitherLuts[2] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Magenta");
+ DitherLuts[3] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "LightMagenta");
+ DitherLuts[4] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Yellow");
+ DitherLuts[5] = cupsLutLoad(ppd, colormodel, header->MediaType,
+ resolution, "Black");
+ break;
+ }
+
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ if (!DitherLuts[plane])
+ DitherLuts[plane] = cupsLutNew(2, default_lut);
+
+ if (DitherLuts[plane][4095].pixel > 1)
+ DotBits[plane] = 2;
+ else
+ DotBits[plane] = 1;
+
+ DitherStates[plane] = cupsDitherNew(header->cupsWidth);
+
+ if (!DitherLuts[plane])
+ DitherLuts[plane] = cupsLutNew(2, default_lut);
+ }
+ }
+
+ fprintf(stderr, "DEBUG: PrinterPlanes = %d\n", PrinterPlanes);
+
+ /*
+ * Initialize the printer...
+ */
+
+ if ((attr = ppdFindAttr(ppd, "cupsInitialNulls", NULL)) != NULL)
+ for (i = atoi(attr->value); i > 0; i --)
+ putchar(0);
+
+ if (Page == 1 && (ppd->model_number & PCL_PJL))
+ {
+ pjl_escape();
+
+ /*
+ * PJL job setup...
+ */
+
+ pjl_set_job(job_id, user, title);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "StartJob")) != NULL)
+ pjl_write(ppd, attr->value, NULL, job_id, user, title, num_options,
+ options);
+
+ snprintf(spec, sizeof(spec), "RENDERMODE.%s", colormodel);
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", spec)) != NULL)
+ printf("@PJL SET RENDERMODE=%s\r\n", attr->value);
+
+ snprintf(spec, sizeof(spec), "COLORSPACE.%s", colormodel);
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", spec)) != NULL)
+ printf("@PJL SET COLORSPACE=%s\r\n", attr->value);
+
+ snprintf(spec, sizeof(spec), "RENDERINTENT.%s", colormodel);
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", spec)) != NULL)
+ printf("@PJL SET RENDERINTENT=%s\r\n", attr->value);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "Duplex")) != NULL)
+ {
+ sprintf(s, "%d", header->Duplex);
+ pjl_write(ppd, attr->value, s, job_id, user, title, num_options, options);
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "Tumble")) != NULL)
+ {
+ sprintf(s, "%d", header->Tumble);
+ pjl_write(ppd, attr->value, s, job_id, user, title, num_options, options);
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "MediaClass")) != NULL)
+ pjl_write(ppd, attr->value, header->MediaClass, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "MediaColor")) != NULL)
+ pjl_write(ppd, attr->value, header->MediaColor, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "MediaType")) != NULL)
+ pjl_write(ppd, attr->value, header->MediaType, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "OutputType")) != NULL)
+ pjl_write(ppd, attr->value, header->OutputType, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "cupsBooklet")) != NULL &&
+ (choice = ppdFindMarkedChoice(ppd, "cupsBooklet")) != NULL)
+ pjl_write(ppd, attr->value, choice->choice, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "Jog")) != NULL)
+ {
+ sprintf(s, "%d", header->Jog);
+ pjl_write(ppd, attr->value, s, job_id, user, title, num_options, options);
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "cupsPunch")) != NULL &&
+ (choice = ppdFindMarkedChoice(ppd, "cupsPunch")) != NULL)
+ pjl_write(ppd, attr->value, choice->choice, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "cupsStaple")) != NULL &&
+ (choice = ppdFindMarkedChoice(ppd, "cupsStaple")) != NULL)
+ pjl_write(ppd, attr->value, choice->choice, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "cupsRET")) != NULL &&
+ (choice = ppdFindMarkedChoice(ppd, "cupsRET")) != NULL)
+ pjl_write(ppd, attr->value, choice->choice, job_id, user, title,
+ num_options, options);
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "cupsTonerSave")) != NULL &&
+ (choice = ppdFindMarkedChoice(ppd, "cupsTonerSave")) != NULL)
+ pjl_write(ppd, attr->value, choice->choice, job_id, user, title,
+ num_options, options);
+
+ if (ppd->model_number & PCL_PJL_PAPERWIDTH)
+ {
+ printf("@PJL SET PAPERLENGTH=%d\r\n", header->PageSize[1] * 10);
+ printf("@PJL SET PAPERWIDTH=%d\r\n", header->PageSize[0] * 10);
+ }
+
+ if (ppd->model_number & PCL_PJL_RESOLUTION)
+ printf("@PJL SET RESOLUTION=%d\r\n", header->HWResolution[0]);
+
+ ppdEmit(ppd, stdout, PPD_ORDER_JCL);
+ if (ppd->model_number & PCL_PJL_HPGL2)
+ pjl_enter_language("HPGL2");
+ else if (ppd->model_number & PCL_PJL_PCL3GUI)
+ pjl_enter_language("PCL3GUI");
+ else
+ pjl_enter_language("PCL");
+ }
+
+ if (Page == 1)
+ {
+ pcl_reset();
+ }
+
+ if (ppd->model_number & PCL_PJL_HPGL2)
+ {
+ if (Page == 1)
+ {
+ /*
+ * HP-GL/2 initialization...
+ */
+
+ printf("IN;");
+ printf("MG\"%d %s %s\";", job_id, user, title);
+ }
+
+ /*
+ * Set media size, position, type, etc...
+ */
+
+ printf("BP5,0;");
+ printf("PS%.0f,%.0f;",
+ header->cupsHeight * 1016.0 / header->HWResolution[1],
+ header->cupsWidth * 1016.0 / header->HWResolution[0]);
+ printf("PU;");
+ printf("PA0,0");
+
+ printf("MT%d;", header->cupsMediaType);
+
+ if (header->CutMedia == CUPS_CUT_PAGE)
+ printf("EC;");
+ else
+ printf("EC0;");
+
+ /*
+ * Set graphics mode...
+ */
+
+ pcl_set_pcl_mode(0);
+ pcl_set_negative_motion();
+ }
+ else
+ {
+ /*
+ * Set media size, position, type, etc...
+ */
+
+ if (!header->Duplex || (Page & 1))
+ {
+ pcl_set_media_size(ppd, header->PageSize[0], header->PageSize[1]);
+
+ if (header->MediaPosition)
+ pcl_set_media_source(header->MediaPosition);
+
+ pcl_set_media_type(header->cupsMediaType);
+
+ if (ppdFindAttr(ppd, "cupsPJL", "Duplex") == NULL)
+ pcl_set_duplex(header->Duplex, header->Tumble);
+
+ /*
+ * Set the number of copies...
+ */
+
+ if (!ppd->manual_copies)
+ pcl_set_copies(header->NumCopies);
+
+ /*
+ * Set the output order/bin...
+ */
+
+ if (ppdFindAttr(ppd, "cupsPJL", "Jog") == NULL && header->Jog)
+ printf("\033&l%dG", header->Jog);
+ }
+ else
+ {
+ /*
+ * Print on the back side...
+ */
+
+ printf("\033&a2G");
+ }
+
+ if (header->Duplex && (ppd->model_number & PCL_RASTER_CRD))
+ {
+ /*
+ * Reload the media...
+ */
+
+ pcl_set_media_source(-2);
+ }
+
+ /*
+ * Set the units for cursor positioning and go to the top of the form.
+ */
+
+ printf("\033&u%dD", header->HWResolution[0]);
+ printf("\033*p0Y\033*p0X");
+ }
+
+ if ((attr = cupsFindAttr(ppd, "cupsPCLQuality", colormodel,
+ header->MediaType, resolution, spec,
+ sizeof(spec))) != NULL)
+ {
+ /*
+ * Set the print quality...
+ */
+
+ if (ppd->model_number & PCL_PJL_HPGL2)
+ printf("QM%d", atoi(attr->value));
+ else
+ printf("\033*o%dM", atoi(attr->value));
+ }
+
+ /*
+ * Enter graphics mode...
+ */
+
+ if (ppd->model_number & PCL_RASTER_CRD)
+ {
+ /*
+ * Use configure raster data command...
+ */
+
+ if (OutputMode == OUTPUT_RGB)
+ {
+ /*
+ * Send 12-byte configure raster data command with horizontal and
+ * vertical resolutions as well as a color count...
+ */
+
+ if ((attr = cupsFindAttr(ppd, "cupsPCLCRDMode", colormodel,
+ header->MediaType, resolution, spec,
+ sizeof(spec))) != NULL)
+ i = atoi(attr->value);
+ else
+ i = 31;
+
+ printf("\033*g12W");
+ putchar(6); /* Format 6 */
+ putchar(i); /* Set pen mode */
+ putchar(0x00); /* Number components */
+ putchar(0x01); /* (1 for RGB) */
+
+ putchar(header->HWResolution[0] >> 8);
+ putchar(header->HWResolution[0]);
+ putchar(header->HWResolution[1] >> 8);
+ putchar(header->HWResolution[1]);
+
+ putchar(header->cupsCompression); /* Compression mode 3 or 10 */
+ putchar(0x01); /* Portrait orientation */
+ putchar(0x20); /* Bits per pixel (32 = RGB) */
+ putchar(0x01); /* Planes per pixel (1 = chunky RGB) */
+ }
+ else
+ {
+ /*
+ * Send the configure raster data command with horizontal and
+ * vertical resolutions as well as a color count...
+ */
+
+ printf("\033*g%dW", PrinterPlanes * 6 + 2);
+ putchar(2); /* Format 2 */
+ putchar(PrinterPlanes); /* Output planes */
+
+ order = ColorOrders[PrinterPlanes - 1];
+
+ for (i = 0; i < PrinterPlanes; i ++)
+ {
+ plane = order[i];
+
+ putchar(header->HWResolution[0] >> 8);
+ putchar(header->HWResolution[0]);
+ putchar(header->HWResolution[1] >> 8);
+ putchar(header->HWResolution[1]);
+ putchar(0);
+ putchar(1 << DotBits[plane]);
+ }
+ }
+ }
+ else if ((ppd->model_number & PCL_RASTER_CID) && OutputMode == OUTPUT_RGB)
+ {
+ /*
+ * Use configure image data command...
+ */
+
+ pcl_set_simple_resolution(header->HWResolution[0]);
+ /* Set output resolution */
+
+ cupsWritePrintData("\033*v6W\0\3\0\10\10\10", 11);
+ /* 24-bit RGB */
+ }
+ else
+ {
+ /*
+ * Use simple raster commands...
+ */
+
+ pcl_set_simple_resolution(header->HWResolution[0]);
+ /* Set output resolution */
+
+ if (PrinterPlanes == 3)
+ pcl_set_simple_cmy();
+ else if (PrinterPlanes == 4)
+ pcl_set_simple_kcmy();
+ }
+
+ if ((attr = ppdFindAttr(ppd, "cupsPCLOrigin", "X")) != NULL)
+ xorigin = atoi(attr->value);
+ else
+ xorigin = 0;
+
+ if ((attr = ppdFindAttr(ppd, "cupsPCLOrigin", "Y")) != NULL)
+ yorigin = atoi(attr->value);
+ else
+ yorigin = 120;
+
+ printf("\033&a%dH\033&a%dV", xorigin, yorigin);
+ printf("\033*r%dS", header->cupsWidth);
+ printf("\033*r%dT", header->cupsHeight);
+ printf("\033*r1A");
+
+ if (header->cupsCompression && header->cupsCompression != 10)
+ printf("\033*b%dM", header->cupsCompression);
+
+ OutputFeed = 0;
+
+ /*
+ * Allocate memory for the page...
+ */
+
+ PixelBuffer = malloc(header->cupsBytesPerLine);
+
+ if (OutputMode == OUTPUT_DITHERED)
+ {
+ InputBuffer = malloc(header->cupsWidth * PrinterPlanes * 2);
+ OutputBuffers[0] = malloc(PrinterPlanes * header->cupsWidth);
+
+ for (i = 1; i < PrinterPlanes; i ++)
+ OutputBuffers[i] = OutputBuffers[0] + i * header->cupsWidth;
+
+ if (RGB)
+ CMYKBuffer = malloc(header->cupsWidth * PrinterPlanes);
+
+ for (plane = 0, DotBufferSize = 0; plane < PrinterPlanes; plane ++)
+ {
+ DotBufferSizes[plane] = (header->cupsWidth + 7) / 8 * DotBits[plane];
+ DotBufferSize += DotBufferSizes[plane];
+ }
+
+ DotBuffers[0] = malloc(DotBufferSize);
+ for (plane = 1; plane < PrinterPlanes; plane ++)
+ DotBuffers[plane] = DotBuffers[plane - 1] + DotBufferSizes[plane - 1];
+ }
+
+ if (header->cupsCompression)
+ CompBuffer = malloc(DotBufferSize * 4);
+
+ if (header->cupsCompression >= 3)
+ SeedBuffer = malloc(DotBufferSize);
+
+ SeedInvalid = 1;
+
+ fprintf(stderr, "BlankValue=%d\n", BlankValue);
+}
+
+
+/*
+ * 'EndPage()' - Finish a page of graphics.
+ */
+
+void
+EndPage(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header) /* I - Page header */
+{
+ int plane; /* Current plane */
+
+
+ /*
+ * End graphics mode...
+ */
+
+ if (ppd->model_number & PCL_RASTER_END_COLOR)
+ printf("\033*rC"); /* End color GFX */
+ else
+ printf("\033*r0B"); /* End B&W GFX */
+
+ /*
+ * Output a page eject sequence...
+ */
+
+ if (ppd->model_number & PCL_PJL_HPGL2)
+ {
+ pcl_set_hpgl_mode(0); /* Back to HP-GL/2 mode */
+ printf("PG;"); /* Eject the current page */
+ }
+ else if (!(header->Duplex && (Page & 1)))
+ printf("\014"); /* Eject current page */
+
+ /*
+ * Free memory for the page...
+ */
+
+ free(PixelBuffer);
+
+ if (OutputMode == OUTPUT_DITHERED)
+ {
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ {
+ cupsDitherDelete(DitherStates[plane]);
+ cupsLutDelete(DitherLuts[plane]);
+ }
+
+ free(DotBuffers[0]);
+ free(InputBuffer);
+ free(OutputBuffers[0]);
+
+ cupsCMYKDelete(CMYK);
+
+ if (RGB)
+ {
+ cupsRGBDelete(RGB);
+ free(CMYKBuffer);
+ }
+ }
+
+ if (header->cupsCompression)
+ free(CompBuffer);
+
+ if (header->cupsCompression >= 3)
+ free(SeedBuffer);
+}
+
+
+/*
+ * 'Shutdown()' - Shutdown a printer.
+ */
+
+void
+Shutdown(ppd_file_t *ppd, /* I - PPD file */
+ int job_id, /* I - Job ID */
+ const char *user, /* I - User printing job */
+ const char *title, /* I - Title of job */
+ int num_options,/* I - Number of command-line options */
+ cups_option_t *options) /* I - Command-line options */
+{
+ ppd_attr_t *attr; /* Attribute from PPD file */
+
+
+ if ((attr = ppdFindAttr(ppd, "cupsPCL", "EndJob")) != NULL)
+ {
+ /*
+ * Tell the printer how many pages were in the job...
+ */
+
+ putchar(0x1b);
+ printf(attr->value, Page);
+ }
+ else
+ {
+ /*
+ * Return the printer to the default state...
+ */
+
+ pcl_reset();
+ }
+
+ if (ppd->model_number & PCL_PJL)
+ {
+ pjl_escape();
+
+ if ((attr = ppdFindAttr(ppd, "cupsPJL", "EndJob")) != NULL)
+ pjl_write(ppd, attr->value, NULL, job_id, user, title, num_options,
+ options);
+ else
+ printf("@PJL EOJ\r\n");
+
+ pjl_escape();
+ }
+}
+
+
+/*
+ * 'CancelJob()' - Cancel the current job...
+ */
+
+void
+CancelJob(int sig) /* I - Signal */
+{
+ (void)sig;
+
+ Canceled = 1;
+}
+
+
+/*
+ * 'CompressData()' - Compress a line of graphics.
+ */
+
+void
+CompressData(unsigned char *line, /* I - Data to compress */
+ int length, /* I - Number of bytes */
+ int plane, /* I - Color plane */
+ int pend, /* I - End character for data */
+ int type) /* I - Type of compression */
+{
+ unsigned char *line_ptr, /* Current byte pointer */
+ *line_end, /* End-of-line byte pointer */
+ *comp_ptr, /* Pointer into compression buffer */
+ *start, /* Start of compression sequence */
+ *seed; /* Seed buffer pointer */
+ int count, /* Count of bytes for output */
+ offset, /* Offset of bytes for output */
+ temp; /* Temporary count */
+ int r, g, b; /* RGB deltas for mode 10 compression */
+
+
+ switch (type)
+ {
+ default :
+ /*
+ * Do no compression; with a mode-0 only printer, we can compress blank
+ * lines...
+ */
+
+ line_ptr = line;
+
+ if (cupsCheckBytes(line, length))
+ line_end = line; /* Blank line */
+ else
+ line_end = line + length; /* Non-blank line */
+ break;
+
+ case 1 :
+ /*
+ * Do run-length encoding...
+ */
+
+ line_end = line + length;
+ for (line_ptr = line, comp_ptr = CompBuffer;
+ line_ptr < line_end;
+ comp_ptr += 2, line_ptr += count)
+ {
+ for (count = 1;
+ (line_ptr + count) < line_end &&
+ line_ptr[0] == line_ptr[count] &&
+ count < 256;
+ count ++);
+
+ comp_ptr[0] = count - 1;
+ comp_ptr[1] = line_ptr[0];
+ }
+
+ line_ptr = CompBuffer;
+ line_end = comp_ptr;
+ break;
+
+ case 2 :
+ /*
+ * Do TIFF pack-bits encoding...
+ */
+
+ line_ptr = line;
+ line_end = line + length;
+ comp_ptr = CompBuffer;
+
+ while (line_ptr < line_end)
+ {
+ if ((line_ptr + 1) >= line_end)
+ {
+ /*
+ * Single byte on the end...
+ */
+
+ *comp_ptr++ = 0x00;
+ *comp_ptr++ = *line_ptr++;
+ }
+ else if (line_ptr[0] == line_ptr[1])
+ {
+ /*
+ * Repeated sequence...
+ */
+
+ line_ptr ++;
+ count = 2;
+
+ while (line_ptr < (line_end - 1) &&
+ line_ptr[0] == line_ptr[1] &&
+ count < 127)
+ {
+ line_ptr ++;
+ count ++;
+ }
+
+ *comp_ptr++ = 257 - count;
+ *comp_ptr++ = *line_ptr++;
+ }
+ else
+ {
+ /*
+ * Non-repeated sequence...
+ */
+
+ start = line_ptr;
+ line_ptr ++;
+ count = 1;
+
+ while (line_ptr < (line_end - 1) &&
+ line_ptr[0] != line_ptr[1] &&
+ count < 127)
+ {
+ line_ptr ++;
+ count ++;
+ }
+
+ *comp_ptr++ = count - 1;
+
+ memcpy(comp_ptr, start, count);
+ comp_ptr += count;
+ }
+ }
+
+ line_ptr = CompBuffer;
+ line_end = comp_ptr;
+ break;
+
+ case 3 :
+ /*
+ * Do delta-row compression...
+ */
+
+ line_ptr = line;
+ line_end = line + length;
+
+ comp_ptr = CompBuffer;
+ seed = SeedBuffer + plane * length;
+
+ while (line_ptr < line_end)
+ {
+ /*
+ * Find the next non-matching sequence...
+ */
+
+ start = line_ptr;
+
+ if (SeedInvalid)
+ {
+ /*
+ * The seed buffer is invalid, so do the next 8 bytes, max...
+ */
+
+ offset = 0;
+
+ if ((count = line_end - line_ptr) > 8)
+ count = 8;
+
+ line_ptr += count;
+ }
+ else
+ {
+ /*
+ * The seed buffer is valid, so compare against it...
+ */
+
+ while (*line_ptr == *seed &&
+ line_ptr < line_end)
+ {
+ line_ptr ++;
+ seed ++;
+ }
+
+ if (line_ptr == line_end)
+ break;
+
+ offset = line_ptr - start;
+
+ /*
+ * Find up to 8 non-matching bytes...
+ */
+
+ start = line_ptr;
+ count = 0;
+ while (*line_ptr != *seed &&
+ line_ptr < line_end &&
+ count < 8)
+ {
+ line_ptr ++;
+ seed ++;
+ count ++;
+ }
+ }
+
+ /*
+ * Place mode 3 compression data in the buffer; see HP manuals
+ * for details...
+ */
+
+ if (offset >= 31)
+ {
+ /*
+ * Output multi-byte offset...
+ */
+
+ *comp_ptr++ = ((count - 1) << 5) | 31;
+
+ offset -= 31;
+ while (offset >= 255)
+ {
+ *comp_ptr++ = 255;
+ offset -= 255;
+ }
+
+ *comp_ptr++ = offset;
+ }
+ else
+ {
+ /*
+ * Output single-byte offset...
+ */
+
+ *comp_ptr++ = ((count - 1) << 5) | offset;
+ }
+
+ memcpy(comp_ptr, start, count);
+ comp_ptr += count;
+ }
+
+ line_ptr = CompBuffer;
+ line_end = comp_ptr;
+
+ memcpy(SeedBuffer + plane * length, line, length);
+ break;
+
+ case 10 :
+ /*
+ * Mode 10 "near lossless" RGB compression...
+ */
+
+ line_ptr = line;
+ line_end = line + length;
+
+ comp_ptr = CompBuffer;
+ seed = SeedBuffer;
+
+ if (PrinterPlanes == 1)
+ {
+ /*
+ * Do grayscale compression to RGB...
+ */
+
+ while (line_ptr < line_end)
+ {
+ /*
+ * Find the next non-matching sequence...
+ */
+
+ start = line_ptr;
+ while (line_ptr < line_end &&
+ *line_ptr == *seed)
+ {
+ line_ptr ++;
+ seed ++;
+ }
+
+ if (line_ptr == line_end)
+ break;
+
+ offset = line_ptr - start;
+
+ /*
+ * Find non-matching grayscale pixels...
+ */
+
+ start = line_ptr;
+ while (line_ptr < line_end &&
+ *line_ptr != *seed)
+ {
+ line_ptr ++;
+ seed ++;
+ }
+
+ count = line_ptr - start;
+
+#if 0
+ fprintf(stderr, "DEBUG: offset=%d, count=%d, comp_ptr=%p(%d of %d)...\n",
+ offset, count, comp_ptr, comp_ptr - CompBuffer,
+ BytesPerLine * 5);
+#endif /* 0 */
+
+ /*
+ * Place mode 10 compression data in the buffer; each sequence
+ * starts with a command byte that looks like:
+ *
+ * CMD SRC SRC OFF OFF CNT CNT CNT
+ *
+ * For the purpose of this driver, CMD and SRC are always 0.
+ *
+ * If the offset >= 3 then additional offset bytes follow the
+ * first command byte, each byte == 255 until the last one.
+ *
+ * If the count >= 7, then additional count bytes follow each
+ * group of pixels, each byte == 255 until the last one.
+ *
+ * The offset and count are in RGB tuples (not bytes, as for
+ * Mode 3 and 9)...
+ */
+
+ if (offset >= 3)
+ {
+ /*
+ * Output multi-byte offset...
+ */
+
+ if (count > 7)
+ *comp_ptr++ = 0x1f;
+ else
+ *comp_ptr++ = 0x18 | (count - 1);
+
+ offset -= 3;
+ while (offset >= 255)
+ {
+ *comp_ptr++ = 255;
+ offset -= 255;
+ }
+
+ *comp_ptr++ = offset;
+ }
+ else
+ {
+ /*
+ * Output single-byte offset...
+ */
+
+ if (count > 7)
+ *comp_ptr++ = (offset << 3) | 0x07;
+ else
+ *comp_ptr++ = (offset << 3) | (count - 1);
+ }
+
+ temp = count - 8;
+ seed -= count;
+
+ while (count > 0)
+ {
+ if (count <= temp)
+ {
+ /*
+ * This is exceedingly lame... The replacement counts
+ * are intermingled with the data...
+ */
+
+ if (temp >= 255)
+ *comp_ptr++ = 255;
+ else
+ *comp_ptr++ = temp;
+
+ temp -= 255;
+ }
+
+ /*
+ * Get difference between current and see pixels...
+ */
+
+ r = *start - *seed;
+ g = r;
+ b = ((*start & 0xfe) - (*seed & 0xfe)) / 2;
+
+ if (r < -16 || r > 15 || g < -16 || g > 15 || b < -16 || b > 15)
+ {
+ /*
+ * Pack 24-bit RGB into 23 bits... Lame...
+ */
+
+ g = *start;
+
+ *comp_ptr++ = g >> 1;
+
+ if (g & 1)
+ *comp_ptr++ = 0x80 | (g >> 1);
+ else
+ *comp_ptr++ = g >> 1;
+
+ if (g & 1)
+ *comp_ptr++ = 0x80 | (g >> 1);
+ else
+ *comp_ptr++ = g >> 1;
+ }
+ else
+ {
+ /*
+ * Pack 15-bit RGB difference...
+ */
+
+ *comp_ptr++ = 0x80 | ((r << 2) & 0x7c) | ((g >> 3) & 0x03);
+ *comp_ptr++ = ((g << 5) & 0xe0) | (b & 0x1f);
+ }
+
+ count --;
+ start ++;
+ seed ++;
+ }
+
+ /*
+ * Make sure we have the ending count if the replacement count
+ * was exactly 8 + 255n...
+ */
+
+ if (temp == 0)
+ *comp_ptr++ = 0;
+ }
+ }
+ else
+ {
+ /*
+ * Do RGB compression...
+ */
+
+ while (line_ptr < line_end)
+ {
+ /*
+ * Find the next non-matching sequence...
+ */
+
+ start = line_ptr;
+ while (line_ptr[0] == seed[0] &&
+ line_ptr[1] == seed[1] &&
+ line_ptr[2] == seed[2] &&
+ (line_ptr + 2) < line_end)
+ {
+ line_ptr += 3;
+ seed += 3;
+ }
+
+ if (line_ptr == line_end)
+ break;
+
+ offset = (line_ptr - start) / 3;
+
+ /*
+ * Find non-matching RGB tuples...
+ */
+
+ start = line_ptr;
+ while ((line_ptr[0] != seed[0] ||
+ line_ptr[1] != seed[1] ||
+ line_ptr[2] != seed[2]) &&
+ (line_ptr + 2) < line_end)
+ {
+ line_ptr += 3;
+ seed += 3;
+ }
+
+ count = (line_ptr - start) / 3;
+
+ /*
+ * Place mode 10 compression data in the buffer; each sequence
+ * starts with a command byte that looks like:
+ *
+ * CMD SRC SRC OFF OFF CNT CNT CNT
+ *
+ * For the purpose of this driver, CMD and SRC are always 0.
+ *
+ * If the offset >= 3 then additional offset bytes follow the
+ * first command byte, each byte == 255 until the last one.
+ *
+ * If the count >= 7, then additional count bytes follow each
+ * group of pixels, each byte == 255 until the last one.
+ *
+ * The offset and count are in RGB tuples (not bytes, as for
+ * Mode 3 and 9)...
+ */
+
+ if (offset >= 3)
+ {
+ /*
+ * Output multi-byte offset...
+ */
+
+ if (count > 7)
+ *comp_ptr++ = 0x1f;
+ else
+ *comp_ptr++ = 0x18 | (count - 1);
+
+ offset -= 3;
+ while (offset >= 255)
+ {
+ *comp_ptr++ = 255;
+ offset -= 255;
+ }
+
+ *comp_ptr++ = offset;
+ }
+ else
+ {
+ /*
+ * Output single-byte offset...
+ */
+
+ if (count > 7)
+ *comp_ptr++ = (offset << 3) | 0x07;
+ else
+ *comp_ptr++ = (offset << 3) | (count - 1);
+ }
+
+ temp = count - 8;
+ seed -= count * 3;
+
+ while (count > 0)
+ {
+ if (count <= temp)
+ {
+ /*
+ * This is exceedingly lame... The replacement counts
+ * are intermingled with the data...
+ */
+
+ if (temp >= 255)
+ *comp_ptr++ = 255;
+ else
+ *comp_ptr++ = temp;
+
+ temp -= 255;
+ }
+
+ /*
+ * Get difference between current and see pixels...
+ */
+
+ r = start[0] - seed[0];
+ g = start[1] - seed[1];
+ b = ((start[2] & 0xfe) - (seed[2] & 0xfe)) / 2;
+
+ if (r < -16 || r > 15 || g < -16 || g > 15 || b < -16 || b > 15)
+ {
+ /*
+ * Pack 24-bit RGB into 23 bits... Lame...
+ */
+
+ *comp_ptr++ = start[0] >> 1;
+
+ if (start[0] & 1)
+ *comp_ptr++ = 0x80 | (start[1] >> 1);
+ else
+ *comp_ptr++ = start[1] >> 1;
+
+ if (start[1] & 1)
+ *comp_ptr++ = 0x80 | (start[2] >> 1);
+ else
+ *comp_ptr++ = start[2] >> 1;
+ }
+ else
+ {
+ /*
+ * Pack 15-bit RGB difference...
+ */
+
+ *comp_ptr++ = 0x80 | ((r << 2) & 0x7c) | ((g >> 3) & 0x03);
+ *comp_ptr++ = ((g << 5) & 0xe0) | (b & 0x1f);
+ }
+
+ count --;
+ start += 3;
+ seed += 3;
+ }
+
+ /*
+ * Make sure we have the ending count if the replacement count
+ * was exactly 8 + 255n...
+ */
+
+ if (temp == 0)
+ *comp_ptr++ = 0;
+ }
+ }
+
+ line_ptr = CompBuffer;
+ line_end = comp_ptr;
+
+ memcpy(SeedBuffer, line, length);
+ break;
+ }
+
+ /*
+ * Set the length of the data and write a raster plane...
+ */
+
+ printf("\033*b%d%c", (int)(line_end - line_ptr), pend);
+ cupsWritePrintData(line_ptr, line_end - line_ptr);
+}
+
+
+/*
+ * 'OutputLine()' - Output the specified number of lines of graphics.
+ */
+
+void
+OutputLine(ppd_file_t *ppd, /* I - PPD file */
+ cups_page_header2_t *header) /* I - Page header */
+{
+ int i, j; /* Looping vars */
+ int plane; /* Current plane */
+ unsigned char bit; /* Current bit */
+ int bytes; /* Number of bytes/plane */
+ int width; /* Width of line in pixels */
+ const int *order; /* Order to use */
+ unsigned char *ptr; /* Pointer into buffer */
+
+
+ /*
+ * Output whitespace as needed...
+ */
+
+ if (OutputFeed > 0)
+ {
+ if (header->cupsCompression < 3)
+ {
+ /*
+ * Send blank raster lines...
+ */
+
+ while (OutputFeed > 0)
+ {
+ printf("\033*b0W");
+ OutputFeed --;
+ }
+ }
+ else
+ {
+ /*
+ * Send Y offset command and invalidate the seed buffer...
+ */
+
+ printf("\033*b%dY", OutputFeed);
+ OutputFeed = 0;
+ SeedInvalid = 1;
+ }
+ }
+
+ /*
+ * Write bitmap data as needed...
+ */
+
+ switch (OutputMode)
+ {
+ case OUTPUT_BITMAP : /* Send 1-bit bitmap data... */
+ order = ColorOrders[PrinterPlanes - 1];
+ bytes = header->cupsBytesPerLine / PrinterPlanes;
+
+ for (i = 0; i < PrinterPlanes; i ++)
+ {
+ plane = order[i];
+
+ CompressData(PixelBuffer + i * bytes, bytes, plane,
+ (i < (PrinterPlanes - 1)) ? 'V' : 'W',
+ header->cupsCompression);
+ }
+ break;
+
+ case OUTPUT_INVERBIT : /* Send inverted 1-bit bitmap data... */
+ order = ColorOrders[PrinterPlanes - 1];
+ bytes = header->cupsBytesPerLine / PrinterPlanes;
+
+ for (i = header->cupsBytesPerLine, ptr = PixelBuffer;
+ i > 0;
+ i --, ptr ++)
+ *ptr = ~*ptr;
+
+ for (i = 0; i < PrinterPlanes; i ++)
+ {
+ plane = order[i];
+
+ CompressData(PixelBuffer + i * bytes, bytes, plane,
+ (i < (PrinterPlanes - 1)) ? 'V' : 'W',
+ header->cupsCompression);
+ }
+ break;
+
+ case OUTPUT_RGB : /* Send 24-bit RGB data... */
+ if (PrinterPlanes == 1 && !BlankValue)
+ {
+ /*
+ * Invert black to grayscale...
+ */
+
+ for (i = header->cupsBytesPerLine, ptr = PixelBuffer;
+ i > 0;
+ i --, ptr ++)
+ *ptr = ~*ptr;
+ }
+
+ /*
+ * Compress the output...
+ */
+
+ CompressData(PixelBuffer, header->cupsBytesPerLine, 0, 'W',
+ header->cupsCompression);
+ break;
+
+ default :
+ order = ColorOrders[PrinterPlanes - 1];
+ width = header->cupsWidth;
+
+ for (i = 0, j = 0; i < PrinterPlanes; i ++)
+ {
+ plane = order[i];
+ bytes = DotBufferSizes[plane] / DotBits[plane];
+
+ for (bit = 1, ptr = DotBuffers[plane];
+ bit <= DotBits[plane];
+ bit <<= 1, ptr += bytes, j ++)
+ {
+ cupsPackHorizontalBit(OutputBuffers[plane], DotBuffers[plane],
+ width, 0, bit);
+ CompressData(ptr, bytes, j,
+ i == (PrinterPlanes - 1) &&
+ bit == DotBits[plane] ? 'W' : 'V',
+ header->cupsCompression);
+ }
+ }
+ break;
+ }
+
+ /*
+ * The seed buffer, if any, now should contain valid data...
+ */
+
+ SeedInvalid = 0;
+}
+
+
+/*
+ * 'ReadLine()' - Read graphics from the page stream.
+ */
+
+int /* O - Number of lines (0 if blank) */
+ReadLine(cups_raster_t *ras, /* I - Raster stream */
+ cups_page_header2_t *header) /* I - Page header */
+{
+ int plane, /* Current color plane */
+ width; /* Width of line */
+
+
+ /*
+ * Read raster data...
+ */
+
+ cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine);
+
+ /*
+ * See if it is blank; if so, return right away...
+ */
+
+ if (cupsCheckValue(PixelBuffer, header->cupsBytesPerLine, BlankValue))
+ return (0);
+
+ /*
+ * If we aren't dithering, return immediately...
+ */
+
+ if (OutputMode != OUTPUT_DITHERED)
+ return (1);
+
+ /*
+ * Perform the color separation...
+ */
+
+ width = header->cupsWidth;
+
+ switch (header->cupsColorSpace)
+ {
+ case CUPS_CSPACE_W :
+ if (RGB)
+ {
+ cupsRGBDoGray(RGB, PixelBuffer, CMYKBuffer, width);
+
+ if (RGB->num_channels == 1)
+ cupsCMYKDoBlack(CMYK, CMYKBuffer, InputBuffer, width);
+ else
+ cupsCMYKDoCMYK(CMYK, CMYKBuffer, InputBuffer, width);
+ }
+ else
+ cupsCMYKDoGray(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ case CUPS_CSPACE_K :
+ cupsCMYKDoBlack(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ default :
+ case CUPS_CSPACE_RGB :
+ if (RGB)
+ {
+ cupsRGBDoRGB(RGB, PixelBuffer, CMYKBuffer, width);
+
+ if (RGB->num_channels == 1)
+ cupsCMYKDoBlack(CMYK, CMYKBuffer, InputBuffer, width);
+ else
+ cupsCMYKDoCMYK(CMYK, CMYKBuffer, InputBuffer, width);
+ }
+ else
+ cupsCMYKDoRGB(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+
+ case CUPS_CSPACE_CMYK :
+ cupsCMYKDoCMYK(CMYK, PixelBuffer, InputBuffer, width);
+ break;
+ }
+
+ /*
+ * Dither the pixels...
+ */
+
+ for (plane = 0; plane < PrinterPlanes; plane ++)
+ cupsDitherLine(DitherStates[plane], DitherLuts[plane], InputBuffer + plane,
+ PrinterPlanes, OutputBuffers[plane]);
+
+ /*
+ * Return 1 to indicate that we have non-blank output...
+ */
+
+ return (1);
+}
+
+
+/*
+ * 'main()' - Main entry and processing of driver.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int fd; /* File descriptor */
+ cups_raster_t *ras; /* Raster stream for printing */
+ cups_page_header2_t header; /* Page header from file */
+ int y; /* Current line */
+ ppd_file_t *ppd; /* PPD file */
+ int job_id; /* Job ID */
+ int num_options; /* Number of options */
+ cups_option_t *options; /* Options */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ "rastertopclx");
+ return (1);
+ }
+
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ /*
+ * Open the PPD file...
+ */
+
+ ppd = ppdOpenFile(getenv("PPD"));
+
+ if (!ppd)
+ {
+ ppd_status_t status; /* PPD error */
+ int linenum; /* Line number */
+
+ fputs("ERROR: The PPD file could not be opened.\n", stderr);
+
+ status = ppdLastError(&linenum);
+
+ fprintf(stderr, "DEBUG: %s on line %d.\n", ppdErrorString(status), linenum);
+
+ return (1);
+ }
+
+ ppdMarkDefaults(ppd);
+ cupsMarkOptions(ppd, num_options, options);
+
+ /*
+ * Open the page stream...
+ */
+
+ if (argc == 7)
+ {
+ if ((fd = open(argv[6], O_RDONLY)) == -1)
+ {
+ perror("ERROR: Unable to open raster file");
+ return (1);
+ }
+ }
+ else
+ fd = 0;
+
+ ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
+
+ /*
+ * Register a signal handler to eject the current page if the
+ * job is cancelled.
+ */
+
+ Canceled = 0;
+
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, CancelJob);
+#elif defined(HAVE_SIGACTION)
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = CancelJob;
+ sigaction(SIGTERM, &action, NULL);
+#else
+ signal(SIGTERM, CancelJob);
+#endif /* HAVE_SIGSET */
+
+ /*
+ * Process pages as needed...
+ */
+
+ job_id = atoi(argv[1]);
+
+ Page = 0;
+
+ while (cupsRasterReadHeader2(ras, &header))
+ {
+ /*
+ * Write a status message with the page number and number of copies.
+ */
+
+ if (Canceled)
+ break;
+
+ Page ++;
+
+ fprintf(stderr, "PAGE: %d %d\n", Page, header.NumCopies);
+ fprintf(stderr, "INFO: Starting page %d.\n", Page);
+
+ StartPage(ppd, &header, atoi(argv[1]), argv[2], argv[3],
+ num_options, options);
+
+ for (y = 0; y < (int)header.cupsHeight; y ++)
+ {
+ /*
+ * Let the user know how far we have progressed...
+ */
+
+ if (Canceled)
+ break;
+
+ if ((y & 127) == 0)
+ {
+ fprintf(stderr, "INFO: Printing page %d, %d%% complete.\n",
+ Page, 100 * y / header.cupsHeight);
+ fprintf(stderr, "ATTR: job-media-progress=%d\n",
+ 100 * y / header.cupsHeight);
+ }
+
+ /*
+ * Read and write a line of graphics or whitespace...
+ */
+
+ if (ReadLine(ras, &header))
+ OutputLine(ppd, &header);
+ else
+ OutputFeed ++;
+ }
+
+ /*
+ * Eject the page...
+ */
+
+ fprintf(stderr, "INFO: Finished page %d.\n", Page);
+
+ EndPage(ppd, &header);
+
+ if (Canceled)
+ break;
+ }
+
+ Shutdown(ppd, job_id, argv[2], argv[3], num_options, options);
+
+ cupsFreeOptions(num_options, options);
+
+ cupsRasterClose(ras);
+
+ if (fd != 0)
+ close(fd);
+
+ return (Page == 0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <ctype.h>
+#include <string.h>
+
+/*
+ * Find the first occurrence of find in s, ignore case.
+ */
+char *
+strcasestr(s, find)
+ const char *s, *find;
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ c = tolower((unsigned char)c);
+ len = strlen(find);
+ do {
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while ((char)tolower((unsigned char)sc) != c);
+ } while (strncasecmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char *)s);
+}
--- /dev/null
+#!/bin/sh
+
+# just for comparison
+/usr/lib/cups/filter/texttops 1 hi_user there_title 1 "" Makefile > test1.ps || :
+
+# for the next to work, you'll have to make a subdirectory fonts/ here, containing the fonts
+# and a subdirectory charsets/ with a file pdf.utf-8
+export CUPS_DATADIR=`pwd`/
+
+./texttopdf 1 hi_user there_title 1 "" Makefile > test1.pdf
+./texttopdf 1 hi_user there_title 1 "PrettyPrint=1" Makefile > test2.pdf
+(export CONTENT_TYPE=application/x-csource; ./texttopdf 1 hi_user there_title 1 "PrettyPrint=1" test_pdf1.c > test3.pdf)
+(export CHARSET=utf-8; ./texttopdf 1 hi_user there_title 1 "PrettyPrint=1" Makefile > test4.pdf)
+(export CHARSET=utf-8; ./texttopdf 1 hi_user there_title 1 "" testin > test5.pdf)
--- /dev/null
+#include "pdfutils.h"
+#include <assert.h>
+#include <string.h>
+
+int main()
+{
+ pdfOut *pdf;
+
+ pdf=pdfOut_new();
+ assert(pdf);
+
+ pdfOut_begin_pdf(pdf);
+
+ // bad font
+ int font_obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Font\n"
+ " /Subtype /Type1\n" // /TrueType,/Type3
+ " /BaseFont /%s\n"
+ ">>\n"
+ "endobj\n"
+ ,font_obj,"Courier");
+ // test
+ const int PageWidth=595,PageLength=842;
+ int cobj=pdfOut_add_xref(pdf);
+ const char buf[]="BT /a 10 Tf (abc) Tj ET";
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Length %d\n"
+ ">>\n"
+ "stream\n"
+ "%s\n"
+ "endstream\n"
+ "endobj\n"
+ ,cobj,strlen(buf),buf);
+
+ int obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Page\n"
+ " /Parent 1 0 R\n"
+ " /MediaBox [0 0 %d %d]\n"
+ " /Contents %d 0 R\n"
+ " /Resources << /Font << /a %d 0 R >> >>\n"
+ ">>\n"
+ "endobj\n"
+ ,obj,PageWidth,PageLength,cobj,font_obj); // TODO: into pdf->
+ pdfOut_add_page(pdf,obj);
+ pdfOut_finish_pdf(pdf);
+
+ pdfOut_free(pdf);
+
+ return 0;
+}
--- /dev/null
+#include "pdfutils.h"
+#include "config.h"
+#include <assert.h>
+#include "fontembed/embed.h"
+#include "fontembed/sfnt.h"
+
+#include <stdio.h>
+
+static inline void write_string(pdfOut *pdf,EMB_PARAMS *emb,const char *str) // {{{
+{
+ assert(pdf);
+ assert(emb);
+ int iA;
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ putc('<',stdout);
+ for (iA=0;str[iA];iA++) {
+ const unsigned short gid=emb_get(emb,(unsigned char)str[iA]);
+ fprintf(stdout,"%04x",gid);
+ }
+ putc('>',stdout);
+ pdf->filepos+=4*iA+2;
+ } else {
+ for (iA=0;str[iA];iA++) {
+ emb_get(emb,(unsigned char)str[iA]);
+ // TODO: pdf: otf_from_pdf_default_encoding
+ }
+ pdfOut_putString(pdf,str,-1);
+ }
+}
+// }}}
+
+int main()
+{
+ pdfOut *pdf;
+
+ pdf=pdfOut_new();
+ assert(pdf);
+
+ pdfOut_begin_pdf(pdf);
+
+ // font, pt.1
+ const char *fn=TESTFONT;
+/*
+ if (argc==2) {
+ fn=argv[1];
+ }
+*/
+ OTF_FILE *otf=otf_load(fn);
+ assert(otf);
+ FONTFILE *ff=fontfile_open_sfnt(otf);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PDF16,
+ EMB_C_FORCE_MULTIBYTE|
+ EMB_C_TAKE_FONTFILE);
+
+ // test
+ const int PageWidth=595,PageLength=842;
+ const int cobj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Length %d 0 R\n"
+ ">>\n"
+ "stream\n"
+ ,cobj,cobj+1);
+ long streamlen=-pdf->filepos;
+ pdfOut_printf(pdf,"BT /a 10 Tf ");
+ write_string(pdf,emb,"Test");
+ pdfOut_printf(pdf," Tj ET");
+
+ streamlen+=pdf->filepos;
+ pdfOut_printf(pdf,"\nendstream\n"
+ "endobj\n");
+ const int clobj=pdfOut_add_xref(pdf);
+ assert(clobj==cobj+1);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%d\n"
+ "endobj\n"
+ ,clobj,streamlen);
+
+ // font
+ int font_obj=pdfOut_write_font(pdf,emb);
+ assert(font_obj);
+
+ int obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Page\n"
+ " /Parent 1 0 R\n"
+ " /MediaBox [0 0 %d %d]\n"
+ " /Contents %d 0 R\n"
+ " /Resources << /Font << /a %d 0 R >> >>\n"
+ ">>\n"
+ "endobj\n"
+ ,obj,PageWidth,PageLength,cobj,font_obj); // TODO: into pdf->
+ pdfOut_add_page(pdf,obj);
+ pdfOut_finish_pdf(pdf);
+
+ pdfOut_free(pdf);
+
+ emb_close(emb);
+
+ return 0;
+}
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common text filter routines for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * TextMain() - Standard main entry for text filters.
+ * compare_keywords() - Compare two C/C++ keywords.
+ * getutf8() - Get a UTF-8 encoded wide character...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "textcommon.h"
+
+
+/*
+ * Globals...
+ */
+
+int WrapLines = 1, /* Wrap text in lines */
+ SizeLines = 60, /* Number of lines on a page */
+ SizeColumns = 80, /* Number of columns on a line */
+ PageColumns = 1, /* Number of columns on a page */
+ ColumnGutter = 0, /* Number of characters between text columns */
+ ColumnWidth = 80, /* Width of each column */
+ PrettyPrint = 0, /* Do pretty code formatting */
+ Copies = 1; /* Number of copies */
+lchar_t **Page = NULL; /* Page characters */
+int NumPages = 0; /* Number of pages in document */
+float CharsPerInch = 10; /* Number of character columns per inch */
+float LinesPerInch = 6; /* Number of lines per inch */
+int NumKeywords = 0; /* Number of known keywords */
+char **Keywords = NULL; /* List of known keywords */
+
+
+/*
+ * Local globals...
+ */
+
+static char *code_keywords[] = /* List of known C/C++ keywords... */
+ {
+ "and",
+ "and_eq",
+ "asm",
+ "auto",
+ "bitand",
+ "bitor",
+ "bool",
+ "break",
+ "case",
+ "catch",
+ "char",
+ "class",
+ "compl",
+ "const",
+ "const_cast",
+ "continue",
+ "default",
+ "delete",
+ "do",
+ "double",
+ "dynamic_cast",
+ "else",
+ "enum",
+ "explicit",
+ "extern",
+ "false",
+ "float",
+ "for",
+ "friend",
+ "goto",
+ "if",
+ "inline",
+ "int",
+ "long",
+ "mutable",
+ "namespace",
+ "new",
+ "not",
+ "not_eq",
+ "operator",
+ "or",
+ "or_eq",
+ "private",
+ "protected",
+ "public",
+ "register",
+ "reinterpret_cast",
+ "return",
+ "short",
+ "signed",
+ "sizeof",
+ "static",
+ "static_cast",
+ "struct",
+ "switch",
+ "template",
+ "this",
+ "throw",
+ "true",
+ "try",
+ "typedef",
+ "typename",
+ "union",
+ "unsigned",
+ "virtual",
+ "void",
+ "volatile",
+ "while",
+ "xor",
+ "xor_eq"
+ },
+ *sh_keywords[] = /* List of known Boure/Korn/zsh/bash keywords... */
+ {
+ "alias",
+ "bg",
+ "break",
+ "case",
+ "cd",
+ "command",
+ "continue",
+ "do",
+ "done",
+ "echo",
+ "elif",
+ "else",
+ "esac",
+ "eval",
+ "exec",
+ "exit",
+ "export",
+ "fc",
+ "fg",
+ "fi",
+ "for",
+ "function",
+ "getopts",
+ "if",
+ "in",
+ "jobs",
+ "kill",
+ "let",
+ "limit",
+ "newgrp",
+ "print",
+ "pwd",
+ "read",
+ "readonly",
+ "return",
+ "select",
+ "set",
+ "shift",
+ "test",
+ "then",
+ "time",
+ "times",
+ "trap",
+ "typeset",
+ "ulimit",
+ "umask",
+ "unalias",
+ "unlimit",
+ "unset",
+ "until",
+ "wait",
+ "whence"
+ "while",
+ },
+ *csh_keywords[] = /* List of known csh/tcsh keywords... */
+ {
+ "alias",
+ "aliases",
+ "bg",
+ "bindkey",
+ "break",
+ "breaksw",
+ "builtins",
+ "case",
+ "cd",
+ "chdir",
+ "complete",
+ "continue",
+ "default",
+ "dirs",
+ "echo",
+ "echotc",
+ "else",
+ "end",
+ "endif",
+ "eval",
+ "exec",
+ "exit",
+ "fg",
+ "foreach",
+ "glob",
+ "goto",
+ "history",
+ "if",
+ "jobs",
+ "kill",
+ "limit",
+ "login",
+ "logout",
+ "ls",
+ "nice",
+ "nohup",
+ "notify",
+ "onintr",
+ "popd",
+ "pushd",
+ "pwd",
+ "rehash",
+ "repeat",
+ "set",
+ "setenv",
+ "settc",
+ "shift",
+ "source",
+ "stop",
+ "suspend",
+ "switch",
+ "telltc",
+ "then",
+ "time",
+ "umask",
+ "unalias",
+ "unbindkey",
+ "unhash",
+ "unlimit",
+ "unset",
+ "unsetenv",
+ "wait",
+ "where",
+ "which",
+ "while"
+ },
+ *perl_keywords[] = /* List of known perl keywords... */
+ {
+ "abs",
+ "accept",
+ "alarm",
+ "and",
+ "atan2",
+ "bind",
+ "binmode",
+ "bless",
+ "caller",
+ "chdir",
+ "chmod",
+ "chomp",
+ "chop",
+ "chown",
+ "chr",
+ "chroot",
+ "closdir",
+ "close",
+ "connect",
+ "continue",
+ "cos",
+ "crypt",
+ "dbmclose",
+ "dbmopen",
+ "defined",
+ "delete",
+ "die",
+ "do",
+ "dump",
+ "each",
+ "else",
+ "elsif",
+ "endgrent",
+ "endhostent",
+ "endnetent",
+ "endprotoent",
+ "endpwent",
+ "endservent",
+ "eof",
+ "eval",
+ "exec",
+ "exists",
+ "exit",
+ "exp",
+ "fcntl",
+ "fileno",
+ "flock",
+ "for",
+ "foreach",
+ "fork",
+ "format",
+ "formline",
+ "getc",
+ "getgrent",
+ "getgrgid",
+ "getgrnam",
+ "gethostbyaddr",
+ "gethostbyname",
+ "gethostent",
+ "getlogin",
+ "getnetbyaddr",
+ "getnetbyname",
+ "getnetent",
+ "getpeername",
+ "getpgrp",
+ "getppid",
+ "getpriority",
+ "getprotobyname",
+ "getprotobynumber",
+ "getprotoent",
+ "getpwent",
+ "getpwnam",
+ "getpwuid",
+ "getservbyname",
+ "getservbyport",
+ "getservent",
+ "getsockname",
+ "getsockopt",
+ "glob",
+ "gmtime",
+ "goto",
+ "grep",
+ "hex",
+ "if",
+ "import",
+ "index",
+ "int",
+ "ioctl",
+ "join",
+ "keys",
+ "kill",
+ "last",
+ "lc",
+ "lcfirst",
+ "length",
+ "link",
+ "listen",
+ "local",
+ "localtime",
+ "log",
+ "lstat",
+ "map",
+ "mkdir",
+ "msgctl",
+ "msgget",
+ "msgrcv",
+ "msgsend",
+ "my",
+ "next",
+ "no",
+ "not",
+ "oct",
+ "open",
+ "opendir",
+ "or",
+ "ord",
+ "pack",
+ "package",
+ "pipe",
+ "pop",
+ "pos",
+ "print",
+ "printf",
+ "push",
+ "quotemeta",
+ "rand",
+ "read",
+ "readdir",
+ "readlink",
+ "recv",
+ "redo",
+ "ref",
+ "rename",
+ "require",
+ "reset",
+ "return",
+ "reverse",
+ "rewinddir",
+ "rindex",
+ "rmdir",
+ "scalar",
+ "seek",
+ "seekdir",
+ "select",
+ "semctl",
+ "semget",
+ "semop",
+ "send",
+ "setgrent",
+ "sethostent",
+ "setnetent",
+ "setpgrp",
+ "setpriority",
+ "setprotoent",
+ "setpwent",
+ "setservent",
+ "setsockopt",
+ "shift",
+ "shmctl",
+ "shmget",
+ "shmread",
+ "shmwrite",
+ "shutdown",
+ "sin",
+ "sleep",
+ "socket",
+ "socketpair",
+ "sort",
+ "splice",
+ "split",
+ "sprintf",
+ "sqrt",
+ "srand",
+ "stat",
+ "study",
+ "sub",
+ "substr",
+ "symlink",
+ "syscall",
+ "sysread",
+ "sysseek",
+ "system",
+ "syswrite",
+ "tell",
+ "telldir",
+ "tie",
+ "tied",
+ "time",
+ "times"
+ "times",
+ "truncate",
+ "uc",
+ "ucfirst",
+ "umask",
+ "undef",
+ "unless",
+ "unlink",
+ "unpack",
+ "unshift",
+ "untie",
+ "until",
+ "use",
+ "utime",
+ "values",
+ "vec",
+ "wait",
+ "waitpid",
+ "wantarray",
+ "warn",
+ "while",
+ "write"
+ };
+
+
+/*
+ * Local functions...
+ */
+
+static int compare_keywords(const void *, const void *);
+static int getutf8(FILE *fp);
+
+
+/*
+ * 'TextMain()' - Standard main entry for text filters.
+ */
+
+int /* O - Exit status */
+TextMain(const char *name, /* I - Name of filter */
+ int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ FILE *fp; /* Print file */
+ ppd_file_t *ppd; /* PPD file */
+ int i, /* Looping var */
+ ch, /* Current char from file */
+ lastch, /* Previous char from file */
+ attr, /* Current attribute */
+ line, /* Current line */
+ column, /* Current column */
+ page_column; /* Current page column */
+ int num_options; /* Number of print options */
+ cups_option_t *options; /* Print options */
+ const char *val; /* Option value */
+ char keyword[64], /* Keyword string */
+ *keyptr; /* Pointer into string */
+ int keycol; /* Column where keyword starts */
+ int ccomment; /* Inside a C-style comment? */
+ int cstring; /* Inside a C string */
+
+
+ /*
+ * Make sure status messages are not buffered...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Check command-line...
+ */
+
+ if (argc < 6 || argc > 7)
+ {
+ fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
+ name);
+ return (1);
+ }
+
+ /*
+ * If we have 7 arguments, print the file named on the command-line.
+ * Otherwise, send stdin instead...
+ */
+
+ if (argc == 6)
+ fp = stdin;
+ else
+ {
+ /*
+ * Try to open the print file...
+ */
+
+ if ((fp = fopen(argv[6], "rb")) == NULL)
+ {
+ perror("DEBUG: unable to open print file - ");
+ return (1);
+ }
+ }
+
+ /*
+ * Process command-line options and write the prolog...
+ */
+
+ options = NULL;
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL &&
+ strcasecmp(val, "no") && strcasecmp(val, "off") &&
+ strcasecmp(val, "false"))
+ {
+ PageLeft = 72.0f;
+ PageRight = PageWidth - 36.0f;
+ PageBottom = PageBottom > 36.0f ? PageBottom : 36.0f;
+ PageTop = PageLength - 36.0f;
+ CharsPerInch = 12;
+ LinesPerInch = 8;
+
+ if ((val = getenv("CONTENT_TYPE")) == NULL)
+ {
+ PrettyPrint = PRETTY_PLAIN;
+ NumKeywords = 0;
+ Keywords = NULL;
+ }
+ else if (strcasecmp(val, "application/x-cshell") == 0)
+ {
+ PrettyPrint = PRETTY_SHELL;
+ NumKeywords = sizeof(csh_keywords) / sizeof(csh_keywords[0]);
+ Keywords = csh_keywords;
+ }
+ else if (strcasecmp(val, "application/x-csource") == 0)
+ {
+ PrettyPrint = PRETTY_CODE;
+ NumKeywords = sizeof(code_keywords) / sizeof(code_keywords[0]);
+ Keywords = code_keywords;
+ }
+ else if (strcasecmp(val, "application/x-perl") == 0)
+ {
+ PrettyPrint = PRETTY_PERL;
+ NumKeywords = sizeof(perl_keywords) / sizeof(perl_keywords[0]);
+ Keywords = perl_keywords;
+ }
+ else if (strcasecmp(val, "application/x-shell") == 0)
+ {
+ PrettyPrint = PRETTY_SHELL;
+ NumKeywords = sizeof(sh_keywords) / sizeof(sh_keywords[0]);
+ Keywords = sh_keywords;
+ }
+ else
+ {
+ PrettyPrint = PRETTY_PLAIN;
+ NumKeywords = 0;
+ Keywords = NULL;
+ }
+ }
+
+ ppd = SetCommonOptions(num_options, options, 1);
+
+ if ((val = cupsGetOption("wrap", num_options, options)) == NULL)
+ WrapLines = 1;
+ else
+ WrapLines = !strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes");
+
+ if ((val = cupsGetOption("columns", num_options, options)) != NULL)
+ {
+ PageColumns = atoi(val);
+
+ if (PageColumns < 1)
+ {
+ fprintf(stderr, "ERROR: Bad columns value %d.\n", PageColumns);
+ return (1);
+ }
+ }
+
+ if ((val = cupsGetOption("cpi", num_options, options)) != NULL)
+ {
+ CharsPerInch = atof(val);
+
+ if (CharsPerInch <= 0.0)
+ {
+ fprintf(stderr, "ERROR: Bad cpi value %f.\n", CharsPerInch);
+ return (1);
+ }
+ }
+
+ if ((val = cupsGetOption("lpi", num_options, options)) != NULL)
+ {
+ LinesPerInch = atof(val);
+
+ if (LinesPerInch <= 0.0)
+ {
+ fprintf(stderr, "ERROR: Bad lpi value %f.", LinesPerInch);
+ return (1);
+ }
+ }
+
+ if (PrettyPrint)
+ PageTop -= 216.0f / LinesPerInch;
+
+ Copies = atoi(argv[4]);
+
+ WriteProlog(argv[3], argv[2], getenv("CLASSIFICATION"),
+ cupsGetOption("page-label", num_options, options), ppd);
+
+ /*
+ * Read text from the specified source and print it...
+ */
+
+ lastch = 0;
+ column = 0;
+ line = 0;
+ page_column = 0;
+ attr = 0;
+ keyptr = keyword;
+ keycol = 0;
+ ccomment = 0;
+ cstring = 0;
+
+ while ((ch = getutf8(fp)) >= 0)
+ {
+ /*
+ * Control codes:
+ *
+ * BS Backspace (0x08)
+ * HT Horizontal tab; next 8th column (0x09)
+ * LF Line feed; forward full line (0x0a)
+ * VT Vertical tab; reverse full line (0x0b)
+ * FF Form feed (0x0c)
+ * CR Carriage return (0x0d)
+ * ESC 7 Reverse full line (0x1b 0x37)
+ * ESC 8 Reverse half line (0x1b 0x38)
+ * ESC 9 Forward half line (0x1b 0x39)
+ */
+
+ switch (ch)
+ {
+ case 0x08 : /* BS - backspace for boldface & underline */
+ if (column > 0)
+ column --;
+
+ keyptr = keyword;
+ keycol = column;
+ break;
+
+ case 0x09 : /* HT - tab to next 8th column */
+ if (PrettyPrint && keyptr > keyword)
+ {
+ *keyptr = '\0';
+ keyptr = keyword;
+
+ if (bsearch(&keyptr, Keywords, NumKeywords, sizeof(char *),
+ compare_keywords))
+ {
+ /*
+ * Put keywords in boldface...
+ */
+
+ i = page_column * (ColumnWidth + ColumnGutter);
+
+ while (keycol < column)
+ {
+ Page[line][keycol + i].attr |= ATTR_BOLD;
+ keycol ++;
+ }
+ }
+ }
+
+ column = (column + 8) & ~7;
+
+ if (column >= ColumnWidth && WrapLines)
+ { /* Wrap text to margins */
+ line ++;
+ column = 0;
+
+ if (line >= SizeLines)
+ {
+ page_column ++;
+ line = 0;
+
+ if (page_column >= PageColumns)
+ {
+ WritePage();
+ page_column = 0;
+ }
+ }
+ }
+
+ keycol = column;
+
+ attr &= ~ATTR_BOLD;
+ break;
+
+ case 0x0d : /* CR */
+#ifndef __APPLE__
+ /*
+ * All but MacOS/Darwin treat CR as was intended by ANSI
+ * folks, namely to move to column 0/1. Some programs still
+ * use this to do boldfacing and underlining...
+ */
+
+ column = 0;
+ break;
+#else
+ /*
+ * MacOS/Darwin still need to treat CR as a line ending.
+ */
+
+ {
+ int nextch;
+ if ((nextch = getc(fp)) != 0x0a)
+ ungetc(nextch, fp);
+ else
+ ch = nextch;
+ }
+#endif /* !__APPLE__ */
+
+ case 0x0a : /* LF - output current line */
+ if (PrettyPrint && keyptr > keyword)
+ {
+ *keyptr = '\0';
+ keyptr = keyword;
+
+ if (bsearch(&keyptr, Keywords, NumKeywords, sizeof(char *),
+ compare_keywords))
+ {
+ /*
+ * Put keywords in boldface...
+ */
+
+ i = page_column * (ColumnWidth + ColumnGutter);
+
+ while (keycol < column)
+ {
+ Page[line][keycol + i].attr |= ATTR_BOLD;
+ keycol ++;
+ }
+ }
+ }
+
+ line ++;
+ column = 0;
+ keycol = 0;
+
+ if (!ccomment && !cstring)
+ attr &= ~(ATTR_ITALIC | ATTR_BOLD | ATTR_RED | ATTR_GREEN | ATTR_BLUE);
+
+ if (line >= SizeLines)
+ {
+ page_column ++;
+ line = 0;
+
+ if (page_column >= PageColumns)
+ {
+ WritePage();
+ page_column = 0;
+ }
+ }
+ break;
+
+ case 0x0b : /* VT - move up 1 line */
+ if (line > 0)
+ line --;
+
+ keyptr = keyword;
+ keycol = column;
+
+ if (!ccomment && !cstring)
+ attr &= ~(ATTR_ITALIC | ATTR_BOLD | ATTR_RED | ATTR_GREEN | ATTR_BLUE);
+ break;
+
+ case 0x0c : /* FF - eject current page... */
+ if (PrettyPrint && keyptr > keyword)
+ {
+ *keyptr = '\0';
+ keyptr = keyword;
+
+ if (bsearch(&keyptr, Keywords, NumKeywords, sizeof(char *),
+ compare_keywords))
+ {
+ /*
+ * Put keywords in boldface...
+ */
+
+ i = page_column * (ColumnWidth + ColumnGutter);
+
+ while (keycol < column)
+ {
+ Page[line][keycol + i].attr |= ATTR_BOLD;
+ keycol ++;
+ }
+ }
+ }
+
+ page_column ++;
+ column = 0;
+ keycol = 0;
+ line = 0;
+
+ if (!ccomment && !cstring)
+ attr &= ~(ATTR_ITALIC | ATTR_BOLD | ATTR_RED | ATTR_GREEN | ATTR_BLUE);
+
+ if (page_column >= PageColumns)
+ {
+ WritePage();
+ page_column = 0;
+ }
+ break;
+
+ case 0x1b : /* Escape sequence */
+ ch = getutf8(fp);
+ if (ch == '7')
+ {
+ /*
+ * ESC 7 Reverse full line (0x1b 0x37)
+ */
+
+ if (line > 0)
+ line --;
+ }
+ else if (ch == '8')
+ {
+ /*
+ * ESC 8 Reverse half line (0x1b 0x38)
+ */
+
+ if ((attr & ATTR_RAISED) && line > 0)
+ {
+ attr &= ~ATTR_RAISED;
+ line --;
+ }
+ else if (attr & ATTR_LOWERED)
+ attr &= ~ATTR_LOWERED;
+ else
+ attr |= ATTR_RAISED;
+ }
+ else if (ch == '9')
+ {
+ /*
+ * ESC 9 Forward half line (0x1b 0x39)
+ */
+
+ if ((attr & ATTR_LOWERED) && line < (SizeLines - 1))
+ {
+ attr &= ~ATTR_LOWERED;
+ line ++;
+ }
+ else if (attr & ATTR_RAISED)
+ attr &= ~ATTR_RAISED;
+ else
+ attr |= ATTR_LOWERED;
+ }
+ break;
+
+ default : /* All others... */
+ if (ch < ' ')
+ break; /* Ignore other control chars */
+
+ if (PrettyPrint > PRETTY_PLAIN)
+ {
+ /*
+ * Do highlighting of C/C++ keywords, preprocessor commands,
+ * and comments...
+ */
+
+ if (ch == ' ' && (attr & ATTR_BOLD))
+ {
+ /*
+ * Stop bolding preprocessor command...
+ */
+
+ attr &= ~ATTR_BOLD;
+ }
+ else if (!(isalnum(ch & 255) || ch == '_') && keyptr > keyword)
+ {
+ /*
+ * Look for a keyword...
+ */
+
+ *keyptr = '\0';
+ keyptr = keyword;
+
+ if (!(attr & ATTR_ITALIC) &&
+ bsearch(&keyptr, Keywords, NumKeywords, sizeof(char *),
+ compare_keywords))
+ {
+ /*
+ * Put keywords in boldface...
+ */
+
+ i = page_column * (ColumnWidth + ColumnGutter);
+
+ while (keycol < column)
+ {
+ Page[line][keycol + i].attr |= ATTR_BOLD;
+ keycol ++;
+ }
+ }
+ }
+ else if ((isalnum(ch & 255) || ch == '_') && !ccomment && !cstring)
+ {
+ /*
+ * Add characters to the current keyword (if they'll fit).
+ */
+
+ if (keyptr == keyword)
+ keycol = column;
+
+ if (keyptr < (keyword + sizeof(keyword) - 1))
+ *keyptr++ = ch;
+ }
+ else if (ch == '\"' && lastch != '\\' && !ccomment && !cstring)
+ {
+ /*
+ * Start a C string constant...
+ */
+
+ cstring = -1;
+ attr = ATTR_BLUE;
+ }
+ else if (ch == '*' && lastch == '/' && !cstring &&
+ PrettyPrint != PRETTY_SHELL)
+ {
+ /*
+ * Start a C-style comment...
+ */
+
+ ccomment = 1;
+ attr = ATTR_ITALIC | ATTR_GREEN;
+ }
+ else if (ch == '/' && lastch == '/' && !cstring &&
+ PrettyPrint == PRETTY_CODE)
+ {
+ /*
+ * Start a C++-style comment...
+ */
+
+ attr = ATTR_ITALIC | ATTR_GREEN;
+ }
+ else if (ch == '#' && !cstring && PrettyPrint != PRETTY_CODE)
+ {
+ /*
+ * Start a shell-style comment...
+ */
+
+ attr = ATTR_ITALIC | ATTR_GREEN;
+ }
+ else if (ch == '#' && column == 0 && !ccomment && !cstring &&
+ PrettyPrint == PRETTY_CODE)
+ {
+ /*
+ * Start a preprocessor command...
+ */
+
+ attr = ATTR_BOLD | ATTR_RED;
+ }
+ }
+
+ if (column >= ColumnWidth && WrapLines)
+ { /* Wrap text to margins */
+ column = 0;
+ line ++;
+
+ if (line >= SizeLines)
+ {
+ page_column ++;
+ line = 0;
+
+ if (page_column >= PageColumns)
+ {
+ WritePage();
+ page_column = 0;
+ }
+ }
+ }
+
+ /*
+ * Add text to the current column & line...
+ */
+
+ if (column < ColumnWidth)
+ {
+ i = column + page_column * (ColumnWidth + ColumnGutter);
+
+ if (PrettyPrint)
+ Page[line][i].attr = attr;
+ else if (ch == ' ' && Page[line][i].ch)
+ ch = Page[line][i].ch;
+ else if (ch == Page[line][i].ch)
+ Page[line][i].attr |= ATTR_BOLD;
+ else if (Page[line][i].ch == '_')
+ Page[line][i].attr |= ATTR_UNDERLINE;
+ else if (ch == '_')
+ {
+ Page[line][i].attr |= ATTR_UNDERLINE;
+
+ if (Page[line][i].ch)
+ ch = Page[line][i].ch;
+ }
+ else
+ Page[line][i].attr = attr;
+
+ Page[line][i].ch = ch;
+ }
+
+ if (PrettyPrint)
+ {
+ if ((ch == '{' || ch == '}') && !ccomment && !cstring &&
+ column < ColumnWidth)
+ {
+ /*
+ * Highlight curley braces...
+ */
+
+ Page[line][column].attr |= ATTR_BOLD;
+ }
+ else if ((ch == '/' || ch == '*') && lastch == '/' &&
+ column < ColumnWidth && PrettyPrint != PRETTY_SHELL)
+ {
+ /*
+ * Highlight first comment character...
+ */
+
+ Page[line][column - 1].attr = attr;
+ }
+ else if (ch == '\"' && lastch != '\\' && !ccomment && cstring > 0)
+ {
+ /*
+ * End a C string constant...
+ */
+
+ cstring = 0;
+ attr &= ~ATTR_BLUE;
+ }
+ else if (ch == '/' && lastch == '*' && ccomment)
+ {
+ /*
+ * End a C-style comment...
+ */
+
+ ccomment = 0;
+ attr &= ~(ATTR_ITALIC | ATTR_GREEN);
+ }
+
+ if (cstring < 0)
+ cstring = 1;
+ }
+
+ column ++;
+ break;
+ }
+
+ /*
+ * Save this character for the next cycle.
+ */
+
+ lastch = ch;
+ }
+
+ /*
+ * Write any remaining page data...
+ */
+
+ if (line > 0 || page_column > 0 || column > 0)
+ WritePage();
+
+ /*
+ * Write the epilog and return...
+ */
+
+ WriteEpilogue();
+
+ if (ppd != NULL)
+ ppdClose(ppd);
+
+ return (0);
+}
+
+
+/*
+ * 'compare_keywords()' - Compare two C/C++ keywords.
+ */
+
+static int /* O - Result of strcmp */
+compare_keywords(const void *k1, /* I - First keyword */
+ const void *k2) /* I - Second keyword */
+{
+ return (strcmp(*((const char **)k1), *((const char **)k2)));
+}
+
+
+/*
+ * 'getutf8()' - Get a UTF-8 encoded wide character...
+ */
+
+static int /* O - Character or -1 on error */
+getutf8(FILE *fp) /* I - File to read from */
+{
+ int ch; /* Current character value */
+ int next; /* Next character from file */
+
+
+ /*
+ * Read the first character and process things accordingly...
+ *
+ * UTF-8 maps 16-bit characters to:
+ *
+ * 0 to 127 = 0xxxxxxx
+ * 128 to 2047 = 110xxxxx 10yyyyyy (xxxxxyyyyyy)
+ * 2048 to 65535 = 1110xxxx 10yyyyyy 10zzzzzz (xxxxyyyyyyzzzzzz)
+ *
+ * We also accept:
+ *
+ * 128 to 191 = 10xxxxxx
+ *
+ * since this range of values is otherwise undefined unless you are
+ * in the middle of a multi-byte character...
+ *
+ * This code currently does not support anything beyond 16-bit
+ * characters, in part because PostScript doesn't support more than
+ * 16-bit characters...
+ */
+
+ if ((ch = getc(fp)) == EOF)
+ return (EOF);
+
+ if (ch < 0xc0) /* One byte character? */
+ return (ch);
+ else if ((ch & 0xe0) == 0xc0)
+ {
+ /*
+ * Two byte character...
+ */
+
+ if ((next = getc(fp)) == EOF)
+ return (EOF);
+ else
+ return (((ch & 0x1f) << 6) | (next & 0x3f));
+ }
+ else if ((ch & 0xf0) == 0xe0)
+ {
+ /*
+ * Three byte character...
+ */
+
+ if ((next = getc(fp)) == EOF)
+ return (EOF);
+
+ ch = ((ch & 0x0f) << 6) | (next & 0x3f);
+
+ if ((next = getc(fp)) == EOF)
+ return (EOF);
+ else
+ return ((ch << 6) | (next & 0x3f));
+ }
+ else
+ {
+ /*
+ * More than three bytes... We don't support that...
+ */
+
+ return (EOF);
+ }
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Common text filter definitions for CUPS.
+ *
+ * Copyright 2007-2010 by Apple Inc.
+ * Copyright 1997-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "common.h"
+
+
+/*
+ * C++ magic...
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/*
+ * Constants...
+ */
+
+#define ATTR_NORMAL 0x00
+#define ATTR_BOLD 0x01
+#define ATTR_ITALIC 0x02
+#define ATTR_BOLDITALIC 0x03
+#define ATTR_FONT 0x03
+
+#define ATTR_UNDERLINE 0x04
+#define ATTR_RAISED 0x08
+#define ATTR_LOWERED 0x10
+#define ATTR_RED 0x20
+#define ATTR_GREEN 0x40
+#define ATTR_BLUE 0x80
+
+#define PRETTY_OFF 0
+#define PRETTY_PLAIN 1
+#define PRETTY_CODE 2
+#define PRETTY_SHELL 3
+#define PRETTY_PERL 4
+#define PRETTY_HTML 5
+
+
+/*
+ * Structures...
+ */
+
+typedef struct /**** Character/attribute structure... ****/
+{
+ unsigned short ch, /* Character */
+ attr; /* Any attributes */
+} lchar_t;
+
+
+/*
+ * Globals...
+ */
+
+extern int WrapLines, /* Wrap text in lines */
+ SizeLines, /* Number of lines on a page */
+ SizeColumns, /* Number of columns on a line */
+ PageColumns, /* Number of columns on a page */
+ ColumnGutter, /* Number of characters between text columns */
+ ColumnWidth, /* Width of each column */
+ PrettyPrint, /* Do pretty code formatting? */
+ Copies; /* Number of copies to produce */
+extern lchar_t **Page; /* Page characters */
+extern int NumPages; /* Number of pages in document */
+extern float CharsPerInch, /* Number of character columns per inch */
+ LinesPerInch; /* Number of lines per inch */
+extern int UTF8, /* Use UTF-8 encoding? */
+ NumKeywords; /* Number of known keywords */
+extern char **Keywords; /* List of known keywords... */
+
+
+/*
+ * Required functions...
+ */
+
+extern int TextMain(const char *name, int argc, char *argv[]);
+extern void WriteEpilogue(void);
+extern void WritePage(void);
+extern void WriteProlog(const char *title, const char *user,
+ const char *classification, const char *label,
+ ppd_file_t *ppd);
+
+
+/*
+ * C++ magic...
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+#!/bin/bash
+## Copyright (C) 2003-2006 Red Hat, Inc.
+## Copyright (C) 2003-2006 Tim Waugh <twaugh@redhat.com>
+## Changed on 2007/05/17, Opher Shachar, LADPC Ltd.
+## Added support for page-ranges option.
+## Added page accounting.
+
+## 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.
+
+if [ $# == 0 ]; then
+ echo >&2 "ERROR: $0 job-id user title copies options [file]"
+ exit 1
+fi
+
+# Extract the papersize
+SENDFF=`grep '^\*DefaultSendFF' "$PPD" | cut -d\ -f2`
+COPIES=1
+if [ $# -ge 4 ]; then
+ COPIES="$4"
+fi
+
+if [ $# -lt 6 ]; then
+ unset TMPFILE
+ trap -- 'rm -f "$TMPFILE"' EXIT
+ TMPFILE=$(mktemp ${TMPDIR:-/tmp}/textonly.XXXXXX)
+ cat > "$TMPFILE"
+else
+ TMPFILE="$6"
+fi
+
+PR=${5#*page-ranges=}
+# Do options specify page-ranges?
+if [[ "$PR" != "$5" ]]; then
+ PR=${PR%% *}
+else
+ #unset PR
+ PR=1-999999
+fi
+
+if [[ "$PR" ]]; then
+ TMPFILE2=$(mktemp ${TMPDIR:-/tmp}/textonly2.XXXXXX)
+ pagenum=0
+ EOF=
+ {
+ while [[ "$PR" ]]; do
+ pl=${PR%%,*} ;# take first subrange
+ PR=${PR#$pl};PR=${PR#,} ;# remove from range list
+ pu=${pl#*-} ;# extract upper and lower
+ pl=${pl%-*} ;# pages of subrange
+ # Allows interpreting 0-5,3-10 as 1-5,6-10 rejects 5-1 or 1-
+ (( pagenum >= pl )) && pl=$(( pagenum + 1 ))
+ (( pl > pu )) && continue
+
+ # Loop reading pages until at or over lower page of subrange.
+ while read -d `echo -ne '\f'` -r; do
+ (( pagenum++ ))
+ (( pagenum == pl )) && break
+ done
+ # Did we reach lower page of subrange or EOF?
+ if (( pagenum < pl )); then
+ [[ ! "$REPLY" ]] && break ;# empty last page - we're done.
+ (( pagenum++ ))
+ EOF=y
+ fi
+ # Output page and report to page log
+ if (( pagenum == pl )); then
+ echo -n "${REPLY}" >>"$TMPFILE2"
+ # If EOF then page has no final FF
+ [[ ! "$EOF" ]] && echo -ne '\f' >>"$TMPFILE2"
+ echo "PAGE: $pagenum $COPIES" >&2
+ fi
+ [[ "$EOF" ]] && break
+ # Is the current subrange a single page?
+ (( pagenum == pu )) && continue
+ while read -d `echo -ne '\f'` -r; do
+ (( pagenum++ ))
+ echo -ne "${REPLY}\f" >>"$TMPFILE2"
+ echo "PAGE: $pagenum $COPIES" >&2
+ (( pagenum == pu )) && break
+ done
+ # Could be that we reached EOF before page boundry
+ if (( pagenum < pu )); then
+ if [[ "$REPLY" ]]; then
+ (( pagenum++ ))
+ echo -n "${REPLY}" >>"$TMPFILE2"
+ echo "PAGE: $pagenum $COPIES" >&2
+ fi
+ break
+ fi
+ done
+ } <"$TMPFILE"
+else
+ TMPFILE2="$TMPFILE"
+ pc=$(grep -co `echo -ne '\f'` "$TMPFILE2")
+ pc=$(( pc * $COPIES ))
+ echo "PAGE: $pc" >&2
+fi
+
+while [ "$COPIES" -gt 0 ]; do
+ # Just translate LF->CRLF at the moment, until the PPD has options added.
+ sed -e 's/$/'`echo -ne '\r'`'/g' "$TMPFILE2"
+
+ if [ "$SENDFF" == "True" ]
+ then
+ echo -ne \\014
+ fi
+
+ COPIES=$(($COPIES - 1))
+done
+# Cleanup
+[[ "$TMPFILE" != "$TMPFILE2" ]] && rm -f "$TMPFILE2"
+exit 0
--- /dev/null
+/*
+ * Text to PDF filter for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 2008,2012 by Tobias Hoffmann.
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ * main() - Main entry for text to PDF filter.
+ * WriteEpilogue() - Write the PDF file epilogue.
+ * WritePage() - Write a page of text.
+ * WriteProlog() - Write the PDF file prolog with options.
+ * write_line() - Write a row of text.
+ * write_string() - Write a string of text.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "textcommon.h"
+#include "pdfutils.h"
+#include "fontembed/embed.h"
+#include <assert.h>
+#include "fontembed/sfnt.h"
+#include <fontconfig/fontconfig.h>
+
+/*
+ * Globals...
+ */
+
+#ifdef CUPS_1_4 /* CUPS 1.4.x or newer: only UTF8 is supported */
+int UTF8 = 1; /* Use UTF-8 encoding? */
+#endif /* CUPS_1_4 */
+
+EMB_PARAMS *font_load(const char *font);
+
+EMB_PARAMS *font_load(const char *font)
+{
+ OTF_FILE *otf;
+
+ FcPattern *pattern;
+ FcFontSet *candidates;
+ FcChar8 *fontname = NULL;
+ FcResult result;
+ int i;
+
+ if ( (font[0]=='/')||(font[0]=='.') ) {
+ candidates = NULL;
+ fontname=(FcChar8 *)strdup(font);
+ } else {
+ FcInit ();
+ pattern = FcNameParse ((const FcChar8 *)font);
+ FcPatternAddInteger (pattern, FC_SPACING, FC_MONO); // guide fc, in case substitution becomes necessary
+ FcConfigSubstitute (0, pattern, FcMatchPattern);
+ FcDefaultSubstitute (pattern);
+
+ /* Receive a sorted list of fonts matching our pattern */
+ candidates = FcFontSort (0, pattern, FcFalse, 0, &result);
+ FcPatternDestroy (pattern);
+
+ /* In the list of fonts returned by FcFontSort()
+ find the first one that is both in TrueType format and monospaced */
+ for (i = 0; i < candidates->nfont; i++) {
+ FcChar8 *fontformat=NULL; // TODO? or just try?
+ int spacing=0; // sane default, as FC_MONO == 100
+ FcPatternGetString (candidates->fonts[i], FC_FONTFORMAT, 0, &fontformat);
+ FcPatternGetInteger (candidates->fonts[i], FC_SPACING, 0, &spacing);
+
+ if ( (fontformat)&&(spacing == FC_MONO) ) {
+ if (strcmp((const char *)fontformat, "TrueType") == 0) {
+ fontname = FcPatternFormat (candidates->fonts[i], (const FcChar8 *)"%{file|cescape}/%{index}");
+ break;
+ } else if (strcmp((const char *)fontformat, "CFF") == 0) {
+ fontname = FcPatternFormat (candidates->fonts[i], (const FcChar8 *)"%{file|cescape}"); // TTC only possible with non-cff glyphs!
+ break;
+ }
+ }
+ }
+ FcFontSetDestroy (candidates);
+ }
+
+ if (!fontname) {
+ // TODO: try /usr/share/fonts/*/*/%s.ttf
+ fprintf(stderr,"No viable font found\n");
+ return NULL;
+ }
+
+ otf = otf_load((const char *)fontname);
+ free(fontname);
+ if (!otf) {
+ return NULL;
+ }
+
+ FONTFILE *ff=fontfile_open_sfnt(otf);
+ assert(ff);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PDF16,
+ EMB_C_FORCE_MULTIBYTE|
+ EMB_C_TAKE_FONTFILE);
+ assert(emb);
+ assert(emb->plan&EMB_A_MULTIBYTE);
+ return emb;
+}
+
+EMB_PARAMS *font_std(const char *name)
+{
+ FONTFILE *ff=fontfile_open_std(name);
+ assert(ff);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PDF16,
+ EMB_C_TAKE_FONTFILE);
+ assert(emb);
+ return emb;
+}
+
+/*
+ * Globals...
+ */
+
+int NumFonts; /* Number of fonts to use */
+EMB_PARAMS *Fonts[256][4]; /* Fonts to use */
+unsigned short Chars[256]; /* Input char to unicode */
+unsigned char Codes[65536]; /* Unicode glyph mapping to font */
+int Widths[256]; /* Widths of each font */
+int Directions[256];/* Text directions for each font */
+pdfOut *pdf;
+int FontResource; /* Object number of font resource dictionary */
+float FontScaleX,FontScaleY; /* The font matrix */
+lchar_t *Title,*Date; /* The title and date strings */
+
+/*
+ * Local functions...
+ */
+
+static void write_line(int row, lchar_t *line);
+static void write_string(int col, int row, int len, lchar_t *s);
+static lchar_t *make_wide(const char *buf);
+static void write_font_str(float x,float y,int fontid, lchar_t *str, int len);
+static void write_pretty_header();
+
+
+/*
+ * 'main()' - Main entry for text to PDF filter.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ char *argv[]) /* I - Command-line arguments */
+{
+ return (TextMain("texttopdf", argc, argv));
+}
+
+
+/*
+ * 'WriteEpilogue()' - Write the PDF file epilogue.
+ */
+
+void
+WriteEpilogue(void)
+{
+ static char *names[] = /* Font names */
+ { "FN","FB","FI" };
+ int i,j;
+
+ free(Page[0]);
+ free(Page);
+
+ // embed fonts
+ for (i = PrettyPrint ? 2 : 1; i >= 0; i --) {
+ for (j = 0; j < NumFonts; j ++)
+ {
+ EMB_PARAMS *emb=Fonts[j][i];
+ if (emb->font->fobj) { // already embedded
+ continue;
+ }
+ if ( (!emb->subset)||(bits_used(emb->subset,emb->font->sfnt->numGlyphs)) ) {
+ emb->font->fobj=pdfOut_write_font(pdf,emb);
+ assert(emb->font->fobj);
+ }
+ }
+ }
+
+ /*
+ * Create the global fontdict
+ */
+
+ // now fix FontResource
+ pdf->xref[FontResource-1]=pdf->filepos;
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<<\n",
+ FontResource);
+
+ for (i = PrettyPrint ? 2 : 1; i >= 0; i --) {
+ for (j = 0; j < NumFonts; j ++) {
+ EMB_PARAMS *emb=Fonts[j][i];
+ if (emb->font->fobj) { // used
+ pdfOut_printf(pdf," /%s%02x %d 0 R\n",names[i],j,emb->font->fobj);
+ }
+ }
+ }
+
+ pdfOut_printf(pdf,">>\n"
+ "endobj\n");
+
+ pdfOut_finish_pdf(pdf);
+
+ pdfOut_free(pdf);
+}
+
+/*
+ * {{{ 'WritePage()' - Write a page of text.
+ */
+
+void
+WritePage(void)
+{
+ int line; /* Current line */
+
+ int content=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Length %d 0 R\n"
+ ">>\n"
+ "stream\n"
+ "q\n"
+ ,content,content+1);
+ long size=-(pdf->filepos-2);
+
+ NumPages ++;
+ if (PrettyPrint)
+ write_pretty_header(pdf);
+
+ for (line = 0; line < SizeLines; line ++)
+ write_line(line, Page[line]);
+
+ size+=pdf->filepos+2;
+ pdfOut_printf(pdf,"Q\n"
+ "endstream\n"
+ "endobj\n");
+
+ int len_obj=pdfOut_add_xref(pdf);
+ assert(len_obj==content+1);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "%d\n"
+ "endobj\n",
+ len_obj,size);
+
+ int obj=pdfOut_add_xref(pdf);
+ pdfOut_printf(pdf,"%d 0 obj\n"
+ "<</Type/Page\n"
+ " /Parent 1 0 R\n"
+ " /MediaBox [0 0 %.0f %.0f]\n"
+ " /Contents %d 0 R\n"
+ " /Resources << /Font %d 0 R >>\n"
+ ">>\n"
+ "endobj\n",
+ obj,PageWidth,PageLength,content,FontResource);
+ pdfOut_add_page(pdf,obj);
+
+ memset(Page[0], 0, sizeof(lchar_t) * SizeColumns * SizeLines);
+}
+// }}}
+
+/*
+ * {{{'WriteProlog()' - Write the PDF file prolog with options.
+ */
+
+void
+WriteProlog(const char *title, /* I - Title of job */
+ const char *user, /* I - Username */
+ const char *classification, /* I - Classification */
+ const char *label, /* I - Page label */
+ ppd_file_t *ppd) /* I - PPD file info */
+{
+ int i, j, k; /* Looping vars */
+ char *charset; /* Character set string */
+ char filename[1024]; /* Glyph filenames */
+ FILE *fp; /* Glyph files */
+ const char *datadir; /* CUPS_DATADIR environment variable */
+ char line[1024], /* Line from file */
+ *lineptr, /* Pointer into line */
+ *valptr; /* Pointer to value in line */
+#ifndef CUPS_1_4 /* CUPS 1.4.x or newer: support for non-utf8 removed */
+ int ch, unicode; /* Character values */
+#endif
+ int start, end; /* Start and end values for range */
+ time_t curtime; /* Current time */
+ struct tm *curtm; /* Current date */
+ char curdate[255]; /* Current date (text format) */
+ int num_fonts=0; /* Number of unique fonts */
+ EMB_PARAMS *fonts[1024]; /* Unique fonts */
+ char *fontnames[1024]; /* Unique fonts */
+#if 0
+ static char *names[] = /* Font names */
+ {
+ "FN","FB","FI"
+ /*
+ "cupsNormal",
+ "cupsBold",
+ "cupsItalic"
+ */
+ };
+#endif
+
+
+ /*
+ * Get the data directory...
+ */
+
+ if ((datadir = getenv("CUPS_DATADIR")) == NULL)
+ datadir = CUPS_DATADIR;
+
+ /*
+ * Adjust margins as necessary...
+ */
+
+ if (classification || label)
+ {
+ /*
+ * Leave room for labels...
+ */
+
+ PageBottom += 36;
+ PageTop -= 36;
+ }
+
+ /*
+ * Allocate memory for the page...
+ */
+
+ SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch;
+ SizeLines = (PageTop - PageBottom) / 72.0 * LinesPerInch;
+
+ Page = calloc(sizeof(lchar_t *), SizeLines);
+ Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
+ for (i = 1; i < SizeLines; i ++)
+ Page[i] = Page[0] + i * SizeColumns;
+
+ if (PageColumns > 1)
+ {
+ ColumnGutter = CharsPerInch / 2;
+ ColumnWidth = (SizeColumns - ColumnGutter * (PageColumns - 1)) /
+ PageColumns;
+ }
+ else
+ ColumnWidth = SizeColumns;
+
+ /*
+ * {{{ Output the PDF header...
+ */
+
+ assert(!pdf);
+ pdf=pdfOut_new();
+ assert(pdf);
+
+ pdfOut_begin_pdf(pdf);
+ pdfOut_printf(pdf,"%%cupsRotation: %d\n", (Orientation & 3) * 90); // TODO?
+
+ pdfOut_add_kv(pdf,"Creator","texttopdf/" PACKAGE_VERSION);
+
+ curtime = time(NULL);
+ curtm = localtime(&curtime);
+ strftime(curdate, sizeof(curdate), "%c", curtm);
+
+ pdfOut_add_kv(pdf,"CreationDate",pdfOut_to_pdfdate(curtm));
+ pdfOut_add_kv(pdf,"Title",title);
+ pdfOut_add_kv(pdf,"Author",user); // was(PostScript): /For
+ // }}}
+
+ /*
+ * {{{ Initialize globals...
+ */
+
+ NumFonts = 0;
+ memset(Fonts, 0, sizeof(Fonts));
+ memset(Chars, 0, sizeof(Chars));
+ memset(Codes, 0, sizeof(Codes));
+ // }}}
+
+ /*
+ * Get the output character set...
+ */
+
+ charset = getenv("CHARSET");
+ if (charset != NULL && strcmp(charset, "us-ascii") != 0) // {{{
+ {
+ snprintf(filename, sizeof(filename), "%s/charsets/pdf.%s", datadir, charset);
+
+ if ((fp = fopen(filename, "r")) == NULL)
+ {
+ /*
+ * Can't open charset file!
+ */
+
+ fprintf(stderr, "ERROR: Unable to open %s: %s\n", filename,
+ strerror(errno));
+ exit(1);
+ }
+
+ /*
+ * Opened charset file; now see if this is really a charset file...
+ */
+
+ if (fgets(line, sizeof(line), fp) == NULL)
+ {
+ /*
+ * Bad/empty charset file!
+ */
+
+ fclose(fp);
+ fprintf(stderr, "ERROR: Bad charset file %s\n", filename);
+ exit(1);
+ }
+
+ if (strncmp(line, "charset", 7) != 0)
+ {
+ /*
+ * Bad format/not a charset file!
+ */
+
+ fclose(fp);
+ fprintf(stderr, "ERROR: Bad charset file %s\n", filename);
+ exit(1);
+ }
+
+ /*
+ * See if this is an 8-bit or UTF-8 character set file...
+ */
+
+ line[strlen(line) - 1] = '\0'; /* Drop \n */
+ for (lineptr = line + 7; isspace(*lineptr & 255); lineptr ++); /* Skip whitespace */
+
+#ifndef CUPS_1_4 /* CUPS 1.4.x or newer: support for non-utf8 removed */
+ if (strcmp(lineptr, "8bit") == 0) // {{{
+ {
+ /*
+ * 8-bit text...
+ */
+
+ UTF8 = 0;
+ NumFonts = 0;
+
+ /*
+ * Read the font description(s)...
+ */
+
+ while (fgets(line, sizeof(line), fp) != NULL)
+ {
+ /*
+ * Skip comment and blank lines...
+ */
+
+ if (line[0] == '#' || line[0] == '\n')
+ continue;
+
+ /*
+ * Read the font descriptions that should look like:
+ *
+ * first last direction width normal [bold italic bold-italic]
+ */
+
+ lineptr = line;
+
+ start = strtol(lineptr, &lineptr, 16);
+ end = strtol(lineptr, &lineptr, 16);
+
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ if (!*lineptr)
+ break; /* Must be a font mapping */
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (!*lineptr)
+ {
+ /*
+ * Can't have a font without all required values...
+ */
+
+ fprintf(stderr, "ERROR: Bad font description line: %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ *lineptr++ = '\0';
+
+ if (strcmp(valptr, "ltor") == 0)
+ Directions[NumFonts] = 1;
+ else if (strcmp(valptr, "rtol") == 0)
+ Directions[NumFonts] = -1;
+ else
+ {
+ fprintf(stderr, "ERROR: Bad text direction %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ /*
+ * Got the direction, now get the width...
+ */
+
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (!*lineptr)
+ {
+ /*
+ * Can't have a font without all required values...
+ */
+
+ fprintf(stderr, "ERROR: Bad font description line: %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ *lineptr++ = '\0';
+
+ if (strcmp(valptr, "single") == 0)
+ Widths[NumFonts] = 1;
+ else if (strcmp(valptr, "double") == 0)
+ Widths[NumFonts] = 2;
+ else
+ {
+ fprintf(stderr, "ERROR: Bad text width %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ /*
+ * Get the fonts...
+ */
+
+ for (i = 0; *lineptr && i < 4; i ++)
+ {
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (*lineptr)
+ *lineptr++ = '\0';
+
+ if (lineptr > valptr) {
+ // search for duplicates
+ for (k = 0; k < num_fonts; k ++)
+ if (strcmp(valptr, fontnames[k]) == 0) {
+ Fonts[NumFonts][i] = fonts[k];
+ break;
+ }
+
+ if (k==num_fonts) { // not found
+ fonts[num_fonts] = Fonts[NumFonts][i] = font_load(valptr);
+ if (!fonts[num_fonts]) { // font missing/corrupt, replace by first
+ fprintf(stderr,"WARNING: Ignored bad font \"%s\"\n",valptr);
+ break;
+ }
+ fontnames[num_fonts++] = strdup(valptr);
+ }
+ }
+ }
+
+ /* ignore complete range, when the first font is not available */
+ if (i==0) {
+ continue;
+ }
+
+ /*
+ * Fill in remaining fonts as needed...
+ */
+
+ for (j = i; j < 4; j ++)
+ Fonts[NumFonts][j] = Fonts[NumFonts][0];
+
+ /*
+ * Define the character mappings...
+ */
+
+ for (i = start; i <= end; i ++)
+ Codes[i] = NumFonts;
+
+ NumFonts ++;
+ }
+
+ /*
+ * Read encoding lines...
+ */
+
+ do
+ {
+ /*
+ * Skip comment and blank lines...
+ */
+
+ if (line[0] == '#' || line[0] == '\n')
+ continue;
+
+ /*
+ * Grab the character and unicode glyph number.
+ */
+
+ if (sscanf(line, "%x%x", &ch, &unicode) == 2 && ch < 256)
+ Chars[ch] = unicode;
+ }
+ while (fgets(line, sizeof(line), fp) != NULL);
+
+ fclose(fp);
+ } else // }}}
+#endif
+ if (strcmp(lineptr, "utf8") == 0) { // {{{
+ /*
+ * UTF-8 (Unicode) text...
+ */
+
+ UTF8 = 1;
+
+ /*
+ * Read the font descriptions...
+ */
+
+ NumFonts = 0;
+
+ while (fgets(line, sizeof(line), fp) != NULL)
+ {
+ /*
+ * Skip comment and blank lines...
+ */
+
+ if (line[0] == '#' || line[0] == '\n')
+ continue;
+
+ /*
+ * Read the font descriptions that should look like:
+ *
+ * start end direction width normal [bold italic bold-italic]
+ */
+
+ lineptr = line;
+
+ start = strtol(lineptr, &lineptr, 16);
+ end = strtol(lineptr, &lineptr, 16);
+
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (!*lineptr)
+ {
+ /*
+ * Can't have a font without all required values...
+ */
+
+ fprintf(stderr, "ERROR: Bad font description line: %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ *lineptr++ = '\0';
+
+ if (strcmp(valptr, "ltor") == 0)
+ Directions[NumFonts] = 1;
+ else if (strcmp(valptr, "rtol") == 0)
+ Directions[NumFonts] = -1;
+ else
+ {
+ fprintf(stderr, "ERROR: Bad text direction %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ /*
+ * Got the direction, now get the width...
+ */
+
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (!*lineptr)
+ {
+ /*
+ * Can't have a font without all required values...
+ */
+
+ fprintf(stderr, "ERROR: Bad font description line: %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ *lineptr++ = '\0';
+
+ if (strcmp(valptr, "single") == 0)
+ Widths[NumFonts] = 1;
+ else if (strcmp(valptr, "double") == 0)
+ Widths[NumFonts] = 2;
+ else
+ {
+ fprintf(stderr, "ERROR: Bad text width %s\n", valptr);
+ fclose(fp);
+ exit(1);
+ }
+
+ /*
+ * Get the fonts...
+ */
+
+ for (i = 0; *lineptr && i < 4; i ++)
+ {
+ while (isspace(*lineptr & 255))
+ lineptr ++;
+
+ valptr = lineptr;
+
+ while (!isspace(*lineptr & 255) && *lineptr)
+ lineptr ++;
+
+ if (*lineptr)
+ *lineptr++ = '\0';
+
+ if (lineptr > valptr) {
+ // search for duplicates
+ for (k = 0; k < num_fonts; k ++)
+ if (strcmp(valptr, fontnames[k]) == 0) {
+ Fonts[NumFonts][i] = fonts[k];
+ break;
+ }
+
+ if (k==num_fonts) { // not found
+ fonts[num_fonts] = Fonts[NumFonts][i] = font_load(valptr);
+ if (!fonts[num_fonts]) { // font missing/corrupt, replace by first
+ fprintf(stderr,"WARNING: Ignored bad font \"%s\"\n",valptr);
+ break;
+ }
+ fontnames[num_fonts++] = strdup(valptr);
+ }
+ }
+ }
+
+ /* ignore complete range, when the first font is not available */
+ if (i==0) {
+ continue;
+ }
+
+ /*
+ * Fill in remaining fonts as needed...
+ */
+
+ for (j = i; j < 4; j ++)
+ Fonts[NumFonts][j] = Fonts[NumFonts][0];
+
+ /*
+ * Define the character mappings...
+ */
+
+ for (i = start; i <= end; i ++)
+ {
+ Codes[i] = NumFonts;
+ }
+
+ /*
+ * Move to the next font, stopping if needed...
+ */
+
+ NumFonts ++;
+ if (NumFonts >= 256)
+ break;
+ }
+
+ fclose(fp);
+ } // }}}
+ else // {{{
+ {
+ fprintf(stderr, "ERROR: Bad charset type %s\n", lineptr);
+ fclose(fp);
+ exit(1);
+ } // }}}
+ } // }}}
+ else // {{{ Standard ASCII
+ {
+ /*
+ * Standard ASCII output just uses Courier, Courier-Bold, and
+ * possibly Courier-Oblique.
+ */
+
+ NumFonts = 1;
+
+ Fonts[0][ATTR_NORMAL] = font_std("Courier");
+ Fonts[0][ATTR_BOLD] = font_std("Courier-Bold");
+ Fonts[0][ATTR_ITALIC] = font_std("Courier-Oblique");
+ Fonts[0][ATTR_BOLDITALIC] = font_std("Courier-BoldOblique");
+
+ Widths[0] = 1;
+ Directions[0] = 1;
+
+ /*
+ * Define US-ASCII characters...
+ */
+
+ for (i = 32; i < 127; i ++)
+ {
+ Chars[i] = i;
+ Codes[i] = NumFonts-1;
+ }
+ }
+ // }}}
+
+ if (NumFonts==0) {
+ fprintf(stderr, "ERROR: No usable font available\n");
+ exit(1);
+ }
+
+ FontScaleX=120.0 / CharsPerInch;
+ FontScaleY=68.0 / LinesPerInch;
+
+ // allocate now, for pages to use. will be fixed in epilogue
+ FontResource=pdfOut_add_xref(pdf);
+
+ if (PrettyPrint)
+ {
+ Date=make_wide(curdate);
+ Title=make_wide(title);
+ }
+}
+// }}}
+
+/*
+ * {{{ 'write_line()' - Write a row of text.
+ */
+
+static void
+write_line(int row, /* I - Row number (0 to N) */
+ lchar_t *line) /* I - Line to print */
+{
+ int i; /* Looping var */
+ int col,xcol,xwid; /* Current column */
+ int attr; /* Current attribute */
+ int font, /* Font to use */
+ lastfont, /* Last font */
+ mono; /* Monospaced? */
+ lchar_t *start; /* First character in sequence */
+
+
+ xcol=0;
+ for (col = 0, start = line; col < SizeColumns;)
+ {
+ while (col < SizeColumns && (line->ch == ' ' || line->ch == 0))
+ {
+ col ++;
+ xcol ++;
+ line ++;
+ }
+
+ if (col >= SizeColumns)
+ break;
+
+ if (NumFonts == 1)
+ {
+ /*
+ * All characters in a single font - assume monospaced and single width...
+ */
+
+ attr = line->attr;
+ start = line;
+
+ while (col < SizeColumns && line->ch != 0 && attr == line->attr)
+ {
+ col ++;
+ line ++;
+ }
+
+ write_string(col - (line - start), row, line - start, start);
+ }
+ else
+ {
+ /*
+ * Multiple fonts; break up based on the font...
+ */
+
+ attr = line->attr;
+ start = line;
+ xwid = 0;
+ if (UTF8) {
+ lastfont = Codes[line->ch];
+ } else {
+ lastfont = Codes[Chars[line->ch]];
+ }
+// mono = strncmp(Fonts[lastfont][0], "Courier", 7) == 0;
+mono=1; // TODO
+
+ col ++;
+ xwid += Widths[lastfont];
+ line ++;
+
+ if (mono)
+ {
+ while (col < SizeColumns && line->ch != 0 && attr == line->attr)
+ {
+ if (UTF8) {
+ font = Codes[line->ch];
+ } else {
+ font = Codes[Chars[line->ch]];
+ }
+ if (/*strncmp(Fonts[font][0], "Courier", 7) != 0 ||*/ // TODO
+ font != lastfont)
+ break;
+
+ col ++;
+ xwid += Widths[lastfont];
+ line ++;
+ }
+ }
+
+ if (Directions[lastfont] > 0) {
+ write_string(xcol, row, line - start, start);
+ xcol += xwid;
+ }
+ else
+ {
+ /*
+ * Do right-to-left text... ; assume no font change without direction change
+ */
+
+ while (col < SizeColumns && line->ch != 0 && attr == line->attr)
+ {
+ if (UTF8) {
+ font = Codes[line->ch];
+ } else {
+ font = Codes[Chars[line->ch]];
+ }
+ if (Directions[font] > 0 &&
+ !ispunct(line->ch & 255) && !isspace(line->ch & 255))
+ break;
+
+ col ++;
+ xwid += Widths[lastfont];
+ line ++;
+ }
+
+ for (i = 1; start < line; i ++, start ++)
+ if (!isspace(start->ch & 255)) {
+ xwid-=Widths[lastfont];
+ write_string(xcol + xwid, row, 1, start);
+ } else {
+ xwid--;
+ }
+ }
+ }
+ }
+}
+// }}}
+
+static lchar_t *make_wide(const char *buf) // {{{ - convert to lchar_t
+{
+ const unsigned char *utf8; /* UTF8 text */
+ lchar_t *ret,*out;
+
+ // this is enough, utf8 chars will only require less space
+ out=ret=malloc((strlen(buf)+1)*sizeof(lchar_t));
+
+ utf8 = (const unsigned char *)buf;
+ while (*utf8)
+ {
+ out->attr=0;
+
+ if (*utf8 < 0xc0 || !UTF8)
+ out->ch = *utf8 ++;
+ else if ((*utf8 & 0xe0) == 0xc0)
+ {
+ /*
+ * Two byte character...
+ */
+
+ out->ch = ((utf8[0] & 0x1f) << 6) | (utf8[1] & 0x3f);
+ utf8 += 2;
+ }
+ else
+ {
+ /*
+ * Three byte character...
+ */
+
+ out->ch = ((((utf8[0] & 0x1f) << 6) | (utf8[1] & 0x3f)) << 6) |
+ (utf8[2] & 0x3f);
+ utf8 += 3;
+ }
+
+ out++;
+ }
+ out->ch=out->attr=0;
+ return ret;
+}
+// }}}
+
+/*
+ * {{{ 'write_string()' - Write a string of text.
+ */
+
+static void
+write_string(int col, /* I - Start column */
+ int row, /* I - Row */
+ int len, /* I - Number of characters */
+ lchar_t *s) /* I - String to print */
+{
+ float x, y; /* Position of text */
+ unsigned attr; /* Character attributes */
+
+
+ /*
+ * Position the text and set the font...
+ */
+
+ if (Duplex && (NumPages & 1) == 0)
+ {
+ x = PageWidth - PageRight;
+ y = PageTop;
+ }
+ else
+ {
+ x = PageLeft;
+ y = PageTop;
+ }
+
+ x += (float)col * 72.0f / (float)CharsPerInch;
+ y -= (float)(row + 0.843) * 72.0f / (float)LinesPerInch;
+
+ attr = s->attr;
+
+ if (attr & ATTR_RAISED)
+ y += 36.0 / (float)LinesPerInch;
+ else if (attr & ATTR_LOWERED)
+ y -= 36.0 / (float)LinesPerInch;
+
+ if (attr & ATTR_UNDERLINE)
+ pdfOut_printf(pdf,"q 0.5 w 0 g %.3f %.3f m %.3f %.3f l S Q ",
+ x, y - 6.8 / LinesPerInch,
+ x + (float)len * 72.0 / (float)CharsPerInch,
+ y - 6.8 / LinesPerInch);
+
+ if (PrettyPrint)
+ {
+ if (ColorDevice) {
+ if (attr & ATTR_RED)
+ pdfOut_printf(pdf,"0.5 0 0 rg\n");
+ else if (attr & ATTR_GREEN)
+ pdfOut_printf(pdf,"0 0.5 0 rg\n");
+ else if (attr & ATTR_BLUE)
+ pdfOut_printf(pdf,"0 0 0.5 rg\n");
+ else
+ pdfOut_printf(pdf,"0 g\n");
+ } else {
+ if ( (attr & ATTR_RED)||(attr & ATTR_GREEN)||(attr & ATTR_BLUE) )
+ pdfOut_printf(pdf,"0.2 g\n");
+ else
+ pdfOut_printf(pdf,"0 g\n");
+ }
+ }
+ else
+ pdfOut_printf(pdf,"0 g\n");
+
+ write_font_str(x,y,attr & ATTR_FONT,s,len);
+}
+// }}}
+
+// {{{ show >len characters from >str, using the right font(s) at >x,>y
+static void write_font_str(float x,float y,int fontid, lchar_t *str, int len)
+{
+ unsigned short ch; /* Current character */
+ static char *names[] = /* Font names */
+ { "FN","FB","FI" };
+
+ if (len==-1) {
+ for (len=0;str[len].ch;len++);
+ }
+ pdfOut_printf(pdf,"BT\n");
+
+ if (x == (int)x)
+ pdfOut_printf(pdf," %.0f ", x);
+ else
+ pdfOut_printf(pdf," %.3f ", x);
+
+ if (y == (int)y)
+ pdfOut_printf(pdf,"%.0f Td\n", y);
+ else
+ pdfOut_printf(pdf,"%.3f Td\n", y);
+
+ int lastfont,font;
+
+ // split on font boundary
+ while (len > 0)
+ {
+ /*
+ * Write a hex string...
+ */
+ if (UTF8) {
+ lastfont=Codes[str->ch];
+ } else {
+ lastfont=Codes[Chars[str->ch]];
+ }
+ EMB_PARAMS *emb=Fonts[lastfont][fontid];
+ OTF_FILE *otf=emb->font->sfnt;
+
+ if (otf) { // TODO?
+ pdfOut_printf(pdf," %.3f Tz\n",
+ FontScaleX*600.0/(otf_get_width(otf,4)*1000.0/otf->unitsPerEm)*100.0/FontScaleY); // TODO?
+ // gid==4 is usually '!', the char after space. We just need "the" width for the monospaced font. gid==0 is bad, and space might also be bad.
+ } else {
+ pdfOut_printf(pdf," %.3f Tz\n",
+ FontScaleX*100.0/FontScaleY); // TODO?
+ }
+
+ pdfOut_printf(pdf," /%s%02x %.3f Tf <",
+ names[fontid],lastfont,FontScaleY);
+
+ while (len > 0)
+ {
+ if (UTF8) {
+ ch=str->ch;
+ } else {
+ ch=Chars[str->ch];
+ }
+
+ font = Codes[ch];
+ if (lastfont != font) {
+ assert(0); // should never happen; TODO
+ break;
+ }
+ if (otf) { // TODO
+ const unsigned short gid=emb_get(emb,ch);
+ pdfOut_printf(pdf,"%04x", gid);
+ } else { // std 14 font with 7-bit us-ascii uses single byte encoding, TODO
+ pdfOut_printf(pdf,"%02x",ch);
+ }
+
+ len --;
+ str ++;
+ }
+
+ pdfOut_printf(pdf,"> Tj\n");
+ }
+ pdfOut_printf(pdf,"ET\n");
+}
+// }}}
+
+static float stringwidth_x(lchar_t *str)
+{
+ int len;
+
+ for (len=0;str[len].ch;len++);
+
+ return (float)len * 72.0 / (float)CharsPerInch;
+}
+
+static void write_pretty_header() // {{{
+{
+ float x,y;
+ pdfOut_printf(pdf,"q\n"
+ "0.9 g\n");
+
+ if (Duplex && (NumPages & 1) == 0) {
+ x = PageWidth - PageRight;
+ y = PageTop + 72.0f / LinesPerInch;
+ } else {
+ x = PageLeft;
+ y = PageTop + 72.0f / LinesPerInch;
+ }
+
+ pdfOut_printf(pdf,"1 0 0 1 %.3f %.3f cm\n",x,y); // translate
+ pdfOut_printf(pdf,"0 0 %.3f %.3f re f\n",
+ PageRight - PageLeft, 144.0f / LinesPerInch);
+ pdfOut_printf(pdf,"0 g 0 G\n");
+
+ if (Duplex && (NumPages & 1) == 0) {
+ x = PageRight - PageLeft - 36.0f / LinesPerInch - stringwidth_x(Title);
+ y = (0.5f + 0.157f) * 72.0f / LinesPerInch;
+ } else {
+ x = 36.0f / LinesPerInch;
+ y = (0.5f + 0.157f) * 72.0f / LinesPerInch;
+ }
+ write_font_str(x,y,ATTR_BOLD,Title,-1);
+
+ x = (-stringwidth_x(Date) + PageRight - PageLeft) * 0.5;
+ write_font_str(x,y,ATTR_BOLD,Date,-1);
+
+ // convert pagenumber to string
+ char tmp[20];
+ tmp[19]=0;
+ snprintf(tmp,19,"%d",NumPages);
+ lchar_t *pagestr=make_wide(tmp);
+
+ if (Duplex && (NumPages & 1) == 0) {
+ x = 36.0f / LinesPerInch;
+ } else {
+ x = PageRight - PageLeft - 36.0f / LinesPerInch - stringwidth_x(pagestr);
+ }
+ write_font_str(x,y,ATTR_BOLD,pagestr,-1);
+
+ pdfOut_printf(pdf,"Q\n");
+}
+// }}}
+
--- /dev/null
+#!/bin/sh
+
+# $Id: $
+#
+# texttops - This is a Text-to-PostScript filter for CUPS
+#
+# Note: This wrapper filter is only included for backward compatibility with
+# certan custom configurations. It is not mentioned in any of the .convs
+# files included in this package and therefore never used with the default
+# configuration. It makes sure that third-party PPD files referring to
+# texttops explicitly or custom configurations (in /etc/cups/*.convs files)
+# will not break.
+#
+# DO NOT create new PPD or .convs files using this filter! texttops is
+# DEPRECATED!
+
+# (C) 2012 Till Kamppeter <till.kamppeter@gmail.com>
+#
+# Released under GPL 2 or later
+#
+
+PDF2PS=`which pdf2ps`
+
+echo "DEBUG: texttops argv[$#] = $@" >&2
+echo "DEBUG: PPD: $PPD" >&2
+
+if [ $# -lt 5 -o $# -gt 6 ]; then
+ echo "ERROR: $0 job-id user title copies options [file]" >&2
+ exit 1
+fi
+
+# Read from given file.
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+`dirname $0`/texttopdf "$1" "$2" "$3" "$4" "$5" | $PDF2PS - -
--- /dev/null
+libfontembed - font embedding and subsetting library
+----------------------------------------------------
+
+This library implements all the stuff required to
+embed and subset TrueType fonts, as for example
+required in PDF files. It is completely self-contained,
+although a FreeType binding might come sometime in the future.
+
+Currently glyf-flavored TrueType is fully supported,
+for OTF, i.e. CFF-flavored TrueType/OpenType, subsetting is not
+done; but embedding does work.
+And single-byte mode does needs work/thought wrt. to encodings.
+Also reencoding and conversion of Type1 to CFF is planned.
+PostScript embedding is another goal of the project.
+
+The most important issue that needs fixing is support for
+text extraction in the PDF multibyte case (most common),
+which requires ToUnicode support; some preparation is already done.
+
+Usage
+-----
+(TODO)... see test_pdf.c ...
+
+ * for direct sfnt access: use <sfnt.h>
+ * for embedding: use <embed.h> (which includes <fontfile.h>)
+
+License (MIT)
+-------------
+Copyright (c) 2008,2012 by Tobias Hoffmann.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+#include <stdlib.h>
+
+const char *aglfn13(unsigned short uni);
+
+#ifdef WITH_AGLFN
+static const char *agl_l207e[]={
+ "space","exclam","quotedbl","numbersign", "dollar","percent","ampersand","quotesingle",
+ "parenleft","parenright","asterisk","plus", "comma","hyphen","period","slash",
+ "zero","one","two","three", "four","five","six","seven", "eight","nine","colon","semicolon", "less","equal","greater","question",
+ "at","A","B","C", "D","E","F","G", "H","I","J","K", "L","M","N","O",
+ "P","Q","R","S", "T","U","V","W", "X","Y","Z","bracketleft", "backslash","bracketright","asciicircum","underscore",
+ "grave","a","b","c", "d","e","f","g", "h","i","j","k", "l","m","n","o",
+ "p","q","r","s", "t","u","v","w", "x","y","z","braceleft", "bar","braceright","asciitilde"};
+
+static const char *agl_la1ff[]={
+ "exclamdown","cent","sterling","currency", "yen","brokenbar","section","dieresis",
+ "copyright","ordfeminine","guillemotleft","logicalnot", "registered","macron","degree","plusminus",
+ 0,0,"acute",0, "paragraph","periodcentered","cedilla",0,
+ "ordmasculine","guillemotright","onequarter","onehalf", "threequarters","questiondown","Agrave","Aacute",
+ "Acircumflex","Atilde","Adieresis","Aring", "AE","Ccedilla","Egrave","Eacute",
+ "Ecircumflex","Edieresis","Igrave","Iacute", "Icircumflex","Idieresis","Eth","Ntilde",
+ "Ograve","Oacute","Ocircumflex","Otilde", "Odieresis","multiply","Oslash","Ugrave",
+ "Uacute","Ucircumflex","Udieresis","Yacute", "Thorn","germandbls","agrave","aacute",
+ "acircumflex","atilde","adieresis","aring", "ae","ccedilla","egrave","eacute",
+ "ecircumflex","edieresis","igrave","iacute", "icircumflex","idieresis","eth","ntilde",
+ "ograve","oacute","ocircumflex","otilde", "odieresis","divide","oslash","ugrave",
+ "uacute","ucircumflex","udieresis","yacute", "thorn","ydieresis"};
+
+static const char *agl_l1007f[]={
+ "Amacron","amacron","Abreve","abreve", "Aogonek","aogonek","Cacute","cacute",
+ "Ccircumflex","ccircumflex","Cdotaccent","cdotaccent", "Ccaron","ccaron","Dcaron","dcaron",
+ "Dcroat","dcroat","Emacron","emacron", "Ebreve","ebreve","Edotaccent","edotaccent",
+ "Eogonek","eogonek","Ecaron","ecaron", "Gcircumflex","gcircumflex","Gbreve","gbreve",
+ "Gdotaccent","gdotaccent","Gcommaaccent","gcommaaccent", "Hcircumflex","hcircumflex","Hbar","hbar",
+ "Itilde","itilde","Imacron","imacron", "Ibreve","ibreve","Iogonek","iogonek",
+ "Idotaccent","dotlessi","IJ","ij", "Jcircumflex","jcircumflex","Kcommaaccent","kcommaaccent",
+ "kgreenlandic","Lacute","lacute","Lcommaaccent", "lcommaaccent","Lcaron","lcaron","Ldot",
+ "ldot","Lslash","lslash","Nacute", "nacute","Ncommaaccent","ncommaaccent","Ncaron",
+ "ncaron","napostrophe","Eng","eng", "Omacron","omacron","Obreve","obreve",
+ "Ohungarumlaut","ohungarumlaut","OE","oe", "Racute","racute","Rcommaaccent","rcommaaccent",
+ "Rcaron","rcaron","Sacute","sacute", "Scircumflex","scircumflex","Scedilla","scedilla",
+ "Scaron","scaron","Tcommaaccent","tcommaaccent", "Tcaron","tcaron","Tbar","tbar",
+ "Utilde","utilde","Umacron","umacron", "Ubreve","ubreve","Uring","uring",
+ "Uhungarumlaut","uhungarumlaut","Uogonek","uogonek", "Wcircumflex","wcircumflex","Ycircumflex","ycircumflex",
+ "Ydieresis","Zacute","zacute","Zdotaccent", "zdotaccent","Zcaron","zcaron","longs"};
+
+struct agl_lt { unsigned short uid; const char *name; } agl_lxx[]={
+ {0x0192,"florin"},{0x01A0,"Ohorn"},{0x01A1,"ohorn"},{0x01AF,"Uhorn"},
+ {0x01B0,"uhorn"},{0x01E6,"Gcaron"},{0x01E7,"gcaron"},{0x01FA,"Aringacute"},
+ {0x01FB,"aringacute"},{0x01FC,"AEacute"},{0x01FD,"aeacute"},{0x01FE,"Oslashacute"},
+ {0x01FF,"oslashacute"},{0x0218,"Scommaaccent"},{0x0219,"scommaaccent"},{0x02BC,"afii57929"},
+ {0x02BD,"afii64937"},{0x02C6,"circumflex"},{0x02C7,"caron"},{0x02D8,"breve"},
+ {0x02D9,"dotaccent"},{0x02DA,"ring"},{0x02DB,"ogonek"},{0x02DC,"tilde"},
+ {0x02DD,"hungarumlaut"},{0x0300,"gravecomb"},{0x0301,"acutecomb"},{0x0303,"tildecomb"},
+ {0x0309,"hookabovecomb"},{0x0323,"dotbelowcomb"},{0x0384,"tonos"},{0x0385,"dieresistonos"},
+ {0x0386,"Alphatonos"},{0x0387,"anoteleia"},{0x0388,"Epsilontonos"},{0x0389,"Etatonos"},
+ {0x038A,"Iotatonos"},{0x038C,"Omicrontonos"},{0x038E,"Upsilontonos"},{0x038F,"Omegatonos"},
+ {0x0390,"iotadieresistonos"},{0x0391,"Alpha"},{0x0392,"Beta"},{0x0393,"Gamma"},
+ {0x0394,"Delta"},{0x0395,"Epsilon"},{0x0396,"Zeta"},{0x0397,"Eta"},
+ {0x0398,"Theta"},{0x0399,"Iota"},{0x039A,"Kappa"},{0x039B,"Lambda"},
+ {0x039C,"Mu"},{0x039D,"Nu"},{0x039E,"Xi"},{0x039F,"Omicron"},
+ {0x03A0,"Pi"},{0x03A1,"Rho"},{0x03A3,"Sigma"},{0x03A4,"Tau"},
+ {0x03A5,"Upsilon"},{0x03A6,"Phi"},{0x03A7,"Chi"},{0x03A8,"Psi"},
+ {0x03A9,"Omega"},{0x03AA,"Iotadieresis"},{0x03AB,"Upsilondieresis"},{0x03AC,"alphatonos"},
+ {0x03AD,"epsilontonos"},{0x03AE,"etatonos"},{0x03AF,"iotatonos"},{0x03B0,"upsilondieresistonos"},
+ {0x03B1,"alpha"},{0x03B2,"beta"},{0x03B3,"gamma"},{0x03B4,"delta"},
+ {0x03B5,"epsilon"},{0x03B6,"zeta"},{0x03B7,"eta"},{0x03B8,"theta"},
+ {0x03B9,"iota"},{0x03BA,"kappa"},{0x03BB,"lambda"},{0x03BC,"mu"},
+ {0x03BD,"nu"},{0x03BE,"xi"},{0x03BF,"omicron"},{0x03C0,"pi"},
+ {0x03C1,"rho"},{0x03C2,"sigma1"},{0x03C3,"sigma"},{0x03C4,"tau"},
+ {0x03C5,"upsilon"},{0x03C6,"phi"},{0x03C7,"chi"},{0x03C8,"psi"},
+ {0x03C9,"omega"},{0x03CA,"iotadieresis"},{0x03CB,"upsilondieresis"},
+ {0x03CC,"omicrontonos"},{0x03CD,"upsilontonos"},{0x03CE,"omegatonos"},
+ {0x03D1,"theta1"},{0x03D2,"Upsilon1"},{0x03D5,"phi1"},{0x03D6,"omega1"},
+ {0x0401,"afii10023"},{0x0402,"afii10051"},{0x0403,"afii10052"},{0x0404,"afii10053"},
+ {0x0405,"afii10054"},{0x0406,"afii10055"},{0x0407,"afii10056"},{0x0408,"afii10057"},
+ {0x0409,"afii10058"},{0x040A,"afii10059"},{0x040B,"afii10060"},{0x040C,"afii10061"},
+ {0x040E,"afii10062"},{0x040F,"afii10145"},{0x0410,"afii10017"},{0x0411,"afii10018"},
+ {0x0412,"afii10019"},{0x0413,"afii10020"},{0x0414,"afii10021"},{0x0415,"afii10022"},
+ {0x0416,"afii10024"},{0x0417,"afii10025"},{0x0418,"afii10026"},{0x0419,"afii10027"},
+ {0x041A,"afii10028"},{0x041B,"afii10029"},{0x041C,"afii10030"},{0x041D,"afii10031"},
+ {0x041E,"afii10032"},{0x041F,"afii10033"},{0x0420,"afii10034"},{0x0421,"afii10035"},
+ {0x0422,"afii10036"},{0x0423,"afii10037"},{0x0424,"afii10038"},{0x0425,"afii10039"},
+ {0x0426,"afii10040"},{0x0427,"afii10041"},{0x0428,"afii10042"},{0x0429,"afii10043"},
+ {0x042A,"afii10044"},{0x042B,"afii10045"},{0x042C,"afii10046"},{0x042D,"afii10047"},
+ {0x042E,"afii10048"},{0x042F,"afii10049"},{0x0430,"afii10065"},{0x0431,"afii10066"},
+ {0x0432,"afii10067"},{0x0433,"afii10068"},{0x0434,"afii10069"},{0x0435,"afii10070"},
+ {0x0436,"afii10072"},{0x0437,"afii10073"},{0x0438,"afii10074"},{0x0439,"afii10075"},
+ {0x043A,"afii10076"},{0x043B,"afii10077"},{0x043C,"afii10078"},{0x043D,"afii10079"},
+ {0x043E,"afii10080"},{0x043F,"afii10081"},{0x0440,"afii10082"},{0x0441,"afii10083"},
+ {0x0442,"afii10084"},{0x0443,"afii10085"},{0x0444,"afii10086"},{0x0445,"afii10087"},
+ {0x0446,"afii10088"},{0x0447,"afii10089"},{0x0448,"afii10090"},{0x0449,"afii10091"},
+ {0x044A,"afii10092"},{0x044B,"afii10093"},{0x044C,"afii10094"},{0x044D,"afii10095"},
+ {0x044E,"afii10096"},{0x044F,"afii10097"},{0x0451,"afii10071"},{0x0452,"afii10099"},
+ {0x0453,"afii10100"},{0x0454,"afii10101"},{0x0455,"afii10102"},{0x0456,"afii10103"},
+ {0x0457,"afii10104"},{0x0458,"afii10105"},{0x0459,"afii10106"},{0x045A,"afii10107"},
+ {0x045B,"afii10108"},{0x045C,"afii10109"},{0x045E,"afii10110"},{0x045F,"afii10193"},
+ {0x0462,"afii10146"},{0x0463,"afii10194"},{0x0472,"afii10147"},{0x0473,"afii10195"},
+ {0x0474,"afii10148"},{0x0475,"afii10196"},{0x0490,"afii10050"},{0x0491,"afii10098"},
+ {0x04D9,"afii10846"},{0x05B0,"afii57799"},{0x05B1,"afii57801"},{0x05B2,"afii57800"},
+ {0x05B3,"afii57802"},{0x05B4,"afii57793"},{0x05B5,"afii57794"},{0x05B6,"afii57795"},
+ {0x05B7,"afii57798"},{0x05B8,"afii57797"},{0x05B9,"afii57806"},{0x05BB,"afii57796"},
+ {0x05BC,"afii57807"},{0x05BD,"afii57839"},{0x05BE,"afii57645"},{0x05BF,"afii57841"},
+ {0x05C0,"afii57842"},{0x05C1,"afii57804"},{0x05C2,"afii57803"},{0x05C3,"afii57658"},
+ {0x05D0,"afii57664"},{0x05D1,"afii57665"},{0x05D2,"afii57666"},{0x05D3,"afii57667"},
+ {0x05D4,"afii57668"},{0x05D5,"afii57669"},{0x05D6,"afii57670"},{0x05D7,"afii57671"},
+ {0x05D8,"afii57672"},{0x05D9,"afii57673"},{0x05DA,"afii57674"},{0x05DB,"afii57675"},
+ {0x05DC,"afii57676"},{0x05DD,"afii57677"},{0x05DE,"afii57678"},{0x05DF,"afii57679"},
+ {0x05E0,"afii57680"},{0x05E1,"afii57681"},{0x05E2,"afii57682"},{0x05E3,"afii57683"},
+ {0x05E4,"afii57684"},{0x05E5,"afii57685"},{0x05E6,"afii57686"},{0x05E7,"afii57687"},
+ {0x05E8,"afii57688"},{0x05E9,"afii57689"},{0x05EA,"afii57690"},{0x05F0,"afii57716"},
+ {0x05F1,"afii57717"},{0x05F2,"afii57718"},{0x060C,"afii57388"},{0x061B,"afii57403"},
+ {0x061F,"afii57407"},{0x0621,"afii57409"},{0x0622,"afii57410"},{0x0623,"afii57411"},
+ {0x0624,"afii57412"},{0x0625,"afii57413"},{0x0626,"afii57414"},{0x0627,"afii57415"},
+ {0x0628,"afii57416"},{0x0629,"afii57417"},{0x062A,"afii57418"},{0x062B,"afii57419"},
+ {0x062C,"afii57420"},{0x062D,"afii57421"},{0x062E,"afii57422"},{0x062F,"afii57423"},
+ {0x0630,"afii57424"},{0x0631,"afii57425"},{0x0632,"afii57426"},{0x0633,"afii57427"},
+ {0x0634,"afii57428"},{0x0635,"afii57429"},{0x0636,"afii57430"},{0x0637,"afii57431"},
+ {0x0638,"afii57432"},{0x0639,"afii57433"},{0x063A,"afii57434"},{0x0640,"afii57440"},
+ {0x0641,"afii57441"},{0x0642,"afii57442"},{0x0643,"afii57443"},{0x0644,"afii57444"},
+ {0x0645,"afii57445"},{0x0646,"afii57446"},{0x0647,"afii57470"},{0x0648,"afii57448"},
+ {0x0649,"afii57449"},{0x064A,"afii57450"},{0x064B,"afii57451"},{0x064C,"afii57452"},
+ {0x064D,"afii57453"},{0x064E,"afii57454"},{0x064F,"afii57455"},{0x0650,"afii57456"},
+ {0x0651,"afii57457"},{0x0652,"afii57458"},{0x0660,"afii57392"},{0x0661,"afii57393"},
+ {0x0662,"afii57394"},{0x0663,"afii57395"},{0x0664,"afii57396"},{0x0665,"afii57397"},
+ {0x0666,"afii57398"},{0x0667,"afii57399"},{0x0668,"afii57400"},{0x0669,"afii57401"},
+ {0x066A,"afii57381"},{0x066D,"afii63167"},{0x0679,"afii57511"},{0x067E,"afii57506"},
+ {0x0686,"afii57507"},{0x0688,"afii57512"},{0x0691,"afii57513"},{0x0698,"afii57508"},
+ {0x06A4,"afii57505"},{0x06AF,"afii57509"},{0x06BA,"afii57514"},{0x06D2,"afii57519"},
+ {0x06D5,"afii57534"},{0x1E80,"Wgrave"},{0x1E81,"wgrave"},{0x1E82,"Wacute"},
+ {0x1E83,"wacute"},{0x1E84,"Wdieresis"},{0x1E85,"wdieresis"},{0x1EF2,"Ygrave"},
+ {0x1EF3,"ygrave"},{0x200C,"afii61664"},{0x200D,"afii301"},{0x200E,"afii299"},
+ {0x200F,"afii300"},{0x2012,"figuredash"},{0x2013,"endash"},{0x2014,"emdash"},
+ {0x2015,"afii00208"},{0x2017,"underscoredbl"},{0x2018,"quoteleft"},{0x2019,"quoteright"},
+ {0x201A,"quotesinglbase"},{0x201B,"quotereversed"},{0x201C,"quotedblleft"},{0x201D,"quotedblright"},
+ {0x201E,"quotedblbase"},{0x2020,"dagger"},{0x2021,"daggerdbl"},{0x2022,"bullet"},
+ {0x2024,"onedotenleader"},{0x2025,"twodotenleader"},{0x2026,"ellipsis"},{0x202C,"afii61573"},
+ {0x202D,"afii61574"},{0x202E,"afii61575"},{0x2030,"perthousand"},{0x2032,"minute"},
+ {0x2033,"second"},{0x2039,"guilsinglleft"},{0x203A,"guilsinglright"},{0x203C,"exclamdbl"},
+ {0x2044,"fraction"},{0x20A1,"colonmonetary"},{0x20A3,"franc"},{0x20A4,"lira"},
+ {0x20A7,"peseta"},{0x20AA,"afii57636"},{0x20AB,"dong"},{0x20AC,"Euro"},
+ {0x2105,"afii61248"},{0x2111,"Ifraktur"},{0x2113,"afii61289"},{0x2116,"afii61352"},
+ {0x2118,"weierstrass"},{0x211C,"Rfraktur"},{0x211E,"prescription"},{0x2122,"trademark"},
+ {0x212E,"estimated"},{0x2135,"aleph"},{0x2153,"onethird"},{0x2154,"twothirds"},
+ {0x215B,"oneeighth"},{0x215C,"threeeighths"},{0x215D,"fiveeighths"},{0x215E,"seveneighths"},
+ {0x2190,"arrowleft"},{0x2191,"arrowup"},{0x2192,"arrowright"},{0x2193,"arrowdown"},
+ {0x2194,"arrowboth"},{0x2195,"arrowupdn"},{0x21A8,"arrowupdnbse"},{0x21B5,"carriagereturn"},
+ {0x21D0,"arrowdblleft"},{0x21D1,"arrowdblup"},{0x21D2,"arrowdblright"},{0x21D3,"arrowdbldown"},
+ {0x21D4,"arrowdblboth"},{0x2200,"universal"},{0x2202,"partialdiff"},{0x2203,"existential"},
+ {0x2205,"emptyset"},{0x2207,"gradient"},{0x2208,"element"},{0x2209,"notelement"},
+ {0x220B,"suchthat"},{0x220F,"product"},{0x2211,"summation"},{0x2212,"minus"},
+ {0x2217,"asteriskmath"},{0x221A,"radical"},{0x221D,"proportional"},{0x221E,"infinity"},
+ {0x221F,"orthogonal"},{0x2220,"angle"},{0x2227,"logicaland"},{0x2228,"logicalor"},
+ {0x2229,"intersection"},{0x222A,"union"},{0x222B,"integral"},{0x2234,"therefore"},
+ {0x223C,"similar"},{0x2245,"congruent"},{0x2248,"approxequal"},{0x2260,"notequal"},
+ {0x2261,"equivalence"},{0x2264,"lessequal"},{0x2265,"greaterequal"},{0x2282,"propersubset"},
+ {0x2283,"propersuperset"},{0x2284,"notsubset"},{0x2286,"reflexsubset"},{0x2287,"reflexsuperset"},
+ {0x2295,"circleplus"},{0x2297,"circlemultiply"},{0x22A5,"perpendicular"},{0x22C5,"dotmath"},
+ {0x2302,"house"},{0x2310,"revlogicalnot"},{0x2320,"integraltp"},{0x2321,"integralbt"},
+ {0x2329,"angleleft"},{0x232A,"angleright"},{0x2500,"SF100000"},{0x2502,"SF110000"},
+ {0x250C,"SF010000"},{0x2510,"SF030000"},{0x2514,"SF020000"},{0x2518,"SF040000"},
+ {0x251C,"SF080000"},{0x2524,"SF090000"},{0x252C,"SF060000"},{0x2534,"SF070000"},
+ {0x253C,"SF050000"},{0x2550,"SF430000"},{0x2551,"SF240000"},{0x2552,"SF510000"},
+ {0x2553,"SF520000"},{0x2554,"SF390000"},{0x2555,"SF220000"},{0x2556,"SF210000"},
+ {0x2557,"SF250000"},{0x2558,"SF500000"},{0x2559,"SF490000"},{0x255A,"SF380000"},
+ {0x255B,"SF280000"},{0x255C,"SF270000"},{0x255D,"SF260000"},{0x255E,"SF360000"},
+ {0x255F,"SF370000"},{0x2560,"SF420000"},{0x2561,"SF190000"},{0x2562,"SF200000"},
+ {0x2563,"SF230000"},{0x2564,"SF470000"},{0x2565,"SF480000"},{0x2566,"SF410000"},
+ {0x2567,"SF450000"},{0x2568,"SF460000"},{0x2569,"SF400000"},{0x256A,"SF540000"},
+ {0x256B,"SF530000"},{0x256C,"SF440000"},{0x2580,"upblock"},{0x2584,"dnblock"},
+ {0x2588,"block"},{0x258C,"lfblock"},{0x2590,"rtblock"},{0x2591,"ltshade"},
+ {0x2592,"shade"},{0x2593,"dkshade"},{0x25A0,"filledbox"},{0x25A1,"H22073"},
+ {0x25AA,"H18543"},{0x25AB,"H18551"},{0x25AC,"filledrect"},{0x25B2,"triagup"},
+ {0x25BA,"triagrt"},{0x25BC,"triagdn"},{0x25C4,"triaglf"},{0x25CA,"lozenge"},
+ {0x25CB,"circle"},{0x25CF,"H18533"},{0x25D8,"invbullet"},{0x25D9,"invcircle"},
+ {0x25E6,"openbullet"},{0x263A,"smileface"},{0x263B,"invsmileface"},{0x263C,"sun"},
+ {0x2640,"female"},{0x2642,"male"},{0x2660,"spade"},{0x2663,"club"},
+ {0x2665,"heart"},{0x2666,"diamond"},{0x266A,"musicalnote"},{0x266B,"musicalnotedbl"}};
+
+static int agl_cmp(const void *a,const void *b)
+{
+ const unsigned short aa=((struct agl_lt *)a)->uid,bb=((struct agl_lt *)b)->uid;
+ if (aa<bb) {
+ return -1;
+ } else if (aa>bb) {
+ return 1;
+ }
+ return 0;
+}
+
+const char *aglfn13(unsigned short uni)
+{
+ if ( (uni>=0x0020)&&(uni<0x007f) ) {
+ return agl_l207e[uni-0x0020];
+ } else if ( (uni>=0x00a1)&&(uni<=0x00ff) ) {
+ return agl_la1ff[uni-0x00a1];
+ } else if ( (uni>=0x0100)&&(uni<=0x017f) ) {
+ return agl_l1007f[uni-0x0100];
+ } else if (uni>=0x0180) {
+ struct agl_lt key,*res;
+ key.uid=uni;
+ res=bsearch(&key,agl_lxx,(sizeof(agl_lxx)/sizeof(struct agl_lt)),sizeof(struct agl_lt),agl_cmp);
+ if (res) {
+ return res->name;
+ }
+ }
+ return NULL;
+}
+#else
+const char *aglfn13(unsigned short uni)
+{
+ return NULL;
+}
+#endif
--- /dev/null
+#ifndef _BITSET_H
+#define _BITSET_H
+
+#include <stdlib.h>
+
+typedef int * BITSET;
+
+static inline void bit_set(BITSET bs,int num)
+{
+ bs[num/(8*sizeof(int))]|=1<<(num%(8*sizeof(int)));
+}
+
+static inline int bit_check(BITSET bs,int num)
+{
+ return bs[num/(8*sizeof(int))]&1<<(num%(8*sizeof(int)));
+}
+
+// use free() when done. returns NULL on bad_alloc
+static inline BITSET bitset_new(int size)
+{
+ return (BITSET)calloc(1,((size+8*sizeof(int)-1)&~(8*sizeof(int)-1))/8);
+}
+
+static inline int bits_used(BITSET bits,int size) // {{{ returns true if any bit is used
+{
+ size=(size+8*sizeof(int)-1)/(8*sizeof(int));
+ while (size>0) {
+ if (*bits) {
+ return 1;
+ }
+ bits++;
+ size--;
+ }
+ return 0;
+}
+// }}}
+
+#endif
--- /dev/null
+#include "dynstring.h"
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+int dyn_init(DYN_STRING *ds,int reserve_size) // {{{
+{
+ assert(ds);
+ assert(reserve_size>0);
+
+ ds->len=0;
+ ds->alloc=reserve_size;
+ ds->buf=malloc(ds->alloc+1);
+ if (!ds->buf) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ ds->len=-1;
+ return -1;
+ }
+ return 0;
+}
+// }}}
+
+void dyn_free(DYN_STRING *ds) // {{{
+{
+ assert(ds);
+
+ ds->len=-1;
+ ds->alloc=0;
+ free(ds->buf);
+ ds->buf=NULL;
+}
+// }}}
+
+int dyn_ensure(DYN_STRING *ds,int free_space) // {{{
+{
+ assert(ds);
+ assert(free_space);
+
+ if (ds->len<0) {
+ return -1;
+ }
+ if (ds->alloc - ds->len >= free_space) {
+ return 0; // done
+ }
+ ds->alloc+=free_space;
+ char *tmp=realloc(ds->buf,ds->alloc+1);
+ if (!tmp) {
+ ds->len=-1;
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ return -1;
+ }
+ ds->buf=tmp;
+ return 0;
+}
+// }}}
+
+int dyn_vprintf(DYN_STRING *ds,const char *fmt,va_list ap) // {{{
+{
+ assert(ds);
+
+ int need,len=strlen(fmt)+100;
+ va_list va;
+
+ if (dyn_ensure(ds,len)==-1) {
+ return -1;
+ }
+
+ while (1) {
+ va_copy(va,ap);
+ need=vsnprintf(ds->buf+ds->len,ds->alloc-ds->len+1,fmt,va);
+ va_end(va);
+ if (need==-1) {
+ len+=100;
+ } else if (need>=len) {
+ len=need;
+ } else {
+ ds->len+=need;
+ break;
+ }
+ if (dyn_ensure(ds,len)==-1) {
+ return -1;
+ }
+ }
+ return 0;
+}
+// }}}
+
+int dyn_printf(DYN_STRING *ds,const char *fmt,...) // {{{
+{
+ va_list va;
+ int ret;
+
+ va_start(va,fmt);
+ ret=dyn_vprintf(ds,fmt,va);
+ va_end(va);
+
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef _DYNSTRING_H
+#define _DYNSTRING_H
+
+typedef struct {
+ int len,alloc;
+ char *buf;
+} DYN_STRING;
+
+int dyn_init(DYN_STRING *ds,int reserve_size); // -1 on error
+void dyn_free(DYN_STRING *ds);
+int dyn_ensure(DYN_STRING *ds,int free_space);
+int dyn_printf(DYN_STRING *ds,const char *fmt,...); // appends
+
+#endif
+
--- /dev/null
+#include "embed.h"
+#include "embed_sfnt_int.h"
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static inline int copy_file(FILE *f,OUTPUT_FN output,void *context) // {{{
+{
+ assert(f);
+ assert(output);
+
+ char buf[4096];
+ int iA,ret=0;
+
+ ret=0;
+ rewind(f);
+ do {
+ iA=fread(buf,1,4096,f);
+ (*output)(buf,iA,context);
+ ret+=iA;
+ } while (iA>0);
+ return ret;
+}
+// }}}
+
+/* certain profiles: (=> constraints to be auto-applied in emb_new via >dest)
+ PSold: T1->T1, TTF->T1, OTF->CFF->T1, STD->STD // output limit: T1 (maybe length, binary/text, ... limit)
+ PS1: T1->T1, TTF->T1, OTF->CFF, STD->STD // output limit: T1,CFF [does this really exists?]
+ PS2: T1->T1, TTF->TTF, OTF->T1, STD->STD // output limit: T1,TTF
+ PS3: T1->T1, TTF->TTF, OTF->CFF, STD->STD
+ PDF12/13?: OTF->CFF
+ PDF16: OTF->OTF (,T1->CFF?)
+ --- rename KEEP_T1 to NEED_T1? NO_T42?
+
+ converters:
+ OTF->CFF, CFF->OTF (extract metrics, etc)
+ (T1->CFF, CFF->T1)
+ ((TTF->T1 ['good'; T1->TTF: not good]))
+ [subsetTTF,subsetCFF,subsetT1]
+
+ output modes:
+ subset,CID(multibyte),(PS:)text/binary,(PS:)incremental
+
+ TODO: remove dest from emb_new, replace with EMB_ACTIONS constraints:
+ - bitfield mask which ACTIONS are allowed. (problem: we want to force certain ones, e.g. MULTIBYTE)
+ - e.g. currently EMB_C_PDF_OT has to functions
+ - the only (other) 'difference' to now is the subsetting spec
+ - another issue is, that emb_pdf_ might want some pdf version informatino (->extra flag?)
+ and funtion to determine appropriate mask for certain destination
+ EMB_ACTIONS emb_mask_for_dest(EMB_DESTINATION)
+ TODO? determine viability before trying emb_embed
+ (idea: use emb_embed(,NULL) -> will just return true/false [same codepath!])
+
+ TODO?! "always subset CJK"
+*/
+
+EMB_PARAMS *emb_new(FONTFILE *font,EMB_DESTINATION dest,EMB_CONSTRAINTS mode) // {{{
+{
+ assert(font);
+
+ EMB_PARAMS *ret=calloc(1,sizeof(EMB_PARAMS));
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ if (mode&EMB_C_TAKE_FONTFILE) {
+ fontfile_close(font);
+ }
+ return NULL;
+ }
+ ret->dest=dest;
+ ret->font=font;
+ if (mode&EMB_C_TAKE_FONTFILE) {
+ ret->plan|=EMB_A_CLOSE_FONTFILE;
+ }
+
+ // check parameters
+ if ( (mode&EMB_C_KEEP_T1)&&(mode&EMB_C_FORCE_MULTIBYTE) ) {
+ fprintf(stderr,"Incompatible mode: KEEP_T1 and FORCE_MULTIBYTE\n");
+ emb_close(ret);
+ return NULL;
+ }
+ if ((mode&0x07)>5) {
+ fprintf(stderr,"Bad subset specification\n");
+ emb_close(ret);
+ return NULL;
+ }
+
+ // determine intype
+ int numGlyphs=0;
+ if (font->sfnt) {
+ if (font->sfnt->flags&OTF_F_FMT_CFF) {
+ ret->intype=EMB_FMT_OTF;
+ } else {
+ ret->intype=EMB_FMT_TTF;
+ }
+ ret->rights=emb_otf_get_rights(ret->font->sfnt);
+ numGlyphs=ret->font->sfnt->numGlyphs; // TODO
+ } else if (font->stdname) {
+ ret->intype=EMB_FMT_STDFONT;
+ ret->rights=EMB_RIGHT_NONE;
+ } else {
+ assert(0);
+ }
+/*
+ if ( (ret->intype==EMB_FMT_CFF)&&
+ (ret->cffFont.is_cid()) ) {
+ ?= || ( (ret->intype==EMB_FMT_OTF)&&(ret->sfnt->cffFont.is_cid()) ) // TODO?
+ ret->plan|=EMB_A_MULTIBYTE;
+ }
+*/
+
+ // determine outtype
+ if (ret->intype==EMB_FMT_STDFONT) {
+ ret->outtype=ret->intype;
+ if (mode&EMB_C_FORCE_MULTIBYTE) {
+ fprintf(stderr,"Multibyte stdfonts are not possible\n");
+ emb_close(ret);
+ return NULL;
+ }
+ return ret; // never subset, no multibyte
+ } else if (ret->intype==EMB_FMT_T1) {
+ if (mode&EMB_C_KEEP_T1) {
+ ret->outtype=EMB_FMT_T1;
+ } else {
+ ret->plan|=EMB_A_T1_TO_CFF;
+ ret->outtype=EMB_FMT_CFF;
+ }
+ } else {
+ ret->outtype=ret->intype;
+ }
+ if (ret->outtype==EMB_FMT_CFF) {
+ if (mode&EMB_C_PDF_OT) {
+ ret->outtype=EMB_FMT_OTF;
+ ret->plan|=EMB_A_CFF_TO_OTF;
+ }
+ } else if (ret->outtype==EMB_FMT_OTF) {
+ // TODO: no support yet; but we want to get the FontDescriptor/Name right
+ mode|=EMB_C_NEVER_SUBSET;
+ if (!(mode&EMB_C_PDF_OT)) { // TODO!?!
+ ret->outtype=EMB_FMT_CFF;
+ ret->plan|=EMB_A_OTF_TO_CFF;
+ }
+ }
+
+ if (mode&EMB_C_FORCE_MULTIBYTE) {
+ ret->plan|=EMB_A_MULTIBYTE;
+ }
+
+ // check rights (for subsetting)
+ if ( (ret->rights&EMB_RIGHT_NONE)||
+ (ret->rights&EMB_RIGHT_BITMAPONLY)||
+ ( (ret->rights&EMB_RIGHT_READONLY)&&(mode&EMB_C_EDITABLE_SUBSET) )||
+ ( (ret->rights&EMB_RIGHT_NO_SUBSET)&&(mode&EMB_C_MUST_SUBSET) ) ) {
+ fprintf(stderr,"The font does not permit the requested embedding\n");
+ emb_close(ret);
+ return NULL;
+ } else if ( (!(ret->rights&EMB_RIGHT_NO_SUBSET))&&
+ (!(mode&EMB_C_NEVER_SUBSET)) ) {
+ ret->plan|=EMB_A_SUBSET;
+ }
+
+ // alloc subset
+ if (ret->plan&EMB_A_SUBSET) {
+ ret->subset=bitset_new(numGlyphs);
+ if (!ret->subset) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ emb_close(ret);
+ return NULL;
+ }
+ }
+
+ return ret;
+}
+// }}}
+
+int emb_embed(EMB_PARAMS *emb,OUTPUT_FN output,void *context) // {{{
+{
+ assert(emb);
+
+ if (emb->dest==EMB_DEST_NATIVE) {
+ } else if (emb->dest<=EMB_DEST_PS) {
+ int ret=-2;
+ const char *fontname=emb_otf_get_fontname(emb->font->sfnt); // TODO!!
+ (*output)("%%BeginFont: ",13,context);
+ (*output)(fontname,strlen(fontname),context);
+ (*output)("\n",1,context);
+ if (emb->outtype==EMB_FMT_T1) {
+ } else if (emb->outtype==EMB_FMT_TTF) { // emb->outtype==EMB_OUTPUT_OTF is stupid (?)
+ // do Type42
+ ret=emb_otf_ps(emb->font->sfnt,NULL,256,NULL,output,context); // TODO?
+ } else if (emb->outtype==EMB_FMT_CFF) {
+ } else if (emb->outtype==EMB_FMT_STDFONT) {
+ }
+ if (ret!=-2) {
+ if (ret!=-1) {
+ (*output)("%%EndFont\n",10,context);
+ } else {
+ fprintf(stderr,"Failed\n");
+ }
+ return ret;
+ }
+ } else if (emb->dest<=EMB_DEST_PDF16) {
+ if (emb->outtype==EMB_FMT_TTF) {
+ assert(emb->font->sfnt);
+ if (emb->plan&EMB_A_SUBSET) {
+ return otf_subset(emb->font->sfnt,emb->subset,output,context);
+ } else if (emb->font->sfnt->numTTC) { //
+ return otf_ttc_extract(emb->font->sfnt,output,context);
+ } else { // copy verbatim
+ return copy_file(emb->font->sfnt->f,output,context);
+ }
+ } else if (emb->outtype==EMB_FMT_OTF) {
+ if (emb->plan&EMB_A_CFF_TO_OTF) {
+ if (emb->plan&EMB_A_T1_TO_CFF) {
+ // TODO
+ } else {
+ // assert(emb->font->cff);
+ // TODO
+ }
+ } else {
+ assert(emb->font->sfnt);
+ if (emb->plan&EMB_A_SUBSET) {
+ return otf_subset_cff(emb->font->sfnt,emb->subset,output,context);
+ } else {
+ return copy_file(emb->font->sfnt->f,output,context);
+ }
+ }
+ } else if (emb->outtype==EMB_FMT_CFF) {
+ if (emb->plan&EMB_A_OTF_TO_CFF) {
+ assert(emb->font->sfnt);
+ if (emb->plan&EMB_A_SUBSET) {
+ // TODO
+ } else {
+ return otf_cff_extract(emb->font->sfnt,output,context);
+ }
+ } else {
+ // TODO
+ }
+ }
+ }
+
+ fprintf(stderr,"NOT IMPLEMENTED\n");
+ assert(0);
+ return -1;
+}
+// }}}
+
+void emb_close(EMB_PARAMS *emb) // {{{
+{
+ if (emb) {
+ free(emb->subset);
+ if (emb->plan&EMB_A_CLOSE_FONTFILE) {
+ fontfile_close(emb->font);
+ }
+ free(emb);
+ }
+}
+// }}}
+
--- /dev/null
+#ifndef EMBED_H
+#define EMBED_H
+
+#include "bitset.h"
+#include "fontfile.h"
+#include "iofn.h"
+
+typedef enum { EMB_FMT_T1, // type1, with AFM/PFM,PFA/PFB
+ EMB_FMT_TTF, // sfnt, for TTF(glyf)
+ EMB_FMT_OTF, // sfnt+cff, for OTF(cff)
+ EMB_FMT_CFF, // cff, for raw CFF
+ EMB_FMT_STDFONT // don't embed (already present)
+ } EMB_FORMAT;
+typedef enum { EMB_DEST_NATIVE, // just subsetting/conversion
+ EMB_DEST_PS,
+// EMB_DEST_PS2,
+// EMB_DEST_PDF13,
+ EMB_DEST_PDF16
+ } EMB_DESTINATION;
+
+typedef enum { EMB_RIGHT_FULL=0, EMB_RIGHT_NONE=0x02,
+ EMB_RIGHT_READONLY=0x04,
+ EMB_RIGHT_NO_SUBSET=0x0100,
+ EMB_RIGHT_BITMAPONLY=0x0200 } EMB_RIGHT_TYPE;
+
+typedef enum { EMB_A_MULTIBYTE=0x01, // embedd as multibyte font?
+ EMB_A_SUBSET=0x02, // do subsetting?
+ EMB_A_T1_TO_CFF=0x04, // convert Type1 to CFF?
+ EMB_A_CFF_TO_OTF=0x08, // wrap CFF(from input or T1+CONVERT_CFF) in sfnt? (OTF)
+ EMB_A_OTF_TO_CFF=0x10, // unwrap CFF
+
+ EMB_A_CLOSE_FONTFILE=0x8000
+ } EMB_ACTIONS;
+
+typedef enum { EMB_C_MUST_SUBSET=0x01, // (fail, when not possible)
+ EMB_C_EDITABLE_SUBSET=0x02, // (...)
+ EMB_C_NEVER_SUBSET=0x04, // (...)
+
+ EMB_C_FORCE_MULTIBYTE=0x08, // always use multibyte fonts
+
+ EMB_C_PDF_OT=0x10, // output TTF/OTF (esp. CFF to OTF)
+ EMB_C_KEEP_T1=0x20, // don't convert T1 to CFF
+
+ EMB_C_TAKE_FONTFILE=0x8000 // take ownership of fontfile
+ } EMB_CONSTRAINTS;
+
+typedef struct _EMB_PARAMS {
+ EMB_FORMAT intype;
+ EMB_FORMAT outtype;
+ EMB_DESTINATION dest;
+
+ EMB_ACTIONS plan;
+
+ // font infos
+ FONTFILE *font;
+ EMB_RIGHT_TYPE rights;
+// public:
+ BITSET subset;
+
+} EMB_PARAMS;
+
+EMB_PARAMS *emb_new(FONTFILE *font,EMB_DESTINATION dest,EMB_CONSTRAINTS mode);
+// emb_embedd does only the "binary" part
+int emb_embed(EMB_PARAMS *emb,OUTPUT_FN output,void *context); // returns number of bytes written
+void emb_close(EMB_PARAMS *emb);
+
+// TODO: encoding, TODO: ToUnicode
+static inline void emb_set(EMB_PARAMS *emb,int unicode,unsigned short gid) // {{{
+{
+ if (emb->subset) {
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ bit_set(emb->subset,gid);
+ // ToUnicode.add(gid,unicode);
+ } else {
+ // TODO ... encoding
+ }
+ }
+}
+// }}}
+
+// TODO: encoding?, TODO: non-sfnt
+static inline unsigned short emb_get(EMB_PARAMS *emb,int unicode) // {{{ gid
+{
+ const unsigned short gid=otf_from_unicode(emb->font->sfnt,unicode);
+ emb_set(emb,unicode,gid);
+ return gid;
+}
+// }}}
+
+#include "embed_pdf.h"
+
+#endif
--- /dev/null
+#include "embed.h"
+#include "embed_pdf.h" // already included fron embed.h ...
+#include "embed_pdf_int.h"
+#include "embed_sfnt_int.h"
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include "frequent.h"
+
+// NOTE: these must be in sync with the EMB_FORMAT enum
+static const char *emb_pdf_font_subtype[][2]={ // {{{ (output_format,multibyte)
+ {"Type1",NULL},
+ {"TrueType","CIDFontType2"},
+ {"Type1","CIDFontType0"},
+ {"Type1","CIDFontType0"},
+ {"Type1",NULL}};
+// }}}
+
+static const char *emb_pdf_fontfile_key[]={ // {{{ (output_format)
+ "FontFile","FontFile2","FontFile3","FontFile3",NULL};
+// }}}
+
+// ... PDF1.6 here
+static const char *emb_pdf_fontfile_subtype[][2]={ // {{{ (output_format,multibyte)
+ {NULL,NULL},
+ {NULL,NULL},
+ {"OpenType","OpenType"},
+ {"Type1C","CIDFontType0C"},
+ {NULL,NULL}};
+// }}}
+
+static inline int emb_multibyte(EMB_PARAMS *emb) // {{{
+{
+ return (emb->plan&EMB_A_MULTIBYTE)?1:0;
+}
+// }}}
+
+static const char *emb_pdf_escape_name(const char *name,int len) // {{{ // - statically allocated buffer
+{
+ assert(name);
+ if (len==-1) {
+ len=strlen(name);
+ }
+ assert(len<=127); // pdf implementation limit
+
+ static char buf[128*3];
+ int iA,iB;
+ const char hex[]="0123456789abcdef";
+
+ for (iA=0,iB=0;iA<len;iA++,iB++) {
+ if ( ((unsigned char)name[iA]<33)||((unsigned char)name[iA]>126)||
+ (strchr("#()<>[]{}/%",name[iA])) ) {
+ buf[iB]='#';
+ buf[++iB]=hex[(name[iA]>>4)&0x0f];
+ buf[++iB]=hex[name[iA]&0xf];
+ } else {
+ buf[iB]=name[iA];
+ }
+ }
+ buf[iB]=0;
+ return buf;
+}
+// }}}
+
+// this is in the font dict
+const char *emb_pdf_get_font_subtype(EMB_PARAMS *emb) // {{{
+{
+ assert(emb);
+ return emb_pdf_font_subtype[emb->outtype][emb_multibyte(emb)];
+}
+// }}}
+
+// in font descriptor
+const char *emb_pdf_get_fontfile_key(EMB_PARAMS *emb) // {{{
+{
+ assert(emb);
+ return emb_pdf_fontfile_key[emb->outtype];
+}
+// }}}
+
+// this is what to put in the font-stream dict
+const char *emb_pdf_get_fontfile_subtype(EMB_PARAMS *emb) // {{{
+{
+ assert(emb);
+ return emb_pdf_fontfile_subtype[emb->outtype][emb_multibyte(emb)];
+}
+// }}}
+
+// {{{ static EMB_PDF_FONTDESCR *emb_pdf_fd_new(fontname,subset_tag,cid_registry,cid_ordering,cid_supplement,panose)
+static EMB_PDF_FONTDESCR *emb_pdf_fd_new(const char *fontname,
+ const char *subset_tag,
+ const char *cid_registry, // or supplement==-1
+ const char *cid_ordering, // or supplement==-1
+ int cid_supplement) // -1 for non-cid
+{
+ assert(fontname);
+ EMB_PDF_FONTDESCR *ret;
+
+ int len=sizeof(EMB_PDF_FONTDESCR);
+ if (subset_tag) {
+ assert(strlen(subset_tag)==6);
+ len+=7;
+ }
+ len+=strlen(fontname)+1;
+ if (cid_supplement>=0) { // cid font
+ len+=12; // space for panose
+ assert(cid_registry);
+ assert(cid_ordering);
+ len+=strlen(cid_registry)+1;
+ len+=strlen(cid_ordering)+1;
+ }
+ ret=calloc(1,len);
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ return NULL;
+ }
+
+ // now fill the struct
+ len=0;
+ if (cid_supplement>=0) { // free space for panose is at beginning
+ len+=12;
+ }
+ ret->fontname=ret->data+len;
+ len+=strlen(fontname)+1;
+ if (subset_tag) {
+ strncpy(ret->fontname,subset_tag,6);
+ ret->fontname[6]='+';
+ strcpy(ret->fontname+7,fontname);
+ len+=7;
+ } else {
+ strcpy(ret->fontname,fontname);
+ }
+ ret->italicAngle=90;
+ if (cid_supplement>=0) {
+ ret->registry=ret->data+len;
+ strcpy(ret->registry,cid_registry);
+ len+=strlen(cid_registry)+1;
+
+ ret->ordering=ret->data+len;
+ strcpy(ret->ordering,cid_ordering);
+ len+=strlen(cid_registry)+1;
+ }
+ ret->supplement=cid_supplement;
+
+ return ret;
+}
+// }}}
+
+EMB_PDF_FONTDESCR *emb_pdf_fontdescr(EMB_PARAMS *emb) // {{{ - to be freed by user
+{
+ assert(emb);
+
+ const char *subset_tag=NULL;
+ // {{{ generate pdf subtag
+ static unsigned int rands=0;
+ if (!rands) {
+ rands=time(NULL);
+ }
+
+ char subtag[7];
+ subtag[6]=0;
+ if (emb->plan&EMB_A_SUBSET) {
+ int iA;
+ for (iA=0;iA<6;iA++) {
+ const int x=(int)(26.0*(rand_r(&rands)/(RAND_MAX+1.0)));
+ subtag[iA]='A'+x;
+ }
+ subset_tag=subtag;
+ }
+ // }}}
+
+ const char *fontname=NULL;
+ if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) { // TODO? use fontinfo from CFF when outtype==CFT, etc.?
+ assert(emb->font->sfnt);
+ fontname=emb_otf_get_fontname(emb->font->sfnt);
+ } else if (emb->outtype==EMB_FMT_STDFONT) {
+ return NULL;
+ } else {
+ fprintf(stderr,"NOT IMPLEMENTED\n");
+ assert(0);
+ return NULL;
+ }
+
+ EMB_PDF_FONTDESCR *ret;
+ if (emb->plan&EMB_A_MULTIBYTE) { // multibyte
+ ret=emb_pdf_fd_new(fontname,subset_tag,"Adobe","Identity",0); // TODO other /ROS ?
+ } else {
+ ret=emb_pdf_fd_new(fontname,subset_tag,NULL,NULL,-1);
+ }
+ if (!ret) {
+ return NULL;
+ }
+
+ if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) {
+ emb_otf_get_pdf_fontdescr(emb->font->sfnt,ret);
+ } else {
+ assert(0);
+ }
+ return ret;
+}
+// }}}
+
+EMB_PDF_FONTWIDTHS *emb_pdf_fw_new(int datasize) // {{{
+{
+ assert(datasize>=0);
+ EMB_PDF_FONTWIDTHS *ret=calloc(1,sizeof(EMB_PDF_FONTWIDTHS)+datasize*sizeof(int));
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ return NULL;
+ }
+ return ret;
+}
+// }}}
+
+// if default_width==-1: default_width will be estimated
+EMB_PDF_FONTWIDTHS *emb_pdf_fw_cidwidths(const BITSET glyphs,int len,int default_width,int (*getGlyphWidth)(void *context,int gid),void *context) // {{{ glyphs==NULL -> output all
+{
+ assert(getGlyphWidth);
+
+ FREQUENT *freq=NULL;
+ if (default_width<0) {
+ freq=frequent_new(3);
+ }
+
+ int iA,b,c;
+ int size=0,in_region=0; // current number of elements in after region start
+
+ // first pass: find continuous regions, calculate needed size, estimate dw
+ for (iA=0,b=0,c=1;iA<len;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+ if ( (!glyphs)||(glyphs[b]&c) ) {
+ if (freq) {
+ const int w=(*getGlyphWidth)(context,iA);
+ frequent_add(freq,w);
+ }
+ if (in_region) {
+ in_region++;
+ } else { // start new region
+ size+=2; // len c
+ in_region=1;
+ }
+ } else { // region end
+ size+=in_region;
+ in_region=0;
+ }
+ }
+ size+=in_region;
+
+ if (freq) {
+ default_width=frequent_get(freq,0);
+ free(freq);
+ }
+ assert(default_width>0);
+
+ // now create the array
+ EMB_PDF_FONTWIDTHS *ret=emb_pdf_fw_new(size+1);
+ if (!ret) {
+ return NULL;
+ }
+ ret->default_width=default_width;
+ ret->warray=ret->data;
+
+ // second pass
+ in_region=0;
+ size=0;
+ int *rlen=0; // position of current len field (only valid if in_region!=0)
+ for (iA=0,b=0,c=1;iA<len;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+ if ( (!glyphs)||(glyphs[b]&c) ) {
+ const int w=(*getGlyphWidth)(context,iA);
+ if (in_region>0) { // in array region
+ if ( (w==default_width)&&(ret->warray[size-1]==default_width) ) { // omit this and prev entry
+ size--;
+ *rlen=in_region-1; // !=0, as it does not start with >default_width
+ in_region=0; // end region, immediate restart will take just the same amount of space
+ } else if ( (in_region>=4)&&
+ (ret->warray[size-1]==w)&&(ret->warray[size-2]==w)&&
+ (ret->warray[size-3]==w)&&(ret->warray[size-4]==w) ) {
+ // five in a row. c1 c2 w [l c] is equally short and can be extended (-len c1 w) [w/ cost of array-region restart]
+ if (in_region==4) { // completely replace
+ size-=6;
+ } else { // first end previous region
+ size-=4;
+ *rlen=in_region-4;
+ }
+ in_region=-4; // start range region instead
+ rlen=&ret->warray[size++];
+ ret->warray[size++]=iA-4;
+ ret->warray[size++]=w;
+ } else { // just add
+ in_region++;
+ ret->warray[size++]=w;
+ }
+ continue;
+ } else if (in_region<0) { // in range region
+ if (ret->warray[size-1]==w) {
+ in_region--; // just add
+ continue;
+ }
+ *rlen=in_region; // end
+ in_region=0;
+ }
+ if (w!=default_width) { // start new array region
+ in_region=1;
+ rlen=&ret->warray[size++];
+ ret->warray[size++]=iA; // c
+ ret->warray[size++]=w;
+ }
+ } else if (in_region) {
+ // TODO? no need to stop range region? } else if (in_region<0) { inregion--; }
+ *rlen=in_region;
+ in_region=0;
+ }
+ }
+ if (in_region) {
+ *rlen=in_region;
+ }
+ ret->warray[size]=0; // terminator
+ return ret;
+}
+// }}}
+
+// TODO: encoding into EMB_PARAMS (emb_new_enc(...,encoding,len ,to_unicode));
+// -> will then change interpretation of BITSET...(?really?); can we allow dynamic encoding map generation?
+// -> encoding has a "len"; len<256
+EMB_PDF_FONTWIDTHS *emb_pdf_fontwidths(EMB_PARAMS *emb) // {{{
+{
+ assert(emb);
+
+ if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) {
+ assert(emb->font->sfnt);
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ return emb_otf_get_pdf_cidwidths(emb->font->sfnt,emb->subset);
+ } else {
+ return emb_otf_get_pdf_widths(emb->font->sfnt,/*encoding*/NULL,emb->font->sfnt->numGlyphs,emb->subset); // TODO: encoding
+ }
+ } else {
+ fprintf(stderr,"NOT IMPLEMENTED\n");
+ assert(0);
+ return NULL;
+ }
+}
+// }}}
+
+/*** PDF out stuff ***/
+#include "dynstring.h"
+
+#define NEXT /* {{{ */ \
+ if ( (len<0)||(len>=size) ) { \
+ assert(0); \
+ free(ret); \
+ return NULL; \
+ } \
+ pos+=len; \
+ size-=len; /* }}} */
+
+// TODO? /CIDSet TODO... /FontFamily /FontStretch /FontWeight (PDF1.5?) would be nice...
+char *emb_pdf_simple_fontdescr(EMB_PARAMS *emb,EMB_PDF_FONTDESCR *fdes,int fontfile_obj_ref) // {{{ - to be freed by user
+{
+ assert(emb);
+ assert(fdes);
+
+ char *ret=NULL,*pos;
+ int len,size;
+
+ size=300;
+ pos=ret=malloc(size);
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ len=snprintf(pos,size,
+ "<</Type /FontDescriptor\n"
+ " /FontName /%s\n" // TODO? handle quoting in struct?
+ " /Flags %d\n"
+ " /ItalicAngle %d\n",
+ emb_pdf_escape_name(fdes->fontname,-1),
+ fdes->flags,
+ fdes->italicAngle);
+ NEXT;
+
+ if (1) { // TODO type!=EMB_PDF_TYPE3
+ len=snprintf(pos,size,
+ " /FontBBox [%d %d %d %d]\n"
+ " /Ascent %d\n"
+ " /Descent %d\n"
+ " /CapHeight %d\n" // if font has Latin chars
+ " /StemV %d\n",
+ fdes->bbxmin,fdes->bbymin,fdes->bbxmax,fdes->bbymax,
+ fdes->ascent,
+ fdes->descent,
+ fdes->capHeight,
+ fdes->stemV);
+ NEXT;
+ }
+ if (fdes->xHeight) {
+ len=snprintf(pos,size," /XHeight %d\n",fdes->xHeight);
+ NEXT;
+ }
+ if (fdes->avgWidth) {
+ len=snprintf(pos,size," /AvgWidth %d\n",fdes->avgWidth);
+ NEXT;
+ }
+ if (fdes->panose) {
+ int iA;
+ len=snprintf(pos,size," /Style << /Panose <");
+ NEXT;
+ if (size<30) {
+ assert(0);
+ free(ret);
+ return NULL;
+ }
+ for (iA=0;iA<12;iA++) {
+ snprintf(pos+iA*2,size-iA*2,"%02x",fdes->panose[iA]);
+ }
+ size-=24;
+ pos+=24;
+ len=snprintf(pos,size,"> >>\n");
+ NEXT;
+ }
+ // TODO (for Type0)? CIDSet -> simply our glyphs BITSET (ok. endianess?)
+ len=snprintf(pos,size,
+ " /%s %d 0 R\n"
+ ">>\n",
+ emb_pdf_get_fontfile_key(emb),
+ fontfile_obj_ref);
+ NEXT;
+
+ return ret;
+}
+// }}}
+
+char *emb_pdf_simple_font(EMB_PARAMS *emb,EMB_PDF_FONTDESCR *fdes,EMB_PDF_FONTWIDTHS *fwid,int fontdescr_obj_ref) // {{{ - to be freed by user
+{
+ assert(emb);
+ assert(fdes);
+ assert(fwid);
+
+ int iA,iB;
+ DYN_STRING ret;
+
+ if (dyn_init(&ret,500)==-1) {
+ return NULL;
+ }
+
+ dyn_printf(&ret,"<</Type /Font\n"
+ " /Subtype /%s\n"
+ " /BaseFont /%s\n"
+ " /FontDescriptor %d 0 R\n",
+ emb_pdf_get_font_subtype(emb),
+ emb_pdf_escape_name(fdes->fontname,-1),
+ fontdescr_obj_ref);
+
+ if (emb->plan&EMB_A_MULTIBYTE) { // multibyte
+ assert(fwid->warray);
+ dyn_printf(&ret," /CIDSystemInfo <<\n"
+ " /Registry (%s)\n"
+ " /Ordering (%s)\n"
+ " /Supplement %d\n"
+ " >>\n"
+ " /DW %d\n",
+// " /CIDToGIDMap /Id...\n" // TrueType only, default /Identity [optional? which PDF version says what?]
+ fdes->registry,
+ fdes->ordering,
+ fdes->supplement,
+ fwid->default_width);
+
+ if (fwid->warray[0]) {
+ dyn_printf(&ret," /W [");
+ for (iA=0;fwid->warray[iA];) {
+ if (fwid->warray[iA]<0) { // c1 (c1-len) w
+ dyn_printf(&ret," %d %d %d",
+ fwid->warray[iA+1],
+ fwid->warray[iA+1]-fwid->warray[iA],
+ fwid->warray[iA+2]);
+ iA+=3;
+ } else { // c [w ... w]
+ iB=fwid->warray[iA++]; // len
+ dyn_printf(&ret," %d [",fwid->warray[iA++]); // c
+ for (;iB>0;iB--) {
+ dyn_printf(&ret," %d",fwid->warray[iA++]);
+ }
+ dyn_printf(&ret,"]");
+ }
+ }
+ dyn_printf(&ret,"]\n");
+ }
+ } else { // "not std14"
+ assert(fwid->widths);
+ dyn_printf(&ret,
+ " /Encoding /MacRomanEncoding\n" // optional; TODO!!!!!
+// " /ToUnicode ?\n" // optional
+ " /FirstChar %d\n"
+ " /LastChar %d\n"
+ " /Widths [",
+ fwid->first,
+ fwid->last);
+ for (iA=0,iB=fwid->first;iB<=fwid->last;iA++,iB++) {
+ dyn_printf(&ret," %d",fwid->widths[iA]);
+ }
+ dyn_printf(&ret,"]\n");
+ }
+ dyn_printf(&ret,">>\n");
+ if (ret.len==-1) {
+ dyn_free(&ret);
+ assert(0);
+ return NULL;
+ }
+
+ return ret.buf;
+}
+// }}}
+
+// TODO? + encoding as param? TODO + ToUnicode cmap => we need another struct EMB_PDF_FONTMAP
+// (TODO?? fontname here without subset-tag [_some_ pdfs out there seem to be that way])
+// TODO? don't do the CidType0 check here?
+// NOTE: this is _additionally_ to emb_pdf_simple_font()!
+char *emb_pdf_simple_cidfont(EMB_PARAMS *emb,const char *fontname,int descendant_obj_ref) // {{{ - to be freed by user
+{
+ assert(emb);
+ assert(fontname);
+
+ char *ret=NULL,*pos;
+ int len,size;
+
+ size=250;
+ pos=ret=malloc(size);
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return NULL;
+ }
+ // for CFF: one of:
+ // UniGB-UCS2-H, UniCNS-UCS2-H, UniJIS-UCS2-H, UniKS-UCS2-H
+ const char *encoding="Identity-H",*addenc="-";
+ if (emb->outtype==EMB_FMT_TTF) { // !=CidType0
+ addenc="";
+ }
+
+ len=snprintf(pos,size,
+ "<</Type /Font\n"
+ " /Subtype /Type0\n"
+ " /BaseFont /%s%s%s\n"
+ " /Encoding /%s\n"
+ " /DescendantFonts [%d 0 R]\n",
+// " /ToUnicode ?\n" // TODO
+ emb_pdf_escape_name(fontname,-1),
+ addenc,((addenc[0])?encoding:""),
+ encoding,
+ descendant_obj_ref);
+ NEXT;
+
+ len=snprintf(pos,size,">>\n");
+ NEXT;
+
+ return ret;
+}
+// }}}
+
+char *emb_pdf_simple_stdfont(EMB_PARAMS *emb) // {{{ - to be freed by user
+{
+ assert(emb);
+ assert(emb->font->stdname);
+
+ char *ret=NULL,*pos;
+ int len,size;
+
+ size=300;
+ pos=ret=malloc(size);
+ if (!ret) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ len=snprintf(pos,size,
+ "<</Type/Font\n"
+ " /Subtype /Type1\n"
+ " /BaseFont /%s\n"
+ ">>\n",
+// emb_pdf_get_font_subtype(emb),
+ emb->font->stdname);
+ NEXT;
+
+ return ret;
+}
+// }}}
+#undef NEXT
+
--- /dev/null
+#ifndef EMBED_PDF_H
+#define EMBED_PDF_H
+
+// all the necessary information for pdf font embedding
+typedef struct {
+ char *fontname;
+ unsigned int flags;
+
+ // for the following: 0=not set/invalid
+ int bbxmin,bbymin,bbxmax,bbymax;
+ int italicAngle; // >=90: not set/invalid
+ int ascent;
+ int descent;
+ int capHeight;
+ int stemV;
+ // optional, default=0:
+ int xHeight;
+ int avgWidth;
+
+ // CID-additions:
+ char *panose; // 12 bytes
+ char *registry,*ordering;
+ int supplement;
+
+ char data[]; // used for storing e.g. >fontname
+} EMB_PDF_FONTDESCR;
+
+typedef struct {
+ // normal font
+ int first,last;
+ int *widths;
+
+ // multibyte font
+ int default_width;
+ int *warray; // format: (len c w ... w)* if (len<0) { c1 (c2=c1+(-len)) w } else { c w[len] }, terminated by len==0
+
+ int data[];
+} EMB_PDF_FONTWIDTHS;
+
+const char *emb_pdf_get_font_subtype(EMB_PARAMS *emb);
+const char *emb_pdf_get_fontfile_key(EMB_PARAMS *emb);
+const char *emb_pdf_get_fontfile_subtype(EMB_PARAMS *emb);
+
+EMB_PDF_FONTDESCR *emb_pdf_fontdescr(EMB_PARAMS *emb);
+EMB_PDF_FONTWIDTHS *emb_pdf_fontwidths(EMB_PARAMS *emb);
+
+/** TODO elsewhere **/
+char *emb_pdf_simple_fontdescr(EMB_PARAMS *emb,EMB_PDF_FONTDESCR *fdes,int fontfile_obj_ref);
+char *emb_pdf_simple_font(EMB_PARAMS *emb,EMB_PDF_FONTDESCR *fdes,EMB_PDF_FONTWIDTHS *fwid,int fontdescr_obj_ref);
+char *emb_pdf_simple_cidfont(EMB_PARAMS *emb,const char *fontname,int descendant_obj_ref);
+char *emb_pdf_simple_stdfont(EMB_PARAMS *emb);
+
+#endif
--- /dev/null
+#ifndef EMBED_PDF_INT_H
+#define EMBED_PDF_INT_H
+
+EMB_PDF_FONTWIDTHS *emb_pdf_fw_new(int datasize);
+
+// if default_width==-1: default_width will be estimated
+// glyphs==NULL -> output all
+EMB_PDF_FONTWIDTHS *emb_pdf_fw_cidwidths(const BITSET glyphs,int len,int default_width,int (*getGlyphWidth)(void *context,int gid),void *context);
+
+#endif
--- /dev/null
+#include "embed.h"
+#include "embed_pdf_int.h"
+#include "embed_sfnt_int.h"
+#include "sfnt.h"
+#include "sfnt_int.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+EMB_RIGHT_TYPE emb_otf_get_rights(OTF_FILE *otf) // {{{
+{
+ EMB_RIGHT_TYPE ret=EMB_RIGHT_FULL;
+
+ int len;
+ char *os2=otf_get_table(otf,OTF_TAG('O','S','/','2'),&len);
+ if (os2) {
+ const unsigned short os2_version=get_USHORT(os2);
+ // check len
+ assert( (os2_version!=0x0000)||(len==78) );
+ assert( (os2_version!=0x0001)||(len==86) );
+ assert( (os2_version<0x0002)||(os2_version>0x0004)||(len==96) );
+ if (os2_version<=0x0004) {
+ // get rights
+ unsigned short fsType=get_USHORT(os2+8);
+ // from Adobe's Fontpolicies_v9.pdf, pg 13:
+ if (fsType==0x0002) {
+ ret=EMB_RIGHT_NONE;
+ } else {
+ ret=fsType&0x0300; // EMB_RIGHT_BITMAPONLY, EMB_RIGHT_NO_SUBSET
+ if ((fsType&0x000c)==0x0004) {
+ ret|=EMB_RIGHT_READONLY;
+ }
+ }
+ }
+ free(os2);
+ }
+ return ret;
+}
+// }}}
+
+// NOTE: statically allocated buffer
+const char *emb_otf_get_fontname(OTF_FILE *otf) // {{{
+{
+ static char fontname[64];
+
+ int len;
+ const char *fname=otf_get_name(otf,3,1,0x409,6,&len); // microsoft
+ if (fname) {
+ int iA,iB=0;
+ for (iA=0;(iA<63)&&(iA*2<len);iA++) {
+ if ( (fname[2*iA]==0)&&
+ (fname[2*iA+1]>=33)&&(fname[2*iA+1]<=126)&&
+ (!strchr("[](){}<>/%",fname[iA*2+1])) ) {
+ fontname[iB++]=fname[iA*2+1];
+ }
+ }
+ fontname[iB]=0;
+ } else if ((fname=otf_get_name(otf,1,0,0,6,&len))) { // mac
+ int iA,iB=0;
+ for (iA=0;(iA<63)&&(iA<len);iA++) {
+ if ( (fname[iA]>=33)&&(fname[iA]<=126)&&
+ (!strchr("[](){}<>/%",fname[iA])) ) {
+ fontname[iB++]=fname[iA];
+ }
+ }
+ fontname[iB]=0;
+ } else {
+ fontname[0]=0;
+ }
+ if (!*fontname) {
+ // TODO construct a fontname, eg from */*/*/4
+ fprintf(stderr,"WARNING: no fontName\n");
+ }
+ return fontname;
+}
+// }}}
+
+// TODO? monospaced by actual glyph width?
+// TODO? use PCLT table? (esp. CFF, as table dircouraged for glyf fonts)
+void emb_otf_get_pdf_fontdescr(OTF_FILE *otf,EMB_PDF_FONTDESCR *ret) // {{{
+{
+ int len;
+
+// TODO
+// ... fill in struct
+ char *head=otf_get_table(otf,OTF_TAG('h','e','a','d'),&len);
+ assert(head); // version is 1.0 from otf_load
+ ret->bbxmin=get_SHORT(head+36)*1000/otf->unitsPerEm;
+ ret->bbymin=get_SHORT(head+38)*1000/otf->unitsPerEm;
+ ret->bbxmax=get_SHORT(head+40)*1000/otf->unitsPerEm;
+ ret->bbymax=get_SHORT(head+42)*1000/otf->unitsPerEm;
+ const int macStyle=get_USHORT(head+44);
+ free(head);
+
+ char *post=otf_get_table(otf,OTF_TAG('p','o','s','t'),&len);
+ assert(post);
+ const unsigned int post_version=get_ULONG(post);
+ // check length
+ assert( (post_version!=0x00010000)||(len==32) );
+ assert( (post_version!=0x00020000)||(len>=34+2*otf->numGlyphs) );
+ assert( (post_version!=0x00025000)||(len==35+otf->numGlyphs) );
+ assert( (post_version!=0x00030000)||(len==32) );
+ assert( (post_version!=0x00020000)||(get_USHORT(post+32)==otf->numGlyphs) ); // v4?
+// assert( (post_version==0x00030000)==(!!(otf->flags&OTF_F_FMT_CFF)) ); // ghostscript embedding does this..
+ // TODO: v4 (apple) : uint16 reencoding[numGlyphs]
+ if ( (post_version==0x00010000)||
+ (post_version==0x00020000)||
+ (post_version==0x00025000)||
+ (post_version==0x00030000)||
+ (post_version==0x00040000) ) {
+ ret->italicAngle=get_LONG(post+4)>>16;
+ if (get_ULONG(post+12)>0) { // monospaced
+ ret->flags|=1;
+ }
+ } else {
+ fprintf(stderr,"WARNING: no italicAngle, no monospaced flag\n");
+ }
+ free(post);
+
+ char *os2=otf_get_table(otf,OTF_TAG('O','S','/','2'),&len);
+ if (os2) {
+ const unsigned short os2_version=get_USHORT(os2);
+ // check len
+ assert( (os2_version!=0x0000)||(len==78) );
+ assert( (os2_version!=0x0001)||(len==86) );
+ assert( (os2_version<0x0002)||(os2_version>0x0004)||(len==96) );
+ if (os2_version<=0x0004) {
+
+ // from PDF14Deltas.pdf, pg 113
+ const int weightClass=get_USHORT(os2+4);
+ ret->stemV=50+weightClass*weightClass/(65*65); // TODO, really bad
+//printf("a %d\n",weightClass);
+
+ if (ret->supplement>=0) { // cid
+ ret->panose=ret->data;
+ memcpy(ret->panose,os2+30,12); // sFamilyClass + panose
+ }
+ const unsigned short fsSelection=get_USHORT(os2+62);
+ if (fsSelection&0x01) { // italic
+ ret->flags|=0x0040;
+ }
+ if ( (fsSelection&0x10)&&(weightClass>600) ) { // force bold
+ ret->flags|=0x0400;
+ }
+ const unsigned char family_class=get_USHORT(os2+30)>>8;
+ if (family_class==10) { // script
+ ret->flags|=0x0008;
+ }
+ if (family_class!=8) { // not sans-serif
+ ret->flags|=0x0002;
+ }
+
+ ret->avgWidth=get_SHORT(os2+2)*1000/otf->unitsPerEm;
+ ret->ascent=get_SHORT(os2+68)*1000/otf->unitsPerEm;
+ ret->descent=get_SHORT(os2+70)*1000/otf->unitsPerEm;
+ if (os2_version>=0x0002) {
+ ret->xHeight=get_SHORT(os2+86)*1000/otf->unitsPerEm;
+ ret->capHeight=get_SHORT(os2+88)*1000/otf->unitsPerEm;
+ } // else capHeight fixed later
+ } else {
+ free(os2);
+ os2=NULL;
+ }
+ } else {
+ fprintf(stderr,"WARNING: no OS/2 table\n");
+ // e.g. subsetted font from ghostscript // e.g. CFF
+ }
+ if (os2) {
+ free(os2);
+ } else { // TODO (if(CFF))
+ fprintf(stderr,"WARNING: no ascent/descent, capHeight, stemV, flags\n");
+ if (macStyle&0x01) { // force bold - just do it on bold
+ ret->flags|=0x0400;
+ }
+ if (macStyle&0x02) { // italic
+ ret->flags|=0x0004;
+ }
+ // ... flags TODO? (Serif, Script, Italic, AllCap,SmallCap, ForceBold)
+ }
+
+// ? maybe get ascent,descent,capHeight,xHeight,stemV directly from cff
+ // Fallbacks
+ if ( (!ret->ascent)||(!ret->descent) ) {
+ char *hhea=otf_get_table(otf,OTF_TAG('h','h','e','a'),&len);
+ if (hhea) {
+ ret->ascent=get_SHORT(hhea+4)*1000/otf->unitsPerEm;
+ ret->descent=get_SHORT(hhea+6)*1000/otf->unitsPerEm;
+ }
+ free(hhea);
+ }
+ if (!ret->stemV) { // TODO? use name
+ const unsigned short d_gid=otf_from_unicode(otf,'.');
+ if (d_gid) { // stemV=bbox['.'].width;
+ len=otf_get_glyph(otf,d_gid);
+ assert(len>=10);
+ ret->stemV=(get_SHORT(otf->gly+6)-get_SHORT(otf->gly+2))*1000/otf->unitsPerEm;
+ } else {
+ if (macStyle&1) { // bold
+ ret->stemV=165;
+ } else {
+ ret->stemV=109; // TODO... unserious values...
+ }
+ }
+ }
+ if (!ret->capHeight) { // TODO? only reqd. for fonts with latin...
+ ret->capHeight=ret->ascent;
+ // TODO: OTF spec says: use metrics of 'H' (0 if not available)
+ }
+ if (0) { // TODO? uses only adobe latin standard? ?? e.g. Type1
+ ret->flags|=0x0020;
+ } else {
+ ret->flags|=0x0004;
+ }
+ // TODO SmallCap by font name(?)
+
+// TODO ; ? cid ?
+}
+// }}}
+
+// TODO: split generic part and otf part
+// TODO: FIXME: gid vs. char ... NOTE: not called in multi_byte mode...
+// Adobe does: char --MacRoman/WinAnsi--> name --AGL--> unicode --cmap(3,1) --> gid only avoidable by setting 'symbol'+custom(1,0)/(3,0)
+// HINT: caller sets len == otf->numGlyphs (only when not using encoding...)
+EMB_PDF_FONTWIDTHS *emb_otf_get_pdf_widths(OTF_FILE *otf,const unsigned short *encoding,int len,const BITSET glyphs) // {{{ glyphs==NULL -> all from 0 to len
+{
+ assert(otf);
+
+ int first=len,last=0;
+ int iA;
+
+ if (glyphs) {
+ for (iA=0;iA<len;iA++) { // iA is a "gid" when in multi_byte mode...
+ const int gid=(encoding)?encoding[iA]:otf_from_unicode(otf,iA); // TODO
+ if (bit_check(glyphs,gid)) {
+ if (first>iA) { // first is a character index
+ first=iA;
+ }
+ if (last<iA) {
+ last=iA;
+ }
+ }
+ }
+ } else {
+ first=0;
+ last=len;
+ }
+ if (last<first) {
+ // empty
+ fprintf(stderr,"WARNING: empty embedding range\n");
+ return NULL;
+ }
+
+ // ensure hmtx is there
+ if (!otf->hmtx) {
+ if (otf_load_more(otf)!=0) {
+ assert(0);
+ return NULL;
+ }
+ }
+
+ // now create the array
+ EMB_PDF_FONTWIDTHS *ret=emb_pdf_fw_new(last-first+1);
+ if (!ret) {
+ return NULL;
+ }
+ ret->first=first;
+ ret->last=last;
+ ret->widths=ret->data;
+ for (iA=0;first<=last;iA++,first++) {
+ const int gid=(encoding)?encoding[first]:otf_from_unicode(otf,first); // TODO
+ if (gid>=otf->numGlyphs) {
+ fprintf(stderr,"Bad glyphid\n");
+ assert(0);
+ free(ret);
+ return NULL;
+ }
+ if ( (!glyphs)||(bit_check(glyphs,gid)) ) {
+ ret->widths[iA]=get_width_fast(otf,gid)*1000/otf->unitsPerEm;
+ } // else 0 from calloc
+ }
+
+ return ret;
+}
+// }}}
+
+// otf->hmtx must be there
+static int emb_otf_pdf_glyphwidth(void *context,int gid) // {{{
+{
+ OTF_FILE *otf=(OTF_FILE *)context;
+ return get_width_fast(otf,gid)*1000/otf->unitsPerEm;
+}
+// }}}
+
+EMB_PDF_FONTWIDTHS *emb_otf_get_pdf_cidwidths(OTF_FILE *otf,const BITSET glyphs) // {{{ // glyphs==NULL -> output all
+{
+ assert(otf);
+
+ // ensure hmtx is there
+ if (!otf->hmtx) {
+ if (otf_load_more(otf)!=0) {
+ assert(0);
+ return NULL;
+ }
+ }
+// int dw=emb_otf_pdf_glyphwidth(otf,0); // e.g.
+ int dw=-1; // let them estimate
+
+ return emb_pdf_fw_cidwidths(glyphs,otf->numGlyphs,dw,emb_otf_pdf_glyphwidth,otf);
+}
+// }}}
+
+/*** PS stuff ***/
+
+#include "dynstring.h"
+
+const char *aglfn13(unsigned short uni); // aglfn13.c
+#include "macroman.h"
+
+// TODO? optimize pascal string skipping? (create index)
+// NOTE: might return a statically allocated string
+static const char *emb_otf_get_post_name(const char *post,unsigned short gid) // {{{
+{
+ if (!post) {
+ return NULL;
+ }
+ const unsigned int post_version=get_ULONG(post);
+ if (post_version==0x00010000) { // font has only 258 chars... font cannot be used on windows
+ if (gid<sizeof(macRoman)/sizeof(macRoman[0])) {
+ return macRoman[gid];
+ }
+ } else if (post_version==0x00020000) {
+ const unsigned short num_glyphs=get_USHORT(post+32);
+ // assert(num_glyphs==otf->numGlyphs);
+ if (gid<num_glyphs) {
+ unsigned short idx=get_USHORT(post+34+2*gid);
+ if (idx<258) {
+ if (gid<sizeof(macRoman)/sizeof(macRoman[0])) {
+ return macRoman[idx];
+ }
+ } else if (idx<32768) {
+ const unsigned char *pos=(unsigned char *)post+34+2*num_glyphs;
+ for (idx-=258;idx>0;idx--) { // this sucks...
+ pos+=*pos+1; // skip this string
+ }
+ // convert pascal string to asciiz
+ static char ret[256];
+ const unsigned char len=*pos;
+ memcpy(ret,(const char *)pos+1,len);
+ ret[len]=0;
+ return ret;
+ }
+ }
+ } else if (post_version==0x00025000) { // similiar to 0x00010000, deprecated
+ const unsigned short num_glyphs=get_USHORT(post+32);
+ if (gid<num_glyphs) {
+ const unsigned short idx=post[34+gid]+gid; // post is signed char *
+ if (idx<sizeof(macRoman)/sizeof(macRoman[0])) {
+ return macRoman[idx];
+ }
+ }
+ } else if (post_version==0x00030000) {
+ // no glyph names, sorry
+// } else if (post_version==0x00040000) { // apple AAT ?!
+ }
+ return NULL;
+}
+// }}}
+
+// TODO!? to_unicode should be able to represent more than one unicode character?
+// NOTE: statically allocated string
+static const char *get_glyphname(const char *post,unsigned short *to_unicode,int charcode,unsigned short gid) // {{{ if charcode==0 -> force gid to be used
+{
+ if (gid==0) {
+ return ".notdef";
+ }
+ const char *postName=emb_otf_get_post_name(post,gid);
+ if (postName) {
+ return postName;
+ }
+ static char ret[255];
+ if (charcode) {
+ if (to_unicode) { // i.e. encoding was there
+ charcode=to_unicode[charcode];
+ // TODO!? to_unicode should be able to represent more than one unicode character?
+ // TODO for additional credit: for ligatures, etc create /f_f /uni12341234 or the like
+ }
+ const char *aglname=aglfn13(charcode); // TODO? special case ZapfDingbats?
+ if (aglname) {
+ return aglname;
+ }
+ snprintf(ret,250,"uni%04X",charcode); // allows extraction
+ } else {
+ snprintf(ret,250,"c%d",gid); // last resort: only by gid
+ }
+ return ret;
+}
+// }}}
+
+struct OUTFILTER_PS {
+ OUTPUT_FN out;
+ void *ctx;
+ int len;
+};
+
+// TODO: for maximum compatiblity (PS<2013 interpreter) split only on table or glyph boundary (needs lookup in loca table!)
+// Note: table boundaries are at each call!
+static void outfilter_ascii_ps(const char *buf,int len,void *context) // {{{
+{
+ struct OUTFILTER_PS *of=context;
+ OUTPUT_FN out=of->out;
+ int iA;
+
+ (*out)("<",1,of->ctx);
+ of->len++;
+
+ const char *last=buf;
+ char tmp[256];
+ while (len>0) {
+ for (iA=0;(iA<76)&&(len>0);iA+=2,len--) {
+ const unsigned char ch=buf[iA>>1];
+ tmp[iA]="0123456789abcdef"[ch>>4];
+ tmp[iA+1]="0123456789abcdef"[ch&0x0f];
+ }
+ buf+=iA>>1;
+ if (buf<last+64000) {
+ if (len>0) {
+ tmp[iA++]='\n';
+ }
+ (*out)(tmp,iA,of->ctx);
+ } else {
+ last=buf;
+ strcpy(tmp+iA,"00>\n<");
+ iA+=5;
+ (*out)(tmp,iA,of->ctx);
+ }
+ of->len+=iA;
+ }
+
+ (*out)("00>\n",4,of->ctx);
+ of->len+=4;
+}
+// }}}
+
+static void outfilter_binary_ps(const char *buf,int len,void *context) // {{{
+{
+ struct OUTFILTER_PS *of=context;
+ OUTPUT_FN out=of->out;
+
+ char tmp[100];
+ while (len>0) {
+ const int maxlen=(len>64000)?64000:len;
+ const int l=sprintf(tmp,"%d RD ",maxlen);
+ (*out)(tmp,l,of->ctx);
+ of->len+=l;
+
+ (*out)(buf,maxlen,of->ctx);
+ (*out)("\n",1,of->ctx);
+ of->len+=maxlen+1;
+ len-=maxlen;
+ buf+=maxlen;
+ }
+}
+// }}}
+
+/*
+ encoding: character-code -> glyph id ["required", NULL: identity, i.e. from_unicode()] // TODO: respect subsetting
+ to_unicode: character-code -> unicode [NULL: no char names] // kind-of "reverse" of encoding (to_unicode does not make sense without >encoding)
+
+Status:
+ - we need a 0..255 encoding to be used in the PS file
+ - we want to allow the use of encoding[]; this should map from your desired PS-stream output character (0..255) directly to the gid
+ - if encoding[] is not used, MacRoman/WinAnsi/latin1 is expected (easiest: latin1, as it is a subset of unicode)
+ i.e. your want to output latin1 to the PS-stream
+ - len is the length of >encoding, or the "last used latin1 character"
+ - oh. in multibyte-mode no >encoding probably should mean identity(gid->gid) not (latin1->gid)
+ - non-multibyte PDF -> only 255 chars ... not recommended (we can't just map to gids, but only to names, which acro will then cmap(3,1) to gids)
+
+ => problem with subsetting BITSET (keyed by gid); we want BITSET keyed by 0..255 (via encoding)
+
+ // TODO: a) multi font encoding
+ // TODO: b) cid/big font encoding (PS>=2015) [/CIDFontType 2] : CMap does Charcode->CID, /CIDMap does CID->GID [e.g. Identity/delta value]
+ // (also needed [or a)] for loca>64000 if split, etc) e.g. /CIDMap 0 [requires PS>=3011?]
+ // [Danger: do not split composites]
+ // TODO? incremental download [/GlyphDirectory array or dict] : /GlyphDirectory does GID-><glyf entry> mapping
+ // need 'fake' gdir table (size,offset=0) in sfnt; loca, glyf can be ommited; hmtx can be omitted for PS>=3011 [/MetricsCount 2]
+ // idea is to fill initial null entries in the array/dict [Beware of save/restore!]
+ // NOTE: even when subsetting the font has to come first in the PS file
+
+
+... special information: when multi-byte PDF encoding is used <gid> is output.
+ therefore /Encoding /Identity-H + /CIDSystemInfo Adobe-Identity-0 will yield 1-1 mapping for font.
+ problem is that text is not selectable. therefore there is the /ToUnicode CMap option
+*/
+int emb_otf_ps(OTF_FILE *otf,unsigned short *encoding,int len,unsigned short *to_unicode,OUTPUT_FN output,void *context) // {{{
+{
+ const int binary=0; // binary format? // TODO
+ if (len>256) {
+ fprintf(stderr,"Encoding too big(%d) for Type42\n",len);
+ return -1;
+ }
+ if (len<1) {
+ fprintf(stderr,"At least .notdef required in Type42\n");
+ return -1;
+ }
+ if (!encoding) {
+ to_unicode=NULL; // does not make sense
+ }
+ int iA,ret=0;
+
+ DYN_STRING ds;
+ if (dyn_init(&ds,1024)==-1) {
+ return -1;
+ }
+
+ int rlen=0;
+ char *head=otf_get_table(otf,OTF_TAG('h','e','a','d'),&rlen);
+ if (!head) {
+ free(ds.buf);
+ return -1;
+ }
+ dyn_printf(&ds,"%!PS-TrueTypeFont-%d-%d\n",
+ otf->version,get_ULONG(head+4));
+ const int bbxmin=get_SHORT(head+36)*1000/otf->unitsPerEm,
+ bbymin=get_SHORT(head+38)*1000/otf->unitsPerEm,
+ bbxmax=get_SHORT(head+40)*1000/otf->unitsPerEm,
+ bbymax=get_SHORT(head+42)*1000/otf->unitsPerEm;
+ free(head);
+
+ char *post=otf_get_table(otf,OTF_TAG('p','o','s','t'),&rlen);
+ if ( (!post)&&(rlen!=-1) ) { // other error than "not found"
+ free(ds.buf);
+ return -1;
+ }
+ if (post) {
+ const unsigned int minMem=get_ULONG(post+16),maxMem=get_ULONG(post+20);
+ if (minMem) {
+ dyn_printf(&ds,"%%VMusage: %d %d\n",minMem,maxMem);
+ }
+ }
+
+ // don't forget the coordinate scaling...
+ dyn_printf(&ds,"11 dict begin\n"
+ "/FontName /%s def\n"
+ "/FontType 42 def\n"
+ "/FontMatrix [1 0 0 1 0 0] def\n"
+ "/FontBBox [%f %f %f %f] def\n"
+ "/PaintType 0 def\n",
+// "/XUID [42 16#%X 16#%X 16#%X 16#%X] def\n" // TODO?!? (md5 of font data) (16# means base16)
+ emb_otf_get_fontname(otf),
+ bbxmin/1000.0,bbymin/1000.0,bbxmax/1000.0,bbymax/1000.0);
+ if (post) {
+ dyn_printf(&ds,"/FontInfo 4 dict dup begin\n"
+// TODO? [even non-post]: /version|/Notice|/Copyright|/FullName|/FamilyName|/Weight () readonly def\n from name table: 5 7 0 4 1 2
+// using: otf_get_name(otf,3,1,0x409,?,&len) / otf_get_name(otf,1,0,0,?,&len) + encoding
+ " /ItalicAngle %d def\n"
+ " /isFixedPitch %s def\n"
+ " /UnderlinePosition %f def\n"
+ " /UnderlineThickness %f def\n"
+ "end readonly def\n",
+ get_LONG(post+4)>>16,
+ (get_ULONG(post+12)?"true":"false"),
+ (get_SHORT(post+8)-get_SHORT(post+10)/2)/(float)otf->unitsPerEm,
+ get_SHORT(post+10)/(float)otf->unitsPerEm);
+ }
+ dyn_printf(&ds,"/Encoding 256 array\n"
+ "0 1 255 { 1 index exch /.notdef put } for\n");
+ for (iA=0;iA<len;iA++) { // encoding data: 0...255 -> /glyphname
+ const int gid=(encoding)?encoding[iA]:otf_from_unicode(otf,iA);
+ if (gid!=0) {
+ dyn_printf(&ds,"dup %d /%s put\n",
+ iA,get_glyphname(post,to_unicode,iA,gid));
+ }
+ }
+ dyn_printf(&ds,"readonly def\n");
+
+ if (binary) {
+ dyn_printf(&ds,"/RD { string currentfile exch readstring pop } executeonly def\n");
+ }
+ dyn_printf(&ds,"/sfnts[\n");
+
+ if (ds.len<0) {
+ free(post);
+ free(ds.buf);
+ return -1;
+ }
+ (*output)(ds.buf,ds.len,context);
+ ret+=ds.len;
+ ds.len=0;
+
+// TODO: only tables as in otf_subset
+// TODO: somehow communicate table boundaries:
+ // otf_action_copy does exactly one output call (per table)
+ // only otf_action_replace might do two (padding)
+ // {{{ copy tables verbatim (does not affect ds .len)
+ struct _OTF_WRITE *otfree=NULL;
+#if 0
+ struct _OTF_WRITE *otw;
+ otwfree=otw=malloc(sizeof(struct _OTF_WRITE)*otf->numTables);
+ if (!otw) {
+ fprintf(stderr,"Bad alloc: %m\n");
+ free(post);
+ free(ds.buf);
+ return -1;
+ }
+ // just copy everything
+ for (iA=0;iA<otf->numTables;iA++) {
+ otw[iA].tag=otf->tables[iA].tag;
+ otw[iA].action=otf_action_copy;
+ otw[iA].param=otf;
+ otw[iA].length=iA;
+ }
+ int numTables=otf->numTables;
+#else
+ struct _OTF_WRITE otw[]={ // sorted
+ {OTF_TAG('c','m','a','p'),otf_action_copy,otf,},
+ {OTF_TAG('c','v','t',' '),otf_action_copy,otf,},
+ {OTF_TAG('f','p','g','m'),otf_action_copy,otf,},
+ {OTF_TAG('g','l','y','f'),otf_action_copy,otf,},
+ {OTF_TAG('h','e','a','d'),otf_action_copy,otf,},
+ {OTF_TAG('h','h','e','a'),otf_action_copy,otf,},
+ {OTF_TAG('h','m','t','x'),otf_action_copy,otf,},
+ {OTF_TAG('l','o','c','a'),otf_action_copy,otf,},
+ {OTF_TAG('m','a','x','p'),otf_action_copy,otf,},
+ {OTF_TAG('n','a','m','e'),otf_action_copy,otf,},
+ {OTF_TAG('p','r','e','p'),otf_action_copy,otf,},
+ // vhea vmtx (never used in PDF, but possible in PS>=3011)
+ {0,0,0,0}};
+ int numTables=otf_intersect_tables(otf,otw);
+#endif
+
+ struct OUTFILTER_PS of;
+ of.out=output;
+ of.ctx=context;
+ of.len=0;
+ if (binary) {
+ iA=otf_write_sfnt(otw,otf->version,numTables,outfilter_binary_ps,&of);
+ } else {
+ iA=otf_write_sfnt(otw,otf->version,numTables,outfilter_ascii_ps,&of);
+ }
+ free(otfree);
+ if (iA==-1) {
+ free(post);
+ free(ds.buf);
+ return -1;
+ }
+ ret+=of.len;
+ // }}} done copying
+
+ dyn_printf(&ds,"] def\n");
+
+ dyn_printf(&ds,"/CharStrings %d dict dup begin\n"
+ "/.notdef 0 def\n",len);
+ for (iA=0;iA<len;iA++) { // charstrings data: /glyphname -> gid
+ const int gid=(encoding)?encoding[iA]:otf_from_unicode(otf,iA);
+ if (gid) {
+ dyn_printf(&ds,"/%s %d def\n",get_glyphname(post,to_unicode,iA,gid),gid);
+ }
+ // (respecting subsetting...)
+ }
+ dyn_printf(&ds,"end readonly def\n");
+ dyn_printf(&ds,"FontName currentdict end definefont pop\n");
+ free(post);
+
+ if (ds.len<0) {
+ free(ds.buf);
+ return -1;
+ }
+ (*output)(ds.buf,ds.len,context);
+ ret+=ds.len;
+ ds.len=0;
+
+ free(ds.buf);
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef EMBED_SFNT_INT_H
+#define EMBED_SFNT_INT_H
+
+#include "sfnt.h"
+#include "embed_pdf.h"
+
+EMB_RIGHT_TYPE emb_otf_get_rights(OTF_FILE *otf);
+
+// NOTE: statically allocated buffer
+const char *emb_otf_get_fontname(OTF_FILE *otf);
+
+void emb_otf_get_pdf_fontdescr(OTF_FILE *otf,EMB_PDF_FONTDESCR *ret);
+EMB_PDF_FONTWIDTHS *emb_otf_get_pdf_widths(OTF_FILE *otf,const unsigned short *encoding,int len,const BITSET glyphs);
+EMB_PDF_FONTWIDTHS *emb_otf_get_pdf_cidwidths(OTF_FILE *otf,const BITSET glyph);
+
+int emb_otf_ps(OTF_FILE *otf,unsigned short *encoding,int len,unsigned short *to_unicode,OUTPUT_FN output,void *context);
+
+#endif
--- /dev/null
+#include "fontfile.h"
+#include <assert.h>
+#include <string.h>
+
+//FONTFILE *fontfile_open(const char *filename);
+
+/*
+FONTFILE *fontfile_open(const char *filename)
+{
+ // TODO? check magic
+ if (...) {
+ }
+}
+*/
+
+FONTFILE *fontfile_open_sfnt(OTF_FILE *otf) // {{{
+{
+ if (!otf) {
+ assert(0);
+ return NULL;
+ }
+ FONTFILE *ret=calloc(1,sizeof(FONTFILE));
+
+ ret->sfnt=otf;
+
+ return ret;
+}
+// }}}
+
+FONTFILE *fontfile_open_std(const char *name) // {{{
+{
+ assert(name);
+ FONTFILE *ret=calloc(1,sizeof(FONTFILE));
+
+ ret->stdname=strdup(name);
+
+ return ret;
+}
+// }}}
+
+void fontfile_close(FONTFILE *ff) // {{{
+{
+ if (ff) {
+ otf_close(ff->sfnt);
+ // ??? cff_close(ff->cff);
+ free(ff->stdname);
+ free(ff);
+ }
+}
+// }}}
--- /dev/null
+#ifndef _FONTFILE_H
+#define _FONTFILE_H
+
+#include "sfnt.h"
+
+struct _FONTFILE {
+ OTF_FILE *sfnt;
+ // ??? *cff;
+ char *stdname;
+ union {
+ int fobj;
+ void *user;
+ };
+};
+
+typedef struct _FONTFILE FONTFILE;
+
+FONTFILE *fontfile_open_sfnt(OTF_FILE *otf);
+FONTFILE *fontfile_open_std(const char *name);
+void fontfile_close(FONTFILE *ff);
+
+#endif
--- /dev/null
+#include "frequent.h"
+#include <assert.h>
+#include <stdlib.h>
+
+// misra-gries
+// http://www2.research.att.com/~marioh/papers/vldb08-2.pdf
+
+struct _FREQUENT {
+ int size,czero;
+ char sorted;
+ struct { intptr_t key; int count,zero; } pair[];
+};
+
+// size is the precision/return size: in sequence with n _add(), it will find at most >size elements with occurence > n/(size+1) times
+FREQUENT *frequent_new(int size) // {{{ - just free() it
+{
+ assert(size>0);
+ FREQUENT *ret=malloc(sizeof(ret[0])+sizeof(ret->pair[0])*size);
+ if (!ret) {
+ return NULL;
+ }
+ ret->size=size;
+ ret->czero=0;
+ ret->sorted=1;
+ int iA;
+ for (iA=0;iA<size;iA++) {
+ ret->pair[iA].key=INTPTR_MIN;
+ ret->pair[iA].count=0;
+ ret->pair[iA].zero=0;
+ }
+
+ return ret;
+}
+// }}}
+
+void frequent_add(FREQUENT *freq,intptr_t key) // {{{
+{
+ assert(freq);
+ int iA,zero=-1;
+ for (iA=freq->size-1;iA>=0;iA--) {
+ if (freq->pair[iA].key==key) {
+ freq->pair[iA].count++;
+ freq->sorted=0;
+ return;
+ } else if (freq->pair[iA].count==freq->czero) {
+ zero=iA;
+ }
+ }
+ if (zero>=0) { // insert into set
+ freq->pair[zero].key=key;
+ freq->pair[zero].count++; // i.e. czero+1
+ freq->pair[zero].zero=freq->czero;
+ // if it was sorted, the free entries are at the end. zero points to the first free entry, because of the loop direction
+ } else { // out-of-set count
+ freq->czero++;
+ }
+}
+// }}}
+
+static int frequent_cmp(const void *a,const void *b) // {{{
+{
+ const typeof(((FREQUENT *)0)->pair[0]) *aa=a;
+ const typeof(((FREQUENT *)0)->pair[0]) *bb=b;
+ return (bb->count-bb->zero)-(aa->count-aa->zero);
+}
+// }}}
+
+// true frequency is somewhere between (count-zero) and count
+intptr_t frequent_get(FREQUENT *freq,int pos) // {{{
+{
+ assert(freq);
+ if (!freq->sorted) {
+ // sort by (count-zero)
+ qsort(freq->pair,freq->size,sizeof(freq->pair[0]),frequent_cmp);
+ freq->sorted=1;
+ }
+ if ( (pos<0)||(pos>=freq->size) ) {
+ return INTPTR_MIN;
+ }
+ return freq->pair[pos].key;
+}
+// }}}
+
--- /dev/null
+#ifndef _FREQUENT_H
+#define _FREQUENT_H
+
+#include <stdint.h>
+
+typedef struct _FREQUENT FREQUENT;
+
+// size is the precision/return size: it will find at most >size elements (i.e. all, if there) with frequency > 1/(size+1)
+FREQUENT *frequent_new(int size); // - just free() it
+
+void frequent_add(FREQUENT *freq,intptr_t key);
+
+// might return INTPTR_MIN, if not populated
+// this is only an approximation!
+intptr_t frequent_get(FREQUENT *freq,int pos); // 0 is "most frequent"
+
+#endif
--- /dev/null
+#ifndef _IOFN_H
+#define _IOFN_H
+
+typedef void (*OUTPUT_FN)(const char *buf,int len,void *context);
+
+#endif
--- /dev/null
+// data header only. for inclusion in only one file
+#ifdef WITH_MACROMAN
+static const char *macRoman[]=
+ {".notdef",".null","nonmarkingreturn","space","exclam", "quotedbl","numbersign","dollar","percent","ampersand",
+ "quotesingle","parenleft","parenright","asterisk","plus", "comma","hyphen","period","slash","zero",
+ "one","two","three","four","five", "six","seven","eight","nine","colon",
+ "semicolon","less","equal","greater","question", "at","A","B","C","D",
+ "E","F","G","H","I", "J","K","L","M","N",
+ "O","P","Q","R","S", "T","U","V","W","X",
+ "Y","Z","bracketleft","backslash","bracketright", "asciicircum","underscore","grave","a","b",
+ "c","d","e","f","g", "h","i","j","k","l",
+ "m","n","o","p","q", "r","s","t","u","v",
+ "w","x","y","z","braceleft", "bar","braceright","asciitilde","Adieresis","Aring",
+ "Ccedilla","Eacute","Ntilde","Odieresis","Udieresis", "aacute","agrave","acircumflex","adieresis","atilde",
+ "aring","ccedilla","eacute","egrave","ecircumflex", "edieresis","iacute","igrave","icircumflex","idieresis",
+ "ntilde","oacute","ograve","ocircumflex","odieresis", "otilde","uacute","ugrave","ucircumflex","udieresis",
+ "dagger","degree","cent","sterling","section", "bullet","paragraph","germandbls","registered","copyright",
+ "trademark","acute","dieresis","notequal","AE", "Oslash","infinity","plusminus","lessequal","greaterequal",
+ "yen","mu","partialdiff","summation","product", "pi","integral","ordfeminine","ordmasculine","Omega",
+ "ae","oslash","questiondown","exclamdown","logicalnot", "radical","florin","approxequal","Delta","guillemotleft",
+ "guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde", "Otilde","OE","oe","endash","emdash",
+ "quotedblleft","quotedblright","quoteleft","quoteright","divide", "lozenge","ydieresis","Ydieresis","fraction","currency",
+ "guilsinglleft","guilsinglright","fi","fl","daggerdbl", "periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex",
+ "Ecircumflex","Aacute","Edieresis","Egrave","Iacute", "Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex",
+ "apple","Ograve","Uacute","Ucircumflex","Ugrave", "dotlessi","circumflex","tilde","macron","breve",
+ "dotaccent","ring","cedilla","hungarumlaut","ogonek", "caron","Lslash","lslash","Scaron","scaron",
+ "Zcaron","zcaron","brokenbar","Eth","eth", "Yacute","yacute","Thorn","thorn","minus","multiply",
+ "onesuperior","twosuperior","threesuperior","onehalf","onequarter", "threequarters","franc","Gbreve","gbreve","Idotaccent",
+ "Scedilla","scedilla","Cacute","cacute","Ccaron", "ccaron","dcroat"};
+#else
+static const char *macRoman[]={0};
+#endif
--- /dev/null
+#include "sfnt.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "embed.h"
+#include "config.h"
+
+#if 0
+enum { TTF_OTF, TYPE1 } inputFile;
+if (TTF_OTF) {
+ assert(!TTC);
+ if (CFF/OTF) {
+ // or EMB_PDF_FONTFILE3_OTF [unstripped]
+ if (CIDfont) {
+ asset(multiBYTE);
+ strip_sfnt() // "CIDFontType0" EMB_PDF_FONTFILE3_CID0C
+ } else {
+ ... strip_sfnt();
+ }
+ } else {
+ ...
+ }
+} else if (TYPE1) {
+ assert(!MMType1);
+ assert(!OCF);
+ assert(!WrappedCID_CFF);
+ ... convert_to_cff()
+}
+// not supported: MMType1 Type3
+#endif
+
+#include <string.h>
+
+static void example_outfn(const char *buf,int len,void *context) // {{{
+{
+ FILE *f=(FILE *)context;
+ if (fwrite(buf,1,len,f)!=len) {
+ perror("Short write");
+ assert(0);
+ return;
+ }
+}
+// }}}
+
+void example_write_fontdescr(OTF_FILE *otf,const char *outfile) // {{{
+{
+ FONTFILE *ff=fontfile_open_sfnt(otf);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PDF16,
+// EMB_C_KEEP_T1
+ EMB_C_FORCE_MULTIBYTE
+
+ );
+ EMB_PDF_FONTDESCR *fdes=emb_pdf_fontdescr(emb);
+ assert(fdes);
+
+ emb_get(emb,'a');
+ emb_get(emb,0x400);
+
+ EMB_PDF_FONTWIDTHS *fwid=emb_pdf_fontwidths(emb);
+ assert(fwid);
+
+ printf("0 0 obj\n");
+ char *res=emb_pdf_simple_fontdescr(emb,fdes,1);
+ assert(res);
+ fputs(res,stdout);
+ free(res);
+ printf("endobj\n");
+
+ printf("1 0 obj\n"
+ "<<\n");
+ if (emb_pdf_get_fontfile_subtype(emb)) {
+ printf(" /Subtype /%s\n",
+ emb_pdf_get_fontfile_subtype(emb));
+ }
+ if (emb->outtype==EMB_FMT_T1) {
+ printf(" /Length1 ?\n"
+ " /Length2 ?\n"
+ " /Length3 ?\n");
+ } else if (emb->outtype==EMB_FMT_TTF) {
+ printf(" /Length1 2 0 R\n");
+ }
+ printf(" /Length 2 0 R\n" // maybe compress it...
+ ">>\n"
+ "stream\n");
+ int outlen=0; // TODO
+// TODO
+ if (outfile) {
+ FILE *f=fopen(outfile,"w");
+ if (!f) {
+ fprintf(stderr,"Opening \"%s\" for writing failed: %m\n",outfile);
+ assert(0);
+ emb_close(emb);
+ return;
+ }
+ outlen=emb_embed(emb,example_outfn,f);
+// outlen=otf_ttc_extract(emb->font->sfnt,example_outfn,f);
+ fclose(f);
+ }
+puts("...");
+ printf("endstream\n"
+ "endobj\n");
+ printf("2 0 obj\n"
+ "%d\n"
+ "endobj\n",
+ outlen
+ );
+
+ printf("3 0 obj\n");
+ res=emb_pdf_simple_font(emb,fdes,fwid,0);
+ assert(res);
+ fputs(res,stdout);
+ free(res);
+ printf("endobj\n");
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ printf("4 0 obj\n");
+ res=emb_pdf_simple_cidfont(emb,fdes->fontname,3);
+ assert(res);
+ fputs(res,stdout);
+ free(res);
+ printf("endobj\n");
+ }
+
+ free(fdes);
+ free(fwid);
+ emb_close(emb);
+#if 1
+ free(ff); // TODO
+#else
+ ff->sfnt=NULL; // TODO
+ fontfile_close(ff);
+#endif
+}
+// }}}
+
+// TODO? reencode?
+int main(int argc,char **argv)
+{
+ const char *fn=TESTFONT;
+ if (argc==2) {
+ fn=argv[1];
+ }
+ OTF_FILE *otf=otf_load(fn);
+ assert(otf);
+ printf("width(4): %d\n",otf_get_width(otf,4));
+
+
+ if (strcmp(fn,"test.ttf")!=0) {
+ example_write_fontdescr(otf,"test.ttf");
+ } else {
+ example_write_fontdescr(otf,NULL);
+ }
+
+ // show_post(otf);
+
+ // show_name(otf);
+
+ // show_cmap(otf);
+ // printf("%d %d\n",otf_from_unicode(otf,'A'),0);
+
+ // ... name 6 -> FontName /20(cid)
+ // ? StemV Flags(?) from FontName
+
+ otf_close(otf);
+
+ return 0;
+}
--- /dev/null
+#include "sfnt.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include "sfnt_int.h"
+
+// TODO?
+// get_SHORT(head+48) // fontDirectionHint
+/* reqd. Tables: cmap, head, hhea, hmtx, maxp, name, OS/2, post
+ OTF: glyf,loca [cvt,fpgm,prep]
+ */
+
+static void otf_bsearch_params(int num, // {{{
+ int recordSize,
+ int *searchRange,
+ int *entrySelector,
+ int *rangeShift)
+{
+ assert(num>0);
+ assert(searchRange);
+ assert(entrySelector);
+ assert(rangeShift);
+
+ int iA,iB;
+ for (iA=1,iB=0;iA<=num;iA<<=1,iB++) {}
+
+ *searchRange=iA*recordSize/2;
+ *entrySelector=iB-1;
+ *rangeShift=num*recordSize-*searchRange;
+}
+// }}}
+
+static char *otf_bsearch(char *table, // {{{
+ const char *target,int len,
+ int searchRange,
+ int entrySelector,
+ int rangeShift,
+ int lower_bound) // return lower_bound, if !=0
+{
+ char *ret=table+rangeShift;
+ if (memcmp(target,ret,len)<0) {
+ ret=table;
+ }
+
+ for (;entrySelector>0;entrySelector--) {
+ searchRange>>=1;
+ ret+=searchRange;
+ if (memcmp(target,ret,len)<0) {
+ ret-=searchRange;
+ }
+ }
+ const int result=memcmp(target,ret,len);
+ if (result==0) {
+ return ret;
+ } else if (lower_bound) {
+ if (result>0) {
+ return ret+searchRange;
+ }
+ return ret;
+ }
+ return NULL; // not found;
+}
+// }}}
+
+static OTF_FILE *otf_new(FILE *f) // {{{
+{
+ assert(f);
+
+ OTF_FILE *ret;
+ ret=calloc(1,sizeof(OTF_FILE));
+ if (ret) {
+ ret->f=f;
+ ret->version=0x00010000;
+ }
+
+ return ret;
+}
+// }}}
+
+// will alloc, if >buf ==NULL, returns >buf, or NULL on error
+// NOTE: you probably want otf_get_table()
+static char *otf_read(OTF_FILE *otf,char *buf,long pos,int length) // {{{
+{
+ char *ours=NULL;
+
+ if (length==0) {
+ return buf;
+ } else if (length<0) {
+ assert(0);
+ return NULL;
+ }
+
+ int res=fseek(otf->f,pos,SEEK_SET);
+ if (res==-1) {
+ fprintf(stderr,"Seek failed: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ // (+3)&~3 for checksum...
+ const int pad_len=(length+3)&~3;
+ if (!buf) {
+ ours=buf=malloc(sizeof(char)*pad_len);
+ if (!buf) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return NULL;
+ }
+ }
+
+ res=fread(buf,1,pad_len,otf->f);
+ if (res!=pad_len) {
+ if (res==length) { // file size not multiple of 4, pad with zero
+ memset(buf+res,0,pad_len-length);
+ } else {
+ fprintf(stderr,"Short read\n");
+ free(ours);
+ return NULL;
+ }
+ }
+
+ return buf;
+}
+// }}}
+
+
+static int otf_get_ttc_start(OTF_FILE *otf,int use_ttc) // {{{
+{
+ char buf[4];
+
+ if (!otf->numTTC) { // >0 if TTC...
+ return 0;
+ }
+
+ int pos=0;
+ if ( (use_ttc<0)||(use_ttc>=otf->numTTC)||
+ (!otf_read(otf,buf,pos+12+4*use_ttc,4)) ) {
+ fprintf(stderr,"Bad TTC subfont number\n");
+ return -1;
+ }
+ return get_ULONG(buf);
+}
+// }}}
+
+OTF_FILE *otf_do_load(OTF_FILE *otf,int pos) // {{{
+{
+ int iA;
+ char buf[16];
+
+ // {{{ read offset table
+ if (otf_read(otf,buf,pos,12)) {
+ otf->version=get_ULONG(buf);
+ if (otf->version==0x00010000) { // 1.0 truetype
+ } else if (otf->version==OTF_TAG('O','T','T','O')) { // OTF(CFF)
+ otf->flags|=OTF_F_FMT_CFF;
+ } else if (otf->version==OTF_TAG('t','r','u','e')) { // (old mac)
+ } else if (otf->version==OTF_TAG('t','y','p','1')) { // sfnt wrapped type1
+ // TODO: unsupported
+ } else {
+ otf_close(otf);
+ otf=NULL;
+ }
+ pos+=12;
+ } else {
+ otf_close(otf);
+ otf=NULL;
+ }
+ if (!otf) {
+ fprintf(stderr,"Not a ttf font\n");
+ return NULL;
+ }
+ otf->numTables=get_USHORT(buf+4);
+ // }}}
+
+ // {{{ read directory
+ otf->tables=malloc(sizeof(OTF_DIRENT)*otf->numTables);
+ if (!otf->tables) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ otf_close(otf);
+ return NULL;
+ }
+ for (iA=0;iA<otf->numTables;iA++) {
+ if (!otf_read(otf,buf,pos,16)) {
+ otf_close(otf);
+ return NULL;
+ }
+ otf->tables[iA].tag=get_ULONG(buf);
+ otf->tables[iA].checkSum=get_ULONG(buf+4);
+ otf->tables[iA].offset=get_ULONG(buf+8);
+ otf->tables[iA].length=get_ULONG(buf+12);
+ if ( (otf->tables[iA].tag==OTF_TAG('C','F','F',' '))&&
+ ((otf->flags&OTF_F_FMT_CFF)==0) ) {
+ fprintf(stderr,"Wrong magic\n");
+ otf_close(otf);
+ return NULL;
+ } else if ( (otf->tables[iA].tag==OTF_TAG('g','l','y','p'))&&
+ (otf->flags&OTF_F_FMT_CFF) ) {
+ fprintf(stderr,"Wrong magic\n");
+ otf_close(otf);
+ return NULL;
+ }
+ pos+=16;
+ }
+ // }}}
+
+// otf->flags|=OTF_F_DO_CHECKSUM;
+ // {{{ check head table
+ int len=0;
+ char *head=otf_get_table(otf,OTF_TAG('h','e','a','d'),&len);
+ if ( (!head)||
+ (get_ULONG(head+0)!=0x00010000)|| // version
+ (len!=54)||
+ (get_ULONG(head+12)!=0x5F0F3CF5)|| // magic
+ (get_SHORT(head+52)!=0x0000) ) { // glyphDataFormat
+ fprintf(stderr,"Unsupported OTF font / head table \n");
+ free(head);
+ otf_close(otf);
+ return NULL;
+ }
+ // }}}
+ otf->unitsPerEm=get_USHORT(head+18);
+ otf->indexToLocFormat=get_SHORT(head+50);
+
+ // {{{ checksum whole file
+ if (otf->flags&OTF_F_DO_CHECKSUM) {
+ unsigned int csum=0;
+ char tmp[1024];
+ rewind(otf->f);
+ while (!feof(otf->f)) {
+ len=fread(tmp,1,1024,otf->f);
+ if (len&3) { // zero padding reqd.
+ memset(tmp+len,0,4-(len&3));
+ }
+ csum+=otf_checksum(tmp,len);
+ }
+ if (csum!=0xb1b0afba) {
+ fprintf(stderr,"Wrong global checksum\n");
+ free(head);
+ otf_close(otf);
+ return NULL;
+ }
+ }
+ // }}}
+ free(head);
+
+ // {{{ read maxp table / numGlyphs
+ char *maxp=otf_get_table(otf,OTF_TAG('m','a','x','p'),&len);
+ if (maxp) {
+ const unsigned int maxp_version=get_ULONG(maxp);
+ if ( (maxp_version==0x00005000)&&(len==6) ) { // version 0.5
+ otf->numGlyphs=get_USHORT(maxp+4);
+ if ( (otf->flags&OTF_F_FMT_CFF)==0) { // only CFF
+ free(maxp);
+ maxp=NULL;
+ }
+ } else if ( (maxp_version==0x00010000)&&(len==32) ) { // version 1.0
+ otf->numGlyphs=get_USHORT(maxp+4);
+ if (otf->flags&OTF_F_FMT_CFF) { // only TTF
+ free(maxp);
+ maxp=NULL;
+ }
+ } else {
+ free(maxp);
+ maxp=NULL;
+ }
+ }
+ if (!maxp) {
+ fprintf(stderr,"Unsupported OTF font / maxp table \n");
+ free(maxp);
+ otf_close(otf);
+ return NULL;
+ }
+ free(maxp);
+ // }}}
+
+ return otf;
+}
+// }}}
+
+OTF_FILE *otf_load(const char *file) // {{{
+{
+ FILE *f;
+ OTF_FILE *otf;
+
+ int use_ttc=-1;
+ if ((f=fopen(file,"rb"))==NULL) {
+ // check for TTC
+ char *tmp=strrchr(file,'/'),*end;
+ if (tmp) {
+ use_ttc=strtoul(tmp+1,&end,10);
+ if (!*end) {
+ end=malloc((tmp-file+1)*sizeof(char));
+ if (!end) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return NULL;
+ }
+ strncpy(end,file,tmp-file);
+ end[tmp-file]=0;
+ f=fopen(end,"rb");
+ free(end);
+ }
+ }
+ if (!f) {
+ fprintf(stderr,"Could not open \"%s\": %s\n", file, strerror(errno));
+ return NULL;
+ }
+ }
+ otf=otf_new(f);
+ if (!otf) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ fclose(f);
+ return NULL;
+ }
+
+ char buf[12];
+ int pos=0;
+ // {{{ check for TTC
+ if (otf_read(otf,buf,pos,12)) {
+ const unsigned int version=get_ULONG(buf);
+ if (version==OTF_TAG('t','t','c','f')) {
+ const unsigned int ttc_version=get_ULONG(buf+4);
+ if ( (ttc_version!=0x00010000)&&(ttc_version!=0x00020000) ) {
+ fprintf(stderr,"Unsupported TTC version\n");
+ otf_close(otf);
+ return NULL;
+ }
+ otf->numTTC=get_ULONG(buf+8);
+ otf->useTTC=use_ttc;
+ pos=otf_get_ttc_start(otf,use_ttc);
+ if (pos==-1) {
+ otf_close(otf);
+ return NULL;
+ }
+ }
+ } else {
+ fprintf(stderr,"Not a ttf font\n");
+ otf_close(otf);
+ return NULL;
+ }
+ // }}}
+
+ return otf_do_load(otf,pos);
+}
+// }}}
+
+void otf_close(OTF_FILE *otf) // {{{
+{
+ assert(otf);
+ if (otf) {
+ free(otf->gly);
+ free(otf->cmap);
+ free(otf->name);
+ free(otf->hmtx);
+ free(otf->glyphOffsets);
+ fclose(otf->f);
+ free(otf->tables);
+ free(otf);
+ }
+}
+// }}}
+
+static int otf_dirent_compare(const void *a,const void *b) // {{{
+{
+ const unsigned int aa=((const OTF_DIRENT *)a)->tag;
+ const unsigned int bb=((const OTF_DIRENT *)b)->tag;
+ if (aa<bb) {
+ return -1;
+ } else if (aa>bb) {
+ return 1;
+ }
+ return 0;
+}
+// }}}
+
+int otf_find_table(OTF_FILE *otf,unsigned int tag) // {{{ - table_index or -1 on error
+{
+#if 0
+ // binary search would require raw table
+ int pos=0;
+ char buf[12];
+ if (!otf_read(otf,buf,pos,12)) {
+ return -1;
+ }
+ pos=12;
+ const unsigned int numTables=get_USHORT(buf+4);
+ char *tables=malloc(16*numTables);
+ if (!tables) {
+ return -1;
+ }
+ if (!otf_read(otf,tables,pos,16*numTables)) {
+ free(tables);
+ return -1;
+ }
+ char target[]={(tag>>24),(tag>>16),(tag>>8),tag};
+ // assert(get_USHORT(buf+6)+get_USHORT(buf+10)==16*numTables);
+ char *result=otf_bsearch(tables,target,4,
+ get_USHORT(buf+6),
+ get_USHORT(buf+8),
+ get_USHORT(buf+10),0);
+ free(tables);
+ if (result) {
+ return (result-tables)/16;
+ }
+#elif 1
+ OTF_DIRENT key={.tag=tag},*res;
+ res=bsearch(&key,otf->tables,otf->numTables,sizeof(otf->tables[0]),otf_dirent_compare);
+ if (res) {
+ return (res-otf->tables);
+ }
+#else
+ int iA;
+ for (iA=0;iA<otf->numTables;iA++) {
+ if (otf->tables[iA].tag==tag) {
+ return iA;
+ }
+ }
+#endif
+ return -1;
+}
+// }}}
+
+char *otf_get_table(OTF_FILE *otf,unsigned int tag,int *ret_len) // {{{
+{
+ assert(otf);
+ assert(ret_len);
+
+ const int idx=otf_find_table(otf,tag);
+ if (idx==-1) {
+ *ret_len=-1;
+ return NULL;
+ }
+ const OTF_DIRENT *table=otf->tables+idx;
+
+ char *ret=otf_read(otf,NULL,table->offset,table->length);
+ if (!ret) {
+ return NULL;
+ }
+ if (otf->flags&OTF_F_DO_CHECKSUM) {
+ unsigned int csum=otf_checksum(ret,table->length);
+ if (tag==OTF_TAG('h','e','a','d')) { // special case
+ csum-=get_ULONG(ret+8);
+ }
+ if (csum!=table->checkSum) {
+ fprintf(stderr,"Wrong checksum for %c%c%c%c\n",OTF_UNTAG(tag));
+ free(ret);
+ return NULL;
+ }
+ }
+ *ret_len=table->length;
+ return ret;
+}
+// }}}
+
+int otf_load_glyf(OTF_FILE *otf) // {{{ - 0 on success
+{
+ assert((otf->flags&OTF_F_FMT_CFF)==0); // not for CFF
+ int iA,len;
+ // {{{ find glyf table
+ iA=otf_find_table(otf,OTF_TAG('g','l','y','f'));
+ if (iA==-1) {
+ fprintf(stderr,"Unsupported OTF font / glyf table \n");
+ return -1;
+ }
+ otf->glyfTable=otf->tables+iA;
+ // }}}
+
+ // {{{ read loca table
+ char *loca=otf_get_table(otf,OTF_TAG('l','o','c','a'),&len);
+ if ( (!loca)||
+ (otf->indexToLocFormat>=2)||
+ (((len+3)&~3)!=((((otf->numGlyphs+1)*(otf->indexToLocFormat+1)*2)+3)&~3)) ) {
+ fprintf(stderr,"Unsupported OTF font / loca table \n");
+ return -1;
+ }
+ if (otf->glyphOffsets) {
+ free(otf->glyphOffsets);
+ assert(0);
+ }
+ otf->glyphOffsets=malloc((otf->numGlyphs+1)*sizeof(unsigned int));
+ if (!otf->glyphOffsets) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return -1;
+ }
+ if (otf->indexToLocFormat==0) {
+ for (iA=0;iA<=otf->numGlyphs;iA++) {
+ otf->glyphOffsets[iA]=get_USHORT(loca+iA*2)*2;
+ }
+ } else { // indexToLocFormat==1
+ for (iA=0;iA<=otf->numGlyphs;iA++) {
+ otf->glyphOffsets[iA]=get_ULONG(loca+iA*4);
+ }
+ }
+ free(loca);
+ if (otf->glyphOffsets[otf->numGlyphs]>otf->glyfTable->length) {
+ fprintf(stderr,"Bad loca table \n");
+ return -1;
+ }
+ // }}}
+
+ // {{{ allocate otf->gly slot
+ int maxGlyfLen=0; // no single glyf takes more space
+ for (iA=1;iA<=otf->numGlyphs;iA++) {
+ const int glyfLen=otf->glyphOffsets[iA]-otf->glyphOffsets[iA-1];
+ if (glyfLen<0) {
+ fprintf(stderr,"Bad loca table: glyph len %d\n",glyfLen);
+ return -1;
+ }
+ if (maxGlyfLen<glyfLen) {
+ maxGlyfLen=glyfLen;
+ }
+ }
+ if (otf->gly) {
+ free(otf->gly);
+ assert(0);
+ }
+ otf->gly=malloc(maxGlyfLen*sizeof(char));
+ if (!otf->gly) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return -1;
+ }
+ // }}}
+
+ return 0;
+}
+// }}}
+
+int otf_load_more(OTF_FILE *otf) // {{{ - 0 on success => hhea,hmtx,name,[glyf]
+{
+ int iA;
+
+ int len;
+ if ((otf->flags&OTF_F_FMT_CFF)==0) { // not for CFF
+ if (otf_load_glyf(otf)==-1) {
+ return -1;
+ }
+ }
+
+ // {{{ read hhea table
+ char *hhea=otf_get_table(otf,OTF_TAG('h','h','e','a'),&len);
+ if ( (!hhea)||
+ (get_ULONG(hhea)!=0x00010000)|| // version
+ (len!=36)||
+ (get_SHORT(hhea+32)!=0) ) { // metric format
+ fprintf(stderr,"Unsupported OTF font / hhea table \n");
+ return -1;
+ }
+ otf->numberOfHMetrics=get_USHORT(hhea+34);
+ free(hhea);
+ // }}}
+
+ // {{{ read hmtx table
+ char *hmtx=otf_get_table(otf,OTF_TAG('h','m','t','x'),&len);
+ if ( (!hmtx)||
+ (len!=otf->numberOfHMetrics*2+otf->numGlyphs*2) ) {
+ fprintf(stderr,"Unsupported OTF font / hmtx table \n");
+ return -1;
+ }
+ if (otf->hmtx) {
+ free(otf->hmtx);
+ assert(0);
+ }
+ otf->hmtx=hmtx;
+ // }}}
+
+ // {{{ read name table
+ char *name=otf_get_table(otf,OTF_TAG('n','a','m','e'),&len);
+ if ( (!name)||
+ (get_USHORT(name)!=0x0000)|| // version
+ (len<get_USHORT(name+2)*12+6)||
+ (len<=get_USHORT(name+4)) ) {
+ fprintf(stderr,"Unsupported OTF font / name table \n");
+ return -1;
+ }
+ // check bounds
+ int name_count=get_USHORT(name+2);
+ const char *nstore=name+get_USHORT(name+4);
+ for (iA=0;iA<name_count;iA++) {
+ const char *nrec=name+6+12*iA;
+ if (nstore-name+get_USHORT(nrec+10)+get_USHORT(nrec+8)>len) {
+ fprintf(stderr,"Bad name table \n");
+ free(name);
+ return -1;
+ }
+ }
+ if (otf->name) {
+ free(otf->name);
+ assert(0);
+ }
+ otf->name=name;
+ // }}}
+
+ return 0;
+}
+// }}}
+
+int otf_load_cmap(OTF_FILE *otf) // {{{ - 0 on success
+{
+ int iA;
+ int len;
+
+ char *cmap=otf_get_table(otf,OTF_TAG('c','m','a','p'),&len);
+ if ( (!cmap)||
+ (get_USHORT(cmap)!=0x0000)|| // version
+ (len<get_USHORT(cmap+2)*8+4) ) {
+ fprintf(stderr,"Unsupported OTF font / cmap table \n");
+ assert(0);
+ return -1;
+ }
+ // check bounds, find (3,0) or (3,1) [TODO?]
+ const int numTables=get_USHORT(cmap+2);
+ for (iA=0;iA<numTables;iA++) {
+ const char *nrec=cmap+4+8*iA;
+ const unsigned int offset=get_ULONG(nrec+4);
+ const char *ndata=cmap+offset;
+ if ( (ndata<cmap+4+8*numTables)||
+ (offset>=len)||
+ (offset+get_USHORT(ndata+2)>len) ) {
+ fprintf(stderr,"Bad cmap table \n");
+ free(cmap);
+ assert(0);
+ return -1;
+ }
+ if ( (get_USHORT(nrec)==3)&&
+ (get_USHORT(nrec+2)<=1)&&
+ (get_USHORT(ndata)==4)&&
+ (get_USHORT(ndata+4)==0) ) {
+ otf->unimap=ndata;
+ }
+ }
+ if (otf->cmap) {
+ free(otf->cmap);
+ assert(0);
+ }
+ otf->cmap=cmap;
+
+ return 0;
+}
+// }}}
+
+int otf_get_width(OTF_FILE *otf,unsigned short gid) // {{{ -1 on error
+{
+ assert(otf);
+
+ if (gid>=otf->numGlyphs) {
+ return -1;
+ }
+
+ // ensure hmtx is there
+ if (!otf->hmtx) {
+ if (otf_load_more(otf)!=0) {
+ assert(0);
+ return -1;
+ }
+ }
+
+ return get_width_fast(otf,gid);
+#if 0
+ if (gid>=otf->numberOfHMetrics) {
+ return get_USHORT(otf->hmtx+(otf->numberOfHMetrics-1)*2);
+ // TODO? lsb=get_SHORT(otf->hmtx+otf->numberOfHMetrics*2+gid*2); // lsb: left_side_bearing (also in table)
+ }
+ return get_USHORT(otf->hmtx+gid*4);
+ // TODO? lsb=get_SHORT(otf->hmtx+gid*4+2);
+#endif
+}
+// }}}
+
+static int otf_name_compare(const void *a,const void *b) // {{{
+{
+ return memcmp(a,b,8);
+}
+// }}}
+
+const char *otf_get_name(OTF_FILE *otf,int platformID,int encodingID,int languageID,int nameID,int *ret_len) // {{{
+{
+ assert(otf);
+ assert(ret_len);
+
+ // ensure name is there
+ if (!otf->name) {
+ if (otf_load_more(otf)!=0) {
+ *ret_len=-1;
+ assert(0);
+ return NULL;
+ }
+ }
+
+ char key[8];
+ set_USHORT(key,platformID);
+ set_USHORT(key+2,encodingID);
+ set_USHORT(key+4,languageID);
+ set_USHORT(key+6,nameID);
+
+ char *res=bsearch(key,otf->name+6,get_USHORT(otf->name+2),12,otf_name_compare);
+ if (res) {
+ *ret_len=get_USHORT(res+8);
+ int npos=get_USHORT(res+10);
+ const char *nstore=otf->name+get_USHORT(otf->name+4);
+ return nstore+npos;
+ }
+ *ret_len=0;
+ return NULL;
+}
+// }}}
+
+int otf_get_glyph(OTF_FILE *otf,unsigned short gid) // {{{ result in >otf->gly, returns length, -1 on error
+{
+ assert(otf);
+ assert((otf->flags&OTF_F_FMT_CFF)==0); // not for CFF
+
+ if (gid>=otf->numGlyphs) {
+ return -1;
+ }
+
+ // ensure >glyphOffsets and >gly is there
+ if ( (!otf->gly)||(!otf->glyphOffsets) ) {
+ if (otf_load_more(otf)!=0) {
+ assert(0);
+ return -1;
+ }
+ }
+
+ const int len=otf->glyphOffsets[gid+1]-otf->glyphOffsets[gid];
+ if (len==0) {
+ return 0;
+ }
+
+ assert(otf->glyfTable->length>=otf->glyphOffsets[gid+1]);
+ if (!otf_read(otf,otf->gly,
+ otf->glyfTable->offset+otf->glyphOffsets[gid],len)) {
+ return -1;
+ }
+
+ return len;
+}
+// }}}
+
+unsigned short otf_from_unicode(OTF_FILE *otf,int unicode) // {{{ 0 = missing
+{
+ assert(otf);
+ assert( (unicode>=0)&&(unicode<65536) );
+// assert((otf->flags&OTF_F_FMT_CFF)==0); // not for CFF, other method!
+
+ // ensure >cmap and >unimap is there
+ if (!otf->cmap) {
+ if (otf_load_cmap(otf)!=0) {
+ assert(0);
+ return 0; // TODO?
+ }
+ }
+ if (!otf->unimap) {
+ fprintf(stderr,"Unicode (3,1) cmap in format 4 not found\n");
+ return 0;
+ }
+
+#if 0
+ // linear search is cache friendly and should be quite fast
+#else
+ const unsigned short segCountX2=get_USHORT(otf->unimap+6);
+ char target[]={unicode>>8,unicode}; // set_USHORT(target,unicode);
+ char *result=otf_bsearch((char *)otf->unimap+14,target,2,
+ get_USHORT(otf->unimap+8),
+ get_USHORT(otf->unimap+10),
+ get_USHORT(otf->unimap+12),1);
+ if (result>=otf->unimap+14+segCountX2) { // outside of endCode[segCount]
+ assert(0); // bad font, no 0xffff sentinel
+ return 0;
+ }
+
+ result+=2+segCountX2; // jump over padding into startCode[segCount]
+ const unsigned short startCode=get_USHORT(result);
+ if (startCode>unicode) {
+ return 0;
+ }
+ result+=2*segCountX2;
+ const unsigned short rangeOffset=get_USHORT(result);
+ if (rangeOffset) {
+ return get_USHORT(result+rangeOffset+2*(unicode-startCode)); // the so called "obscure indexing trick" into glyphIdArray[]
+ // NOTE: this is according to apple spec; microsoft says we must add delta (probably incorrect; fonts probably have delta==0)
+ } else {
+ const short delta=get_SHORT(result-segCountX2);
+ return (delta+unicode)&0xffff;
+ }
+#endif
+}
+// }}}
+
+/** output stuff **/
+int otf_action_copy(void *param,int table_no,OUTPUT_FN output,void *context) // {{{
+{
+ OTF_FILE *otf=param;
+ const OTF_DIRENT *table=otf->tables+table_no;
+
+ if (!output) { // get checksum and unpadded length
+ *(unsigned int *)context=table->checkSum;
+ return table->length;
+ }
+
+// TODO? copy_block(otf->f,table->offset,(table->length+3)&~3,output,context);
+// problem: PS currently depends on single-output. also checksum not possible
+ char *data=otf_read(otf,NULL,table->offset,table->length);
+ if (!data) {
+ return -1;
+ }
+ int ret=(table->length+3)&~3;
+ (*output)(data,ret,context);
+ free(data);
+ return ret; // padded length
+}
+// }}}
+
+// TODO? >modified time-stamp?
+// Note: don't use this directly. otf_write_sfnt will internally replace otf_action_copy for head with this
+int otf_action_copy_head(void *param,int csum,OUTPUT_FN output,void *context) // {{{
+{
+ OTF_FILE *otf=param;
+ const int table_no=otf_find_table(otf,OTF_TAG('h','e','a','d')); // we can't have csum AND table_no ... never mind!
+ assert(table_no!=-1);
+ const OTF_DIRENT *table=otf->tables+table_no;
+
+ if (!output) { // get checksum and unpadded length
+ *(unsigned int *)context=table->checkSum;
+ return table->length;
+ }
+
+ char *data=otf_read(otf,NULL,table->offset,table->length);
+ if (!data) {
+ return -1;
+ }
+ set_ULONG(data+8,0xb1b0afba-csum); // head. fix global checksum
+ int ret=(table->length+3)&~3;
+ (*output)(data,ret,context);
+ free(data);
+ return ret; // padded length
+}
+// }}}
+
+int otf_action_replace(void *param,int length,OUTPUT_FN output,void *context) // {{{
+{
+ char *data=param;
+ char pad[4]={0,0,0,0};
+
+ int ret=(length+3)&~3;
+ if (!output) { // get checksum and unpadded length
+ if (ret!=length) {
+ unsigned int csum=otf_checksum(data,ret-4);
+ memcpy(pad,data+ret-4,ret-length);
+ csum+=get_ULONG(pad);
+ *(unsigned int *)context=csum;
+ } else {
+ *(unsigned int *)context=otf_checksum(data,length);
+ }
+ return length;
+ }
+
+ (*output)(data,length,context);
+ if (ret!=length) {
+ (*output)(pad,ret-length,context);
+ }
+
+ return ret; // padded length
+}
+// }}}
+
+/* windows "works best" with the following ordering:
+ head, hhea, maxp, OS/2, hmtx, LTSH, VDMX, hdmx, cmap, fpgm, prep, cvt, loca, glyf, kern, name, post, gasp, PCLT, DSIG
+or for CFF:
+ head, hhea, maxp, OS/2, name, cmap, post, CFF, (other tables, as convenient)
+*/
+#define NUM_PRIO 20
+static const struct { int prio; unsigned int tag; } otf_tagorder_win[]={ // {{{
+ {19,OTF_TAG('D','S','I','G')},
+ { 5,OTF_TAG('L','T','S','H')},
+ { 3,OTF_TAG('O','S','/','2')},
+ {18,OTF_TAG('P','C','L','T')},
+ { 6,OTF_TAG('V','D','M','X')},
+ { 8,OTF_TAG('c','m','a','p')},
+ {11,OTF_TAG('c','v','t',' ')},
+ { 9,OTF_TAG('f','p','g','m')},
+ {17,OTF_TAG('g','a','s','p')},
+ {13,OTF_TAG('g','l','y','f')},
+ { 7,OTF_TAG('h','d','m','x')},
+ { 0,OTF_TAG('h','e','a','d')},
+ { 1,OTF_TAG('h','h','e','a')},
+ { 4,OTF_TAG('h','m','t','x')},
+ {14,OTF_TAG('k','e','r','n')},
+ {12,OTF_TAG('l','o','c','a')},
+ { 2,OTF_TAG('m','a','x','p')},
+ {15,OTF_TAG('n','a','m','e')},
+ {16,OTF_TAG('p','o','s','t')},
+ {10,OTF_TAG('p','r','e','p')}};
+// }}}
+
+int otf_write_sfnt(struct _OTF_WRITE *otw,unsigned int version,int numTables,OUTPUT_FN output,void *context) // {{{
+{
+ int iA;
+ int ret;
+
+ int *order=malloc(sizeof(int)*numTables); // temporary
+ char *start=malloc(12+16*numTables);
+ if ( (!order)||(!start) ) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ free(order);
+ free(start);
+ return -1;
+ }
+
+ if (1) { // sort tables
+ int priolist[NUM_PRIO]={0,};
+
+ // reverse intersection of both sorted arrays
+ int iA=numTables-1,iB=sizeof(otf_tagorder_win)/sizeof(otf_tagorder_win[0])-1;
+ int ret=numTables-1;
+ while ( (iA>=0)&&(iB>=0) ) {
+ if (otw[iA].tag==otf_tagorder_win[iB].tag) {
+ priolist[otf_tagorder_win[iB--].prio]=1+iA--;
+ } else if (otw[iA].tag>otf_tagorder_win[iB].tag) { // no order known: put unchanged at end of result
+ order[ret--]=iA--;
+ } else { // <
+ iB--;
+ }
+ }
+ for (iA=NUM_PRIO-1;iA>=0;iA--) { // pick the matched tables up in sorted order (bucketsort principle)
+ if (priolist[iA]) {
+ order[ret--]=priolist[iA]-1;
+ }
+ }
+ } else {
+ for (iA=0;iA<numTables;iA++) {
+ order[iA]=iA;
+ }
+ }
+
+ // the header
+ set_ULONG(start,version);
+ set_USHORT(start+4,numTables);
+ int a,b,c;
+ otf_bsearch_params(numTables,16,&a,&b,&c);
+ set_USHORT(start+6,a);
+ set_USHORT(start+8,b);
+ set_USHORT(start+10,c);
+
+ // first pass: calculate table directory / offsets and checksums
+ unsigned int globalSum=0,csum;
+ int offset=12+16*numTables;
+ int headAt=-1;
+ for (iA=0;iA<numTables;iA++) {
+ char *entry=start+12+16*order[iA];
+ const int res=(*otw[order[iA]].action)(otw[order[iA]].param,otw[order[iA]].length,NULL,&csum);
+ assert(res>=0);
+ if (otw[order[iA]].tag==OTF_TAG('h','e','a','d')) {
+ headAt=order[iA];
+ }
+ set_ULONG(entry,otw[order[iA]].tag);
+ set_ULONG(entry+4,csum);
+ set_ULONG(entry+8,offset);
+ set_ULONG(entry+12,res);
+ offset+=(res+3)&~3; // padding
+ globalSum+=csum;
+ }
+
+ // second pass: write actual data
+ // write header + directory
+ ret=12+16*numTables;
+ (*output)(start,ret,context);
+ globalSum+=otf_checksum(start,ret);
+
+ // change head
+ if ( (headAt!=-1)&&(otw[headAt].action==otf_action_copy) ) { // more needed?
+ otw[headAt].action=otf_action_copy_head;
+ otw[headAt].length=globalSum;
+ }
+
+ // write tables
+ for (iA=0;iA<numTables;iA++) {
+ const int res=(*otw[order[iA]].action)(otw[order[iA]].param,otw[order[iA]].length,output,context);
+ if (res<0) {
+ free(order);
+ free(start);
+ return -1;
+ }
+ assert(((res+3)&~3)==res); // correctly padded? (i.e. next line is just ret+=res;)
+ ret+=(res+3)&~3;
+ }
+ assert(offset==ret);
+ free(order);
+ free(start);
+
+ return ret;
+}
+// }}}
+
--- /dev/null
+#ifndef _SFNT_H
+#define _SFNT_H
+
+#include <stdio.h>
+
+typedef struct {
+ unsigned int tag;
+ unsigned int checkSum;
+ unsigned int offset;
+ unsigned int length;
+} OTF_DIRENT;
+
+typedef struct {
+ FILE *f;
+ unsigned int numTTC,useTTC;
+ unsigned int version;
+
+ unsigned short numTables;
+ OTF_DIRENT *tables;
+
+ int flags;
+ unsigned short unitsPerEm;
+ unsigned short indexToLocFormat; // 0=short, 1=long
+ unsigned short numGlyphs;
+
+ // optionally loaded data
+ unsigned int *glyphOffsets;
+ unsigned short numberOfHMetrics;
+ char *hmtx,*name,*cmap;
+ const char *unimap; // ptr to (3,1) or (3,0) cmap start
+
+ // single glyf buffer, allocated large enough by otf_load_more()
+ char *gly;
+ OTF_DIRENT *glyfTable;
+
+} OTF_FILE;
+#define OTF_F_FMT_CFF 0x10000
+#define OTF_F_DO_CHECKSUM 0x40000
+
+// to load TTC collections: append e.g. "/3" for the third font in the file.
+OTF_FILE *otf_load(const char *file);
+void otf_close(OTF_FILE *otf);
+
+#define OTF_TAG(a,b,c,d) (unsigned int)( ((a)<<24)|((b)<<16)|((c)<<8)|(d) )
+#define OTF_UNTAG(a) (((unsigned int)(a)>>24)&0xff),(((unsigned int)(a)>>16)&0xff),\
+ (((unsigned int)(a)>>8)&0xff),(((unsigned int)(a))&0xff)
+
+char *otf_get_table(OTF_FILE *otf,unsigned int tag,int *ret_len);
+
+int otf_get_width(OTF_FILE *otf,unsigned short gid);
+const char *otf_get_name(OTF_FILE *otf,int platformID,int encodingID,int languageID,int nameID,int *ret_len);
+int otf_get_glyph(OTF_FILE *otf,unsigned short gid);
+unsigned short otf_from_unicode(OTF_FILE *otf,int unicode);
+
+#include "bitset.h"
+#include "iofn.h"
+
+// TODO?! allow glyphs==NULL for non-subsetting table reduction?
+int otf_subset(OTF_FILE *otf,BITSET glyphs,OUTPUT_FN output,void *context);
+int otf_ttc_extract(OTF_FILE *otf,OUTPUT_FN output,void *context);
+int otf_subset_cff(OTF_FILE *otf,BITSET glyphs,OUTPUT_FN output,void *context);
+int otf_cff_extract(OTF_FILE *otf,OUTPUT_FN output,void *context);
+
+#endif
--- /dev/null
+#ifndef _SFNT_INT_H
+#define _SFNT_INT_H
+
+static inline unsigned short get_USHORT(const char *buf) // {{{
+{
+ return ((unsigned char)buf[0]<<8)|((unsigned char)buf[1]);
+}
+// }}}
+static inline short get_SHORT(const char *buf) // {{{
+{
+ return (buf[0]<<8)|((unsigned char)buf[1]);
+}
+// }}}
+static inline unsigned int get_UINT24(const char *buf) // {{{
+{
+ return ((unsigned char)buf[0]<<16)|
+ ((unsigned char)buf[1]<<8)|
+ ((unsigned char)buf[2]);
+}
+// }}}
+static inline unsigned int get_ULONG(const char *buf) // {{{
+{
+ return ((unsigned char)buf[0]<<24)|
+ ((unsigned char)buf[1]<<16)|
+ ((unsigned char)buf[2]<<8)|
+ ((unsigned char)buf[3]);
+}
+// }}}
+static inline int get_LONG(const char *buf) // {{{
+{
+ return (buf[0]<<24)|
+ ((unsigned char)buf[1]<<16)|
+ ((unsigned char)buf[2]<<8)|
+ ((unsigned char)buf[3]);
+}
+// }}}
+
+static inline void set_USHORT(char *buf,unsigned short val) // {{{
+{
+ buf[0]=val>>8;
+ buf[1]=val&0xff;
+}
+// }}}
+static inline void set_ULONG(char *buf,unsigned int val) // {{{
+{
+ buf[0]=val>>24;
+ buf[1]=(val>>16)&0xff;
+ buf[2]=(val>>8)&0xff;
+ buf[3]=val&0xff;
+}
+// }}}
+
+static inline unsigned int otf_checksum(const char *buf, unsigned int len) // {{{
+{
+ unsigned int ret=0;
+ for (len=(len+3)/4;len>0;len--,buf+=4) {
+ ret+=get_ULONG(buf);
+ }
+ return ret;
+}
+// }}}
+static inline int get_width_fast(OTF_FILE *otf,int gid) // {{{
+{
+ if (gid>=otf->numberOfHMetrics) {
+ return get_USHORT(otf->hmtx+(otf->numberOfHMetrics-1)*4);
+ } else {
+ return get_USHORT(otf->hmtx+gid*4);
+ }
+}
+// }}}
+
+int otf_load_glyf(OTF_FILE *otf); // - 0 on success
+int otf_load_more(OTF_FILE *otf); // - 0 on success
+
+int otf_find_table(OTF_FILE *otf,unsigned int tag); // - table_index or -1 on error
+
+int otf_action_copy(void *param,int csum,OUTPUT_FN output,void *context);
+int otf_action_replace(void *param,int csum,OUTPUT_FN output,void *context);
+
+// Note: don't use this directly. otf_write_sfnt will internally replace otf_action_copy for head with this
+int otf_action_copy_head(void *param,int csum,OUTPUT_FN output,void *context);
+
+struct _OTF_WRITE {
+ unsigned long tag;
+ int (*action)(void *param,int length,OUTPUT_FN output,void *context); // -1 on error, num_bytes_written on success; if >output==NULL return checksum in (unsigned int *)context instead.
+ void *param;
+ int length;
+};
+
+int otf_write_sfnt(struct _OTF_WRITE *otw,unsigned int version,int numTables,OUTPUT_FN output,void *context);
+
+/** from sfnt_subset.c: **/
+
+// otw {0,}-terminated, will be modified; returns numTables for otf_write_sfnt
+int otf_intersect_tables(OTF_FILE *otf,struct _OTF_WRITE *otw);
+
+#endif
--- /dev/null
+#include "sfnt.h"
+#include "sfnt_int.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include "bitset.h"
+
+int otf_ttc_extract(OTF_FILE *otf,OUTPUT_FN output,void *context) // {{{
+{
+ assert(otf);
+ assert(output);
+ assert(otf->numTTC);
+ int iA;
+
+ struct _OTF_WRITE *otw;
+ otw=malloc(sizeof(struct _OTF_WRITE)*otf->numTables);
+ if (!otw) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ return -1;
+ }
+
+ // just copy everything
+ for (iA=0;iA<otf->numTables;iA++) {
+ otw[iA].tag=otf->tables[iA].tag;
+ otw[iA].action=otf_action_copy;
+ otw[iA].param=otf;
+ otw[iA].length=iA;
+ }
+ iA=otf_write_sfnt(otw,otf->version,otf->numTables,output,context);
+ free(otw);
+
+ return iA;
+}
+// }}}
+
+// otw {0,}-terminated, will be modified; returns numTables for otf_write_sfnt
+int otf_intersect_tables(OTF_FILE *otf,struct _OTF_WRITE *otw) // {{{
+{
+ int iA,iB,numTables=0;
+ for (iA=0,iB=0;(iA<otf->numTables)&&(otw[iB].tag);) {
+ if (otf->tables[iA].tag==otw[iB].tag) {
+ if (otw[iB].action==otf_action_copy) {
+ otw[iB].length=iA; // original table location found.
+ }
+ if (iB!=numTables) { // >, actually
+ memmove(otw+numTables,otw+iB,sizeof(struct _OTF_WRITE));
+ }
+ iA++;
+ iB++;
+ numTables++;
+ } else if (otf->tables[iA].tag<otw[iB].tag) {
+ iA++;
+ } else { // not in otf->tables
+ if (otw[iB].action!=otf_action_copy) { // keep
+ if (iB!=numTables) { // >, actually
+ memmove(otw+numTables,otw+iB,sizeof(struct _OTF_WRITE));
+ }
+ numTables++;
+ } // else delete
+ iB++;
+ }
+ }
+ return numTables;
+}
+// }}}
+
+
+// include components (set bit in >glyphs) of currently loaded compound glyph (with >curgid)
+// returns additional space requirements (when bits below >donegid are touched)
+static int otf_subset_glyf(OTF_FILE *otf,int curgid,int donegid,BITSET glyphs) // {{{
+{
+ int ret=0;
+ if (get_SHORT(otf->gly)>=0) { // not composite
+ return ret; // done
+ }
+
+ char *cur=otf->gly+10;
+
+ unsigned short flags;
+ do {
+ flags=get_USHORT(cur);
+ const unsigned short sub_gid=get_USHORT(cur+2);
+ assert(sub_gid<otf->numGlyphs);
+ if (!bit_check(glyphs,sub_gid)) {
+ // bad: temporarily load sub glyph
+ const int len=otf_get_glyph(otf,sub_gid);
+ assert(len>0);
+ bit_set(glyphs,sub_gid);
+ if (sub_gid<donegid) {
+ ret+=len;
+ ret+=otf_subset_glyf(otf,sub_gid,donegid,glyphs); // composite of composites?, e.g. in DejaVu
+ }
+ const int res=otf_get_glyph(otf,curgid); // reload current glyph
+ assert(res);
+ }
+
+ // skip parameters
+ cur+=6;
+ if (flags&0x01) {
+ cur+=2;
+ }
+ if (flags&0x08) {
+ cur+=2;
+ } else if (flags&0x40) {
+ cur+=4;
+ } else if (flags&0x80) {
+ cur+=8;
+ }
+ } while (flags&0x20); // more components
+
+ return ret;
+}
+// }}}
+
+// TODO: cmap only required in non-CID context
+int otf_subset(OTF_FILE *otf,BITSET glyphs,OUTPUT_FN output,void *context) // {{{ - returns number of bytes written
+{
+ assert(otf);
+ assert(glyphs);
+ assert(output);
+
+ int iA,b,c;
+
+ // first pass: include all required glyphs
+ bit_set(glyphs,0); // .notdef always required
+ int glyfSize=0;
+ for (iA=0,b=0,c=1;iA<otf->numGlyphs;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+ if (glyphs[b]&c) {
+ int len=otf_get_glyph(otf,iA);
+ if (len<0) {
+ assert(0);
+ return -1;
+ } else if (len>0) {
+ glyfSize+=len;
+ len=otf_subset_glyf(otf,iA,iA,glyphs);
+ if (len<0) {
+ assert(0);
+ return -1;
+ }
+ glyfSize+=len;
+ }
+ }
+ }
+
+ // second pass: calculate new glyf and loca
+ int locaSize=(otf->numGlyphs+1)*(otf->indexToLocFormat+1)*2;
+
+ char *new_loca=malloc(locaSize);
+ char *new_glyf=malloc(glyfSize);
+ if ( (!new_loca)||(!new_glyf) ) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ free(new_loca);
+ free(new_glyf);
+ return -1;
+ }
+
+ int offset=0;
+ for (iA=0,b=0,c=1;iA<otf->numGlyphs;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+
+ assert(offset%2==0);
+ // TODO? change format? if glyfSize<0x20000
+ if (otf->indexToLocFormat==0) {
+ set_USHORT(new_loca+iA*2,offset/2);
+ } else { // ==1
+ set_ULONG(new_loca+iA*4,offset);
+ }
+
+ if (glyphs[b]&c) {
+ const int len=otf_get_glyph(otf,iA);
+ assert(len>=0);
+ memcpy(new_glyf+offset,otf->gly,len);
+ offset+=len;
+ }
+ }
+ // last entry
+ if (otf->indexToLocFormat==0) {
+ set_USHORT(new_loca+otf->numGlyphs*2,offset/2);
+ } else { // ==1
+ set_ULONG(new_loca+otf->numGlyphs*4,offset);
+ }
+ assert(offset==glyfSize);
+
+ // determine new tables.
+ struct _OTF_WRITE otw[]={ // sorted
+ // TODO: cmap only required in non-CID context or always in CFF
+ {OTF_TAG('c','m','a','p'),otf_action_copy,otf,},
+ {OTF_TAG('c','v','t',' '),otf_action_copy,otf,},
+ {OTF_TAG('f','p','g','m'),otf_action_copy,otf,},
+ {OTF_TAG('g','l','y','f'),otf_action_replace,new_glyf,glyfSize},
+ {OTF_TAG('h','e','a','d'),otf_action_copy,otf,}, // _copy_head
+ {OTF_TAG('h','h','e','a'),otf_action_copy,otf,},
+ {OTF_TAG('h','m','t','x'),otf_action_copy,otf,},
+ {OTF_TAG('l','o','c','a'),otf_action_replace,new_loca,locaSize},
+ {OTF_TAG('m','a','x','p'),otf_action_copy,otf,},
+ {OTF_TAG('n','a','m','e'),otf_action_copy,otf,},
+ {OTF_TAG('p','r','e','p'),otf_action_copy,otf,},
+ // vhea vmtx (never used in PDF, but possible in PS>=3011)
+ {0,0,0,0}};
+
+ // and write them
+ int numTables=otf_intersect_tables(otf,otw);
+ int ret=otf_write_sfnt(otw,otf->version,numTables,output,context);
+
+ free(new_loca);
+ free(new_glyf);
+ return ret;
+
+ //TODO ? reduce cmap [to (1,0) ;-)]
+ //TODO (cmap for non-cid)
+}
+// }}}
+
+// TODO no subsetting actually done (for now)
+int otf_subset_cff(OTF_FILE *otf,BITSET glyphs,OUTPUT_FN output,void *context) // {{{ - returns number of bytes written
+{
+ assert(otf);
+ assert(output);
+
+// TODO char *new_cff=cff_subset(...);
+
+ // determine new tables.
+ struct _OTF_WRITE otw[]={
+ {OTF_TAG('C','F','F',' '),otf_action_copy,otf,},
+// {OTF_TAG('C','F','F',' '),otf_action_replace,new_glyf,glyfSize},
+ {OTF_TAG('c','m','a','p'),otf_action_copy,otf,},
+#if 0 // not actually needed!
+ {OTF_TAG('c','v','t',' '),otf_action_copy,otf,},
+ {OTF_TAG('f','p','g','m'),otf_action_copy,otf,},
+ {OTF_TAG('h','e','a','d'),otf_action_copy,otf,}, // _copy_head
+ {OTF_TAG('h','h','e','a'),otf_action_copy,otf,},
+ {OTF_TAG('h','m','t','x'),otf_action_copy,otf,},
+ {OTF_TAG('m','a','x','p'),otf_action_copy,otf,},
+ {OTF_TAG('n','a','m','e'),otf_action_copy,otf,},
+ {OTF_TAG('p','r','e','p'),otf_action_copy,otf,},
+#endif
+ {0,0,0,0}};
+
+ // and write them
+ int numTables=otf_intersect_tables(otf,otw);
+ int ret=otf_write_sfnt(otw,otf->version,numTables,output,context);
+
+// free(new_cff);
+ return ret;
+}
+// }}}
+
+//int copy_block(FILE *f,long pos,int length,OUTPUT_FN output,void *context); // copied bytes or -1 (also on premature EOF)
+
+static int copy_block(FILE *f,long pos,int length,OUTPUT_FN output,void *context) // {{{
+{
+ assert(f);
+ assert(output);
+
+ char buf[4096];
+ int iA,ret;
+
+ ret=fseek(f,pos,SEEK_SET);
+ if (ret==-1) {
+ fprintf(stderr,"Seek failed: %s\n", strerror(errno));
+ return -1;
+ }
+ ret=0;
+ while (length>4096) {
+ iA=fread(buf,1,4096,f);
+ if (iA<4096) {
+ return -1;
+ }
+ (*output)(buf,iA,context);
+ ret+=iA;
+ length-=iA;
+ };
+ iA=fread(buf,1,length,f);
+ if (iA<length) {
+ return -1;
+ }
+ (*output)(buf,iA,context);
+ ret+=iA;
+
+ return ret;
+}
+// }}}
+
+int otf_cff_extract(OTF_FILE *otf,OUTPUT_FN output,void *context) // {{{ - returns number of bytes written
+{
+ assert(otf);
+ assert(output);
+
+ int idx=otf_find_table(otf,OTF_TAG('C','F','F',' '));
+ if (idx==-1) {
+ return -1;
+ }
+ const OTF_DIRENT *table=otf->tables+idx;
+
+ return copy_block(otf->f,table->offset,table->length,output,context);
+}
+// }}}
+
+// CFF *otf_get_cff(); // not load, but create by "substream"-in ctor
+#if 0 // TODO elsewhere : char *cff_subset(...);
+ // first pass: include all required glyphs
+ bit_set(glyphs,0); // .notdef always required
+ int glyfSize=0;
+ for (iA=0,b=0,c=1;iA<otf->numGlyphs;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+ if (glyphs[b]&c) {
+// TODO: cff_glyph
+ }
+ }
+
+ // second pass: calculate new glyf and loca
+ char *new_cff=malloc(cffSize);
+ if (!new_cff) {
+ fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
+ assert(0);
+ return -1;
+ }
+
+ int offset=0;
+ for (iA=0,b=0,c=1;iA<otf->numGlyphs;iA++,c<<=1) {
+ if (!c) {
+ b++;
+ c=1;
+ }
+ if (glyphs[b]&c) {
+//...
+ }
+ }
+ return new_cff;
+#endif
--- /dev/null
+#include "sfnt.h"
+#include "sfnt_int.h"
+#include "embed.h"
+#include "config.h"
+#include "embed_sfnt_int.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+enum { WEIGHT_THIN=100,
+ WEIGHT_EXTRALIGHT=200, WEIGHT_ULTRALIGHT=200,
+ WEIGHT_LIGHT=300,
+ WEIGHT_NORMAL=400, WEIGHT_REGULAR=400,
+ WEIGHT_MEDIUM=500,
+ WEIGHT_SEMIBOLD=600, // DEMI
+ WEIGHT_BOLD=700,
+ WEIGHT_EXTRABOLD=800, WEIGHT_ULTRABOLD=800,
+ WEIGHT_BLACK=900, WEIGHT_HEAVY=900 };
+
+void show_post(OTF_FILE *otf) // {{{
+{
+ assert(otf);
+ int len=0;
+ char *buf;
+
+ buf=otf_get_table(otf,OTF_TAG('p','o','s','t'),&len);
+ if (!buf) {
+ assert(len==-1);
+ printf("No post table\n");
+ return;
+ }
+ // TODO: check len
+ printf("POST: (%d bytes)\n"
+ " version: %08x\n"
+ " italicAngle: %d.%d\n"
+ " underlinePosition: %d\n"
+ " underlineThickness: %d\n"
+ " isFixedPitch: %d\n"
+ " vmType42: %d %d\n"
+ " vmType1: %d %d\n",len,
+ get_ULONG(buf),
+ get_LONG(buf+4)>>16,get_ULONG(buf+4)&0xffff,
+ get_SHORT(buf+8),
+ get_SHORT(buf+10),
+ get_ULONG(buf+12),
+ get_ULONG(buf+16),get_ULONG(buf+20),
+ get_ULONG(buf+24),get_ULONG(buf+38));
+ free(buf);
+}
+// }}}
+
+void show_name(OTF_FILE *otf) // {{{
+{
+ assert(otf);
+ int iA,len=0;
+ char *buf;
+
+ buf=otf_get_table(otf,OTF_TAG('n','a','m','e'),&len);
+ if (!buf) {
+ assert(len==-1);
+ printf("No name table\n");
+ return;
+ }
+ printf("NAME:\n");
+ int name_count=get_USHORT(buf+2);
+ const char *nstore=buf+get_USHORT(buf+4);
+ for (iA=0;iA<name_count;iA++) {
+ const char *nrec=buf+6+12*iA;
+ printf(" { platformID/encodingID/languageID/nameID: %d/%d/%d/%d\n"
+ " length: %d, offset: %d, data :",
+ get_USHORT(nrec),
+ get_USHORT(nrec+2),
+ get_USHORT(nrec+4),
+ get_USHORT(nrec+6),
+ get_USHORT(nrec+8),
+ get_USHORT(nrec+10));
+ if ( (get_USHORT(nrec)==0)||
+ ( (get_USHORT(nrec)==3) ) ) { // WCHAR
+ int nlen=get_USHORT(nrec+8);
+ int npos=get_USHORT(nrec+10);
+ for (;nlen>0;nlen-=2,npos+=2) {
+ if (nstore[npos]!=0x00) {
+ printf("?");
+ } else {
+ printf("%c",nstore[npos+1]);
+ }
+ }
+ printf(" }\n");
+ } else {
+ printf("%.*s }\n",
+ get_USHORT(nrec+8),nstore+get_USHORT(nrec+10));
+ }
+ }
+ free(buf);
+}
+// }}}
+
+void show_cmap(OTF_FILE *otf) // {{{
+{
+ assert(otf);
+ int iA,len=0;
+
+ char *cmap=otf_get_table(otf,OTF_TAG('c','m','a','p'),&len);
+ if (!cmap) {
+ assert(len==-1);
+ printf("No cmap table\n");
+ return;
+ }
+ printf("cmap:\n");
+ assert(get_USHORT(cmap)==0x0000); // version
+ const int numTables=get_USHORT(cmap+2);
+ printf(" numTables: %d\n",numTables);
+ for (iA=0;iA<numTables;iA++) {
+ const char *nrec=cmap+4+8*iA;
+ const char *ndata=cmap+get_ULONG(nrec+4);
+ assert(ndata>=cmap+4+8*numTables);
+ printf(" platformID/encodingID: %d/%d\n"
+ " offset: %d data (format: %d, length: %d, language: %d);\n",
+ get_USHORT(nrec),get_USHORT(nrec+2),
+ get_ULONG(nrec+4),
+ get_USHORT(ndata),get_USHORT(ndata+2),get_USHORT(ndata+4));
+ }
+ free(cmap);
+}
+// }}}
+
+void show_glyf(OTF_FILE *otf,int full) // {{{
+{
+ assert(otf);
+
+ // ensure >glyphOffsets and >gly is there
+ if ( (!otf->gly)||(!otf->glyphOffsets) ) {
+ if (otf_load_glyf(otf)!=0) {
+ assert(0);
+ return;
+ }
+ }
+
+ int iA;
+ int compGlyf=0,zeroGlyf=0;
+
+ // {{{ glyf
+ assert(otf->gly);
+ for (iA=0;iA<otf->numGlyphs;iA++) {
+ int len=otf_get_glyph(otf,iA);
+ if (len==0) {
+ zeroGlyf++;
+ } else if (get_SHORT(otf->gly)==-1) {
+ compGlyf++;
+ }
+ if (full) {
+ printf("%d(%d) ",get_SHORT(otf->gly),len);
+ }
+ }
+ if (full) {
+ printf("\n");
+ }
+ printf("numGlyf(nonnull): %d(%d), composites: %d\n",otf->numGlyphs,otf->numGlyphs-zeroGlyf,compGlyf);
+ // }}}
+}
+// }}}
+
+void show_hmtx(OTF_FILE *otf) // {{{
+{
+ assert(otf);
+ int iA;
+
+ otf_get_width(otf,0); // load table.
+ if (!otf->hmtx) {
+ printf("NOTE: no hmtx table!\n");
+ return;
+ }
+ printf("hmtx (%d):\n",otf->numberOfHMetrics);
+ for (iA=0;iA<otf->numberOfHMetrics;iA++) {
+ printf("(%d,%d) ",
+ get_USHORT(otf->hmtx+iA*4),
+ get_SHORT(otf->hmtx+iA*4+2));
+ }
+ printf(" (last is repeated for the remaining %d glyphs)\n",otf->numGlyphs-otf->numberOfHMetrics);
+}
+// }}}
+
+int main(int argc,char **argv)
+{
+ const char *fn=TESTFONT;
+ if (argc==2) {
+ fn=argv[1];
+ }
+ OTF_FILE *otf=otf_load(fn);
+ assert(otf);
+ if (otf->numTTC) {
+ printf("TTC has %d fonts, using %d\n",otf->numTTC,otf->useTTC);
+ }
+ if (otf->version==0x00010000) {
+ printf("Got TTF 1.0\n");
+ } else if (otf->version==OTF_TAG('O','T','T','O')) {
+ printf("Got OTF(CFF)\n");
+ } else if (otf->version==OTF_TAG('t','r','u','e')) {
+ printf("Got TTF (true)\n");
+ } else if (otf->version==OTF_TAG('t','y','p','1')) {
+ printf("Got SFNT(Type1)\n");
+ }
+
+ printf("Has %d tables\n",otf->numTables);
+
+ int iA;
+ for (iA=0;iA<otf->numTables;iA++) {
+ printf("%c%c%c%c %d @%d\n",OTF_UNTAG(otf->tables[iA].tag),otf->tables[iA].length,otf->tables[iA].offset);
+ }
+ printf("unitsPerEm: %d, indexToLocFormat: %d\n",
+ otf->unitsPerEm,otf->indexToLocFormat);
+ printf("num glyphs: %d\n",otf->numGlyphs);
+ otf_get_width(otf,0); // load table.
+ printf("numberOfHMetrics: %d\n",otf->numberOfHMetrics);
+
+ printf("Embedding rights: %x\n",emb_otf_get_rights(otf));
+
+ show_post(otf);
+
+ show_name(otf);
+
+ show_cmap(otf);
+ // printf("%d %d\n",otf_from_unicode(otf,'A'),0);
+
+ if (!(otf->flags&OTF_F_FMT_CFF)) {
+ show_glyf(otf,1);
+ }
+
+ show_hmtx(otf);
+
+ otf_close(otf);
+
+ return 0;
+}
--- /dev/null
+#include "embed.h"
+#include "config.h"
+#include "sfnt.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static void example_outfn(const char *buf,int len,void *context) // {{{
+{
+ FILE *f=(FILE *)context;
+ if (fwrite(buf,1,len,f)!=len) {
+ fprintf(stderr,"Short write: %m\n");
+ assert(0);
+ return;
+ }
+}
+// }}}
+
+#define OBJ \
+ xref[xrefpos++]=ftell(f); \
+ fprintf(f,"%d 0 obj\n",xrefpos);
+
+#define ENDOBJ \
+ fprintf(f,"endobj\n");
+
+#define STREAMDICT \
+ OBJ; \
+ fprintf(f,"<<\n" \
+ " /Length %d 0 R\n",xrefpos+1);
+
+#define STREAMDATA \
+ fprintf(f,">>\n" \
+ "stream\n"); \
+ stream_len=-ftell(f);
+
+#define STREAM \
+ STREAMDICT \
+ STREAMDATA
+
+#define ENDSTREAM \
+ stream_len+=ftell(f); \
+ fprintf(f,"endstream\n" \
+ "endobj\n"); \
+ OBJ; \
+ fprintf(f,"%d\n",stream_len); \
+ ENDOBJ;
+
+static inline void write_string(FILE *f,EMB_PARAMS *emb,const char *str) // {{{
+{
+ assert(f);
+ assert(emb);
+ int iA;
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ putc('<',f);
+ for (iA=0;str[iA];iA++) {
+ const unsigned short gid=emb_get(emb,(unsigned char)str[iA]);
+ fprintf(f,"%04x",gid);
+ }
+ putc('>',f);
+ } else {
+ putc('(',f);
+ for (iA=0;str[iA];iA++) {
+ emb_get(emb,(unsigned char)str[iA]);
+ }
+ fprintf(f,"%s",str); // TODO
+ putc(')',f);
+ }
+}
+// }}}
+
+int main(int argc,char **argv)
+{
+ const char *fn=TESTFONT;
+ if (argc==2) {
+ fn=argv[1];
+ }
+ OTF_FILE *otf=otf_load(fn);
+ assert(otf);
+ FONTFILE *ff=fontfile_open_sfnt(otf);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PDF16,
+ EMB_C_FORCE_MULTIBYTE|
+ EMB_C_TAKE_FONTFILE);
+
+ FILE *f=fopen("test.pdf","w");
+ assert(f);
+ int xref[100],xrefpos=3;
+ int stream_len;
+
+ fprintf(f,"%%PDF-1.3\n");
+ // content
+ STREAM;
+ fprintf(f,"BT\n" // content
+ " 100 100 Td\n"
+ " /F1 10 Tf\n");
+ write_string(f,emb,"Hallo");
+ fprintf(f," Tj\n"
+ "ET\n");
+ ENDSTREAM;
+
+ emb_get(emb,'a');
+
+ // {{{ do font
+ EMB_PDF_FONTDESCR *fdes=emb_pdf_fontdescr(emb);
+ assert(fdes);
+ EMB_PDF_FONTWIDTHS *fwid=emb_pdf_fontwidths(emb);
+ assert(fwid);
+
+ STREAMDICT;
+ int ff_ref=xrefpos;
+ if (emb_pdf_get_fontfile_subtype(emb)) {
+ fprintf(f," /Subtype /%s\n",
+ emb_pdf_get_fontfile_subtype(emb));
+ }
+ if (emb->outtype==EMB_FMT_T1) {
+ fprintf(f," /Length1 ?\n"
+ " /Length2 ?\n"
+ " /Length3 ?\n");
+ } else if (emb->outtype==EMB_FMT_TTF) {
+ fprintf(f," /Length1 %d 0 R\n",xrefpos+2);
+ }
+ STREAMDATA;
+ const int outlen=emb_embed(emb,example_outfn,f);
+ ENDSTREAM;
+ if (emb->outtype==EMB_FMT_TTF) {
+ OBJ;
+ fprintf(f,"%d\n",outlen);
+ ENDOBJ;
+ }
+
+ OBJ;
+ const int fd_ref=xrefpos;
+ char *res=emb_pdf_simple_fontdescr(emb,fdes,ff_ref);
+ assert(res);
+ fputs(res,f);
+ free(res);
+ ENDOBJ;
+
+ OBJ;
+ int f_ref=xrefpos;
+ res=emb_pdf_simple_font(emb,fdes,fwid,fd_ref);
+ assert(res);
+ fputs(res,f);
+ free(res);
+ ENDOBJ;
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ OBJ;
+ res=emb_pdf_simple_cidfont(emb,fdes->fontname,f_ref);
+ f_ref=xrefpos;
+ assert(res);
+ fputs(res,f);
+ free(res);
+ ENDOBJ;
+ }
+
+ free(fdes);
+ free(fwid);
+ // }}}
+
+ int iA;
+
+ xref[2]=ftell(f);
+ fprintf(f,"3 0 obj\n"
+ "<</Type/Page\n"
+ " /Parent 2 0 R\n"
+ " /MediaBox [0 0 595 842]\n"
+ " /Contents 4 0 R\n"
+ " /Resources <<\n"
+ " /Font <<\n"
+ " /F1 %d 0 R\n"
+ " >>\n"
+ " >>\n"
+ ">>\n"
+ "endobj\n",
+ f_ref);
+ xref[1]=ftell(f);
+ fprintf(f,"2 0 obj\n"
+ "<</Type/Pages\n"
+ " /Count 1\n"
+ " /Kids [3 0 R]"
+ ">>\n"
+ "endobj\n");
+ xref[0]=ftell(f);
+ fprintf(f,"1 0 obj\n"
+ "<</Type/Catalog\n"
+ " /Pages 2 0 R\n"
+ ">>\n"
+ "endobj\n");
+ // {{{ pdf trailer
+ int xref_start=ftell(f);
+ fprintf(f,"xref\n"
+ "0 %d\n"
+ "%010d 65535 f \n",
+ xrefpos+1,0);
+ for (iA=0;iA<xrefpos;iA++) {
+ fprintf(f,"%010d 00000 n \n",xref[iA]);
+ }
+ fprintf(f,"trailer\n"
+ "<<\n"
+ " /Size %d\n"
+ " /Root 1 0 R\n"
+ ">>\n"
+ "startxref\n"
+ "%d\n"
+ "%%%%EOF\n",
+ xrefpos+1,xref_start);
+ // }}}
+ fclose(f);
+
+ emb_close(emb);
+
+ return 0;
+}
--- /dev/null
+#include "embed.h"
+#include "config.h"
+#include "sfnt.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+const char *emb_otf_get_fontname(OTF_FILE *otf); // TODO
+
+static void example_outfn(const char *buf,int len,void *context) // {{{
+{
+ FILE *f=(FILE *)context;
+ if (fwrite(buf,1,len,f)!=len) {
+ fprintf(stderr,"Short write: %m\n");
+ assert(0);
+ return;
+ }
+}
+// }}}
+
+static inline void write_string(FILE *f,EMB_PARAMS *emb,const char *str) // {{{
+{
+ assert(f);
+ assert(emb);
+ int iA;
+
+ if (emb->plan&EMB_A_MULTIBYTE) {
+ putc('<',f);
+ for (iA=0;str[iA];iA++) {
+ const unsigned short gid=emb_get(emb,(unsigned char)str[iA]);
+ fprintf(f,"%04x",gid);
+ }
+ putc('>',f);
+ } else {
+ putc('(',f);
+ for (iA=0;str[iA];iA++) {
+ emb_get(emb,(unsigned char)str[iA]);
+ }
+ fprintf(f,"%s",str); // TODO
+ putc(')',f);
+ }
+}
+// }}}
+
+int main(int argc,char **argv)
+{
+ const char *fn=TESTFONT;
+ if (argc==2) {
+ fn=argv[1];
+ }
+ OTF_FILE *otf=otf_load(fn);
+ assert(otf);
+ FONTFILE *ff=fontfile_open_sfnt(otf);
+ EMB_PARAMS *emb=emb_new(ff,
+ EMB_DEST_PS,
+// EMB_C_FORCE_MULTIBYTE| // not yet...
+ EMB_C_TAKE_FONTFILE);
+
+ FILE *f=fopen("test.ps","w");
+ assert(f);
+
+ fprintf(f,"%%!PS-Adobe-2.0\n");
+
+ char *str="Hallo";
+
+ emb_get(emb,'a');
+
+ int iA;
+ for (iA=0;str[iA];iA++) {
+ emb_get(emb,(unsigned char)str[iA]);
+ }
+
+ emb_embed(emb,example_outfn,f);
+
+ // content
+ fprintf(f," 100 100 moveto\n" // content
+ " /%s findfont 10 scalefont setfont\n",emb_otf_get_fontname(emb->font->sfnt));
+ write_string(f,emb,"Hallo");
+// Note that write_string sets subset bits, but it's too late
+ fprintf(f," show\n"
+ "showpage\n");
+
+ fprintf(f,"%%%%EOF\n");
+ fclose(f);
+
+ emb_close(emb);
+
+ return 0;
+}
--- /dev/null
+#!/bin/sh
+#
+# "$Id$"
+#
+# Install a program, script, or datafile.
+#
+# Copyright 2008-2009 by Apple Inc.
+#
+# This script is not compatible with BSD (or any other) install program, as it
+# allows owner and group changes to fail with a warning and makes sure that the
+# destination directory permissions are as specified - BSD install and the
+# original X11 install script did not change permissions of existing
+# directories. It also does not support the transform options since CUPS does
+# not use them...
+#
+# Original script from X11R5 (mit/util/scripts/install.sh)
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+
+# set DOITPROG to echo to test this script
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# Force umask to 022...
+umask 022
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c)
+ instcmd="$cpprog"
+ shift
+ continue
+ ;;
+
+ -d)
+ dir_arg=true
+ shift
+ continue
+ ;;
+
+ -m)
+ chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue
+ ;;
+
+ -o)
+ chowncmd="$chownprog $2"
+ shift
+ shift
+ continue
+ ;;
+
+ -g)
+ chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue
+ ;;
+
+ -s)
+ stripcmd="$stripprog"
+ shift
+ continue
+ ;;
+
+ *)
+ if [ x"$src" = x ]; then
+ src="$1"
+ else
+ dst="$1"
+ fi
+ shift
+ continue
+ ;;
+ esac
+done
+
+if [ x"$src" = x ]; then
+ echo "install-sh: No input file specified"
+ exit 1
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst="$src"
+ src=""
+
+ if [ -d "$dst" ]; then
+ instcmd=:
+ else
+ instcmd=$mkdirprog
+ fi
+else
+ # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if [ ! -f "$src" -a ! -d "$src" ]; then
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]; then
+ echo "install: No destination specified"
+ exit 1
+ fi
+
+ # If destination is a directory, append the input filename.
+ if [ -d "$dst" ]; then
+ dst="$dst/`basename $src`"
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir="`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`"
+
+# Make sure that the destination directory exists.
+# This part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+ defaultIFS='
+ '
+ IFS="${IFS-${defaultIFS}}"
+
+ oIFS="${IFS}"
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS="${oIFS}"
+
+ pathcomp=''
+
+ while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ]; then $doit $mkdirprog "${pathcomp}"; fi
+
+ pathcomp="${pathcomp}/"
+ done
+fi
+
+if [ x"$dir_arg" != x ]; then
+ # Make a directory...
+ $doit $instcmd $dst || exit 1
+
+ # Allow chown/chgrp to fail, but log a warning
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst || echo "warning: Unable to change owner of $dst!"; fi
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst || echo "warning: Unable to change group of $dst!"; fi
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst || exit 1; fi
+else
+ # Install a file...
+ dstfile="`basename $dst`"
+
+ # Check the destination file - for libraries just use the "-x" option
+ # to strip...
+ case "$dstfile" in
+ *.a | *.dylib | *.sl | *.sl.* | *.so | *.so.*)
+ stripopt="-x"
+ ;;
+ *)
+ stripopt=""
+ ;;
+ esac
+
+ # Make a temp file name in the proper directory.
+ dsttmp="$dstdir/#inst.$$#"
+
+ # Move or copy the file name to the temp name
+ $doit $instcmd $src $dsttmp || exit 1
+
+ # Update permissions and strip as needed, then move to the final name.
+ # If the chmod, strip, rm, or mv commands fail, remove the installed
+ # file...
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripopt "$dsttmp" || echo "warning: Unable to strip $dst!"; fi
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp" || echo "warning: Unable to change owner of $dst!"; fi
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp" || echo "warning: Unable to change group of $dst!"; fi
+
+ trap "rm -f ${dsttmp}" 0 &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; fi &&
+ $doit $rmcmd -f "$dstdir/$dstfile" &&
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+fi
+
+exit 0
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libcupsfilters
+Description: Library for reading and writing cups filters
+Version: @VERSION@
+
+Libs: -L${libdir} -lcupsfilters
+Libs.private: @CUPS_LIBS@ @LIBJPEG_LIBS@ @LIBPNG_LIBS@ @LIBTIFF_LIBS@
+Cflags: -I${includedir}/cupsfilters
--- /dev/null
+<manifest>
+ <request>
+ <domain name="cups"/>
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libfontembed
+Description: Library for de/embedding fonts to pdf
+Version: @VERSION@
+
+Libs: -L${libdir} -lfontembed
+Cflags: -I${includedir}/fontembed
--- /dev/null
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --no-quiet, --no-silent
+# print informational messages (default)
+# --no-warn don't display warning messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print more informational messages than default
+# --no-verbose don't print the extra informational messages
+# --version print version information
+# -h, --help, --help-all print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE. When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION="2.4.2 Debian-2.4.2-1ubuntu2"
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+ fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+ s@/\./@/@g
+ t dotsl
+ s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+# value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+ # Start from root dir and reassemble the path.
+ func_normal_abspath_result=
+ func_normal_abspath_tpath=$1
+ func_normal_abspath_altnamespace=
+ case $func_normal_abspath_tpath in
+ "")
+ # Empty path, that just means $cwd.
+ func_stripname '' '/' "`pwd`"
+ func_normal_abspath_result=$func_stripname_result
+ return
+ ;;
+ # The next three entries are used to spot a run of precisely
+ # two leading slashes without using negated character classes;
+ # we take advantage of case's first-match behaviour.
+ ///*)
+ # Unusual form of absolute path, do nothing.
+ ;;
+ //*)
+ # Not necessarily an ordinary path; POSIX reserves leading '//'
+ # and for example Cygwin uses it to access remote file shares
+ # over CIFS/SMB, so we conserve a leading double slash if found.
+ func_normal_abspath_altnamespace=/
+ ;;
+ /*)
+ # Absolute path, do nothing.
+ ;;
+ *)
+ # Relative path, prepend $cwd.
+ func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+ ;;
+ esac
+ # Cancel out all the simple stuff to save iterations. We also want
+ # the path to end with a slash for ease of parsing, so make sure
+ # there is one (and only one) here.
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+ while :; do
+ # Processed it all yet?
+ if test "$func_normal_abspath_tpath" = / ; then
+ # If we ascended to the root using ".." the result may be empty now.
+ if test -z "$func_normal_abspath_result" ; then
+ func_normal_abspath_result=/
+ fi
+ break
+ fi
+ func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcar"`
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcdr"`
+ # Figure out what to do with it
+ case $func_normal_abspath_tcomponent in
+ "")
+ # Trailing empty path component, ignore it.
+ ;;
+ ..)
+ # Parent dir; strip last assembled component from result.
+ func_dirname "$func_normal_abspath_result"
+ func_normal_abspath_result=$func_dirname_result
+ ;;
+ *)
+ # Actual path component, append it.
+ func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+ ;;
+ esac
+ done
+ # Restore leading double-slash if one was found on entry.
+ func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+# value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+ func_relative_path_result=
+ func_normal_abspath "$1"
+ func_relative_path_tlibdir=$func_normal_abspath_result
+ func_normal_abspath "$2"
+ func_relative_path_tbindir=$func_normal_abspath_result
+
+ # Ascend the tree starting from libdir
+ while :; do
+ # check if we have found a prefix of bindir
+ case $func_relative_path_tbindir in
+ $func_relative_path_tlibdir)
+ # found an exact match
+ func_relative_path_tcancelled=
+ break
+ ;;
+ $func_relative_path_tlibdir*)
+ # found a matching prefix
+ func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+ func_relative_path_tcancelled=$func_stripname_result
+ if test -z "$func_relative_path_result"; then
+ func_relative_path_result=.
+ fi
+ break
+ ;;
+ *)
+ func_dirname $func_relative_path_tlibdir
+ func_relative_path_tlibdir=${func_dirname_result}
+ if test "x$func_relative_path_tlibdir" = x ; then
+ # Have to descend all the way to the root!
+ func_relative_path_result=../$func_relative_path_result
+ func_relative_path_tcancelled=$func_relative_path_tbindir
+ break
+ fi
+ func_relative_path_result=../$func_relative_path_result
+ ;;
+ esac
+ done
+
+ # Now calculate path; take care to avoid doubling-up slashes.
+ func_stripname '' '/' "$func_relative_path_result"
+ func_relative_path_result=$func_stripname_result
+ func_stripname '/' '/' "$func_relative_path_tcancelled"
+ if test "x$func_stripname_result" != x ; then
+ func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+ fi
+
+ # Normalisation. If bindir is libdir, return empty string,
+ # else relative path ending with a slash; either way, target
+ # file name can be directly appended.
+ if test ! -z "$func_relative_path_result"; then
+ func_stripname './' '' "$func_relative_path_result/"
+ func_relative_path_result=$func_stripname_result
+ fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=${PATH_SEPARATOR-:}
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes. A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$opt_dry_run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ fi
+
+ $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+ esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "$1" | $SED \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+ *)
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result. All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+ case $1 in
+ [0-9]* | *[!a-zA-Z0-9_]*)
+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+ ;;
+ * )
+ func_tr_sh_result=$1
+ ;;
+ esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $opt_debug
+
+ $SED -n '/(C)/!b go
+ :more
+ /\./!{
+ N
+ s/\n# / /
+ b more
+ }
+ :go
+ /^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/^# *.*--help/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ echo
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ :print
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+ p
+ d
+ }
+ /^# .* home page:/b print
+ /^# General help using/b print
+ ' < "$progpath"
+ ret=$?
+ if test -z "$1"; then
+ exit $ret
+ fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ $opt_debug
+
+ func_error "missing argument for $1."
+ exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+ func_quote_for_eval "${2}"
+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+ done
+
+ exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+
+ exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
+
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
+
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ fi
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly. This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+ --debug|-x) opt_debug='set -x'
+ func_echo "enabling shell trace mode"
+ $opt_debug
+ ;;
+ --dry-run|--dryrun|-n)
+ opt_dry_run=:
+ ;;
+ --config)
+ opt_config=:
+func_config
+ ;;
+ --dlopen|-dlopen)
+ optarg="$1"
+ opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+ shift
+ ;;
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=:
+ ;;
+ --features)
+ opt_features=:
+func_features
+ ;;
+ --finish)
+ opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ --help)
+ opt_help=:
+ ;;
+ --help-all)
+ opt_help_all=:
+opt_help=': help-all'
+ ;;
+ --mode)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_mode="$optarg"
+case $optarg in
+ # Valid mode arguments:
+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+esac
+ shift
+ ;;
+ --no-silent|--no-quiet)
+ opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-warning|--no-warn)
+ opt_warning=false
+func_append preserve_args " $opt"
+ ;;
+ --no-verbose)
+ opt_verbose=false
+func_append preserve_args " $opt"
+ ;;
+ --silent|--quiet)
+ opt_silent=:
+func_append preserve_args " $opt"
+ opt_verbose=false
+ ;;
+ --verbose|-v)
+ opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+ ;;
+ --tag)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+
+ # Separate optargs to long options:
+ --*=*)
+ func_split_long_opt "$opt"
+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ # Separate non-argument short options:
+ -\?*|-h*|-n*|-v*)
+ func_split_short_opt "$opt"
+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
+ esac
+ done
+
+ # Validate options:
+
+ # save first non-option argument
+ if test "$#" -gt 0; then
+ nonopt="$opt"
+ shift
+ fi
+
+ # preserve --debug
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ ;;
+ esac
+
+ $opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$opt_mode' for more information."
+ }
+
+
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot. Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+ case "$lt_sysroot:$1" in
+ ?*:"$lt_sysroot"*)
+ func_stripname "$lt_sysroot" '' "$1"
+ func_replace_sysroot_result="=$func_stripname_result"
+ ;;
+ *)
+ # Including no sysroot.
+ func_replace_sysroot_result=$1
+ ;;
+ esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case "$@ " in
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+ $opt_debug
+ func_convert_core_file_wine_to_w32_result="$1"
+ if test -n "$1"; then
+ # Unfortunately, winepath does not exit with a non-zero error code, so we
+ # are forced to check the contents of stdout. On the other hand, if the
+ # command is not found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both error code of
+ # zero AND non-empty stdout, which explains the odd construction:
+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ func_convert_core_file_wine_to_w32_result=
+ fi
+ fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+ $opt_debug
+ # unfortunately, winepath doesn't convert paths, only file names
+ func_convert_core_path_wine_to_w32_result=""
+ if test -n "$1"; then
+ oldIFS=$IFS
+ IFS=:
+ for func_convert_core_path_wine_to_w32_f in $1; do
+ IFS=$oldIFS
+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+ else
+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+ fi
+ fi
+ done
+ IFS=$oldIFS
+ fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+ $opt_debug
+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+ if test "$?" -ne 0; then
+ # on failure, ensure result is empty
+ func_cygpath_result=
+ fi
+ else
+ func_cygpath_result=
+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+ fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format. Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+ $opt_debug
+ # awkward: cmd appends spaces to result
+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+ $opt_debug
+ if test -z "$2" && test -n "$1" ; then
+ func_error "Could not determine host file name corresponding to"
+ func_error " \`$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_file_result="$1"
+ fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+ $opt_debug
+ if test -z "$4" && test -n "$3"; then
+ func_error "Could not determine the host path corresponding to"
+ func_error " \`$3'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This is a deliberately simplistic "conversion" and
+ # should not be "improved". See libtool.info.
+ if test "x$1" != "x$2"; then
+ lt_replace_pathsep_chars="s|$1|$2|g"
+ func_to_host_path_result=`echo "$3" |
+ $SED -e "$lt_replace_pathsep_chars"`
+ else
+ func_to_host_path_result="$3"
+ fi
+ fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+ $opt_debug
+ case $4 in
+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+ ;;
+ esac
+ case $4 in
+ $2 ) func_append func_to_host_path_result "$3"
+ ;;
+ esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+ $opt_debug
+ $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result. If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+ $opt_debug
+ case ,$2, in
+ *,"$to_tool_file_cmd",*)
+ func_to_tool_file_result=$1
+ ;;
+ *)
+ $to_tool_file_cmd "$1"
+ func_to_tool_file_result=$func_to_host_file_result
+ ;;
+ esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+ func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+ # LT_CYGPATH in this case.
+ func_to_host_file_result=`cygpath -m "$1"`
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format. Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_file_wine_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+ func_convert_core_file_wine_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format. If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+# file name conversion function : func_convert_file_X_to_Y ()
+# path conversion function : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same. If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+ $opt_debug
+ if test -z "$to_host_path_cmd"; then
+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
+ fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+ $opt_debug
+ func_init_to_host_path_cmd
+ $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+ func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from ARG. MSYS
+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+ # and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format. Requires a wine environment and
+# a working winepath. Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+ pie_flag=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
+ arg_mode=target
+ continue
+ ;;
+
+ -pie | -fpie | -fPIE)
+ func_append pie_flag " $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
+ func_append later " $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+ func_append_quoted lastarg "$arg"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
+
+ # Add the arguments to base_compile.
+ func_append base_compile " $lastarg"
+ continue
+ ;;
+
+ *)
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ func_append_quoted base_compile "$lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ func_fatal_error "you must specify an argument for -Xcompile"
+ ;;
+ target)
+ func_fatal_error "you must specify a target with \`-o'"
+ ;;
+ *)
+ # Get the name of the library object.
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ case $libobj in
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
+ esac
+
+ case $libobj in
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *)
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
+ -static)
+ build_libtool_libs=no
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
+ lobj=${xdir}$objdir/$objname
+
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+ func_append removelist " $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
+ fi
+
+ $opt_dry_run || $RM $removelist
+ func_append removelist " $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+ srcfile=$func_to_tool_file_result
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ func_mkdir_p "$xdir$objdir"
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ func_append command " -o $lobj"
+ fi
+
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile$pie_flag"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ func_append command " -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $opt_mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ compile)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to build PIC objects only
+ -prefer-non-pic try to build non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only build a \`.o' file suitable for static linking
+ -Wc,FLAG pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+ execute)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+ finish)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+ install)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -bindir BINDIR specify path to binaries directory (for systems where
+ libraries must be found in the PATH setting at runtime)
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+ -Wc,FLAG
+ -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
+ -Wl,FLAG
+ -Xlinker FLAG pass linker-specific FLAG directly to the linker
+ -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+ uninstall)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+ ;;
+ esac
+
+ echo
+ $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+ if test "$opt_help" = :; then
+ func_mode_help
+ else
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ func_mode_help
+ done
+ } | sed -n '1p; 2,$s/^Usage:/ or: /p'
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ echo
+ func_mode_help
+ done
+ } |
+ sed '1d
+ /^When reporting/,/^Report/{
+ H
+ d
+ }
+ $x
+ /information about other modes/d
+ /more detailed .*MODE/d
+ s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+ fi
+ exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $opt_dlopen; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ func_append dir "/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -* | *.la | *.lo ) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_append_quoted args "$file"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+ echo "export $shlibpath_var"
+ fi
+ $ECHO "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ libs=
+ libdirs=
+ admincmds=
+
+ for opt in "$nonopt" ${1+"$@"}
+ do
+ if test -d "$opt"; then
+ func_append libdirs " $opt"
+
+ elif test -f "$opt"; then
+ if func_lalib_unsafe_p "$opt"; then
+ func_append libs " $opt"
+ else
+ func_warning "\`$opt' is not a valid libtool archive"
+ fi
+
+ else
+ func_fatal_error "invalid argument \`$opt'"
+ fi
+ done
+
+ if test -n "$libs"; then
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ if $opt_dry_run; then
+ for lib in $libs; do
+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+ done
+ else
+ tmpdir=`func_mktempdir`
+ for lib in $libs; do
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ done
+ ${RM}r "$tmpdir"
+ fi
+ fi
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+
+ echo "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ echo "pages."
+ ;;
+ *)
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ echo "----------------------------------------------------------------------"
+ fi
+ exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ case $nonopt in *shtool*) :;; *) false;; esac; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ func_append install_prog "$func_quote_for_eval_result"
+ install_shared_prog=$install_prog
+ case " $install_prog " in
+ *[\\\ /]cp\ *) install_cp=: ;;
+ *) install_cp=false ;;
+ esac
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ no_mode=:
+ for arg
+ do
+ arg2=
+ if test -n "$dest"; then
+ func_append files " $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ if $install_cp; then :; else
+ prev=$arg
+ fi
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ if test "x$prev" = x-m && test -n "$install_override_mode"; then
+ arg2=$install_override_mode
+ no_mode=false
+ fi
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ func_quote_for_eval "$arg"
+ func_append install_prog " $func_quote_for_eval_result"
+ if test -n "$arg2"; then
+ func_quote_for_eval "$arg2"
+ fi
+ func_append install_shared_prog " $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -n "$install_override_mode" && $no_mode; then
+ if $install_cp; then :; else
+ func_quote_for_eval "$install_override_mode"
+ func_append install_shared_prog " -m $func_quote_for_eval_result"
+ fi
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ func_append staticlibs " $file"
+ ;;
+
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append current_libdirs " $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append future_libdirs " $libdir" ;;
+ esac
+ fi
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ func_append dir "$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ fi
+ }
+ else
+ # Install the binary that we compiled earlier.
+ file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ for progfile in $progfiles; do
+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p "$dlprefile"; then
+ func_tr_sh "$dlprefile"
+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
+ dlprefile_dlbasename=""
+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+ if test -n "$dlprefile_dlname" ; then
+ func_basename "$dlprefile_dlname"
+ dlprefile_dlbasename="$func_basename_result"
+ else
+ # no lafile. user explicitly requested -dlpreopen <import library>.
+ $sharedlib_from_linklib_cmd "$dlprefile"
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+ fi
+ $opt_dry_run || {
+ if test -n "$dlprefile_dlbasename" ; then
+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+ else
+ func_warning "Could not compute DLL name from $name"
+ eval '$ECHO ": $name " >> "$nlist"'
+ fi
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+ }
+ else # not an import lib
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ fi
+ ;;
+ *)
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ ;;
+ esac
+ done
+
+ $opt_dry_run || {
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $MV "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if $GREP -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ $GREP -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ echo >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) func_append symtab_cflags " $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+ $opt_debug
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+ $opt_debug
+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+ $opt_debug
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+ $SED '/^Contents of section '"$match_literal"':/{
+ # Place marker at beginning of archive member dllname section
+ s/.*/====MARK====/
+ p
+ d
+ }
+ # These lines can sometimes be longer than 43 characters, but
+ # are always uninteresting
+ /:[ ]*file format pe[i]\{,1\}-/d
+ /^In archive [^:]*:/d
+ # Ensure marker is printed
+ /^====MARK====/p
+ # Remove all lines with less than 43 characters
+ /^.\{43\}/!d
+ # From remaining lines, remove first 43 characters
+ s/^.\{43\}//' |
+ $SED -n '
+ # Join marker and all lines until next marker into a single line
+ /^====MARK====/ b para
+ H
+ $ b para
+ b
+ :para
+ x
+ s/\n//g
+ # Remove the marker
+ s/^====MARK====//
+ # Remove trailing dots and whitespace
+ s/[\. \t]*$//
+ # Print
+ /./p' |
+ # we now have a list, one entry per line, of the stringified
+ # contents of the appropriate section of all members of the
+ # archive which possess that section. Heuristic: eliminate
+ # all those which have a first or second character that is
+ # a '.' (that is, objdump's representation of an unprintable
+ # character.) This should work for all archives with less than
+ # 0x302f exports -- but will fail for DLLs whose name actually
+ # begins with a literal '.' or a single character followed by
+ # a '.'.
+ #
+ # Of those that remain, print the first one.
+ $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+ test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+ test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+ $opt_debug
+ if func_cygming_gnu_implib_p "$1" ; then
+ # binutils import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+ elif func_cygming_ms_implib_p "$1" ; then
+ # ms-generated import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+ else
+ # unknown
+ sharedlib_from_linklib_result=""
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ if test "$lock_old_archive_extraction" = yes; then
+ lockfile=$f_ex_an_ar_oldlib.lock
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+ 'stat=$?; rm -f "$lockfile"; exit $stat'
+ if test "$lock_old_archive_extraction" = yes; then
+ $opt_dry_run || rm -f "$lockfile"
+ fi
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename "$darwin_archive"`
+ darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd $darwin_orig_dir
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=${1-no}
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+ qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+ $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+ ECHO=\"$qECHO\"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=\$0
+ shift
+ for lt_opt
+ do
+ case \"\$lt_opt\" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+ cat \"\$lt_dump_D/\$lt_dump_F\"
+ exit 0
+ ;;
+ --lt-*)
+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n \"\$lt_option_debug\"; then
+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ case \" \$* \" in
+ *\\ --lt-*)
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done ;;
+ esac
+ func_exec_program_core \${1+\"\$@\"}
+}
+
+ # Parse options
+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # fixup the dll searchpath if we need to.
+ #
+ # Fix the DLL searchpath if we need to. Do this before prepending
+ # to shlibpath, because on Windows, both are PATH and uninstalled
+ # libraries must come first.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+ func_exec_program \${1+\"\$@\"}
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+*/
+EOF
+ cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+ cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_path "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_path "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ newargz = XMALLOC (char *, argc + 1);
+
+ /* very simple arg parsing; don't want to rely on getopt
+ * also, copy all non cwrapper options to newargz, except
+ * argz[0], which is handled differently
+ */
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ lt_dump_script (stdout);
+ return 0;
+ }
+ if (strcmp (argv[i], debug_opt) == 0)
+ {
+ lt_debug = 1;
+ continue;
+ }
+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal (__FILE__, __LINE__,
+ "unrecognized %s option: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+EOF
+ cat <<EOF
+ /* The GNU banner must be the first non-error debug message */
+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+ cat <<"EOF"
+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (before symlink chase) at: %s\n",
+ tmp_pathspec);
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (after symlink chase) at: %s\n",
+ actual_cwrapper_path);
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) libtool target name: %s\n",
+ target_name);
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+ because on Windows, both *_VARNAMEs are PATH but uninstalled
+ libraries must come first. */
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+ nonnull (lt_argv_zero));
+ for (i = 0; i < newargc; i++)
+ {
+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+ i, nonnull (newargz[i]));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ newargz = prepare_spawn (newargz);
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) failed to launch target \"%s\": %s\n",
+ lt_argv_zero, nonnull (strerror (errno)));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void *p = (void *) malloc (num);
+ if (!p)
+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+ string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+ nonempty (wrapper));
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char *path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char *q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR (*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name =
+ XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name =
+ XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ lt_debugprintf (__FILE__, __LINE__,
+ "checking path component for symlinks: %s\n",
+ tmp_pathspec);
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "error accessing file \"%s\": %s",
+ tmp_pathspec, nonnull (strerror (errno)));
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert (str != NULL);
+ assert (pat != NULL);
+
+ len = strlen (str);
+ patlen = strlen (pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp (str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (lt_debug)
+ {
+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+ int line, const char *mode,
+ const char *message, va_list ap)
+{
+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+ return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+ return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_setenv) setting '%s' to '%s'\n",
+ nonnull (name), nonnull (value));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+EOF
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+ Note that spawn() does not by itself call the command interpreter
+ (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+ ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&v);
+ v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+ }) ? "cmd.exe" : "command.com").
+ Instead it simply concatenates the arguments, separated by ' ', and calls
+ CreateProcess(). We must quote the arguments since Win32 CreateProcess()
+ interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+ special way:
+ - Space and tab are interpreted as delimiters. They are not treated as
+ delimiters if they are surrounded by double quotes: "...".
+ - Unescaped double quotes are removed from the input. Their only effect is
+ that within double quotes, space and tab are treated like normal
+ characters.
+ - Backslashes not followed by double quotes are not special.
+ - But 2*n+1 backslashes followed by a double quote become
+ n backslashes followed by a double quote (n >= 0):
+ \" -> "
+ \\\" -> \"
+ \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+ size_t argc;
+ char **new_argv;
+ size_t i;
+
+ /* Count number of arguments. */
+ for (argc = 0; argv[argc] != NULL; argc++)
+ ;
+
+ /* Allocate new argument vector. */
+ new_argv = XMALLOC (char *, argc + 1);
+
+ /* Put quoted arguments into the new argument vector. */
+ for (i = 0; i < argc; i++)
+ {
+ const char *string = argv[i];
+
+ if (string[0] == '\0')
+ new_argv[i] = xstrdup ("\"\"");
+ else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+ {
+ int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+ size_t length;
+ unsigned int backslashes;
+ const char *s;
+ char *quoted_string;
+ char *p;
+
+ length = 0;
+ backslashes = 0;
+ if (quote_around)
+ length++;
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ length += backslashes + 1;
+ length++;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ length += backslashes + 1;
+
+ quoted_string = XMALLOC (char, length + 1);
+
+ p = quoted_string;
+ backslashes = 0;
+ if (quote_around)
+ *p++ = '"';
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ {
+ unsigned int j;
+ for (j = backslashes + 1; j > 0; j--)
+ *p++ = '\\';
+ }
+ *p++ = c;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ {
+ unsigned int j;
+ for (j = backslashes; j > 0; j--)
+ *p++ = '\\';
+ *p++ = '"';
+ }
+ *p = '\0';
+
+ new_argv[i] = quoted_string;
+ }
+ else
+ new_argv[i] = (char *) string;
+ }
+ new_argv[argc] = NULL;
+
+ return new_argv;
+}
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+ func_emit_wrapper yes |
+ $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/ fputs ("\1", f);/p
+g
+D'
+ cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+ $opt_debug
+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args=$nonopt
+ base_compile="$nonopt $@"
+ compile_command=$nonopt
+ finalize_command=$nonopt
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+ new_inherited_linker_flags=
+
+ avoid_version=no
+ bindir=
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+ weak_libs=
+ single_module="${wl}-single_module"
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ func_warning "complete static linking is impossible in this configuration"
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ bindir)
+ bindir="$arg"
+ prev=
+ continue
+ ;;
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ func_append dlfiles " $arg"
+ else
+ func_append dlprefiles " $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat "$save_arg"`
+ do
+# func_append moreargs " $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ done
+ else
+ func_fatal_error "link input file \`$arg' does not exist"
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) func_append rpath " $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) func_append xrpath " $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ weak)
+ func_append weak_libs " $arg"
+ prev=
+ continue
+ ;;
+ xcclinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xcompiler)
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xlinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $wl$qarg"
+ prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append finalize_command " $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -bindir)
+ prev=bindir
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework)
+ prev=framework
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ func_stripname "-L" '' "$arg"
+ if test -z "$func_stripname_result"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
+ *)
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+ *) func_append deplibs " -L$dir" ;;
+ esac
+ func_append lib_search_path " $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
+ *) func_append dllsearchpath ":$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ func_append deplibs " System.ltframework"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ func_append deplibs " $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot|--sysroot)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
+ continue
+ ;;
+
+ -multi_module)
+ single_module="${wl}-multi_module"
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ continue
+ ;;
+
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -weak)
+ prev=weak
+ continue
+ ;;
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $func_quote_for_eval_result"
+ func_append compiler_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # Flags to be passed through unchanged, with rationale:
+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
+ # -r[0-9][0-9]* specify processor for the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+ # +DA*, +DD* enable 64-bit mode for the HP compiler
+ # -q* compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+ # -F/path path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ func_append compiler_flags " $arg"
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ func_append objs " $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ func_append deplibs " $arg"
+ func_append old_deplibs " $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ func_resolve_sysroot "$arg"
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ func_append dlfiles " $func_resolve_sysroot_result"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ func_append dlprefiles " $func_resolve_sysroot_result"
+ prev=
+ else
+ func_append deplibs " $func_resolve_sysroot_result"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+ done # argument parsing loop
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ func_basename "$output"
+ outputname="$func_basename_result"
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+ func_to_tool_file "$output_objdir/"
+ tool_output_objdir=$func_to_tool_file_result
+ # Create the object directory.
+ func_mkdir_p "$output_objdir"
+
+ # Determine the type of output
+ case $output in
+ "")
+ func_fatal_help "you must specify an output file"
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if $opt_preserve_dup_deps ; then
+ case "$libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append libs " $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if $opt_duplicate_compiler_generated_deps; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ esac
+ func_append pre_post_deps " $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+
+ case $linkmode in
+ lib)
+ passes="conv dlpreopen link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+
+ for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
+ esac
+ fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ func_resolve_sysroot "$lib"
+ case $lib in
+ *.la) func_source "$func_resolve_sysroot_result" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ func_basename "$deplib"
+ deplib_base=$func_basename_result
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) func_append deplibs " $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append compiler_flags " $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ func_warning "\`-l' is ignored for archives/objects"
+ continue
+ fi
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
+ if test "$linkmode" = lib; then
+ searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+ else
+ searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+ fi
+ for searchdir in $searchdirs; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if func_lalib_p "$lib"; then
+ library_names=
+ old_library=
+ func_source "$lib"
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ *)
+ func_warning "\`-L' is ignored for archives/objects"
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ func_stripname '-R' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ lib=$func_resolve_sysroot_result
+ ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ echo
+ $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not use here."
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ func_append newdlprefiles " $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append newdlfiles " $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ fi
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ inherited_linker_flags=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && func_append dlfiles " $dlopen"
+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ func_append convenience " $ladir/$objdir/$old_library"
+ func_append old_convenience " $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ func_fatal_error "\`$lib' is not a convenience library"
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ if test -n "$old_library" &&
+ { test "$prefer_static_libs" = yes ||
+ test "$prefer_static_libs,$installed" = "built,no"; }; then
+ linklib=$old_library
+ else
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ fi
+ if test -z "$linklib"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ func_append dlprefiles " $lib $dependency_libs"
+ else
+ func_append newdlfiles " $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ func_basename "$lib"
+ laname="$func_basename_result"
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ func_warning "library \`$lib' was moved."
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$lt_sysroot$libdir"
+ absdir="$lt_sysroot$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ fi
+ fi # $installed = yes
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ fi
+ case "$host" in
+ # special handling for platforms with PE-DLLs.
+ *cygwin* | *mingw* | *cegcc* )
+ # Linker will automatically link against shared library if both
+ # static and shared are present. Therefore, ensure we extract
+ # symbols from the import library if a shared library is present
+ # (otherwise, the dlopen module name will be incorrect). We do
+ # this by putting the import library name into $newdlprefiles.
+ # We recover the dlopen module name by 'saving' the la file
+ # name in a special purpose variable, and (later) extracting the
+ # dlname from the la file.
+ if test -n "$dlname"; then
+ func_tr_sh "$dir/$linklib"
+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+ func_append newdlprefiles " $dir/$linklib"
+ else
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ fi
+ ;;
+ * )
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ func_append newdlprefiles " $dir/$dlname"
+ else
+ func_append newdlprefiles " $dir/$linklib"
+ fi
+ ;;
+ esac
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ func_append newlib_search_path " $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) func_append temp_rpath "$absdir:" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ func_append notinst_deplibs " $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ func_append notinst_deplibs " $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ echo
+ if test "$linkmode" = prog; then
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $ECHO "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.a
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
+ if /usr/bin/file -L $add 2> /dev/null |
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; then
+ $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ echo
+ echo "*** And there doesn't seem to be a static archive available"
+ echo "*** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$absdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ func_fatal_configuration "unsupported hardcode properties"
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ $ECHO "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) func_append xrpath " $temp_xrpath";;
+ esac;;
+ *) func_append temp_deplibs " $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ func_append newlib_search_path " $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result";;
+ *) func_resolve_sysroot "$deplib" ;;
+ esac
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $func_resolve_sysroot_result "*)
+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ esac
+ fi
+ func_append tmp_libs " $func_resolve_sysroot_result"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ path=
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
+ func_dirname "$deplib" "" "."
+ dir=$func_dirname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ func_warning "cannot determine absolute directory name of \`$dir'"
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if $GREP "^installed=no" $deplib > /dev/null; then
+ case $host in
+ *-*-darwin*)
+ depdepl=
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
+ fi
+ fi
+ ;;
+ *)
+ path="-L$absdir/$objdir"
+ ;;
+ esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
+ ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test "$pass" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) func_append lib_search_path " $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ func_append tmp_libs " $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
+
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ func_append objs "$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+ $ECHO "*** objects $objs is not portable!"
+ func_append libobjs " $objs"
+ fi
+ fi
+
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+ set dummy $rpath
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ shift
+ IFS="$save_ifs"
+
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ # correct linux to gnu/linux during the next big refactor
+ darwin|linux|osf|windows|none)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|qnx|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ *)
+ func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+ ;;
+ esac
+ ;;
+ no)
+ current="$1"
+ revision="$2"
+ age="$3"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ func_arith $current + 1
+ minor_current=$func_arith_result
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ func_arith $current - $age
+ else
+ func_arith $current - $age + 1
+ fi
+ major=$func_arith_result
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux) # correct to gnu/linux during the next big refactor
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ func_append verstring ":${current}.0"
+ ;;
+
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+
+ *)
+ func_fatal_configuration "unknown library version type \`$version_type'"
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ func_warning "undefined symbols not allowed in $host shared libraries"
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ fi
+
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ func_append libobjs " $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
+ if test "$opt_mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$ECHO "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext | *.gcno)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ func_append removelist " $p"
+ ;;
+ *) ;;
+ esac
+ done
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ func_append oldlibs " $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+ # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ func_replace_sysroot "$libdir"
+ func_append temp_xrpath " -R$func_replace_sysroot_result"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) func_append dlfiles " $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) func_append dlprefiles " $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ func_append deplibs " System.ltframework"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ func_append deplibs " -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $opt_dry_run || $RM conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ if test -n "$file_magic_glob"; then
+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+ else
+ libnameglob=$libname
+ fi
+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ if test "$want_nocaseglob" = yes; then
+ shopt -s nocaseglob
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ $nocaseglob
+ else
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ fi
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ done
+ fi
+ case $tmp_deplibs in
+ *[!\ \ ]*)
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ ;;
+ esac
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Remove ${wl} instances when linking with ld.
+ # FIXME: should test the right _cmds variable.
+ case $archive_cmds in
+ *\$LD\ *) wl= ;;
+ esac
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ func_append linknames " $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ func_append delfiles " $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd1 in $cmds; do
+ IFS="$save_ifs"
+ # Take the normal branch if the nm_file_list_spec branch
+ # doesn't work or if tool conversion is not needed.
+ case $nm_file_list_spec~$to_tool_file_cmd in
+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+ try_normal_branch=yes
+ eval cmd=\"$cmd1\"
+ func_len " $cmd"
+ len=$func_len_result
+ ;;
+ *)
+ try_normal_branch=no
+ ;;
+ esac
+ if test "$try_normal_branch" = yes \
+ && { test "$len" -lt "$max_cmd_len" \
+ || test "$max_cmd_len" -le -1; }
+ then
+ func_show_eval "$cmd" 'exit $?'
+ skipped_export=false
+ elif test -n "$nm_file_list_spec"; then
+ func_basename "$output"
+ output_la=$func_basename_result
+ save_libobjs=$libobjs
+ save_output=$output
+ output=${output_objdir}/${output_la}.nm
+ func_to_tool_file "$output"
+ libobjs=$nm_file_list_spec$func_to_tool_file_result
+ func_append delfiles " $output"
+ func_verbose "creating $NM input file list: $output"
+ for obj in $save_libobjs; do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > "$output"
+ eval cmd=\"$cmd1\"
+ func_show_eval "$cmd" 'exit $?'
+ output=$save_output
+ libobjs=$save_libobjs
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ func_append tmp_deplibs " $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ func_append linker_flags " $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ func_basename "$output"
+ output_la=$func_basename_result
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ last_robj=
+ k=1
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append objlist " $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+ eval concat_cmds=\"$reload_cmds\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=" $obj"
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ func_append delfiles " $output"
+
+ else
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ fi
+ fi
+
+ test -n "$save_libobjs" &&
+ func_verbose "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
+
+ case $output in
+ *.lo)
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $opt_dry_run || $RM $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # If we're not building shared, we need to use non_pic_objs
+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+ fi
+
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
+ esac
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
+
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ case $host in
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ func_append compile_command " ${wl}-bind_at_load"
+ func_append finalize_command " ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ func_append compile_command " $compile_deplibs"
+ func_append finalize_command " $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
+ *) func_append dllsearchpath ":$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ fi
+
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
+ fi
+
+ wrappers_required=yes
+ case $host in
+ *cegcc* | *mingw32ce*)
+ # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
+ # Replace the output file specification.
+ compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Delete the generated files.
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $opt_dry_run || $RM $output
+ # Link the executable and exit
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output_objdir/$outputname"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Now create the wrapper script.
+ func_verbose "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
+
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
+ ;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_wrapper no > $output
+ chmod +x $output
+ ;;
+ esac
+ }
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save $symfileobj"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ func_append oldobjs " $symfileobj"
+ fi
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $addlibs
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ echo "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+ func_mkdir_p "$gentop"
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ func_basename "$obj"
+ objbase="$func_basename_result"
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ func_arith $counter + 1
+ counter=$func_arith_result
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ func_append oldobjs " $gentop/$newobj"
+ ;;
+ *) func_append oldobjs " $obj" ;;
+ esac
+ done
+ fi
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+ eval cmds=\"$old_archive_cmds\"
+
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ elif test -n "$archiver_list_spec"; then
+ func_verbose "using command file archive linking..."
+ for obj in $oldobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > $output_objdir/$libname.libcmd
+ func_to_tool_file "$output_objdir/$libname.libcmd"
+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ func_verbose "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ oldobjs=
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+ for obj in $save_oldobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ len=$len0
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ func_execute_cmds "$cmds" 'exit $?'
+ done
+
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ func_verbose "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+ # Only create the output if not a dry run.
+ $opt_dry_run || {
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+ func_resolve_sysroot "$deplib"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ -L*)
+ func_stripname -L '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -L$func_replace_sysroot_result"
+ ;;
+ -R*)
+ func_stripname -R '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -R$func_replace_sysroot_result"
+ ;;
+ *) func_append newdependency_libs " $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+
+ for lib in $dlfiles; do
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ *) func_append newdlfiles " $lib" ;;
+ esac
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ esac
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlfiles " $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlprefiles " $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $RM $output
+ # place dlname in correct position for cygwin
+ # In fact, it would be nice if we could use this code for all target
+ # systems that can't hard-code library paths into their executables
+ # and that have no shared library path variable independent of PATH,
+ # but it turns out we can't easily determine that from inspecting
+ # libtool variables, so we have to hard-code the OSs to which it
+ # applies here; at the moment, that means platforms that use the PE
+ # object format with DLL files. See the long comment at the top of
+ # tests/bindir.at for full details.
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ # If a -bindir argument was supplied, place the dll there.
+ if test "x$bindir" != x ;
+ then
+ func_relative_path "$install_libdir" "$bindir"
+ tdlname=$func_relative_path_result$dlname
+ else
+ # Otherwise fall back on heuristic.
+ tdlname=../bin/$dlname
+ fi
+ ;;
+ esac
+ $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $ECHO >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ }
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+ func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) func_append RM " $arg"; rmforce=yes ;;
+ -*) func_append RM " $arg" ;;
+ *) func_append files " $arg" ;;
+ esac
+ done
+
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
+
+ rmdirs=
+
+ for file in $files; do
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
+ odir="$objdir"
+ else
+ odir="$dir/$objdir"
+ fi
+ func_basename "$file"
+ name="$func_basename_result"
+ test "$opt_mode" = uninstall && odir="$dir"
+
+ # Remember odir for removal later, being careful to avoid duplicates
+ if test "$opt_mode" = clean; then
+ case " $rmdirs " in
+ *" $odir "*) ;;
+ *) func_append rmdirs " $odir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if { test -L "$file"; } >/dev/null 2>&1 ||
+ { test -h "$file"; } >/dev/null 2>&1 ||
+ test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ func_append rmfiles " $odir/$n"
+ done
+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+ case "$opt_mode" in
+ clean)
+ case " $library_names " in
+ *" $dlname "*) ;;
+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ esac
+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if func_lalib_p "$file"; then
+
+ # Read the .lo file
+ func_source $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" &&
+ test "$pic_object" != none; then
+ func_append rmfiles " $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
+ func_append rmfiles " $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$opt_mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ func_append rmfiles " $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ func_append rmfiles " $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ func_append rmfiles " $odir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ func_append rmfiles " $odir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ func_show_eval "$RM $rmfiles" 'exit_status=1'
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ func_show_eval "rmdir $dir >/dev/null 2>&1"
+ fi
+ done
+
+ exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+ eval exec "$exec_cmd"
+ exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
--- /dev/null
+dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+dnl
+dnl This macro sets VARNAME to the expansion of the DIR variable,
+dnl taking care of fixing up ${prefix} and such.
+dnl
+dnl VARNAME is then offered as both an output variable and a C
+dnl preprocessor symbol.
+dnl
+dnl Example:
+dnl
+dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+dnl
+dnl @category Misc
+dnl @author Stepan Kasal <kasal@ucw.cz>
+dnl @author Andreas Schwab <schwab@suse.de>
+dnl @author Guido U. Draheim <guidod@gmx.de>
+dnl @author Alexandre Oliva
+dnl @version 2006-10-13
+dnl @license AllPermissive
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ac_define_dir="\"[$]$2\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
--- /dev/null
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+# This macro compares two version strings. Due to the various number of
+# minor-version numbers that can exist, and the fact that string
+# comparisons are not compatible with numeric comparisons, this is not
+# necessarily trivial to do in a autoconf script. This macro makes doing
+# these comparisons easy.
+#
+# The six basic comparisons are available, as well as checking equality
+# limited to a certain number of minor-version levels.
+#
+# The operator OP determines what type of comparison to do, and can be one
+# of:
+#
+# eq - equal (test A == B)
+# ne - not equal (test A != B)
+# le - less than or equal (test A <= B)
+# ge - greater than or equal (test A >= B)
+# lt - less than (test A < B)
+# gt - greater than (test A > B)
+#
+# Additionally, the eq and ne operator can have a number after it to limit
+# the test to that number of minor versions.
+#
+# eq0 - equal up to the length of the shorter version
+# ne0 - not equal up to the length of the shorter version
+# eqN - equal up to N sub-version levels
+# neN - not equal up to N sub-version levels
+#
+# When the condition is true, shell commands ACTION-IF-TRUE are run,
+# otherwise shell commands ACTION-IF-FALSE are run. The environment
+# variable 'ax_compare_version' is always set to either 'true' or 'false'
+# as well.
+#
+# Examples:
+#
+# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+# would both be true.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+# would both be false.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+# would be true because it is only comparing two minor versions.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+# would be true because it is only comparing the lesser number of minor
+# versions of the two values.
+#
+# Note: The characters that separate the version numbers do not matter. An
+# empty string is the same as version 0. OP is evaluated by autoconf, not
+# configure, so must be a string, not a variable.
+#
+# The author would like to acknowledge Guido Draheim whose advice about
+# the m4_case and m4_ifvaln functions make this macro only include the
+# portions necessary to perform the specific comparison specified by the
+# OP argument in the final configure script.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+ AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+ A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+ B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+ dnl # then the first line is used to determine if the condition is true.
+ dnl # The sed right after the echo is to remove any indented white space.
+ m4_case(m4_tolower($2),
+ [lt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [gt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [le],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],
+ [ge],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],[
+ dnl Split the operator from the subversion count if present.
+ m4_bmatch(m4_substr($2,2),
+ [0],[
+ # A count of zero means use the length of the shorter version.
+ # Determine the number of characters in A and B.
+ ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+ ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+ # Set A to no more than B's length and B to no more than A's length.
+ A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+ ],
+ [[0-9]+],[
+ # A count greater than zero means use only that many subversions
+ A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ ],
+ [.+],[
+ AC_WARNING(
+ [illegal OP numeric parameter: $2])
+ ],[])
+
+ # Pad zeros at end of numbers to make same length.
+ ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+ B="$B`echo $A | sed 's/./0/g'`"
+ A="$ax_compare_version_tmp_A"
+
+ # Check for equality or inequality as necessary.
+ m4_case(m4_tolower(m4_substr($2,0,2)),
+ [eq],[
+ test "x$A" = "x$B" && ax_compare_version=true
+ ],
+ [ne],[
+ test "x$A" != "x$B" && ax_compare_version=true
+ ],[
+ AC_WARNING([illegal OP parameter: $2])
+ ])
+ ])
+
+ AS_VAR_POPDEF([A])dnl
+ AS_VAR_POPDEF([B])dnl
+
+ dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+ if test "$ax_compare_version" = "true" ; then
+ m4_ifvaln([$4],[$4],[:])dnl
+ m4_ifvaln([$5],[else $5])dnl
+ fi
+]) dnl AX_COMPARE_VERSION
--- /dev/null
+#
+# "$Id: $"
+#
+# MIME conversions file for OpenPrinting CUPS Filters.
+#
+# Copyright 2007-2011 by Apple Inc.
+# Copyright 1997-2007 by Easy Software Products.
+#
+# These coded instructions, statements, and computer programs are the
+# property of Apple Inc. and are protected by Federal copyright
+# law. Distribution and use rights are outlined in the file "LICENSE.txt"
+# which should have been included with this file. If this file is
+# file is missing or damaged, see the license at "http://www.cups.org/".
+#
+
+########################################################################
+#
+# Format of Lines:
+#
+# source/type destination/type cost filter
+#
+# General Notes:
+#
+# The "cost" field is used to find the least costly filters to run
+# when converting a job file to a printable format.
+#
+# All filters *must* accept the standard command-line arguments
+# (job-id, user, title, copies, options, [filename or stdin]) to
+# work with CUPS.
+#
+
+########################################################################
+#
+# PDF filters
+#
+
+# CUPS file conversion rules for PostScript input when we are working with
+# the PDF printing workflow. General PostScript input should be converted to
+# PDF, so that pdftopdf is doing the page management on PDF data and the
+# renderer/driver part renders PDF. An exception is made for PostScript
+# coming from the Adobe Reader. As this PostScript cannot be converted to PDF
+# if it comes from an encrypted PDF file, we simply override pstopdf and the
+# PDF workflow.
+
+application/postscript application/pdf 22 pstopdf
+application/vnd.adobe-reader-postscript application/vnd.cups-postscript 66 pstops
+
+application/pdf application/vnd.cups-pdf 22 pdftopdf
+application/x-cshell application/pdf 0 texttopdf
+application/x-csource application/pdf 0 texttopdf
+application/x-perl application/pdf 0 texttopdf
+application/x-shell application/pdf 0 texttopdf
+text/plain application/pdf 0 texttopdf
+text/html application/pdf 0 texttopdf
+image/gif application/vnd.cups-pdf 33 imagetopdf
+image/png application/vnd.cups-pdf 33 imagetopdf
+image/jpeg application/vnd.cups-pdf 33 imagetopdf
+image/tiff application/vnd.cups-pdf 33 imagetopdf
+image/x-bitmap application/vnd.cups-pdf 33 imagetopdf
+image/x-photocd application/vnd.cups-pdf 33 imagetopdf
+image/x-portable-anymap application/vnd.cups-pdf 33 imagetopdf
+image/x-portable-bitmap application/vnd.cups-pdf 33 imagetopdf
+image/x-portable-graymap application/vnd.cups-pdf 33 imagetopdf
+image/x-portable-pixmap application/vnd.cups-pdf 33 imagetopdf
+image/x-sgi-rgb application/vnd.cups-pdf 33 imagetopdf
+image/x-xbitmap application/vnd.cups-pdf 33 imagetopdf
+image/x-xpixmap application/vnd.cups-pdf 33 imagetopdf
+image/x-xwindowdump application/vnd.cups-pdf 33 imagetopdf
+image/x-sun-raster application/vnd.cups-pdf 33 imagetopdf
+
+########################################################################
+#
+# PostScript filters
+#
+
+#application/pdf application/vnd.cups-postscript 66 pdftops
+application/vnd.cups-pdf application/vnd.cups-postscript 22 pdftops
+#application/postscript application/vnd.cups-postscript 66 pstops
+
+########################################################################
+#
+# Raster filters...
+#
+
+application/vnd.cups-pdf application/vnd.cups-raster 100 pdftoraster
+image/gif application/vnd.cups-raster 100 imagetoraster
+image/png application/vnd.cups-raster 100 imagetoraster
+image/jpeg application/vnd.cups-raster 100 imagetoraster
+image/tiff application/vnd.cups-raster 100 imagetoraster
+image/x-bitmap application/vnd.cups-raster 100 imagetoraster
+image/x-photocd application/vnd.cups-raster 100 imagetoraster
+image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
+image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
+image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
+image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
+image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
+image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
+image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
+image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
+
+########################################################################
+#
+# Text filters (only for text-only printers)...
+#
+
+application/x-cshell text/plain 100 -
+application/x-csource text/plain 100 -
+application/x-perl text/plain 100 -
+application/x-shell text/plain 100 -
+text/html text/plain 100 -
+text/css text/plain 100 -
+
+#
+# End of "$Id: $".
+#
--- /dev/null
+#
+# "$Id: $"
+#
+# MIME types file for OpenPrinting CUPS Filters.
+#
+# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
+# VERSIONS OF OPENPRINTING CUPS FILTERS. Instead, create a "local.types"
+# file that reflects your local configuration changes.
+#
+# Copyright 2011 by Till Kamppeter
+#
+#
+# Distribution and use rights are outlined in the file "LICENSE.txt"
+# which should have been included with this file.
+#
+
+########################################################################
+#
+# Format of Lines:
+#
+# super/type rules
+#
+# "rules" can be any combination of:
+#
+# ( expr ) Parenthesis for expression grouping
+# + Logical AND
+# , or whitespace Logical OR
+# ! Logical NOT
+# match("pattern") Pattern match on filename
+# extension Pattern match on "*.extension"
+# ascii(offset,length) True if bytes are valid printable ASCII
+# (CR, NL, TAB, BS, 32-126)
+# priority(number) Sets priority of type (0=lowest,
+# 100=default, 200=highest)
+# printable(offset,length) True if bytes are printable 8-bit chars
+# (CR, NL, TAB, BS, 32-126, 128-254)
+# string(offset,"string") True if bytes are identical to string
+# istring(offset,"string") True if bytes are identical to
+# case-insensitive string
+# char(offset,value) True if byte is identical
+# short(offset,value) True if 16-bit integer is identical
+# int(offset,value) True if 32-bit integer is identical
+# locale("string") True if current locale matches string
+# contains(offset,range,"string") True if the range contains the string
+#
+# General Notes:
+#
+# MIME type names are case-insensitive. Internally they are converted
+# to lowercase. Multiple occurrences of a type will cause the provided
+# rules to be appended to the existing definition. If two types use the same
+# rules to resolve a type and have the same priority, e.g. "doc" extension for
+# "text/bar" and "text/foo", the returned type will be the first type as
+# sorted in alphanumerically ascending order without regard to case. Thus,
+# the "text/bar" type will match the "doc" extension first unless the
+# "text/foo" type has specified a higher priority.
+#
+# The "printable" rule differs from the "ascii" rule in that it also
+# accepts 8-bit characters in the range 128-255.
+#
+# String constants must be surrounded by "" if they contain whitespace.
+# To insert binary data into a string, use the <hex> notation.
+#
+
+########################################################################
+#
+# Application-generated files...
+#
+
+# CUPS file detection rule for PostScript which is generated by the Adobe
+# Reader. We distinguish PostScript from the Adobe reader here so that we
+# can override pstopdf and the PDF workflow for these PostScript files as the
+# conversion of them to PDF does not work if the original PDF file was
+# encrypted.
+
+application/vnd.adobe-reader-postscript priority(150) contains(0,4096,"%%Creator: Adobe Acrobat") + \
+ (ai eps ps string(0,%!) string(0,<04>%!) \
+ contains(0,128,<1B>%-12345X) + \
+ (contains(0,4096,"LANGUAGE=POSTSCRIPT") \
+ contains(0,4096,"LANGUAGE = Postscript") \
+ contains(0,4096,"LANGUAGE = PostScript") \
+ contains(0,4096,"LANGUAGE = POSTSCRIPT") \
+ (contains(0,4096,<0a>%!) + \
+ !contains(0,4096,"ENTER LANGUAGE"))))
+
+########################################################################
+#
+# Image files...
+#
+
+image/x-xbitmap xbm string(0,"#define");
+image/x-xpixmap xpm string(3,"XPM")
+image/x-xwindowdump xwd string(4,<00000007>)
+image/urf urf string(0,UNIRAST<00>)
+
+########################################################################
+#
+# CUPS-specific types...
+#
+
+application/vnd.cups-pdf
+application/vnd.cups-pdf-banner string(0,'#PDF-BANNER')
+
+#
+# End of "$Id: $".
+#
--- /dev/null
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2012-01-06.13; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
--- /dev/null
+%define _unpackaged_files_terminate_build 0
+
+Summary: cups-filters
+Name: cups-filters
+Version: 1.0.25
+Release: 2
+License: GPL
+Group: System Environment/Daemons
+Source0: %{name}-%{version}.tar.gz
+Url: http://www.cups.org
+Patch1: tizen-pdftoraster-oom-fix.patch
+
+Requires(post): eglibc
+Requires: libcupsfilters1
+#used only for texttopdf
+#Requires: libfontembed
+BuildRequires: cups
+BuildRequires: pkgconfig(poppler)
+BuildRequires: pkgconfig(poppler-cpp)
+BuildRequires: pkgconfig(lcms2)
+BuildRequires: pkgconfig(libpng)
+BuildRequires: pkgconfig(fontconfig)
+BuildRequires: pkgconfig(ijs)
+BuildRequires: xpdf-tools
+BuildRequires: libjpeg-turbo-devel
+BuildRequires: libtiff-devel
+BuildRequires: zlib-devel
+BuildRequires: cups-devel
+BuildRequires: cups-libs
+BuildRequires: pkgconfig(gnutls)
+BuildRequires: pkgconfig(libqpdf)
+BuildRequires: which
+
+%description
+This package provides the CUPS shared libraries.
+
+%package -n libcupsfilters1
+Summary: CUPS - shared libraries
+Group: System Environment/Libraries
+Requires: cups
+Provides: libcupsfilters1
+
+%description -n libcupsfilters1
+This package provides the CUPS shared libraries.
+
+%package -n libfontembed
+Summary: CUPS - shared libraries
+Group: System Environment/Libraries
+Requires: cups
+Provides: libfontembed
+
+%description -n libfontembed
+This package provides library which contains functions for font embedding in PDF files, commonly
+ used by CUPS filters.
+
+%package -n libfontembed-devel
+Summary: CUPS - shared libraries
+Group: System Environment/Libraries
+Requires: cups
+Provides: libfontembed-devel
+
+%description -n libfontembed-devel
+This package provides the headers and development environment for libfontembed library.
+
+%package -n libcupsfilters-devel
+Summary: CUPS - shared libraries
+Group: System Environment/Libraries
+
+%description -n libcupsfilters-devel
+This package provides the CUPS headers and development environment.
+
+%prep
+%setup -q
+# OOM can be happened in using pdftoraster, becuase 600dpi use huge memory(about 1.6G)
+# This patch fixes pdftoraster to use about 400M in 600dpi printing.
+%patch1 -p1
+
+%build
+./autogen.sh
+%configure \
+ --prefix=/usr --mandir=/usr/share/man --without-tiff --without-php \
+ --enable-imagefilters --with-jpeg --with-png \
+ --enable-largefile \
+ --with-pdftops=pdftops
+ #--with-pdftops-path=/usr/bin/pdftops
+
+BUILDROOT=$RPM_BUILD_ROOT DESTDIR=$RPM_BUILD_ROOT DSTROOT=$RPM_BUILD_ROOT make -Ioprs -Iopvp -I../opvp -I. -I.. -I/usr/include/poppler -I/usr/include/ijs -I/usr/include/poppler/splash
+
+%install
+rm -rf $RPM_BUILD_ROOT
+#make BUILDROOT=$RPM_BUILD_ROOT install
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name}
+cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libcupsfilters1
+cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libfontembed
+
+#%post
+#if [ "$1" = "configure" ]; then
+#
+# if [ -r /var/run/cups/cups.sock ]; then
+# # Restart CUPS (to register new and updated MIME rules)
+# invoke-rc.d cups force-reload || true
+#
+# # Wait for the CUPS daemon getting ready after reloading it
+# for i in 1 2 3 4 5; do if [ -r /var/run/cups/cups.sock ]; then break; fi; sleep 1; echo -n "."; done; #echo;
+# fi
+#
+#elif [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ] || [ "$1" = "abort-deconfigure" ]; then
+# :
+#else
+# echo "postinst called with unknown argument \`$1'" >&2
+# exit 0
+#fi
+
+%files
+%defattr (-,root,root)
+%manifest cups-filters.manifest
+/usr/share/license/%{name}
+%exclude /etc/fonts/conf.d/99pdftoopvp.conf
+%exclude %{_libdir}/cups/backend/*
+%attr(0755,root,root) %dir /usr/lib/cups/filter
+%{_libdir}/cups/filter/*
+%exclude %{_libdir}/cups/filter/texttopdf
+%exclude %{_libdir}/cups/filter/textonly
+%exclude %{_libdir}/cups/filter/texttops
+%exclude %{_libdir}/cups/filter/commandtoescpx
+%exclude %{_libdir}/cups/filter/commandtopclx
+%exclude %{_libdir}/cups/filter/rastertoescpx
+%exclude %{_libdir}/cups/filter/rastertopclx
+%exclude %{_libdir}/cups/filter/pdftoijs
+%exclude %{_libdir}/cups/filter/pdftoopvp
+#%exclude /usr/share/cups/banners
+#%exclude /usr/share/cups/drv/*
+%exclude /usr/share/ppd/*
+%dir /usr/share/cups
+/usr/share/cups/*
+#../*.ppd-updater usr/share/cups/ppd-updaters/
+
+%files -n libfontembed
+%manifest libfontembed.manifest
+%defattr(-,root,root)
+/usr/share/license/libfontembed
+%{_libdir}/libfontembed.so.*
+
+%files -n libfontembed-devel
+%defattr(-,root,root)
+%{_libdir}/libfontembed.so
+#%{_libdir}/libcupsfilters.a
+%{_libdir}/pkgconfig/libfontembed.pc
+%{_includedir}/fontembed/*.h
+
+%files -n libcupsfilters1
+%manifest libcupsfilters1.manifest
+%defattr(-,root,root)
+/usr/share/license/libcupsfilters1
+%{_libdir}/libcupsfilters.so.*
+
+%files -n libcupsfilters-devel
+%defattr(-,root,root)
+%{_libdir}/libcupsfilters.so
+#%{_libdir}/libcupsfilters.a
+%{_libdir}/pkgconfig/libcupsfilters.pc
+%{_includedir}/cupsfilters/*.h
--- /dev/null
+diff -urN cups-filters.orig/filter/pdftoraster.cxx cups-filters/filter/pdftoraster.cxx
+--- cups-filters.orig/filter/pdftoraster.cxx 2012-12-18 11:26:38.864685553 +0900
++++ cups-filters/filter/pdftoraster.cxx 2012-12-26 14:56:47.500912858 +0900
+@@ -87,6 +87,7 @@
+
+ #define MAX_CHECK_COMMENT_LINES 20
+ #define MAX_BYTES_PER_PIXEL 32
++#define MAX_BYTES_PER_SLICE 20000000
+
+ namespace {
+ typedef unsigned char *(*ConvertLineFunc)(unsigned char *src,
+@@ -1469,7 +1470,7 @@
+ }
+
+ static void writePageImage(cups_raster_t *raster, SplashBitmap *bitmap,
+- int pageNo)
++ int pageNo, unsigned int nlines)
+ {
+ ConvertLineFunc convertLine;
+ unsigned char *lineBuf = NULL;
+@@ -1505,9 +1506,9 @@
+ for (unsigned int plane = 0;plane < nplanes;plane++) {
+ unsigned char *bp = (unsigned char *)(bitmap->getDataPtr());
+
+- bp += rowsize * bitmapoffset[1] +
+- popplerBitsPerPixel * bitmapoffset[0] / 8;
+- for (unsigned int h = 0;h < header.cupsHeight;h++) {
++// bp += rowsize * bitmapoffset[1] +
++// popplerBitsPerPixel * bitmapoffset[0] / 8;
++ for (unsigned int h = 0;h < nlines;h++) {
+ for (unsigned int band = 0;band < nbands;band++) {
+ dp = convertLine(bp,lineBuf,h,plane+band,header.cupsWidth,
+ bytesPerLine);
+@@ -1622,10 +1623,6 @@
+ }
+ }
+
+- doc->displayPage(out,pageNo,header.HWResolution[0],
+- header.HWResolution[1],(landscape == 0 ? 0 : 90),
+- gTrue,gTrue,gTrue);
+- bitmap = out->getBitmap();
+ bitmapoffset[0] = margins[0] / 72.0 * header.HWResolution[0];
+ bitmapoffset[1] = margins[3] / 72.0 * header.HWResolution[1];
+
+@@ -1656,8 +1653,22 @@
+ exit(1);
+ }
+
+- /* write page image */
+- writePageImage(raster,bitmap,pageNo);
++ //calculate the number of slices
++ unsigned int totalBytes = header.cupsBytesPerLine * header.cupsHeight;
++ unsigned int numSlices = totalBytes / MAX_BYTES_PER_SLICE;
++ numSlices += ((totalBytes % MAX_BYTES_PER_SLICE) > 0) ? 1 : 0;
++ unsigned int linesInSlice = header.cupsHeight / numSlices;
++ linesInSlice += header.cupsHeight % numSlices > 0 ? 1 : 0;
++ unsigned int linesRemained = header.cupsHeight;
++ for(unsigned int i=0;i<numSlices;i++) {
++ unsigned int linesToPrint = linesInSlice > linesRemained ? linesRemained : linesInSlice;
++ doc->displayPageSlice(out,pageNo,header.HWResolution[0],
++ header.HWResolution[1],(landscape == 0 ? 0 : 90),
++ gTrue,gTrue,gTrue, 0, linesInSlice*i, header.cupsWidth, linesToPrint);
++ bitmap = out->getBitmap();
++ writePageImage(raster,bitmap,pageNo, linesToPrint);
++ linesRemained = linesRemained - linesInSlice;
++ }
+ }
+
+ static void setPopplerColorProfile()
--- /dev/null
+*PPD-Adobe: "4.3"
+*%
+*% This PPD file is for using a PDF printer in its native PDF mode, with
+*% option settings controlled via PJL commands. It uses CUPS with the
+*% OpenPrinting CUPS Filters package.
+*%
+*% This PPD is experimental. It is possible that some of the options
+*% and settings do not make sense or do not cause any change on the output.
+*% It can even happen that with certain settings nothing or an error page
+*% comes out.
+*%
+*% This file is published under the GNU General Public License
+*%
+*% You may save this file as 'Generic-PDF_Printer-PDF.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "PDF.PPD"
+*Manufacturer: "Generic"
+*Product: "(Generic PDF Printer)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*ModelName: "Generic PDF Printer"
+*ShortNickName: "Generic PDF Printer"
+*NickName: "Generic PDF Printer"
+*PSVersion: "(3010.107) 0"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: CMYK
+*FileSystem: False
+*Throughput: "30"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "MFG:Generic;CMD:PJL,PDF;MDL:PDF Printer;CLS:PRINTER;DES:Generic PDF Printer;DRV:DPDF,R1,M0;"
+*JCLBegin: "<1B>%-12345X@PJL JOB<0A>"
+*JCLToPDFInterpreter: "@PJL ENTER LANGUAGE = PDF<0A>"
+*JCLEnd: "<1B>%-12345X@PJL EOJ <0A><1B>%-12345X"
+*cupsFilter: "application/vnd.cups-pdf 0 -"
+
+*OpenGroup: General/General
+*JCLOpenUI *PageSize/Page Size: PickOne
+*OrderDependency: 100 JCLSetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "@PJL SET PAPER=LETTER<0A>"
+*PageSize A4/A4: "@PJL SET PAPER=A4<0A>"
+*PageSize A5/A5: "@PJL SET PAPER=A5<0A>"
+*PageSize A6/A6: "@PJL SET PAPER=A6<0A>"
+*PageSize ISOB5/ISO B5: "@PJL SET PAPER=B5<0A>"
+*PageSize EnvC5/C5: "@PJL SET PAPER=C5<0A>"
+*PageSize Env10/Com 10: "@PJL SET PAPER=COM10<0A>"
+*PageSize EnvDL/DL: "@PJL SET PAPER=DL<0A>"
+*PageSize 5x13/Eight Point 5x13: "@PJL SET PAPER=EIGHTPOINT5X13<0A>"
+*PageSize EnvC6/Envelope C6: "@PJL SET PAPER=ENVELOPEC6<0A>"
+*PageSize Executive/Executive: "@PJL SET PAPER=EXECUTIVE<0A>"
+*PageSize B5/JIS B5: "@PJL SET PAPER=JISB5<0A>"
+*PageSize B6/JIS B6: "@PJL SET PAPER=JISB6<0A>"
+*PageSize Legal/Legal: "@PJL SET PAPER=LEGAL<0A>"
+*PageSize EnvMonarch/Monarch: "@PJL SET PAPER=MONARCH<0A>"
+*PageSize 69x95mm/16K: "@PJL SET PAPER=SIZE16K195x270<0A>"
+*PageSize Statement/Statement: "@PJL SET PAPER=STATEMENT<0A>"
+*JCLCloseUI: *PageSize
+
+*JCLOpenUI *PageRegion: PickOne
+*OrderDependency: 100 JCLSetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "@PJL SET PAPER=LETTER<0A>"
+*PageRegion A4/A4: "@PJL SET PAPER=A4<0A>"
+*PageRegion A5/A5: "@PJL SET PAPER=A5<0A>"
+*PageRegion A6/A6: "@PJL SET PAPER=A6<0A>"
+*PageRegion ISOB5/ISO B5: "@PJL SET PAPER=B5<0A>"
+*PageRegion EnvC5/C5: "@PJL SET PAPER=C5<0A>"
+*PageRegion Env10/Com 10: "@PJL SET PAPER=COM10<0A>"
+*PageRegion EnvDL/DL: "@PJL SET PAPER=DL<0A>"
+*PageRegion 5x13/Eight Point 5x13: "@PJL SET PAPER=EIGHTPOINT5X13<0A>"
+*PageRegion EnvC6/Envelope C6: "@PJL SET PAPER=ENVELOPEC6<0A>"
+*PageRegion Executive/Executive: "@PJL SET PAPER=EXECUTIVE<0A>"
+*PageRegion B5/JIS B5: "@PJL SET PAPER=JISB5<0A>"
+*PageRegion B6/JIS B6: "@PJL SET PAPER=JISB6<0A>"
+*PageRegion Legal/Legal: "@PJL SET PAPER=LEGAL<0A>"
+*PageRegion EnvMonarch/Monarch: "@PJL SET PAPER=MONARCH<0A>"
+*PageRegion 69x95mm/16K: "@PJL SET PAPER=SIZE16K195x270<0A>"
+*PageRegion Statement/Statement: "@PJL SET PAPER=STATEMENT<0A>"
+*JCLCloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "18 36 594 756"
+*ImageableArea A4/A4: "18 36 577 806"
+*ImageableArea A5/A5: "18 36 402 559"
+*ImageableArea A6/A6: "18 36 279 384"
+*ImageableArea ISOB5/ISO B5: "18 36 480 672"
+*ImageableArea EnvC5/C5: "18 36 441 613"
+*ImageableArea Env10/Com 10: "18 36 279 648"
+*ImageableArea EnvDL/DL: "18 36 293 587"
+*ImageableArea 5x13/Eight Point 5x13: "18 36 342 900"
+*ImageableArea EnvC6/Envelope C6: "18 36 305 423"
+*ImageableArea Executive/Executive: "18 36 504 720"
+*ImageableArea B5/JIS B5: "18 36 500 691"
+*ImageableArea B6/JIS B6: "18 36 344 482"
+*ImageableArea Legal/Legal: "18 36 594 972"
+*ImageableArea EnvMonarch/Monarch: "18 36 261 504"
+*ImageableArea 69x95mm/16K: "18 36 177 234"
+*ImageableArea Statement/Statement: "18 36 378 576"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "420 595"
+*PaperDimension A6/A6: "297 420"
+*PaperDimension ISOB5/ISO B5: "498 708"
+*PaperDimension EnvC5/C5: "459 649"
+*PaperDimension Env10/Com 10: "297 684"
+*PaperDimension EnvDL/DL: "311 623"
+*PaperDimension 5x13/Eight Point 5x13: "360 936"
+*PaperDimension EnvC6/Envelope C6: "323 459"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension B5/JIS B5: "518 727"
+*PaperDimension B6/JIS B6: "362 518"
+*PaperDimension Legal/Legal: "612 1008"
+*PaperDimension EnvMonarch/Monarch: "279 540"
+*PaperDimension 69x95mm/16K: "195 270"
+*PaperDimension Statement/Statement: "396 612"
+
+*JCLOpenUI *manualfeed/Manual Feed of Paper: PickOne
+*OrderDependency: 100 JCLSetup *manualfeed
+*Defaultmanualfeed: off
+*manualfeed off/Off: "@PJL SET MANUALFEED=OFF<0A>"
+*manualfeed on/On: "@PJL SET MANUALFEED=ON<0A>"
+*JCLCloseUI: *manualfeed
+
+*JCLOpenUI *manualduplex/Manual duplex: PickOne
+*OrderDependency: 100 JCLSetup *manualduplex
+*Defaultmanualduplex: off
+*manualduplex off/Off: "@PJL SET MANUALDUPLEX=OFF<0A>"
+*manualduplex on/On: "@PJL SET MANUALDUPLEX=ON<0A>"
+*JCLCloseUI: *manualduplex
+
+*JCLOpenUI *Duplex/Double-Sided Printing: PickOne
+*OrderDependency: 100 JCLSetup *Duplex
+*DefaultDuplex: None
+*Duplex None/Off: "@PJL SET DUPLEX=OFF<0A>"
+*Duplex DuplexNoTumble/Long-Edge binding: "@PJL SET DUPLEX=ON<0A>@PJL SET BINDING=LONGEDGE<0A>"
+*Duplex DuplexTumble/Short-Edge binding: "@PJL SET DUPLEX=ON<0A>@PJL SET BINDING=SHORTEDGE<0A>"
+*JCLCloseUI: *Duplex
+
+*JCLOpenUI *Resolution/Resolution: PickOne
+*OrderDependency: 100 JCLSetup *Resolution
+*DefaultResolution: 600dpi
+*Resolution 300dpi/300 dpi: "@PJL SET RESOLUTION=300<0A>"
+*Resolution 600dpi/600 dpi: "@PJL SET RESOLUTION=600<0A>"
+*Resolution 1200dpi/1200 dpi: "@PJL SET RESOLUTION=1200<0A>"
+*JCLCloseUI: *Resolution
+
+*JCLOpenUI *ret/Resolution Enhancement: PickOne
+*OrderDependency: 100 JCLSetup *ret
+*Defaultret: notset
+*ret dark/Dark: "@PJL SET RET=DARK<0A>"
+*ret light/Light: "@PJL SET RET=LIGHT<0A>"
+*ret medium/Medium: "@PJL SET RET=MEDIUM<0A>"
+*ret notset/notset: "@PJL SET RET=NOTSET<0A>"
+*ret off/Off: "@PJL SET RET=OFF<0A>"
+*JCLCloseUI: *ret
+
+*JCLOpenUI *borderless/Borderless Printing: PickOne
+*OrderDependency: 100 JCLSetup *borderless
+*Defaultborderless: on
+*borderless off/Off: "@PJL SET BORDERLESS=OFF<0A>"
+*borderless on/On: "@PJL SET BORDERLESS=ON<0A>"
+*JCLCloseUI: *borderless
+
+*JCLOpenUI *edgetoedge/Edge to edge: PickOne
+*OrderDependency: 100 JCLSetup *edgetoedge
+*Defaultedgetoedge: yes
+*edgetoedge no/No: "@PJL SET EDGETOEDGE=NO<0A>"
+*edgetoedge yes/Yes: "@PJL SET EDGETOEDGE=YES<0A>"
+*JCLCloseUI: *edgetoedge
+
+*JCLOpenUI *joboffset/Job Offset: PickOne
+*OrderDependency: 100 JCLSetup *joboffset
+*Defaultjoboffset: on
+*joboffset off/Off: "@PJL SET JOBOFFSET=OFF<0A>"
+*joboffset on/On: "@PJL SET JOBOFFSET=ON<0A>"
+*JCLCloseUI: *joboffset
+
+*JCLOpenUI *lowsupplies/On low supplies: PickOne
+*OrderDependency: 100 JCLSetup *lowsupplies
+*Defaultlowsupplies: continue
+*lowsupplies continue/Continue: "@PJL SET LOWSUPPLIES=CONTINUE<0A>"
+*lowsupplies stop/Stop: "@PJL SET LOWSUPPLIES=STOP<0A>"
+*JCLCloseUI: *lowsupplies
+
+*JCLOpenUI *overridea4withletter/Override A4 with Letter: PickOne
+*OrderDependency: 100 JCLSetup *overridea4withletter
+*Defaultoverridea4withletter: yes
+*overridea4withletter no/No: "@PJL SET OVERRIDEA4WITHLETTER=NO<0A>"
+*overridea4withletter yes/Yes: "@PJL SET OVERRIDEA4WITHLETTER=YES<0A>"
+*JCLCloseUI: *overridea4withletter
+
+*CloseGroup: General
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
+
--- /dev/null
+*PPD-Adobe: "4.3"
+*%
+*% This PPD file is for using the HP Color LaserJet CM3530 MFP in native
+*% PDF mode, using CUPS with the OpenPrinting CUPS Filters package
+*%
+*% This PPD is experimental. It is possible that some of the options
+*% and settings do not make sense or do not cause any change on the output.
+*% It can even happen that with certain settings nothing or an error page
+*% comes out.
+*%
+*% This file is published under the GNU General Public License
+*%
+*% You may save this file as 'HP-Color_LaserJet_CM3530_MFP-PDF.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "CM353PDF.PPD"
+*Manufacturer: "HP"
+*Product: "(HP Color LaserJet CM3530 MFP)"
+*Product: "(Hewlett-Packard HP Color LaserJet CM3530 MFP)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*ModelName: "HP Color LaserJet CM3530 MFP"
+*ShortNickName: "HP Color LaserJet CM3530 MFP"
+*NickName: "HP Color LaserJet CM3530 MFP PDF"
+*PSVersion: "(3010.107) 0"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: CMYK
+*FileSystem: False
+*Throughput: "30"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "MFG:Hewlett-Packard;CMD:PJL,BIDI-ECP,PCLXL,PCL,PDF,PJL,POSTSCRIPT;MDL:HP Color LaserJet CM3530 MFP;CLS:PRINTER;DES:Hewlett-Packard Color LaserJet CM3530 MFP;DRV:DPDF,R0,M0;"
+*JCLBegin: "<1B>%-12345X@PJL JOB<0A>"
+*JCLToPDFInterpreter: "@PJL ENTER LANGUAGE = PDF <0A>"
+*JCLEnd: "<1B>%-12345X@PJL EOJ <0A><1B>%-12345X"
+*cupsFilter: "application/vnd.cups-pdf 0 -"
+
+*OpenGroup: General/General
+*JCLOpenUI *PageSize/Page Size: PickOne
+*OrderDependency: 100 JCLSetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "@PJL SET PAPER=LETTER<0A>"
+*PageSize A4/A4: "@PJL SET PAPER=A4<0A>"
+*PageSize A5/A5: "@PJL SET PAPER=A5<0A>"
+*PageSize A6/A6: "@PJL SET PAPER=A6<0A>"
+*PageSize ISOB5/ISO B5: "@PJL SET PAPER=B5<0A>"
+*PageSize EnvC5/C5: "@PJL SET PAPER=C5<0A>"
+*PageSize Env10/Com 10: "@PJL SET PAPER=COM10<0A>"
+*PageSize EnvDL/DL: "@PJL SET PAPER=DL<0A>"
+*PageSize 5x13/Eight Point 5x13: "@PJL SET PAPER=EIGHTPOINT5X13<0A>"
+*PageSize EnvC6/Envelope C6: "@PJL SET PAPER=ENVELOPEC6<0A>"
+*PageSize Executive/Executive: "@PJL SET PAPER=EXECUTIVE<0A>"
+*PageSize B5/JIS B5: "@PJL SET PAPER=JISB5<0A>"
+*PageSize B6/JIS B6: "@PJL SET PAPER=JISB6<0A>"
+*PageSize Legal/Legal: "@PJL SET PAPER=LEGAL<0A>"
+*PageSize EnvMonarch/Monarch: "@PJL SET PAPER=MONARCH<0A>"
+*PageSize 69x95mm/16K: "@PJL SET PAPER=SIZE16K195x270<0A>"
+*PageSize Statement/Statement: "@PJL SET PAPER=STATEMENT<0A>"
+*JCLCloseUI: *PageSize
+
+*JCLOpenUI *PageRegion: PickOne
+*OrderDependency: 100 JCLSetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "@PJL SET PAPER=LETTER<0A>"
+*PageRegion A4/A4: "@PJL SET PAPER=A4<0A>"
+*PageRegion A5/A5: "@PJL SET PAPER=A5<0A>"
+*PageRegion A6/A6: "@PJL SET PAPER=A6<0A>"
+*PageRegion ISOB5/ISO B5: "@PJL SET PAPER=B5<0A>"
+*PageRegion EnvC5/C5: "@PJL SET PAPER=C5<0A>"
+*PageRegion Env10/Com 10: "@PJL SET PAPER=COM10<0A>"
+*PageRegion EnvDL/DL: "@PJL SET PAPER=DL<0A>"
+*PageRegion 5x13/Eight Point 5x13: "@PJL SET PAPER=EIGHTPOINT5X13<0A>"
+*PageRegion EnvC6/Envelope C6: "@PJL SET PAPER=ENVELOPEC6<0A>"
+*PageRegion Executive/Executive: "@PJL SET PAPER=EXECUTIVE<0A>"
+*PageRegion B5/JIS B5: "@PJL SET PAPER=JISB5<0A>"
+*PageRegion B6/JIS B6: "@PJL SET PAPER=JISB6<0A>"
+*PageRegion Legal/Legal: "@PJL SET PAPER=LEGAL<0A>"
+*PageRegion EnvMonarch/Monarch: "@PJL SET PAPER=MONARCH<0A>"
+*PageRegion 69x95mm/16K: "@PJL SET PAPER=SIZE16K195x270<0A>"
+*PageRegion Statement/Statement: "@PJL SET PAPER=STATEMENT<0A>"
+*JCLCloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "18 36 594 756"
+*ImageableArea A4/A4: "18 36 577 806"
+*ImageableArea A5/A5: "18 36 402 559"
+*ImageableArea A6/A6: "18 36 279 384"
+*ImageableArea ISOB5/ISO B5: "18 36 480 672"
+*ImageableArea EnvC5/C5: "18 36 441 613"
+*ImageableArea Env10/Com 10: "18 36 279 648"
+*ImageableArea EnvDL/DL: "18 36 293 587"
+*ImageableArea 5x13/Eight Point 5x13: "18 36 342 900"
+*ImageableArea EnvC6/Envelope C6: "18 36 305 423"
+*ImageableArea Executive/Executive: "18 36 504 720"
+*ImageableArea B5/JIS B5: "18 36 500 691"
+*ImageableArea B6/JIS B6: "18 36 344 482"
+*ImageableArea Legal/Legal: "18 36 594 972"
+*ImageableArea EnvMonarch/Monarch: "18 36 261 504"
+*ImageableArea 69x95mm/16K: "18 36 177 234"
+*ImageableArea Statement/Statement: "18 36 378 576"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "420 595"
+*PaperDimension A6/A6: "297 420"
+*PaperDimension ISOB5/ISO B5: "498 708"
+*PaperDimension EnvC5/C5: "459 649"
+*PaperDimension Env10/Com 10: "297 684"
+*PaperDimension EnvDL/DL: "311 623"
+*PaperDimension 5x13/Eight Point 5x13: "360 936"
+*PaperDimension EnvC6/Envelope C6: "323 459"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension B5/JIS B5: "518 727"
+*PaperDimension B6/JIS B6: "362 518"
+*PaperDimension Legal/Legal: "612 1008"
+*PaperDimension EnvMonarch/Monarch: "279 540"
+*PaperDimension 69x95mm/16K: "195 270"
+*PaperDimension Statement/Statement: "396 612"
+
+*JCLOpenUI *manualfeed/Manual Feed of Paper: PickOne
+*OrderDependency: 100 JCLSetup *manualfeed
+*Defaultmanualfeed: off
+*manualfeed off/Off: "@PJL SET MANUALFEED=OFF<0A>"
+*manualfeed on/On: "@PJL SET MANUALFEED=ON<0A>"
+*JCLCloseUI: *manualfeed
+
+*JCLOpenUI *manualduplex/Manual duplex: PickOne
+*OrderDependency: 100 JCLSetup *manualduplex
+*Defaultmanualduplex: off
+*manualduplex off/Off: "@PJL SET MANUALDUPLEX=OFF<0A>"
+*manualduplex on/On: "@PJL SET MANUALDUPLEX=ON<0A>"
+*JCLCloseUI: *manualduplex
+
+*JCLOpenUI *Duplex/Double-Sided Printing: PickOne
+*OrderDependency: 100 JCLSetup *Duplex
+*DefaultDuplex: None
+*Duplex None/Off: "@PJL SET DUPLEX=OFF<0A>"
+*Duplex DuplexNoTumble/Long-Edge binding: "@PJL SET DUPLEX=ON<0A>@PJL SET BINDING=LONGEDGE<0A>"
+*Duplex DuplexTumble/Short-Edge binding: "@PJL SET DUPLEX=ON<0A>@PJL SET BINDING=SHORTEDGE<0A>"
+*JCLCloseUI: *Duplex
+
+*JCLOpenUI *Resolution/Resolution: PickOne
+*OrderDependency: 100 JCLSetup *Resolution
+*DefaultResolution: 600dpi
+*Resolution 300dpi/300 dpi: "@PJL SET RESOLUTION=300<0A>"
+*Resolution 600dpi/600 dpi: "@PJL SET RESOLUTION=600<0A>"
+*Resolution 1200dpi/1200 dpi: "@PJL SET RESOLUTION=1200<0A>"
+*JCLCloseUI: *Resolution
+
+
+*JCLOpenUI *colorbalanceblack/Color balance black: PickOne
+*OrderDependency: 100 JCLSetup *colorbalanceblack
+*Defaultcolorbalanceblack: 4
+*colorbalanceblack 0/0: "@PJL SET COLORBALANCEBLACK=0<0A>"
+*colorbalanceblack 1/1: "@PJL SET COLORBALANCEBLACK=1<0A>"
+*colorbalanceblack 2/2: "@PJL SET COLORBALANCEBLACK=2<0A>"
+*colorbalanceblack 3/3: "@PJL SET COLORBALANCEBLACK=3<0A>"
+*colorbalanceblack 4/4: "@PJL SET COLORBALANCEBLACK=4<0A>"
+*colorbalanceblack 5/5: "@PJL SET COLORBALANCEBLACK=5<0A>"
+*colorbalanceblack 6/6: "@PJL SET COLORBALANCEBLACK=6<0A>"
+*colorbalanceblack 7/7: "@PJL SET COLORBALANCEBLACK=7<0A>"
+*colorbalanceblack 8/8: "@PJL SET COLORBALANCEBLACK=8<0A>"
+*JCLCloseUI: *colorbalanceblack
+
+*CustomJCLcolorbalanceblack True: "@PJL SET COLORBALANCEBLACK=\1<0A>"
+*ParamCustomJCLcolorbalanceblack colorbalanceblack/colorbalanceblack: 1 int 0 8
+
+*JCLOpenUI *colorbalancecyan/Color balance cyan: PickOne
+*OrderDependency: 100 JCLSetup *colorbalancecyan
+*Defaultcolorbalancecyan: 4
+*colorbalancecyan 0/0: "@PJL SET COLORBALANCECYAN=0<0A>"
+*colorbalancecyan 1/1: "@PJL SET COLORBALANCECYAN=1<0A>"
+*colorbalancecyan 2/2: "@PJL SET COLORBALANCECYAN=2<0A>"
+*colorbalancecyan 3/3: "@PJL SET COLORBALANCECYAN=3<0A>"
+*colorbalancecyan 4/4: "@PJL SET COLORBALANCECYAN=4<0A>"
+*colorbalancecyan 5/5: "@PJL SET COLORBALANCECYAN=5<0A>"
+*colorbalancecyan 6/6: "@PJL SET COLORBALANCECYAN=6<0A>"
+*colorbalancecyan 7/7: "@PJL SET COLORBALANCECYAN=7<0A>"
+*colorbalancecyan 8/8: "@PJL SET COLORBALANCECYAN=8<0A>"
+*JCLCloseUI: *colorbalancecyan
+
+*CustomJCLcolorbalancecyan True: "@PJL SET COLORBALANCECYAN=\1<0A>"
+*ParamCustomJCLcolorbalancecyan colorbalancecyan/colorbalancecyan: 1 int 0 8
+
+*JCLOpenUI *colorbalancemagenta/Color balance magenta: PickOne
+*OrderDependency: 100 JCLSetup *colorbalancemagenta
+*Defaultcolorbalancemagenta: 4
+*colorbalancemagenta 0/0: "@PJL SET COLORBALANCEMAGENTA=0<0A>"
+*colorbalancemagenta 1/1: "@PJL SET COLORBALANCEMAGENTA=1<0A>"
+*colorbalancemagenta 2/2: "@PJL SET COLORBALANCEMAGENTA=2<0A>"
+*colorbalancemagenta 3/3: "@PJL SET COLORBALANCEMAGENTA=3<0A>"
+*colorbalancemagenta 4/4: "@PJL SET COLORBALANCEMAGENTA=4<0A>"
+*colorbalancemagenta 5/5: "@PJL SET COLORBALANCEMAGENTA=5<0A>"
+*colorbalancemagenta 6/6: "@PJL SET COLORBALANCEMAGENTA=6<0A>"
+*colorbalancemagenta 7/7: "@PJL SET COLORBALANCEMAGENTA=7<0A>"
+*colorbalancemagenta 8/8: "@PJL SET COLORBALANCEMAGENTA=8<0A>"
+*JCLCloseUI: *colorbalancemagenta
+
+*CustomJCLcolorbalancemagenta True: "@PJL SET COLORBALANCEMAGENTA=\1<0A>"
+*ParamCustomJCLcolorbalancemagenta colorbalancemagenta/colorbalancemagenta: 1 int 0 8
+
+*JCLOpenUI *colorbalanceyellow/Color balance yellow: PickOne
+*OrderDependency: 100 JCLSetup *colorbalanceyellow
+*Defaultcolorbalanceyellow: 4
+*colorbalanceyellow 0/0: "@PJL SET COLORBALANCEYELLOW=0<0A>"
+*colorbalanceyellow 1/1: "@PJL SET COLORBALANCEYELLOW=1<0A>"
+*colorbalanceyellow 2/2: "@PJL SET COLORBALANCEYELLOW=2<0A>"
+*colorbalanceyellow 3/3: "@PJL SET COLORBALANCEYELLOW=3<0A>"
+*colorbalanceyellow 4/4: "@PJL SET COLORBALANCEYELLOW=4<0A>"
+*colorbalanceyellow 5/5: "@PJL SET COLORBALANCEYELLOW=5<0A>"
+*colorbalanceyellow 6/6: "@PJL SET COLORBALANCEYELLOW=6<0A>"
+*colorbalanceyellow 7/7: "@PJL SET COLORBALANCEYELLOW=7<0A>"
+*colorbalanceyellow 8/8: "@PJL SET COLORBALANCEYELLOW=8<0A>"
+*JCLCloseUI: *colorbalanceyellow
+
+*CustomJCLcolorbalanceyellow True: "@PJL SET COLORBALANCEYELLOW=\1<0A>"
+*ParamCustomJCLcolorbalanceyellow colorbalanceyellow/colorbalanceyellow: 1 int 0 8
+
+
+*JCLOpenUI *colorsupplyout/On color supply out: PickOne
+*OrderDependency: 100 JCLSetup *colorsupplyout
+*Defaultcolorsupplyout: autocontinueblack
+*colorsupplyout autocontinueblack/Continue in grayscale: "@PJL SET COLORSUPPLYOUT=AUTOCONTINUEBLACK<0A>"
+*colorsupplyout stop/Stop: "@PJL SET COLORSUPPLYOUT=STOP<0A>"
+*JCLCloseUI: *colorsupplyout
+
+*JCLOpenUI *ret/Resolution Enhancement: PickOne
+*OrderDependency: 100 JCLSetup *ret
+*Defaultret: notset
+*ret dark/Dark: "@PJL SET RET=DARK<0A>"
+*ret light/Light: "@PJL SET RET=LIGHT<0A>"
+*ret medium/Medium: "@PJL SET RET=MEDIUM<0A>"
+*ret notset/notset: "@PJL SET RET=NOTSET<0A>"
+*ret off/Off: "@PJL SET RET=OFF<0A>"
+*JCLCloseUI: *ret
+
+*JCLOpenUI *borderless/Borderless Printing: PickOne
+*OrderDependency: 100 JCLSetup *borderless
+*Defaultborderless: on
+*borderless off/Off: "@PJL SET BORDERLESS=OFF<0A>"
+*borderless on/On: "@PJL SET BORDERLESS=ON<0A>"
+*JCLCloseUI: *borderless
+
+*JCLOpenUI *contentorientation/Content Orientation: PickOne
+*OrderDependency: 100 JCLSetup *contentorientation
+*Defaultcontentorientation: notspecified
+*contentorientation landscape/Landscape: "@PJL SET CONTENTORIENTATION=LANDSCAPE<0A>"
+*contentorientation notspecified/Not specified: "@PJL SET CONTENTORIENTATION=NOTSPECIFIED<0A>"
+*contentorientation portrait/Portrait: "@PJL SET CONTENTORIENTATION=PORTRAIT<0A>"
+*contentorientation reverselandscape/Reverse landscape: "@PJL SET CONTENTORIENTATION=REVERSELANDSCAPE<0A>"
+*contentorientation reverseportrait/Reverse portrait: "@PJL SET CONTENTORIENTATION=REVERSEPORTRAIT<0A>"
+*JCLCloseUI: *contentorientation
+
+*JCLOpenUI *edgecontrol/Edge control: PickOne
+*OrderDependency: 100 JCLSetup *edgecontrol
+*Defaultedgecontrol: maximum
+*edgecontrol normal/Normal: "@PJL SET EDGECONTROL=NORMAL<0A>"
+*edgecontrol light/Light: "@PJL SET EDGECONTROL=LIGHT<0A>"
+*edgecontrol maximum/Maximum: "@PJL SET EDGECONTROL=MAXIMUM<0A>"
+*edgecontrol off/Off: "@PJL SET EDGECONTROL=OFF<0A>"
+*JCLCloseUI: *edgecontrol
+
+*JCLOpenUI *edgetoedge/Edge to edge: PickOne
+*OrderDependency: 100 JCLSetup *edgetoedge
+*Defaultedgetoedge: yes
+*edgetoedge no/No: "@PJL SET EDGETOEDGE=NO<0A>"
+*edgetoedge yes/Yes: "@PJL SET EDGETOEDGE=YES<0A>"
+*JCLCloseUI: *edgetoedge
+
+*JCLOpenUI *finish/Finisher: PickOne
+*OrderDependency: 100 JCLSetup *finish
+*Defaultfinish: none
+*finish none/None: "@PJL SET FINISH=NONE<0A>"
+*finish on/On: "@PJL SET FINISH=ON<0A>"
+*finish staple/Staple: "@PJL SET FINISH=STAPLE<0A>"
+*JCLCloseUI: *finish
+
+*JCLOpenUI *hold/Hold Job: PickOne
+*OrderDependency: 100 JCLSetup *hold
+*Defaulthold: off
+*hold off/Off: "@PJL SET HOLD=OFF<0A>"
+*hold on/On: "@PJL SET HOLD=ON<0A>"
+*hold proof/Proof: "@PJL SET HOLD=PROOF<0A>"
+*hold store/Store: "@PJL SET HOLD=STORE<0A>"
+*JCLCloseUI: *hold
+
+*JCLOpenUI *joboffset/Job Offset: PickOne
+*OrderDependency: 100 JCLSetup *joboffset
+*Defaultjoboffset: on
+*joboffset off/Off: "@PJL SET JOBOFFSET=OFF<0A>"
+*joboffset on/On: "@PJL SET JOBOFFSET=ON<0A>"
+*JCLCloseUI: *joboffset
+
+*JCLOpenUI *lowsupplies/On low supplies: PickOne
+*OrderDependency: 100 JCLSetup *lowsupplies
+*Defaultlowsupplies: continue
+*lowsupplies continue/Continue: "@PJL SET LOWSUPPLIES=CONTINUE<0A>"
+*lowsupplies stop/Stop: "@PJL SET LOWSUPPLIES=STOP<0A>"
+*JCLCloseUI: *lowsupplies
+
+*JCLOpenUI *overridea4withletter/Override A4 with Letter: PickOne
+*OrderDependency: 100 JCLSetup *overridea4withletter
+*Defaultoverridea4withletter: yes
+*overridea4withletter no/No: "@PJL SET OVERRIDEA4WITHLETTER=NO<0A>"
+*overridea4withletter yes/Yes: "@PJL SET OVERRIDEA4WITHLETTER=YES<0A>"
+*JCLCloseUI: *overridea4withletter
+
+*JCLOpenUI *planesinuse/Planes in use: PickOne
+*OrderDependency: 100 JCLSetup *planesinuse
+*Defaultplanesinuse: 3
+*planesinuse 1/1: "@PJL SET PLANESINUSE=1<0A>"
+*planesinuse 3/3: "@PJL SET PLANESINUSE=3<0A>"
+*JCLCloseUI: *planesinuse
+
+*JCLOpenUI *printonbackside/Print on back side: PickOne
+*OrderDependency: 100 JCLSetup *printonbackside
+*Defaultprintonbackside: on
+*printonbackside off/Off: "@PJL SET PRINTONBACKSIDE=OFF<0A>"
+*printonbackside on/On: "@PJL SET PRINTONBACKSIDE=ON<0A>"
+*JCLCloseUI: *printonbackside
+
+*JCLOpenUI *processingaction/Processing Action: PickOne
+*OrderDependency: 100 JCLSetup *processingaction
+*Defaultprocessingaction: replace
+*processingaction append/Append: "@PJL SET PROCESSINGACTION=APPEND<0A>"
+*processingaction replace/Replace: "@PJL SET PROCESSINGACTION=REPLACE<0A>"
+*JCLCloseUI: *processingaction
+
+*JCLOpenUI *processingboundary/Processing Boundary: PickOne
+*OrderDependency: 100 JCLSetup *processingboundary
+*Defaultprocessingboundary: job
+*processingboundary job/Job: "@PJL SET PROCESSINGBOUNDARY=JOB<0A>"
+*processingboundary mopy/Mopy: "@PJL SET PROCESSINGBOUNDARY=MOPY<0A>"
+*JCLCloseUI: *processingboundary
+
+*JCLOpenUI *reprint/Reprint job: PickOne
+*OrderDependency: 100 JCLSetup *reprint
+*Defaultreprint: auto
+*reprint auto/Automatic: "@PJL SET REPRINT=AUTO<0A>"
+*reprint off/Off: "@PJL SET REPRINT=OFF<0A>"
+*reprint on/On: "@PJL SET REPRINT=ON<0A>"
+*JCLCloseUI: *reprint
+
+*JCLOpenUI *stapleoption/Stapling Mode: PickOne
+*OrderDependency: 100 JCLSetup *stapleoption
+*Defaultstapleoption: none
+*stapleoption default/Default: "@PJL SET STAPLEOPTION=DEFAULT<0A>"
+*stapleoption custom/Custom Size: "@PJL SET STAPLEOPTION=CUSTOM<0A>"
+*stapleoption five/5: "@PJL SET STAPLEOPTION=FIVE<0A>"
+*stapleoption four/4: "@PJL SET STAPLEOPTION=FOUR<0A>"
+*stapleoption none/None: "@PJL SET STAPLEOPTION=NONE<0A>"
+*stapleoption one/1: "@PJL SET STAPLEOPTION=ONE<0A>"
+*stapleoption oneangled/One Angled: "@PJL SET STAPLEOPTION=ONEANGLED<0A>"
+*stapleoption oneopposed/One Opposed: "@PJL SET STAPLEOPTION=ONEOPPOSED<0A>"
+*stapleoption option3/Option 3: "@PJL SET STAPLEOPTION=OPTION3<0A>"
+*stapleoption option4/Option 4: "@PJL SET STAPLEOPTION=OPTION4<0A>"
+*stapleoption option5/Option 5: "@PJL SET STAPLEOPTION=OPTION5<0A>"
+*stapleoption option6/Option 6: "@PJL SET STAPLEOPTION=OPTION6<0A>"
+*stapleoption seven/7: "@PJL SET STAPLEOPTION=SEVEN<0A>"
+*stapleoption six/6: "@PJL SET STAPLEOPTION=SIX<0A>"
+*stapleoption three/3: "@PJL SET STAPLEOPTION=THREE<0A>"
+*stapleoption two/2: "@PJL SET STAPLEOPTION=TWO<0A>"
+*JCLCloseUI: *stapleoption
+
+*CloseGroup: General
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
+
--- /dev/null
+*PPD-Adobe: "4.3"
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "HPIJS.PPD"
+*Manufacturer: "HP"
+*Product: "(PhotoSmart Pro B8300)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-pdf 0 pdftoijs"
+*ModelName: "HP PhotoSmart Pro B8300"
+*ShortNickName: "HP PhotoSmart Pro B8300 hpijs"
+*NickName: "HP PhotoSmart Pro B8300 CUPS/pdftoijs/hpijs"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: RGB
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dhpijs,R1,M1,F1,Sv,TI,X1200,Y1200,C1,t90,l90,g100,p100,s70;"
+
+*driverName hpijs/hpijs - HP's IJS driver for most of their non-PostScript printers: ""
+*driverType I/IJS: ""
+*driverUrl: "http://hplipopensource.com/"
+*driverObsolete: False
+*driverSupplier: "Hewlett-Packard"
+*driverManufacturerSupplied: True
+*driverLicense: "BSD"
+*driverFreeSoftware: True
+*driverSupportContactVoluntary: "https://launchpad.net/hplip HPLIP support and bug tracking system"
+*driverMaxResolution: 1200 1200
+*driverColor: True
+*driverTextSupport: 90
+*driverLineartSupport: 90
+*driverGraphicsSupport: 100
+*driverPhotoSupport: 100
+*driverRenderingSpeed: 70
+
+*DefaultResolution: 1200dpi
+
+
+
+*HWMargins: 18 36 18 9
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 105 AnySetup *CustomPageSize
+*CustomPageSize True: ""
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*ijsServer: "hpijs"
+*ijsManufacturer: "HP"
+*ijsModel: "deskjet 5600"
+*ijsColorSpace: "rgb"
+
+*OpenGroup: General/General
+
+*OpenUI *Quality/Resolution, Quality, Ink Type, Media Type: PickOne
+*OrderDependency: 100 AnySetup *Quality
+*DefaultQuality: 600ColorCMYK
+
+*Quality 300ColorCMYK/300 dpi, Color, Black + Color Cartr.: ""
+*ijsParams Quality=300ColorCMYK: "Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=300ColorCMYK: "300 300"
+
+*Quality 300ColorCMYKFullBleed/300 dpi, Color, Full Bleed, Black + Color Cartr.: ""
+*ijsParams Quality=300ColorCMYKFullbleed: "Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2,Quality:FullBleed=1"
+*ijsResolution Quality=300ColorCMYKFullbleed: "300 300"
+
+*Quality 300DraftColorCMYK/300 dpi, Draft, Color, Black + Color Cartr.: ""
+*ijsParams Quality=300DraftColorCMYK: "Quality:Quality=1,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=300DraftColorCMYK: "300 300"
+
+*Quality 300DraftGrayscaleCMYK/300 dpi, Draft, Grayscale, Black + Color Cartr.: ""
+*ijsParams Quality=300DraftGrayscaleCMYK: "Quality:Quality=1,Quality:ColorMode=0,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=300DraftGrayscaleCMYK: "300 300"
+
+*Quality 300FastDraftColorCMYK/300 dpi, FastDraft, Color, Black + Color Cartr.: ""
+*ijsParams Quality=300FastDraftColorCMYK: "Quality:Quality=4,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution 300FastDraftColorCMYK: "300 300"
+
+*Quality 300FastDraftGrayscaleCMYK/300 dpi, FastDraft, Grayscale, Black + Color Cartr.: ""
+*ijsParams Quality=300FastDraftGrayscaleCMYK: "Quality:Quality=4,Quality:ColorMode=0,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=300FastDraftGrayscaleCMYK: "300 300"
+
+*Quality 300GrayscaleCMYK/300 dpi, Grayscale, Black + Color Cartr.: ""
+*ijsParams Quality=300GrayscaleCMYK: "Quality:Quality=0,Quality:ColorMode=0,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=300GrayscaleCMYK: "300 300"
+
+*Quality 600ColorCMYK/600 dpi, Color, Black + Color Cartr.: ""
+*ijsParams Quality=600ColorCMYK: "Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=600ColorCMYK: "600 600"
+
+*Quality 600ColorCMYKFullBleed/600 dpi, Color, Full Bleed, Black + Color Cartr.: ""
+*ijsParams Quality=600ColorCMYKFullbleed: "Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2,Quality:FullBleed=1"
+*ijsResolution Quality=600ColorCMYKFullbleed: "600 600"
+
+*Quality 600GrayscaleCMYK/600 dpi, Grayscale, Black + Color Cartr.: ""
+*ijsParams Quality=600GrayscaleCMYK: "Quality:Quality=0,Quality:ColorMode=0,Quality:MediaType=0,Quality:PenSet=2"
+*ijsResolution Quality=600GrayscaleCMYK: "600 600"
+
+*Quality 1200PhotoCMYK/1200 dpi, Photo, Black + Color Cartr., Photo Paper: ""
+*ijsParams Quality=1200PhotoCMYK: "Quality:Quality=3,Quality:ColorMode=2,Quality:MediaType=2,Quality:PenSet=2"
+*ijsResolution Quality=1200PhotoCMYK: "1200 1200"
+
+*Quality 1200PhotoCMYKFullBleed/1200 dpi, Photo, Full Bleed, Black + Color Cartr., Photo Paper: ""
+*ijsParams Quality=1200PhotoCMYKFullBleed: "Quality:Quality=3,Quality:ColorMode=2,Quality:MediaType=3,Quality:PenSet=2,Quality:FullBleed=1"
+*ijsResolution Quality=1200PhotoCMYKFullBleed: "1200 1200"
+
+*CloseUI: *Quality
+
+*OpenUI *InputSlot/Media Source: PickOne
+*OrderDependency: 100 AnySetup *InputSlot
+*DefaultInputSlot: Default
+
+*InputSlot Default/Printer default: ""
+*ijsParams InputSlot=Default: "PS:MediaPosition=7"
+
+*InputSlot PhotoTray/Photo Tray: ""
+*ijsParams InputSlot=PhotoTray: "PS:MediaPosition=6"
+
+*InputSlot Upper/Upper Tray: ""
+*ijsParams InputSlot=Upper: "PS:MediaPosition=1"
+
+*InputSlot Lower/Lower Tray: ""
+*ijsParams InputSlot=Lower: "PS:MediaPosition=4"
+
+*InputSlot CDDVDTray/CD or DVD Tray: ""
+*ijsParams InputSlot=CDDVDTray: "PS:MediaPosition=14"
+
+*InputSlot Envelope/Envelope Feeder: ""
+*ijsParams InputSlot=Envelope: "PS:MediaPosition=3"
+
+*InputSlot LargeCapacity/Large Capacity Tray: ""
+*ijsParams InputSlot=LargeCapacity: "PS:MediaPosition=5"
+
+*InputSlot Manual/Manual Feeder: ""
+*ijsParams InputSlot=Manual: "PS:MediaPosition=2"
+
+*InputSlot MPTray/Multi Purpose Tray: ""
+*ijsParams InputSlot=MPTray: "PS:MediaPosition=8"
+
+*CloseUI: *InputSlot
+
+*OpenUI *PageSize/Page Size: PickOne
+*OrderDependency: 105 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: ""
+*PageSize A4/A4: ""
+*PageSize Photo/Photo or 4x6 inch index card: ""
+*PageSize Photo5x7/Photo or 5x7 inch index card: ""
+*PageSize PhotoTearOff/Photo with tear-off tab: ""
+*PageSize 3x5/3x5 inch index card: ""
+*PageSize 5x8/5x8 inch index card: ""
+*PageSize A3/A3: ""
+*PageSize A5/A5: ""
+*PageSize A6/A6: ""
+*PageSize A6TearOff/A6 with tear-off tab: ""
+*PageSize B4JIS/B4 (JIS): ""
+*PageSize B5JIS/B5 (JIS): ""
+*PageSize CDDVD80/CD or DVD 80 mm: ""
+*PageSize CDDVD120/CD or DVD 120 mm: ""
+*PageSize Env10/Envelope #10: ""
+*PageSize EnvC5/Envelope C5: ""
+*PageSize EnvC6/Envelope C6: ""
+*PageSize EnvDL/Envelope DL: ""
+*PageSize EnvISOB5/Envelope B5: ""
+*PageSize EnvMonarch/Envelope Monarch: ""
+*PageSize Executive/Executive: ""
+*PageSize FLSA/American Foolscap: ""
+*PageSize Hagaki/Hagaki: ""
+*PageSize Ledger/Ledger: ""
+*PageSize Legal/Legal: ""
+*PageSize Oufuku/Oufuku-Hagaki: ""
+*PageSize SuperB/Super B: ""
+*PageSize w558h774/16K: ""
+*PageSize w612h935/Executive (JIS): ""
+*PageSize w774h1116/8K: ""
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 105 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: ""
+*PageRegion A4/A4: ""
+*PageRegion Photo/Photo or 4x6 inch index card: ""
+*PageRegion Photo5x7/Photo or 5x7 inch index card: ""
+*PageRegion PhotoTearOff/Photo with tear-off tab: ""
+*PageRegion 3x5/3x5 inch index card: ""
+*PageRegion 5x8/5x8 inch index card: ""
+*PageRegion A3/A3: ""
+*PageRegion A5/A5: ""
+*PageRegion A6/A6: ""
+*PageRegion A6TearOff/A6 with tear-off tab: ""
+*PageRegion B4JIS/B4 (JIS): ""
+*PageRegion B5JIS/B5 (JIS): ""
+*PageRegion CDDVD80/CD or DVD 80 mm: ""
+*PageRegion CDDVD120/CD or DVD 120 mm: ""
+*PageRegion Env10/Envelope #10: ""
+*PageRegion EnvC5/Envelope C5: ""
+*PageRegion EnvC6/Envelope C6: ""
+*PageRegion EnvDL/Envelope DL: ""
+*PageRegion EnvISOB5/Envelope B5: ""
+*PageRegion EnvMonarch/Envelope Monarch: ""
+*PageRegion Executive/Executive: ""
+*PageRegion FLSA/American Foolscap: ""
+*PageRegion Hagaki/Hagaki: ""
+*PageRegion Ledger/Ledger: ""
+*PageRegion Legal/Legal: ""
+*PageRegion Oufuku/Oufuku-Hagaki: ""
+*PageRegion SuperB/Super B: ""
+*PageRegion w558h774/16K: ""
+*PageRegion w612h935/Executive (JIS): ""
+*PageRegion w774h1116/8K: ""
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "18 36 594 783"
+*ImageableArea A4/A4: "9.72 36 585.28 833"
+*ImageableArea Photo/Photo or 4x6 inch index card: "0 36 288 432"
+*ImageableArea Photo5x7/Photo or 5x7 inch index card: "0 36 360 504"
+*ImageableArea PhotoTearOff/Photo with tear-off tab: "0 0 288 432"
+*ImageableArea 3x5/3x5 inch index card: "0 36 216 360"
+*ImageableArea 5x8/5x8 inch index card: "0 36 360 576"
+*ImageableArea A3/A3: "14.40 36.00 827.60 1181"
+*ImageableArea A5/A5: "9 36 411 586"
+*ImageableArea A6/A6: "0 36 297 420"
+*ImageableArea A6TearOff/A6 with tear-off tab: "0 0 297 420"
+*ImageableArea B4JIS/B4 (JIS): "18 36 711 1024"
+*ImageableArea B5JIS/B5 (JIS): "18 36 498 720"
+*ImageableArea CDDVD80/CD or DVD 80 mm: "0 36 237 237"
+*ImageableArea CDDVD120/CD or DVD 120 mm: "0 36 360 360"
+*ImageableArea Env10/Envelope #10: "0 36 297 684"
+*ImageableArea EnvC5/Envelope C5: "18 36 441 640"
+*ImageableArea EnvC6/Envelope C6: "0 36 323 459"
+*ImageableArea EnvDL/Envelope DL: "0 36 312 624"
+*ImageableArea EnvISOB5/Envelope B5: "18 36 481 700"
+*ImageableArea EnvMonarch/Envelope Monarch: "0 36 279 540"
+*ImageableArea Executive/Executive: "18 36 504 747"
+*ImageableArea FLSA/American Foolscap: "18 36 594 927"
+*ImageableArea Hagaki/Hagaki: "0 36 283 420"
+*ImageableArea Ledger/Ledger: "14.40 36 777.60 1215"
+*ImageableArea Legal/Legal: "18 36 594 999"
+*ImageableArea Oufuku/Oufuku-Hagaki: "0 36 420 567"
+*ImageableArea SuperB/Super B: "14.40 36 921.60 1359"
+*ImageableArea w558h774/16K: "18 36 540 765"
+*ImageableArea w612h935/Executive (JIS): "18 36 594 926"
+*ImageableArea w774h1116/8K: "18 36 756 1107"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension Photo/Photo or 4x6 inch index card: "288 432"
+*PaperDimension Photo5x7/Photo or 5x7 inch index card: "360 504"
+*PaperDimension PhotoTearOff/Photo with tear-off tab: "288 432"
+*PaperDimension 3x5/3x5 inch index card: "216 360"
+*PaperDimension 5x8/5x8 inch index card: "360 576"
+*PaperDimension A3/A3: "842 1190"
+*PaperDimension A5/A5: "420 595"
+*PaperDimension A6/A6: "297 420"
+*PaperDimension A6TearOff/A6 with tear-off tab: "297 420"
+*PaperDimension B4JIS/B4 (JIS): "729 1033"
+*PaperDimension B5JIS/B5 (JIS): "516 729"
+*PaperDimension CDDVD80/CD or DVD 80 mm: "237 237"
+*PaperDimension CDDVD120/CD or DVD 120 mm: "360 360"
+*PaperDimension Env10/Envelope #10: "297 684"
+*PaperDimension EnvC5/Envelope C5: "459 649"
+*PaperDimension EnvC6/Envelope C6: "323 459"
+*PaperDimension EnvDL/Envelope DL: "312 624"
+*PaperDimension EnvISOB5/Envelope B5: "499 709"
+*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension FLSA/American Foolscap: "612 936"
+*PaperDimension Hagaki/Hagaki: "283 420"
+*PaperDimension Ledger/Ledger: "792 1224"
+*PaperDimension Legal/Legal: "612 1008"
+*PaperDimension Oufuku/Oufuku-Hagaki: "420 567"
+*PaperDimension SuperB/Super B: "936 1368"
+*PaperDimension w558h774/16K: "558 774"
+*PaperDimension w612h935/Executive (JIS): "612 935"
+*PaperDimension w774h1116/8K: "774 1116"
+
+*OpenUI *Duplex/Double-Sided Printing: PickOne
+*FoomaticRIPOption Duplex: enum CmdLine A
+*OrderDependency: 120 AnySetup *Duplex
+*DefaultDuplex: None
+*Duplex DuplexNoTumble/Long Edge (Standard): ""
+*Duplex DuplexTumble/Short Edge (Flip): ""
+*Duplex None/Off: ""
+*CloseUI: *Duplex
+
+*CloseGroup: General
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
--- /dev/null
+*PPD-Adobe: "4.3"
+*%
+*% Text-only printer definition
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "TEXTONLY.PPD"
+*Manufacturer: "Generic"
+*Product: "(Generic)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "text/plain 0 textonly"
+*ModelName: "Generic text-only printer"
+*ShortNickName: "Generic text-only printer"
+*NickName: "Generic text-only printer"
+*PSVersion: "(2017.000) 0"
+*LanguageLevel: "2"
+*ColorDevice: False
+*DefaultColorSpace: Gray
+*FileSystem: False
+*Throughput: "8"
+*LandscapeOrientation: Plus90
+*VariablePaperSize: False
+*TTRasterizer: Type42
+*DefaultImageableArea: Letter
+*ImageableArea Letter/US Letter: "18 36 594 756"
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*OpenUI *PageSize/Media Size: PickOne
+*OrderDependency: 10 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 10 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageRegion
+
+*OpenUI *SendFF: Boolean
+*DefaultSendFF: False
+*SendFF True/True: ""
+*SendFF False/False: ""
+*CloseUI: *SendFF
--- /dev/null
+package CUPS;
+
+use 5.006;
+use strict;
+use warnings;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+our @ISA = qw(Exporter DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration use CUPS ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+our %EXPORT_TAGS = ( 'all' => [ qw(
+ CUPS_DATE_ANY
+ CUPS_VERSION
+ HTTP_MAX_BUFFER
+ HTTP_MAX_HOST
+ HTTP_MAX_URI
+ HTTP_MAX_VALUE
+ IPP_MAX_NAME
+ IPP_MAX_VALUES
+ IPP_PORT
+ PPD_MAX_LINE
+ PPD_MAX_NAME
+ PPD_MAX_TEXT
+ PPD_VERSION
+) ] );
+
+our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+our @EXPORT = qw(
+ CUPS_DATE_ANY
+ CUPS_VERSION
+ HTTP_MAX_BUFFER
+ HTTP_MAX_HOST
+ HTTP_MAX_URI
+ HTTP_MAX_VALUE
+ IPP_MAX_NAME
+ IPP_MAX_VALUES
+ IPP_PORT
+ PPD_MAX_LINE
+ PPD_MAX_NAME
+ PPD_MAX_TEXT
+ PPD_VERSION
+);
+our $VERSION = '1.2';
+
+sub AUTOLOAD {
+ # This AUTOLOAD is used to 'autoload' constants from the constant()
+ # XS function. If a constant is not found then control is passed
+ # to the AUTOLOAD in AutoLoader.
+
+ my $constname;
+ our $AUTOLOAD;
+ ($constname = $AUTOLOAD) =~ s/.*:://;
+ croak "& not defined" if $constname eq 'constant';
+ my $val = constant($constname, @_ ? $_[0] : 0);
+ if ($! != 0) {
+ if ($! =~ /Invalid/ || $!{EINVAL}) {
+ $AutoLoader::AUTOLOAD = $AUTOLOAD;
+ goto &AutoLoader::AUTOLOAD;
+ }
+ else {
+ croak "Your vendor has not defined CUPS macro $constname";
+ }
+ }
+ {
+ no strict 'refs';
+ # Fixed between 5.005_53 and 5.005_61
+ if ($] >= 5.00561) {
+ *$AUTOLOAD = sub () { $val };
+ }
+ else {
+ *$AUTOLOAD = sub { $val };
+ }
+ }
+ goto &$AUTOLOAD;
+}
+
+bootstrap CUPS $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+CUPS - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+ use CUPS;
+ blah blah blah
+
+=head1 DESCRIPTION
+
+Stub documentation for CUPS, created by h2xs. It looks like the
+author of the extension was negligent enough to leave the stub
+unedited.
+
+Blah blah blah.
+
+=head2 EXPORT
+
+None by default.
+
+=head2 Exportable constants
+
+ CUPS_DATE_ANY
+ CUPS_VERSION
+ HTTP_MAX_BUFFER
+ HTTP_MAX_HOST
+ HTTP_MAX_URI
+ HTTP_MAX_VALUE
+ IPP_MAX_NAME
+ IPP_MAX_VALUES
+ IPP_PORT
+ PPD_MAX_LINE
+ PPD_MAX_NAME
+ PPD_MAX_TEXT
+ PPD_VERSION
+
+
+=head1 AUTHOR
+
+A. U. Thor, E<lt>a.u.thor@a.galaxy.far.far.awayE<gt>
+
+=head1 SEE ALSO
+
+L<perl>.
+
+=cut
--- /dev/null
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <cups/cups.h>
+#include <cups/http.h>
+#include <cups/ipp.h>
+#include <cups/language.h>
+#include <cups/ppd.h>
+
+static int
+not_here(char *s)
+{
+ croak("%s not implemented on this architecture", s);
+ return -1;
+}
+
+static double
+constant_PPD_M(char *name, int len, int arg)
+{
+ if (5 + 3 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[5 + 3]) {
+ case 'L':
+ if (strEQ(name + 5, "AX_LINE")) { /* PPD_M removed */
+#ifdef PPD_MAX_LINE
+ return PPD_MAX_LINE;
+#else
+ goto not_there;
+#endif
+ }
+ case 'N':
+ if (strEQ(name + 5, "AX_NAME")) { /* PPD_M removed */
+#ifdef PPD_MAX_NAME
+ return PPD_MAX_NAME;
+#else
+ goto not_there;
+#endif
+ }
+ case 'T':
+ if (strEQ(name + 5, "AX_TEXT")) { /* PPD_M removed */
+#ifdef PPD_MAX_TEXT
+ return PPD_MAX_TEXT;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant_P(char *name, int len, int arg)
+{
+ if (1 + 3 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[1 + 3]) {
+ case 'M':
+ if (!strnEQ(name + 1,"PD_", 3))
+ break;
+ return constant_PPD_M(name, len, arg);
+ case 'V':
+ if (strEQ(name + 1, "PD_VERSION")) { /* P removed */
+#ifdef PPD_VERSION
+ return PPD_VERSION;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant_H(char *name, int len, int arg)
+{
+ if (1 + 8 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[1 + 8]) {
+ case 'B':
+ if (strEQ(name + 1, "TTP_MAX_BUFFER")) { /* H removed */
+#ifdef HTTP_MAX_BUFFER
+ return HTTP_MAX_BUFFER;
+#else
+ goto not_there;
+#endif
+ }
+ case 'H':
+ if (strEQ(name + 1, "TTP_MAX_HOST")) { /* H removed */
+#ifdef HTTP_MAX_HOST
+ return HTTP_MAX_HOST;
+#else
+ goto not_there;
+#endif
+ }
+ case 'U':
+ if (strEQ(name + 1, "TTP_MAX_URI")) { /* H removed */
+#ifdef HTTP_MAX_URI
+ return HTTP_MAX_URI;
+#else
+ goto not_there;
+#endif
+ }
+ case 'V':
+ if (strEQ(name + 1, "TTP_MAX_VALUE")) { /* H removed */
+#ifdef HTTP_MAX_VALUE
+ return HTTP_MAX_VALUE;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant_IPP_M(char *name, int len, int arg)
+{
+ if (5 + 3 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[5 + 3]) {
+ case 'N':
+ if (strEQ(name + 5, "AX_NAME")) { /* IPP_M removed */
+#ifdef IPP_MAX_NAME
+ return IPP_MAX_NAME;
+#else
+ goto not_there;
+#endif
+ }
+ case 'V':
+ if (strEQ(name + 5, "AX_VALUES")) { /* IPP_M removed */
+#ifdef IPP_MAX_VALUES
+ return IPP_MAX_VALUES;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant_I(char *name, int len, int arg)
+{
+ if (1 + 3 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[1 + 3]) {
+ case 'M':
+ if (!strnEQ(name + 1,"PP_", 3))
+ break;
+ return constant_IPP_M(name, len, arg);
+ case 'P':
+ if (strEQ(name + 1, "PP_PORT")) { /* I removed */
+#ifdef IPP_PORT
+ return IPP_PORT;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant_C(char *name, int len, int arg)
+{
+ if (1 + 4 >= len ) {
+ errno = EINVAL;
+ return 0;
+ }
+ switch (name[1 + 4]) {
+ case 'D':
+ if (strEQ(name + 1, "UPS_DATE_ANY")) { /* C removed */
+#ifdef CUPS_DATE_ANY
+ return CUPS_DATE_ANY;
+#else
+ goto not_there;
+#endif
+ }
+ case 'V':
+ if (strEQ(name + 1, "UPS_VERSION")) { /* C removed */
+#ifdef CUPS_VERSION
+ return CUPS_VERSION;
+#else
+ goto not_there;
+#endif
+ }
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+ errno = 0;
+ switch (name[0 + 0]) {
+ case 'C':
+ return constant_C(name, len, arg);
+ case 'H':
+ return constant_H(name, len, arg);
+ case 'I':
+ return constant_I(name, len, arg);
+ case 'P':
+ return constant_P(name, len, arg);
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+
+MODULE = CUPS PACKAGE = CUPS
+
+
+double
+constant(sv,arg)
+ PREINIT:
+ STRLEN len;
+ INPUT:
+ SV * sv
+ char * s = SvPV(sv, len);
+ int arg
+ CODE:
+ RETVAL = constant(s,len,arg);
+ OUTPUT:
+ RETVAL
+
--- /dev/null
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ 'NAME' => 'CUPS',
+ 'VERSION_FROM' => 'CUPS.pm', # finds $VERSION
+ 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (ABSTRACT_FROM => 'CUPS.pm', # retrieve abstract from module
+ AUTHOR => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>') : ()),
+ 'LIBS' => ['-lcups '], # e.g., '-lm'
+ 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
+ # Insert -I. if you add *.h files later:
+ 'INC' => '', # e.g., '-I/usr/include/other'
+ # Un-comment this if you add C files to link with later:
+ # 'OBJECT' => '$(O_FILES)', # link all the C files too
+);
--- /dev/null
+CUPS version 1.2
+================
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the
+README file from a module distribution so that people browsing the
+archive can use it get an idea of the modules uses. It is usually a
+good idea to provide version information here so that people can
+decide whether fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+ blah blah blah
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2002 A. U. Thor blah blah blah
+
--- /dev/null
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test;
+BEGIN { plan tests => 1 };
+use CUPS;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+# Insert your test code below, the Test module is use()ed here so read
+# its man page ( perldoc Test ) for help writing this test script.
+
--- /dev/null
+README - 02/25/2006
+-------------------
+
+INTRODUCTION
+
+ This directory contains a dynamically loadable CUPS extension
+ module for PHP 4 and 5. The CUPS 1.2 module has been
+ substantially updated to provide an API more consistent with
+ the C API and is NOT compatible with the CUPS 1.1 module.
+
+
+COMPILING AND INSTALLING
+
+ Run "make" to compile the PHP CUPS extension:
+
+ make
+
+ To install it, type:
+
+ make install
+
+
+RESOURCES AND SUPPORT
+
+ Questions should be reported to the CUPS newsgroups/mailing
+ lists at:
+
+ http://www.cups.org/newsgroups.php
+
+ Bug reports and enhancement requests can be submitted via the
+ form at:
+
+ http://www.cups.org/str.php
+
+
+QUICK REFERENCE DOCUMENTATION
+
+ In lieu of actual documentation, the following definitions
+ can be used as a quick reference to the supported functions:
+
+
+ CUPS_CANCEL_JOB
+
+ Cancels a job on the named destination:
+
+ bool cups_cancel_job(string dest, int id)
+
+ The return value is TRUE on success and FALSE on failure.
+
+ Example:
+
+ if (!cups_cancel_job("myprinter", 123))
+ print("Unable to cancel job: " . cups_last_error_string() . "\n");
+
+
+ CUPS_GET_DESTS
+
+ Gets a list of available destinations:
+
+ array cups_get_dests()
+
+ The return value is an array of objects with the following
+ properties:
+
+ name The name of the printer or class
+ instance The instance of the printer or class
+ is_default TRUE if the printer or class is the default destination
+ options Associative array of options and their values
+
+ Example:
+
+ $dest = cups_get_dests();
+
+
+ CUPS_GET_JOBS
+
+ Gets a list of jobs:
+
+ array cups_get_jobs(string dest, bool myjobs, int completed)
+
+ The "dest" string can be blank for jobs on all destinations.
+ Pass TRUE for "myjobs" to only get jobs for the current user.
+ The "completed" argument can be 0 for pending jobs, 1 for
+ completed jobs, and -1 for all jobs.
+
+ The return value is an array of objects with the following
+ properties:
+
+ id The job ID
+ dest Printer or class name
+ title Title/job name
+ user User the submitted the job
+ format Document format
+ state Job state
+ size Size in kilobytes
+ priority Priority (1-100)
+ completed_time Time the job was completed
+ creation_time Time the job was created
+ processing_time Time the job was processed
+
+ Example:
+
+ $jobs = cups_get_jobs("", FALSE, -1);
+
+
+ CUPS_LAST_ERROR
+
+ Returns the IPP status code for the most recent request:
+
+ int cups_last_error()
+
+ Example:
+
+ $error = cups_last_error();
+
+
+ CUPS_LAST_ERROR_STRING
+
+ Returns the IPP status-message string for the most recent request:
+
+ string cups_last_error_string()
+
+ Example:
+
+ $message = cups_last_error_string();
+
+
+ CUPS_PRINT_FILE
+
+ Prints a single file to a printer or class:
+
+ int cups_print_file(string dest, string filename, string title,
+ array options)
+
+ The return value is the job ID or 0 if there was an error.
+
+ Example:
+
+ $options = array("name" => "value", "name2" => "value2");
+ $id = cups_print_file("dest", "filename", "title", $options);
+
+
+ CUPS_PRINT_FILES
+
+ Prints one or more files to a printer or class:
+
+ int cups_print_files(string dest, array files, string title,
+ array options);
+
+ The return value is the job ID or 0 if there was an error.
+
+ Example:
+
+ $files = array("file1", "file2", "file3");
+ $options = array("name" => "value", "name2" => "value2");
+ $id = cups_print_file("dest", $files, "title", $options);
+
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * Printing utilities for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ * cups_convert_options() - Convert a PHP options array to a CUPS options array.
+ * zm_startup_phpcups() - Initialize the CUPS module.
+ * zif_cups_cancel_job() - Cancel a job.
+ * zif_cups_get_dests() - Get a list of printers and classes.
+ * zif_cups_get_jobs() - Get a list of jobs.
+ * zif_cups_last_error() - Return the last IPP status code.
+ * zif_cups_last_error_string() - Return the last IPP status
+ * zif_cups_print_file() - Print a single file.
+ * zif_cups_print_files() - Print multiple files.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/string-private.h>
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "phpcups.h"
+
+
+/*
+ * PHP function list...
+ */
+
+function_entry phpcups_functions[] =
+{
+ PHP_FE(cups_cancel_job, NULL)
+ PHP_FE(cups_get_dests, NULL)
+ PHP_FE(cups_get_jobs, NULL)
+ PHP_FE(cups_last_error, NULL)
+ PHP_FE(cups_last_error_string, NULL)
+ PHP_FE(cups_print_file, NULL)
+ PHP_FE(cups_print_files, NULL)
+ {NULL, NULL, NULL}
+};
+
+
+/*
+ * PHP module info...
+ */
+
+zend_module_entry phpcups_module_entry =
+{
+ STANDARD_MODULE_HEADER,
+ "phpcups",
+ phpcups_functions,
+ PHP_MINIT(phpcups),
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ CUPS_SVERSION,
+ STANDARD_MODULE_PROPERTIES
+};
+
+
+ZEND_GET_MODULE(phpcups)
+
+
+/*
+ * 'cups_convert_options()' - Convert a PHP options array to a CUPS options array.
+ */
+
+static int /* O - Number of options */
+cups_convert_options(
+ zval *optionsobj, /* I - Options array object */
+ cups_option_t **options) /* O - Options */
+{
+ int num_options; /* Number of options */
+ HashTable *ht; /* Option array hash table */
+ Bucket *current; /* Current element in array */
+ zval *value; /* Current value in array */
+ char temp[255]; /* String value for numbers */
+
+
+ ht = Z_ARRVAL_P(optionsobj);
+ num_options = 0;
+
+ for (current = ht->pListHead; current; current = current->pListNext)
+ {
+ value = (zval *)current->pDataPtr;
+
+ switch (Z_TYPE_P(value))
+ {
+ case IS_LONG :
+ sprintf(temp, "%ld", Z_LVAL_P(value));
+ num_options = cupsAddOption(current->arKey, temp, num_options,
+ options);
+ break;
+
+ case IS_DOUBLE :
+ sprintf(temp, "%g", Z_DVAL_P(value));
+ num_options = cupsAddOption(current->arKey, temp, num_options,
+ options);
+ break;
+
+ case IS_BOOL :
+ num_options = cupsAddOption(current->arKey,
+ Z_BVAL_P(value) ? "true" : "false",
+ num_options, options);
+ break;
+
+ case IS_STRING :
+ num_options = cupsAddOption(current->arKey, Z_STRVAL_P(value),
+ num_options, options);
+ break;
+ }
+ }
+
+ return (num_options);
+}
+
+
+/*
+ * 'zm_startup_phpcups()' - Initialize the CUPS module.
+ */
+
+PHP_MINIT_FUNCTION(phpcups)
+{
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_LOCAL", CUPS_PRINTER_LOCAL, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_CLASS", CUPS_PRINTER_CLASS, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_REMOTE", CUPS_PRINTER_REMOTE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_BW", CUPS_PRINTER_BW, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_COLOR", CUPS_PRINTER_COLOR, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_DUPLEX", CUPS_PRINTER_DUPLEX, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_STAPLE", CUPS_PRINTER_STAPLE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_COPIES", CUPS_PRINTER_COPIES, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_COLLATE", CUPS_PRINTER_COLLATE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_PUNCH", CUPS_PRINTER_PUNCH, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_COVER", CUPS_PRINTER_COVER, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_BIND", CUPS_PRINTER_BIND, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_SORT", CUPS_PRINTER_SORT, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_SMALL", CUPS_PRINTER_SMALL, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_MEDIUM", CUPS_PRINTER_MEDIUM, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_LARGE", CUPS_PRINTER_LARGE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_VARIABLE", CUPS_PRINTER_VARIABLE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_IMPLICIT", CUPS_PRINTER_IMPLICIT, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_DEFAULT", CUPS_PRINTER_DEFAULT, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_FAX", CUPS_PRINTER_FAX, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_REJECTING", CUPS_PRINTER_REJECTING, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_DELETE", CUPS_PRINTER_DELETE, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_NOT_SHARED", CUPS_PRINTER_NOT_SHARED, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_AUTHENTICATED", CUPS_PRINTER_AUTHENTICATED, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_COMMANDS", CUPS_PRINTER_COMMANDS, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_DISCOVERED", CUPS_PRINTER_DISCOVERED, CONST_CS);
+ REGISTER_LONG_CONSTANT("CUPS_PRINTER_OPTIONS", CUPS_PRINTER_OPTIONS, CONST_CS);
+
+ REGISTER_LONG_CONSTANT("IPP_OK", IPP_OK, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_SUBST", IPP_OK_SUBST, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_CONFLICT", IPP_OK_CONFLICT, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_IGNORED_SUBSCRIPTIONS", IPP_OK_IGNORED_SUBSCRIPTIONS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_IGNORED_NOTIFICATIONS", IPP_OK_IGNORED_NOTIFICATIONS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_TOO_MANY_EVENTS", IPP_OK_TOO_MANY_EVENTS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_BUT_CANCEL_SUBSCRIPTION", IPP_OK_BUT_CANCEL_SUBSCRIPTION, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OK_EVENTS_COMPLETE", IPP_OK_EVENTS_COMPLETE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_REDIRECTION_OTHER_SITE", IPP_REDIRECTION_OTHER_SITE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_BAD_REQUEST", IPP_BAD_REQUEST, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_FORBIDDEN", IPP_FORBIDDEN, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_NOT_AUTHENTICATED", IPP_NOT_AUTHENTICATED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_NOT_AUTHORIZED", IPP_NOT_AUTHORIZED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_NOT_POSSIBLE", IPP_NOT_POSSIBLE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_TIMEOUT", IPP_TIMEOUT, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_NOT_FOUND", IPP_NOT_FOUND, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_GONE", IPP_GONE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_REQUEST_ENTITY", IPP_REQUEST_ENTITY, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_REQUEST_VALUE", IPP_REQUEST_VALUE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_DOCUMENT_FORMAT", IPP_DOCUMENT_FORMAT, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_ATTRIBUTES", IPP_ATTRIBUTES, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_URI_SCHEME", IPP_URI_SCHEME, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_CHARSET", IPP_CHARSET, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_CONFLICT", IPP_CONFLICT, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_COMPRESSION_NOT_SUPPORTED", IPP_COMPRESSION_NOT_SUPPORTED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_COMPRESSION_ERROR", IPP_COMPRESSION_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_DOCUMENT_FORMAT_ERROR", IPP_DOCUMENT_FORMAT_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_DOCUMENT_ACCESS_ERROR", IPP_DOCUMENT_ACCESS_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_ATTRIBUTES_NOT_SETTABLE", IPP_ATTRIBUTES_NOT_SETTABLE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_IGNORED_ALL_SUBSCRIPTIONS", IPP_IGNORED_ALL_SUBSCRIPTIONS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_TOO_MANY_SUBSCRIPTIONS", IPP_TOO_MANY_SUBSCRIPTIONS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_IGNORED_ALL_NOTIFICATIONS", IPP_IGNORED_ALL_NOTIFICATIONS, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_PRINT_SUPPORT_FILE_NOT_FOUND", IPP_PRINT_SUPPORT_FILE_NOT_FOUND, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_INTERNAL_ERROR", IPP_INTERNAL_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_OPERATION_NOT_SUPPORTED", IPP_OPERATION_NOT_SUPPORTED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_SERVICE_UNAVAILABLE", IPP_SERVICE_UNAVAILABLE, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_VERSION_NOT_SUPPORTED", IPP_VERSION_NOT_SUPPORTED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_DEVICE_ERROR", IPP_DEVICE_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_TEMPORARY_ERROR", IPP_TEMPORARY_ERROR, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_NOT_ACCEPTING", IPP_NOT_ACCEPTING, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_PRINTER_BUSY", IPP_PRINTER_BUSY, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_ERROR_JOB_CANCELLED", IPP_ERROR_JOB_CANCELLED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_MULTIPLE_JOBS_NOT_SUPPORTED", IPP_MULTIPLE_JOBS_NOT_SUPPORTED, CONST_CS);
+ REGISTER_LONG_CONSTANT("IPP_PRINTER_IS_DEACTIVATED", IPP_PRINTER_IS_DEACTIVATED, CONST_CS);
+
+ return (SUCCESS);
+}
+
+/*
+ * 'zif_cups_cancel_job()' - Cancel a job.
+ */
+
+PHP_FUNCTION(cups_cancel_job)
+{
+ char *dest; /* Destination */
+ int dest_len, /* Length of destination */
+ id; /* Job ID */
+
+
+ if (ZEND_NUM_ARGS() != 2 ||
+ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &dest, &dest_len, &id))
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_LONG(cupsCancelJob(dest, id));
+}
+
+
+/*
+ * 'zif_cups_get_dests()' - Get a list of printers and classes.
+ */
+
+PHP_FUNCTION(cups_get_dests)
+{
+ int i, j, /* Looping vars */
+ num_dests; /* Number of destinations */
+ cups_dest_t *dests, /* Destinations */
+ *dest; /* Current destination */
+ cups_option_t *option; /* Current option */
+ zval *destobj, /* Destination object */
+ *optionsobj; /* Options object */
+
+
+ if (ZEND_NUM_ARGS() != 0)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ if ((num_dests = cupsGetDests(&dests)) <= 0)
+ {
+ RETURN_NULL();
+ }
+
+ if (array_init(return_value) == SUCCESS)
+ {
+ for (i = 0, dest = dests; i < num_dests; i ++, dest ++)
+ {
+ MAKE_STD_ZVAL(destobj);
+
+ if (object_init(destobj) == SUCCESS)
+ {
+ /*
+ * Add properties to the destination for each of the cups_dest_t
+ * members...
+ */
+
+ add_property_string(destobj, "name", dest->name, 1);
+ add_property_string(destobj, "instance",
+ dest->instance ? dest->instance : "", 1);
+ add_property_long(destobj, "is_default", dest->is_default);
+
+ /*
+ * Create an associative array for the options...
+ */
+
+ MAKE_STD_ZVAL(optionsobj);
+
+ if (array_init(optionsobj) == SUCCESS)
+ {
+ for (j = 0, option = dest->options;
+ j < dest->num_options;
+ j ++, option ++)
+ add_assoc_string(optionsobj, option->name, option->value, 1);
+
+ add_property_zval(destobj, "options", optionsobj);
+ }
+
+ add_index_zval(return_value, i, destobj);
+ }
+ }
+ }
+
+ cupsFreeDests(num_dests, dests);
+}
+
+
+/*
+ * 'zif_cups_get_jobs()' - Get a list of jobs.
+ */
+
+PHP_FUNCTION(cups_get_jobs)
+{
+ char *dest; /* Destination */
+ int dest_len, /* Length of destination */
+ myjobs, /* Only show my jobs? */
+ completed; /* Show completed jobs? */
+ int i, /* Looping var */
+ num_jobs; /* Number of jobs */
+ cups_job_t *jobs, /* Jobs */
+ *job; /* Current job */
+ zval *jobobj; /* Job object */
+
+
+
+
+ if (ZEND_NUM_ARGS() != 3 ||
+ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &dest, &dest_len, &myjobs, &completed))
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ if (!*dest)
+ dest = NULL;
+
+ if ((num_jobs = cupsGetJobs(&jobs, dest, myjobs, completed)) <= 0)
+ {
+ RETURN_NULL();
+ }
+
+ if (array_init(return_value) == SUCCESS)
+ {
+ for (i = 0, job = jobs; i < num_jobs; i ++, job ++)
+ {
+ MAKE_STD_ZVAL(jobobj);
+
+ if (object_init(jobobj) == SUCCESS)
+ {
+ /*
+ * Add properties to the job for each of the cups_job_t
+ * members...
+ */
+
+ add_property_long(jobobj, "id", job->id);
+ add_property_string(jobobj, "dest", job->dest, 1);
+ add_property_string(jobobj, "title", job->title, 1);
+ add_property_string(jobobj, "user", job->user, 1);
+ add_property_string(jobobj, "format", job->format, 1);
+ add_property_long(jobobj, "state", job->state);
+ add_property_long(jobobj, "size", job->size);
+ add_property_long(jobobj, "priority", job->priority);
+ add_property_long(jobobj, "completed_time", job->completed_time);
+ add_property_long(jobobj, "creation_time", job->creation_time);
+ add_property_long(jobobj, "processing_time", job->processing_time);
+
+ add_index_zval(return_value, i, jobobj);
+ }
+ }
+ }
+
+ cupsFreeJobs(num_jobs, jobs);
+}
+
+
+/*
+ * 'zif_cups_last_error()' - Return the last IPP status code.
+ */
+
+PHP_FUNCTION(cups_last_error)
+{
+ if (ZEND_NUM_ARGS() != 0)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_LONG(cupsLastError());
+}
+
+
+/*
+ * 'zif_cups_last_error_string()' - Return the last IPP status-message.
+ */
+
+PHP_FUNCTION(cups_last_error_string)
+{
+ if (ZEND_NUM_ARGS() != 0)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_STRING((char *)cupsLastErrorString(), 1);
+}
+
+
+/*
+ * 'zif_cups_print_file()' - Print a single file.
+ */
+
+PHP_FUNCTION(cups_print_file)
+{
+ char *dest; /* Destination */
+ int dest_len; /* Length of destination */
+ char *filename; /* Filename */
+ int filename_len; /* Length of filename */
+ char *title; /* Title */
+ int title_len; /* Length of title */
+ zval *optionsobj; /* Array of options */
+ int num_options; /* Number of options */
+ cups_option_t *options; /* Options */
+ int id; /* Job ID */
+
+
+ if (ZEND_NUM_ARGS() != 4 ||
+ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssa", &dest, &dest_len,
+ &filename, &filename_len,
+ &title, &title_len, &optionsobj))
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ num_options = cups_convert_options(optionsobj, &options);
+
+ id = cupsPrintFile(dest, filename, title, num_options, options);
+
+ cupsFreeOptions(num_options, options);
+
+ RETURN_LONG(id);
+}
+
+
+/*
+ * 'zif_cups_print_files()' - Print multiple files.
+ */
+
+PHP_FUNCTION(cups_print_files)
+{
+ char *dest; /* Destination */
+ int dest_len; /* Length of destination */
+ zval *filesobj; /* Files array */
+ int num_files; /* Number of files */
+ const char *files[1000]; /* Files */
+ char *title; /* Title */
+ int title_len; /* Length of title */
+ zval *optionsobj; /* Array of options */
+ int num_options; /* Number of options */
+ cups_option_t *options; /* Options */
+ HashTable *ht2; /* Option array hash table */
+ Bucket *current; /* Current element in array */
+ int id; /* Job ID */
+
+
+ if (ZEND_NUM_ARGS() != 4 ||
+ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sasa", &dest, &dest_len, &filesobj,
+ &title, &title_len, &optionsobj))
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ ht2 = Z_ARRVAL_P(filesobj);
+ num_files = 0;
+
+ for (current = ht2->pListHead; current; current = current->pListNext)
+ {
+ files[num_files ++] = Z_STRVAL_P(((zval *)current->pDataPtr));
+
+ if (num_files >= (int)(sizeof(files) / sizeof(files[0])))
+ break;
+ }
+
+ num_options = cups_convert_options(optionsobj, &options);
+
+ id = cupsPrintFiles(dest, num_files, files, title, num_options, options);
+
+ cupsFreeOptions(num_options, options);
+
+ RETURN_LONG(id);
+}
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * PHP module include file for CUPS.
+ *
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ */
+
+#ifndef PHPCUPS_H
+# define PHPCUPS_H
+
+/*
+ * Include necessary headers...
+ */
+
+# include <cups/cups.h>
+# include <cups/language.h>
+# include <cups/debug-private.h>
+# include <fcntl.h>
+# include <sys/stat.h>
+# if defined(WIN32) || defined(__EMX__)
+# include <io.h>
+# else
+# include <unistd.h>
+# endif /* WIN32 || __EMX__ */
+
+
+/*
+ * Zend definitions...
+ */
+
+extern zend_module_entry phpcups_module_entry;
+# define phpext_phpcups_ptr &phpcups_module_entry
+
+# ifdef PHP_WIN32
+# define PHP_PHPCUPS_API __declspec(dllexport)
+# else
+# define PHP_PHPCUPS_API
+# endif
+
+# ifdef ZTS
+# include "TSRM.h"
+# endif
+
+PHP_MINIT_FUNCTION(phpcups);
+
+PHP_FUNCTION(cups_cancel_job);
+PHP_FUNCTION(cups_get_dests);
+PHP_FUNCTION(cups_get_jobs);
+PHP_FUNCTION(cups_last_error);
+PHP_FUNCTION(cups_last_error_string);
+PHP_FUNCTION(cups_print_file);
+PHP_FUNCTION(cups_print_files);
+
+#endif /* !PHPCUPS_H */
+
+
+/*
+ * End of "$Id$".
+ */
--- /dev/null
+#!/usr/bin/php -f
+<?
+//
+// "$Id: phpcups.php 3603 2003-04-11 18:42:52Z mike $"
+//
+// PHP test script for CUPS.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1997-2006 by Easy Software Products, all rights reserved.
+//
+// These coded instructions, statements, and computer programs are the
+// property of Apple Inc. and are protected by Federal copyright
+// law. Distribution and use rights are outlined in the file "LICENSE.txt"
+// which should have been included with this file. If this file is
+// file is missing or damaged, see the license at "http://www.cups.org/".
+//
+
+// Make sure the module is loaded...
+if(!extension_loaded("phpcups"))
+{
+ dl("phpcups.so");
+}
+
+// Get the list of functions in the module...
+$module = "phpcups";
+$functions = get_extension_funcs($module);
+
+print("Functions available in the $module extension:\n");
+
+foreach ($functions as $func)
+{
+ print("$func\n");
+}
+
+print("\n");
+
+print("cups_get_dests:\n");
+print_r(cups_get_dests());
+
+print("cups_get_jobs(\"\", 0, -1):\n");
+print_r(cups_get_jobs("", 0, -1));
+
+print("cups_print_file(\"test\", \"../../test/testfile.jpg\", "
+ ."\"testfile.jpg\", ...):\n");
+print_r(cups_print_file("test", "../../test/testfile.jpg", "testfile.jpg",
+ array("scaling" => "100",
+ "page-label" => "testfile.jpg")));
+
+print("cups_print_files(\"test\", array(\"../../test/testfile.jpg\", "
+ ."\"../../test/testfile.ps\"), \"testfiles\", ...):\n");
+print_r(cups_print_files("test", array("../../test/testfile.jpg",
+ "../../test/testfile.ps"),
+ "testfiles",
+ array("scaling" => "100",
+ "page-label" => "testfile.jpg")));
+
+//
+// End of "$Id: phpcups.php 3603 2003-04-11 18:42:52Z mike $".
+//
+?>