diff options
83 files changed, 36922 insertions, 0 deletions
@@ -0,0 +1,13 @@ +xcam: David Mosberger +xscanimage: Tristan Tarrant, Andreas Beck, and David Mosberger +scanadf: Tom Martone, Andreas Beck, and David Mosberger + +xscanimage icon: Maciek Podkomorzy + +Email addresses: + +Andreas Beck <becka@sunserver1.rz.uni-duesseldorf.de> +David Mosberger <David.Mosberger@acm.org> +Maciek Podkomorzy <gammaray@satfilm.net.pl> +Tom Martone <tom@martoneconsulting.com> +Tristan Tarrant <ttarrant@etnoteam.it> @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..079550a --- /dev/null +++ b/Changelog @@ -0,0 +1,838 @@ +****** Release of sane-frontends-1.0.14 ***** + +2005-09-18 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Changed version to 1.0.14. + * src/Makefile.in: Added missing DISTFILE. + +2005-05-31 Oliver Rauch <oliver.rauch@xsane.org> + * src/xcam.c update_param: added patch by + Douglas Schilling Landgraf: + if (dialog == NULL) return; + +2005-05-10 Gerard Klaver <gerard at gkall dot hobby dot nl> + * src/xcam.c - moved 2 DBG lines from above to below variable + declarations (OS/2 compiler error bugreport Franz Bakan) + - Changed declaration for "remaining" from SANE_Int to size_t + + moved lines for generating frame count, fps and +2005-05-07 Gerard Klaver <gerard at gkall dot hobby dot nl> + * src/xcam.c -moved lines for generating frame count, fps and + fps avarage value from nex_frame to input_available routine. + -solved bug for fps values > 1 + +2005-04-11 Gerard Klaver <gerard at gkall dot hobby dot nl> + * src/xcam.c added TXT button for option text line adding to i + image with name, date and time info. + font_6x11.h file and add_text routine taken from the (GPLed) + webcam.c file, part of xawtv, (c) 1998-2002 Gerd Knorr. + add_text was modified for this program (xcam_add_text). + + added RGB/BGR button option to switch the colors if needed. + + solved segment fault when no usb scanner/vidcam devices + is attached to system ( bug report from Henning Meier-Geinitz) + + patch update for recording feature (SANE bugreport 300224) + added SAVE Frame button, output filename box. + With Save Frame button image can be saved as + .pnm .pgm .pbm or .ppm file + + added info row with x, y, image-size, fps count, fps, fps_ava + + added -V and -h option (version and help + added option -B -buffersize so instead of default input buffer of + 32*1024 a buffer of 1024*1024 can be chosen + + src/font_6x11.h file added to src directory + src/xscanimage.c updates for debug output + src/preview.c updates for debug output + src/gtkglue.c updates for debug output + doc/xcam.man update for -B, help and debug info option + +2004-12-11 Julien Blache <jb@jblache.org> + * sanei resync with sane-backends, fixes a deadlock between xscanimage + and saned when scanning over the network. + +2004-10-30 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * doc/scanadf.man src/scanadf.c: Wait for scan-scripts so all + files are handled before leaving scanadf. Patch from Tristan + Hill <stan@saticed.me.uk>, bug #300993. + +2004-10-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Changed version to 1.0.13-cvs. End of + freeze. + +****** Release of sane-frontends-1.0.13 ***** + +2004-10-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Changed version to 1.0.13. + +2004-10-16 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Don't ask user to remove + /dev/null. Current autoconf doesn't use cache files. + +-- snapshot 1.0.13-pre1 + +2004-10-10 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * Makefile.in: Added xscanimage-icon-48x48-2.png to DISTFILES. + +2004-10-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * xscanimage-icon-48x48-2.png: Added xscanimage icon (from Maciek + Podkomorzy <gammaray@satfilm.net.pl>). + +2004-10-03 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/gtkglue.c: Don't try to print non-readable options. Don't + try to write non-writable options (bug #300621). Don't print + warnings for options without constraints. + +2004-07-09 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * doc/scanadf.man src/scanadf.c: Added -N option to stop scanadf + from overwriting files (patch from Paul Walmsley + <paul@booyaka.com>). + +2004-05-12 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * acinclude.m4 aclocal.m4 configure sane-frontends.lsm: Removed + old links to ftp.mostang.com. + +2004-04-29 Julien Blache <jb@jblache.org> + * src/gtkglue.h: looks like someone wanted GSGDialog.twocolumn to + an int rather than a GtkWidget *. Fixed. + +2004-04-24 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * Makefile.in: Remove autoconf temp files in distclean. + +2004-04-20 Julien Blache <jb@jblache.org> + + * src/preview.c: make the preview work when it's resized. + +2004-04-19 Julien Blache <jb@jblache.org> + + * src/xcam.c: fixed xcam layout. + +2004-04-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Set version to 1.0.12-cvs. + +****** Release of sane-frontends-1.0.12 ***** + +2004-04-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Set version to 1.0.12. + +2004-04-12 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/gtkglue.c: Used "us" for microsecond as the UTF8 + text didn't work with GTK 1.2. See bug #300621. + +-- snapshot 1.0.12-pre1 + +2004-04-09 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Updated supported Gimp versions. + * configure configure.in: Make sure that build also works without + libgtk 2.0. + * config.guess config.sub: Updated. + +2004-04-05 Gerard Klaver <gerard at gkall dot hobby dot nl> + * src/gtkglue.c UTF8 patch from Mattias Ellert for + SANE_UNIT_MICROSECOND, See bug #300621. + +2004-04-05 Gerard Klaver <gerard at gkall dot hobby dot nl> + * src/gtkglue.c src.gtkglue.h src/preferences.c src/preferences.h + src/xcam.c src/xscanimage.c: Add display option one or two column + See bug #300450. + +2004-04-02 Henning Meier-Geinitz <henning@meier-geinitz.de> + * src/preview.c src/xscanimage.c: Set sensitivity to false when + scanning or previewing. This change fixes some problems that + accour when preview ist started again while preview is running. + See bug #300220, #300219, and #300218. + +2004-04-02 Julien BLACHE <jb@jblache.org> + * src/xscanimage.c: fix select_device_callback() to return 0, fixing + a minor yet annoying bug in the device chooser (radio buttons didn't + toggle their status when clicked). + +2004-02-22 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * lib/usleep.c sanei/sanei_load_values.c + sanei/sanei_save_values.c: Port to nsr-tandem-nsk (patch + from "Bates, Tom" <tom.bates at hp.com>). + +2004-01-25 Julien BLACHE <jb@jblache.org> + * src/xscanimage.c: add a call to gimp_extension_ack(), conforming + to the GIMP 2.0 plug-in API. Also initialize the status to GIMP_PDB_CALLING_ERROR. + +2004-01-22 Julien BLACHE <jb@jblache.org> + * src/xscanimage.c: reverse the #ifdef ENABLE_GIMP_1_3 logic, we + now have ENABLE_GIMP_1_2 when GIMP 1.2 is explicitely wanted. + * configure.in: make GIMP 2.0 the default. + * include/sane/config.h: replace ENABLE_GIMP_1_3 by ENABLE_GIMP_1_2. + * aclocal.m4, acinclude.m4: include the AM_PATH_GIMP_2_0 macros, + which replaces the AM_PATH_GIMP_1_4 macro. + +2003-12-15 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage: Added debug messages to most functions. + Added checks for the return values of SANE API functions. + * src/gtkglue.c src/preview.c: Added checks for the return + values of SANE API functions. + +2003-11-26 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * Makefile.in: Generate md5 hash when making a release. Remove + generated .lsm file in "make distclean". + * doc/Makefile.in: Fixed link to images in HTML manpages. + +2003-10-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Check if the gamma value is not negative and + <255. based on a patch from Patch from Gerard Klaver + <gerard@gkall.hobby.nl>, bug #300251. + +2003-09-30 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Make sure that we save only to files with + extension pnm (and similar). Patch from Gerard Klaver + <gerard@gkall.hobby.nl>, bug #300239. + +2003-09-24 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * README doc/scanadf.man: Changed links to + sane-project.org. Minor updates. + * TODO Makefile.in: Removed TODO. Everything was added to the + bug-tracking system. + +2003-07-28 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL configure configure.in src/xscanimage.c: Support for gimp + version 1.3.17 (patch from Julien BLACHE <jb@jblache.org>). + +2003-07-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Avoid integer overflow when calculating the + size of very big images. + +2003-06-25 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in src/xscanimage.c: Fix for API-change in + gimp 1.3.15 (patch from Julien BLACHE <jb@jblache.org>). + + +2003-05-15 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Added information on dependency on devel packages for + sane-backends. Mentioned supported versions of gtk and gimp + explicitely. + +2003-04-26 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Changed version to 1.0.11-cvs. + * sane-frontends.lsm: Added scanadf. + +****** Release of sane-frontends-1.0.11 ***** + +2003-04-20 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * Makefile.in: Add acinclude.m4 to DISTFILES. + * configure configure.in: New version: 1.0.11. + +2003-03-23 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * acinclude.m4 aclocal.m4 configure configure.in + include/sane/config.h.in src/xscanimage.c: Added GIMP 1.3 support. + Added support for autoheader. Patch from Julien BLACHE + <jb@jblache.org>. + +2003-03-22 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xcam.c: Use a scrollbar if the options dialog gets too big. + Patch from Julien BLACHE <jb@jblache.org>. + * acinclude.m4 aclocal.m4 configure configure.in src/Makefile.in + src/gtkglue.c src/preview.c src/xscanimage.c: Added acinclude.m4 + to create aclocal.m4 automatically. Added GTK2 support. Check for + GTK2 only if the gimp plugin is disabled. If GTK2 is not available, + we'll fallback to a lower version if available. Patch from Julien + BLACHE <jb@jblache.org>. + Check that setting resolution option in preview succeeded. + Otherwise we may use the main resolution setting accidently. + * TODO: Updated xcam and xscanimage entries. + +2003-02-01 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Tell gimp which resolution we used for the scan. + Based on patch from Aurelien Jarno <lists@aurel32.net>. + * src/xscanimage.c doc/xscanimage.man: Move gimp menu entries to + File/Acquire/xscanimage/*. Patch from Julien BLACHE <jb@jblache.org>. + +****** Release of sane-frontends-1.0.10. End of code freeze ***** + +2003-01-31 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * TODO: Removed PUT_PIXEL problem. + * configure configure.in: Increased version to 1.0.10. + +2003-01-29 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Added comment about OS/2 pthread problem. + +---- CODE FREEZE FOR SANE 1.0.10 --- +-- snapshot 1.0.10-pre3 + +2003-01-24 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xcam.c: Fixed the xcam code related to the GdkImage data buffer + filling. I've resorted to the RGB shift values contained in the + GdkVisual associated to the image. It seems to work pretty well now, + and should be more portable among different platforms and X11 + visuals. Only 24/32 bit was fixed, 15/16 bit may need more work. + Patch from Andrea Suatoni <a.suatoni@telefonica.net>. + * src/xcam.c: Used shift values also for 15/16 bit modes. + +2003-01-18 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in include/sane/config.h.in src/preferences.c + src/preview.c src/progress.c: Some platforms/compilers don't + define u_int8_t so we must do that ourselves. + +-- snapshot 1.0.10-pre2 + +2003-01-14 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/Makefile.in: Create $(DESTDIR)$(sanedatadir) before installing + sane-style.rc. + +---- FEATURE FREEZE FOR SANE 1.0.10 --- +-- snapshot 1.0.10-pre1 + +2003-01-12 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xcam.c: Removed already defined Preferences variable. + * TODO: Minor cleanup + update. + +2003-01-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/Makefile.in: Install sane-style.rc to $(sanedatadir) where + it can be found by the frontends (from Andrea Suatoni + <a.suatoni@telefonica.net>). + +2002-12-30 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/gtkglue.c src/xscanimage.c: Use a scrollbar if the options + dialog gets too big. Make output filname dialog modal. Add check + marks for unit menu. All patches from Julien BLACHE + <jblache@debian.org>. + +2002-11-14 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Added 16 bit support for stand-alone mode + SANE_FRAME_GRAY and SANE_FRAME_RGB (from Sergey Vlasov + <vsu@altlinux.ru>.). Call scan_done if an error occurs during + scan_start. Run sane_cancel even if sane_read wasn't called + once. + +2002-10-24 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Addded extra version -cvs again. + +****** Release of sane-frontends-1.0.9. End of code freeze ***** + +2002-10-23 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: New version: 1.0.9. + +---- CODE FREEZE FOR SANE 1.0.9 --- +-- snapshot 1.0.9-pre2 + +2002-10-17 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c src/preview.h src/xscanimage.c: Disable "Scan" + and "Acquire Preview" buttons while scanning, and "Acquire + Preview" while acquiring a preview. Avoids error messages and/or + lockups. Patch from Aurelien Jarno <ml@aurel32.net>. + * TODO: Added some more xscanimage bugs. + +2002-10-15 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c: Added malloc that got lost in previous commit. + +2002-09-30 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c: Avoid unaligned 1 bit previews. Fixed 1 bit color mode + (also three-pass). Changed 1 bit color modes to most significant bit + is first pixel. + +---- FEATURE FREEZE FOR SANE 1.0.9 --- +-- snapshot 1.0.9-pre1 + +2002-09-02 Matto Marjanovic <maddog@mir.com> + + * src/progress.c, src/xscanimage.c: Added a couple of GTK mainloop + calls so that the UI is updated in a more timely fashion. Helps + with backends which have potentially slow sane_start() and + sane_read() commands (e.g. microtek). + +2002-06-07 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * config.guess config.sub: Updated to latest versions (from + ftp://ftp.gnu.org/pub/gnu/config/). + +2002-05-27 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * configure.in/configure V_EXTRA=-cvs + +****** Release of sane-frontends-1.0.8. End of code freeze ***** + +2002-05-25 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Set version to 1.0.8. + +---- CODE FREEZE FOR SANE 1.0.8 --- +-- snapshot 1.0.8-pre1 + +2002-05-03 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Check for libsyslog and libsocket for OS/2. + +---- FEATURE FREEZE FOR SANE 1.0.8 --- + +2002-04-13 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c: Really use only guint types instead of u_int??_t. + * configure configure.in lib/Makefile.in sanei/Makefile.in: + Use ranlib if available. If we run AIX, don't use archives. + +2002-04-06 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c src/xscanimage.c: Don't remove imput tags that + haven't been added. Don't hang when EOF and non-blocking. + * PROBLEMS TODO: Moved the entry about progress bar in three-pass + mode to PROBLEMS. + +2002-04-02 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c: Used guint types instead of u_int. Set order of pixels + in 1 bit color mode to least significant -> most significant. + That's the same as in three-pass mode. + +2002-04-01 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/preview.c: Fixed 1 bit color three-pass mode. Added 16 bit modes. + Added 1 bit color mode. + +2002-03-28 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * Makefile.in: Remove *.tar.gz when making distclean. + * doc/Makefile.in src/Makefile.in: Add DESTDIR variable to allow + installing to a temporary directory. Actually print the names + of the installed files, not only their path. + +2002-03-15 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/Makefile.in: Actually print what we are installing where. + +2002-02-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: New version: 1.0.7-cvs. + +****** Release of sane-frontends-1.0.7. End of code freeze ***** + +2002-02-02 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * config.guess config.sub: Use the same versions as in sane-backends + to avoid compilation problems on newer platforms. + +2002-01-29 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: New version: 1.0.7. Disabled extra version. + +---- CODE FREEZE FOR SANE 1.0.7 --- +--- sane-frontends-1.0.7-beta2 ---- + +2002-01-27 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * TODO: Removed entry about scanadf. Removed entry concerning testing. + * INSTALL: Added link to man xscanimage. Added info about + LD_LIBRARY_PATH. + * doc/xscanimage.man: Updated for gimp-1.2. Added link to scanadf. + +2002-01-26 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: Moved the message about problems from NEWS to + configure itsself. + * NEWS: Now this file describes the user-visible changes between + releases as in sane-backends. Updated for sane-frontends 1.0.7. + +--- sane-frontends-1.0.7-beta1 --- + +2002-01-16 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/scanadf.c: OS/2 compatibility fixes. + +2002-01-13 Tom Martone <tom@martoneconsulting.com> + + * doc/scanadf.man + added sane(7) to SEE ALSO section + +2002-01-12 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure: Regenerated from configure.in. + * doc/.cvsignore src/.cvsignore: Added scanadf. + * INSTALL: Added note about --help. + * README: Mentioned scanadf. + +2002-01-11 Tom Martone <tom@martoneconsulting.com> + * src/scanadf.c (new) + * doc/scanadf.man (new) + * ./configure.in + * src/Makefile.in + * doc/Makefile.in + * AUTHORS + added scanadf program + +2002-01-08 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * include/Makefile.in: Created. Moved distclean target to this file + from root dir. + * doc/Makefile.in lib/Makefile.in sanei/Makefile.in src/Makefile.in: + Fixed .PHONY. Added target "dist". + * Makefile.in: Added target "dist" and "sane-frontends". make dist + creates sane-frontends-x.y.z.tar.gz and make sane-frontends also + creates the appropriate sane-x-y-z.lsm. Moved distclean to include/. + Fixed .PHONY. + * configure configure.in: Added V_EXTRA version number to mark CVS + releases (-cvs) and snapshosts/betas (e.g. -beta1). V_EXTRA will + be empty for releases. Create include/Makefile. + * sane-frontends.lsm: Made it more compatible with lsm standard. Added + OpenBSD. Fixed mostang.com cvs directory. + +2002-01-08 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * configure.in: removed "rm -f $cache_file" when sane or gtk + was not found. This was bad when a user used a global cache_file + +2001-11-29 Oliver Schwartz <Oliver.Schwartz@gmx.de> + + * preview.c: in function restore_preview_image() check for + width==0 to avoid floating point exception + +2001-11-04 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * sane-frontends-lsm: New file. Created Linux Software Map + template to make uploading the sane-frontends package to mirrors + easier. + * Makefile.in: Added target "lsm" from sane-backends. + +****** Release of sane-frontends-1.0.6. End of code freeze ***** +****** Code freeze for sane-1.0.6 is active ***** + +2001-10-29 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure configure.in: New version: 1.0.6. + +****** snapshot 2001-10-27 ***** + +2001-10-26 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: GTK_CONFIG needs the full path name. + +****** Feature freeze for sane-1.0.6 is active ***** +****** snapshot 2001-10-15 ***** + +2001-10-13 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Fixed pnm output of images with a depth >8. + Don't send gimp images with more then 8 bits/color. Patches from + mh <crapsite@gmx.net>. Changed name of find-scanner + to sane-find-scanner. + * TODO: Added xscanimage problem with gamma tables. + +2001-09-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Added paragraph about gcc and GNU make and the C compiler. + Added sentence about GTK_CONFIG. Removed information about + SANE 1.0.1. + + * README: Removed list of frontends. Point to mostang.com instead. + +2001-08-03 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/Makefile.in src/preview.c src/xscanimage.c: Use "xscanimage" + as program name consistantly (instead of "xscan"). + + * configure configure.in lib/Makefile.in lib/alloca.c lib/getenv.c + lib/getipt.c lib/getopt1.c lib/isfdtype.c lib/snprintf.c + lib/strdup.c lib/strndup.c lib/strsep.c lib/usleep.c lib/vsyslog.c + include/sane/config.h.in: Added missing getenv, isfdtype, and + vsyslog functions from sane-backends. Used + #include "../include/sane/config.h". + +2001-07-11 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * sanei/sanei_init_debug.c: Use syslog.h instead of sys/syslog.h. + +2001-07-11 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Corrected some typos. + * configure configure.in: Made the error message that is printed if + the SANE libraries can't be found more verbose. + +2001-07-07 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * doc/Makefile.in: Use 6 lines as top/bottom margin for man2html + to avoid losing 2 lines at every page break. + * doc/.cvsignore: Added *.html. + +2001-07-02 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * configure/configure.in: added check for os2.h + + * src/xscanimage.c: added set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO); + before result = gimp_main (argc, argv); for os2 + + +2001-07-01 Oliver Rauch <Oliver.Rauch@rauch-domain.de> +************************ end of code freeze *********************************** +************************ Release of sane-frontends 1.0.5 ********************** + + +2001-06-25 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * configure/configure.in: changed version to 1.0.5 + +2001-06-25 ********** CODE FREEZE FOR SANE-1.0.5 + snapshot sane-frontends-pre1-1.0.5 + planned release on 2001-07-01 + +--- cvs snapshot-2001-06-17 --- + +2001-06-12 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * changed "#ifdef OS2" to "#ifdef HAVE_OS2_H" in gtkglue.c + +--- cvs snapshot-2001-06-10 --- + +2001-06-10 Petter Reinholdtsen <pere@td.org.uit.no> + + * TODO: Added URL to scanadf. + +2001-06-09 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * TODO: Added entry about sanei problems and removed entry about + filters. + +2001-06-09 Oliver Rauch <Oliver.Rauch@Rauch-Domain.DE> + + * src/gtkglue.c: gsg_make_path(): colons ":" in dev_name + are replaced by "+_" for OS2 + +--- feature freeze for sane-1.0.5 is active --- +--- cvs snapshot-2001-06-05 --- + +2001-05-28 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * README doc/xcam.man doc/xscanimage.man: Added links to sane(7). + * src/xscanimage.c src/xcam.c src/preview.c src/gtkglue.c + src/preview.h src/gtkglue.h: Used #include "../include/..." for + internal headers. + * Makefile.in src/Makefile.in sanei/Makefile.in lib/Makefile.in + doc/Makefile.in INSTALL: Added target "make uninstall". + +2001-05-27 Petter Reinholdtsen <pere@td.org.uit.no> + + * sanei/sanei_codec_bin.c sanei/sanei_wire.c: Synchronize with + sane-backends/sanei/ to avoid linker problems. Correct fix is + probably to make libsanei available from sane-backends. + +2001-05-06 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * configure.in1: Removed. + +2001-05-05 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/xscanimage.c: Fixed problems with old gimp versions. + +2001-04-29 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * src/Makefile.in: Missing quotation marks seem to cause problems + with some shells. + +2001-04-28 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * TODO: Removed entries about >8bit support for xscanimage, xcam doc + strings, and hand-scanner mode in xscanimage. + * src/xscanimage.c: Print an error when hand-scanner mode is requested. + Don't try to calculate image size in this case. + +2001-04-27 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * doc/xscanimage.man src/xscanimage.c src/xscanimage-gimp-1_0-compat.h: + Implemented (again) support for SANE_DEFAULT_DEVICE. If set, the + suitable backend is preselected in the device dialog. Use new Gimp + API, added compatibility file for old Gimp API (from xsane). + * TODO: Removed entry about SANE_DEFAULT_DEVICE and new Gimp API. + +2001-04-22 Henning Meier-Geinitz <henning@meier-geinitz.de> + + * INSTALL: Clarified that /usr/local/lib/sane in ld.so.conf is only + needed for SANE 1.0.1 and /usr/local/lib for 1.0.2 and later. + * NEWS: Made the message shorter. Now the status output of configure + should fit onto one screen. Updated Oliver's email address. + * src/Makefile.in: Added message if no programs can be installed + (usually if gtk wasn't found). + +2001-04-11 Henning Meier-Geinitz <hmg@gmx.de> + + * doc/xscanimage.man: Added descriptions of the --version and + --help options. + +2001-04-08 Henning Meier-Geinitz <hmg@gmx.de> + + * INSTALL: Only gtk 0.99.13 is needed, not 1.2.0. Some spelling and + formatting fixes. + +2000-12-23 Henning Meier-Geinitz <hmg@gmx.de> + + * aclocal.m4 configure: Fixed some bugs concerning link checks for + libsane. + * src/xscanimage.c: Use g_free for memory acquired by g_new. + * TODO: Removed entries about g_free and ac_local.m4. + +************************ Release of sane-frontends 1.0.4 ********************** + +2000-12-17 Henning Meier-Geinitz <hmg@gmx.de> + + * TODO: Added points about using g_free instead of free and the + sane compile/link test problem. + +************************** Code freeze for SANE 1.0.4 ************************ + +2000-12-10 Henning Meier-Geinitz <hmg@gmx.de> + + * doc/xscanimage.man: Fixed some typos and made clear that + SANE_DEFAULT_DEVICE doesn't work yet. + +2000-12-08 Henning Meier-Geinitz <hmg@gmx.de> + + * TODO: Updated. Removed entry about --without-x. + * src/xscanimage.c: Fixed bux: When closing "select device" dialog + with the window manager xscanimage wasn't exited. + +************************* snapshot-2000-12-04 ******************************* + +2000-11-30 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * src/Makefile.in: removed unused variable XSCAN + +************************* snapshot-2000-11-28 ******************************* +************************* Feature freeze for SANE 1.0.4 ********************* + +2000-11-26 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * changed configure.in/configure: + - removed test for X (AC_PATH_X), the X-Test is done in GTK + - added configure optin "--disable-guis", this does not + make sense in the moment because there are no non-GUI-progs, + but it is planned to include other progs (e.g. scanadf). + +2000-11-22 Henning Meier-Geinitz <hmg@gmx.de> + + * README: Added link to QuiteInsane. + +2000-11-19 Henning Meier-Geinitz <hmg@gmx.de> + + * TODO: Removed entry about stiff.* + + * src/xscanimage.c: Removed support for SANE_DEFAULT_DEVICE. Using + only this device without giving the user the ability to change to + other devices isn't the intended behaviour. + +2000-11-19 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * xscanimage.c: Suppressed Gimp warning at xscanimage startup + +2000-11-19 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * Removed src/stiff.[ch] and removed SCAN_OBJ=stiff.o from src/Makefile.in + +2000-11-18 Henning Meier-Geinitz <hmg@gmx.de> + + * src/xscanimage.c: Moved Defines for DBG_* outside the + #ifdef HAVE_LIBGIMP_GIMP_H block. + +2000-11-16 Henning Meier-Geinitz <hmg@gmx.de> + + * TODO: Entries about SANE_DEFAULT_DEVICE and DBG output. + + * src/xscanimage.c: Added suport for DBG messages. Added only a + few messages including a more verbose output when xscanimage + can't find any devices. Added support for SANE_DEFAULT_DEVICE. + + * doc/xscanimage.man: Documented support for SANE_DEFAULT_DEVICE and + SANE_DEBUG_XSCANIMAGE. + +2000-11-15 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * changed sanei/Makefile.in: SANE_CFLAGS is used now (for #include <sane.h>) + * changed acloacl.m4: SANE_LDFLAGS is used for sane test + +2000-11-14 Henning Meier-Geinitz <hmg@gmx.de> + + * TODO: Added entries about stiff.c and libgimp warning in xscanimage. + +2000-11-14 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * changed src/Makefile.in: SANE_LDFLAGS is used now + * changed aclocal.m4: removed bug (SANE_LDLAGS=>SANE_LDFLAGS) + and updated configure script + +2000-11-13 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * changed configure + configure.in, script aborts now if sane or gtk + is not found + +2000-11-12 Henning Meier-Geinitz <hmg@gmx.de> + + * README: Added information for developers and link to SANE website. + * TODO: Updated. + * INSTALL: Added link to GIMP website. + * src/xcam.c: Application is exited when window is closed (by + window manager) + +2000-11-12, 2000-11-11 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * several changes in configure scripts and Makefiles + * removed several unnecessary files + +2000-11-11 Henning Meier-Geinitz <hmg@gmx.de> + + * .cvsignore doc/.cvsignore include/.cvsignore + include/sane/.cvsignore lib/.cvsignore sanei/.cvsignore + src/.cvsignore: Added .cvsignore files. + * COPYING: Added GPL. + * TODO: Added from sane-backends. + * AUTHORS: Added from sane-backends. + * README: New file. + * NEWS: Renamed (old name: sane-frontend.NEWS). + * INSTALL: Renamed (old name: sane.INSTALL) and some reformating. + Added hint to PROBLEMS. Added some point about necessary packages. + * PROBLEMS: Renamed (old name: sane.PROBLEMS). + +2000-11-10 Oliver Rauch <Oliver.Rauch@Wolfsburg.DE> + + * created own Package for frontends xscanimage and xcam + +Old entries can be found in file ChangeLog of the package containing the +backends of SANE. + @@ -0,0 +1,61 @@ +How to configure, build, and install SANE-FRONTENDS. + +Quick install: +============== + +./configure +make +make install + + +Type `./configure --help' for a list of options. + +Prerequisites: + +- GNU make version 3.70 or later and an ANSI C-Compiler (e.g. gcc) is needed + for compilation. It may be necessary to specify the path to GNU make and the + compiler by setting the environment variables MAKE and CC before running + configure. + +- You must install the sane-backends package before you can configure this + package. If you use pre-compiled binaries (e.g. from your distribution) you + will also have to install the SANE headers (maybe in a package called + sane-devel or similar). In this case you also need the -devel packages for + all the software sane-backends depends on (e.g. libusb). If you're lucky, + your distribution took care of that. Otherwise run sane-config --libs and + make sure that the -devel packages for all the libraries mentioned in the + output are installed. + +- For xscanimage and xcam you need the X Window libraries and headers. + Furthermore GTK version 0.99.13 (or 1.0.*, 1.2.*, 2.0.*) must be installed + together with its header files. GTK can be found at http://www.gtk.org/. For + some operating systems it's necessary to set the path to gtk-config + explicitely. This can be done by using the environment variable + GTK_CONFIG. For FreeBSD try `GTK_CONFIG=/usr/X11R6/bin/gtk12-config'. + +- If you want to use xscanimage as a GIMP plug-in, the GIMP libraries and + headers are necessary. See http://www.gimp.org/. See also `man xscanimage'. + Versions 1.2.*, and 2.0.* are known to work. + +- If you get an error message that libsane-dll.so.1 or libsane-so.1 is not + found, you have to tell your system where the SANE-libraries are installed. + On some systems the library directory `/usr/local/lib' is not searched by + the system's dynamic library loader. If SANE is installed in `/usr/local/...' + you have to tell your system's dynamic library loader to search in + `/usr/local/lib'. For Linux: add the path `/usr/local/lib' to + /etc/ld.so.conf and call ldconfig (as root). Another approach is to set the + environment variable LD_LIBRARY_PATH (or the equivalent on other operating + systems) to `/usr/local/lib'. + +- OS/2: If you get errors like this one: "xcam.o: Undefined symbol + _pthread_write referenced from text segment", libpthread must be linked. + Find "gtk-config" on your system and add "-lpthreads" to the list of + libraries. + +Uninstall +========= + +To uninstall the binaries and manual pages, type `make uninstall'. + + +See also the PROBLEMS and README files. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..d481f41 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,104 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = . + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +sanedatadir = @datadir@/sane + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +@SET_MAKE@ + +SUBDIRS = include lib sanei src doc + +DISTFILES = AUTHORS COPYING Changelog INSTALL Makefile.in NEWS PROBLEMS \ + README acinclude.m4 aclocal.m4 config.guess config.sub configure \ + configure.in install-sh mkinstalldirs sane-frontends.lsm \ + xscanimage-icon-48x48-2.png + +.PHONY: all all-recursive clean clean-recursive depend \ + depend-recursive dist install install-recursive lsm sane-frontends \ + uninstall uninstall-recursive + +all: all-recursive + +$(PACKAGE)-$(VERSION).lsm: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).lsm + ( cat $(PACKAGE).lsm | \ + sed -e "s|_DATE_|`date +%d%b%y`|g" \ + -e "s|_VERSION_|$(VERSION)|g" \ + -e "s|_T_S_|`find $(PACKAGE)-$(VERSION).tar.gz -printf \"%3k\"`|g"\ + -e "s|_L_S_|`find $(PACKAGE).lsm -printf "%3k"`|g" > \ + $(PACKAGE)-$(VERSION).lsm \ + ) + +lsm: $(PACKAGE)-$(VERSION).lsm dist + +install: install-recursive + +uninstall: uninstall-recursive + +clean: clean-recursive + +distclean: clean distclean-recursive + rm -f *~ *.log *.bak libtool *.tar.gz + rm -f Makefile config.cache config.status + rm -f intl/Makefile + rm -f $(distdir).tar.gz.md5 + rm -f sane-frontends-*.lsm + rm -rf autom4te.cache + +depend: depend-recursive + +all-recursive install-recursive uninstall-recursive clean-recursive \ +distclean-recursive depend-recursive: + @for subdir in $(SUBDIRS); do \ + target=`echo $@ | sed s/-recursive//`; \ + echo making $$target in $$subdir; \ + (cd $$subdir && $(MAKE) $$target) \ + || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" + + +dist: $(DISTFILES) + rm -fr $(distdir) + $(MKDIR) $(distdir) + for file in $(DISTFILES); do \ + ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \ + done + for subdir in $(SUBDIRS) ; do \ + mkdir $(distdir)/$$subdir || exit 1; \ + (cd $$subdir && $(MAKE) $@) || exit 1; \ + done + tar chzf $(distdir).tar.gz $(distdir) + rm -fr $(distdir) + +md5: dist + md5sum $(distdir).tar.gz > $(distdir).tar.gz.md5 + +$(PACKAGE)-$(VERSION).tar.gz: dist + +sane-frontends: dist lsm md5 @@ -0,0 +1,11 @@ +-*-Mode: outline-*- + +New with 1.0.7, released 2002-02-04: + +* New frontend: scanadf (command line frontend focussing on scanners with + automatic document feeders). +* Updated frontends: xscanimage +* Documentation updates. +* Build fixes. +* Bugfixes. + diff --git a/PROBLEMS b/PROBLEMS new file mode 100644 index 0000000..1651fa1 --- /dev/null +++ b/PROBLEMS @@ -0,0 +1,8 @@ +- xscanimage/xcam crashes X server on Linux/Alpha + Older versions of the TGA X server (such as version 3.1.2) are known + to fail when creating shared images of certain sizes. This can be + avoided by invoking xscanimage and xcam with option --no-shm. + +- In three-pass mode, the progress indicator is not updated correctly. This + just menas that scanning is faster than the disk can handle. It happens + especially in three-pass mode because much seeking is going on in this mode. @@ -0,0 +1,32 @@ +This is the sane-frontends package. + +To find out more about SANE (Scanner Access Now Easy) look at the SANE +website: http://www.sane-project.org/. There is also information on how to +subscribe the SANE mailing list (sane-devel). + +These SANE applications (frontends) are included in this package (together +with their documentation): + + Frontend Documentation (man page) +-------------------------------------------------------------------------- + xscanimage xscanimage(1) + xcam xcam(1) + scanadf scanadf(1) + +For general information about SANE, read man sane(7). + +You must install the sane-backends package before you can compile the +frontends. sane-backends also includes the command-line frontend scanimage +and the network daemon saned. + +For details about installation please read the INSTALL file. + +For a list of other SANE frontends look at +http://www.sane-project.org//sane-frontends.html. + +Developers may wish to look at the SANE standard (sane.tex). It can be found +in the sane-backends distribution or in various file formats at the website: +http://www.sane-project.org/docs.html + +Please report bugs and missing features at our bug-tracking system: +http://www.sane-project.org/bugs.html diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..9c7f451 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,592 @@ +# acinclude.m4 for sane-frontends +# AM_PATH_GTK +# AM_PATH_GIMP +# AM_PATH_SANE + +###################################################################### +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) + min_gtk_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gtktest"); + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include <gtk/gtk.h> +#include <stdio.h> +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + + +###################################################################### +# Configure paths for The GIMP +# Oliver Rauch 2000-12-28 + +dnl AM_PATH_GIMP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GIMP, and define GIMP_CFLAGS and GIMP_LIBS +dnl +AC_DEFUN(AM_PATH_GIMP, +[dnl +dnl Get the cflags and libraries from the gimp-config script +dnl + AC_ARG_WITH(gimp-prefix,[ --with-gimp-prefix=PFX Prefix where GIMP is installed (optional)], + gimp_config_prefix="$withval", gimp_config_prefix="") + AC_ARG_WITH(gimp-exec-prefix,[ --with-gimp-exec-prefix=PFX Exec prefix where GIMP is installed (optional)], + gimp_config_exec_prefix="$withval", gimp_config_exec_prefix="") + AC_ARG_ENABLE(gimptest, [ --disable-gimptest Do not try to compile and run a test GIMP program], , enable_gimptest=yes) + + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + ac_save_GTK_CFLAGS="$GTK_CFLAGS" + ac_save_GTK_LIBS="$GTK_LIBS" + + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_exec_prefix/bin/gimp-config + fi + fi + + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_prefix/bin/gimp-config + fi + fi + + AC_PATH_PROG(GIMP_CONFIG, gimp-config, no) + if test "$GIMP_CONFIG" = "no" ; then + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_exec_prefix/bin/gimptool + fi + fi + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_prefix/bin/gimptool + fi + fi + AC_PATH_PROG(GIMP_TOOL, gimptool, no) + GIMP_CONFIG=$GIMP_TOOL + fi + + min_gimp_version=ifelse([$1], ,1.0.0,$1) + no_gimp="" + + if test "$GIMP_CONFIG" = "no" ; then +dnl we do not have gimp-config (gimp-1.0.x does not have gimp-config) +dnl so we have to use the GTK_* things for testing for gimp.h and gimpfeatures.h + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" + AC_CHECK_HEADERS(libgimp/gimp.h, GIMP_LIBS="-lgimp", no_gimp=yes) + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) + CPPFLAGS="$ac_save_CPPFLAGS" + CFLAGS="${CFLAGS} ${GTK_CFLAGS}" + LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + if test "x$no_gimp" = x ; then + AC_MSG_CHECKING(GIMP compilation) + gimp_config_major_version=-1 + gimp_config_minor_version=0 + gimp_config_micro_version=0 + fi + else +dnl Ok, we have gimp-config and so we do not need the GTK_* things because they are +dnl included in the output of gimp-config +# GTK_CFLAGS="" +# GTK_LIBS="" + GIMP_CFLAGS=`$GIMP_CONFIG $gimp_config_args --cflags` + GIMP_LIBS=`$GIMP_CONFIG $gimp_config_args --libs`" -lgimp" + gimp_config_major_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gimp_config_minor_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gimp_config_micro_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + CFLAGS="${CFLAGS} ${GIMP_CFLAGS}" + LIBS="${LIBS} ${GIMP_LIBS}" + AC_MSG_CHECKING(for GIMP - version >= $min_gimp_version) + fi + +dnl +dnl Now check if the installed GIMP is sufficiently new. (Also sanity +dnl checks the results of gimp-config to some extent +dnl + if test "x$no_gimp" = x ; then + if test "x$enable_gimptest" = "xyes" ; then + rm -f conf.gimptest + AC_TRY_RUN([ +#include <libgimp/gimp.h> +#include <stdio.h> + +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, NULL, NULL, NULL +}; + + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gimptest"); + + if (sscanf("$min_gimp_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gimp_version"); + exit(1); + } + + if ( ($gimp_config_major_version != -1) && + ((gimp_major_version != $gimp_config_major_version) || + (gimp_minor_version != $gimp_config_minor_version) || + (gimp_micro_version != $gimp_config_micro_version)) ) + { + printf("\n*** 'gimp-config --version' returned %d.%d.%d, but GIMP (%d.%d.%d)\n", + $gimp_config_major_version, $gimp_config_minor_version, $gimp_config_micro_version, + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf ("*** was found! If gimp-config was correct, then it is best\n"); + printf ("*** to remove the old version of GIMP. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gimp-config was wrong, set the environment variable GIMP_CONFIG\n"); + printf("*** to point to the correct copy of gimp-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gimp_major_version > major) || + ((gimp_major_version == major) && (gimp_minor_version > minor)) || + ((gimp_major_version == major) && (gimp_minor_version == minor) && (gimp_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GIMP (%d.%d.%d) was found.\n", + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf("*** You need a version of GIMP newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GIMP is always available from ftp://ftp.gimp.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gimp-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GIMP, but you can also set the GIMP_CONFIG environment to point to the\n"); + printf("*** correct copy of gimp-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +], , no_gimp=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + fi + fi + + if test "x$no_gimp" = x ; then +dnl gimp test succeeded or not tested + if test "x$enable_gimptest" = "xyes" ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(not tested) + fi + if test "$GIMP_CONFIG" != "no" ; then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GIMP_CFLAGS}" + AC_CHECK_HEADERS(libgimp/gimp.h) + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) + CPPFLAGS="$ac_save_CPPFLAGS" + fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test -f conf.gimptest ; then + : + else + echo "*** Could not run GIMP test program, checking why..." + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$LIBS $GIMP_LIBS" + AC_TRY_LINK([ +#include <libgimp/gimp.h> +#include <stdio.h> +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif +GimpPlugInInfo PLUG_IN_INFO = { NULL, NULL, NULL, NULL }; +], [ return ((gimp_major_version) || (gimp_minor_version) || (gimp_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GIMP or finding the wrong" + echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "***" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi +dnl ok, gimp does not work, so we have to use the gtk_* things again + GIMP_CFLAGS="" + GIMP_LIBS="" +# GTK_CFLAGS="$ac_save_GTK_CFLAGS" +# GTK_LIBS="$ac_save_GTK_LIBS" +# CFLAGS="${CFLAGS} ${GTK_CFLAGS}" +# LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GIMP_CFLAGS) + AC_SUBST(GIMP_LIBS) + rm -f conf.gimptest +]) + + +# ******************************************************************** +# Configure paths for SANE +# Oliver Rauch 2000-10-30 + +dnl AM_PATH_SANE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SANE, and define SANE_CFLAGS and SANE_LIBS +dnl +AC_DEFUN(AM_PATH_SANE, +[dnl +dnl Get the cflags and libraries from the sane-config script +dnl +AC_ARG_WITH(sane-prefix,[ --with-sane-prefix=PFX Prefix where SANE is installed (optional)], + sane_config_prefix="$withval", sane_config_prefix="") +AC_ARG_WITH(sane-exec-prefix,[ --with-sane-exec-prefix=PFX Exec prefix where SANE is installed (optional)], + sane_config_exec_prefix="$withval", sane_config_exec_prefix="") +AC_ARG_ENABLE(sanetest, [ --disable-sanetest Do not try to compile and run a test SANE program], , enable_sanetest=yes) + + if test x$sane_config_exec_prefix != x ; then + sane_config_args="$sane_config_args --exec-prefix=$sane_config_exec_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_exec_prefix/bin/sane-config + fi + fi + if test x$sane_config_prefix != x ; then + sane_config_args="$sane_config_args --prefix=$sane_config_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_prefix/bin/sane-config + fi + fi + + AC_PATH_PROG(SANE_CONFIG, sane-config, no) + min_sane_version=ifelse([$1], ,1.0.0,$1) + AC_MSG_CHECKING(for SANE - version >= $min_sane_version) + no_sane="" + if test "$SANE_CONFIG" = "no" ; then + no_sane=yes + else + SANE_CFLAGS=`$SANE_CONFIG $sane_config_args --cflags` + SANE_LDFLAGS=`$SANE_CONFIG $sane_config_args --ldflags` +# SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs` + SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs | sed -e 's/-lintl//g'` + SANE_PREFIX=`$SANE_CONFIG $sane_config_args --prefix` + sane_config_major_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sane_config_minor_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sane_config_micro_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sanetest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SANE_CFLAGS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + LIBS="$LIBS $SANE_LIBS" +dnl +dnl Now check if the installed SANE is sufficiently new. (Also sanity +dnl checks the results of sane-config to some extent +dnl + rm -f conf.sanetest + AC_TRY_RUN([ +#include <sane/sane.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.sanetest"); + + if (sscanf("$min_sane_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sane_version"); + exit(1); + } + + if ( ($sane_config_major_version == major) && + ( ($sane_config_minor_version > minor) || + ( ($sane_config_minor_version == minor) && ($sane_config_micro_version >= micro)))) + { + return 0; + } + else if ($sane_config_major_version > major) + { + printf("\n*** A too new version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE with the major version number %d.\n", major); + } + else + { + printf("\n*** An old version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + } + + printf("*** SANE is always available from http://www.sane-project.org\n"); + printf("***\n"); + printf("*** If you have already installed a sufficient version, this error\n"); + printf("*** probably means that the wrong copy of the sane-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of SANE, but you can also set the SANE_CONFIG environment to point to the\n"); + printf("*** correct copy of sane-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + + return 1; +} +],, no_sane=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sane" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SANE_CONFIG" = "no" ; then + echo "*** The sane-config script installed by SANE could not be found" + echo "*** If SANE was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SANE_CONFIG environment variable to the" + echo "*** full path to sane-config." + else + if test -f conf.sanetest ; then + : + else + echo "*** Could not run SANE test program, checking why..." + CFLAGS="$CFLAGS $SANE_CFLAGS" + LIBS="$LIBS $SANE_LIBS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + AC_TRY_LINK([ +#include <sane/sane.h> +#include <stdio.h> +], [ return (SANE_CURRENT_MAJOR); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SANE or finding the wrong" + echo "*** version of SANE. If it is not finding SANE, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location. Also, make sure you have run ldconfig if that" + echo "*** is required on your system." + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SANE was incorrectly installed" + echo "*** or that you have moved SANE since it was installed. In the latter case, you" + echo "*** may want to edit the sane-config script: $SANE_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SANE_CFLAGS="" + SANE_LDFLAGS="" + SANE_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SANE_LDFLAGS) + AC_SUBST(SANE_CFLAGS) + AC_SUBST(SANE_LIBS) + AC_SUBST(SANE_PREFIX) + rm -f conf.sanetest +]) + +# ******************************************************************** + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..b83ffbb --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1069 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# acinclude.m4 for sane-frontends +# AM_PATH_GTK +# AM_PATH_GIMP +# AM_PATH_SANE + +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) + min_gtk_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gtktest"); + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include <gtk/gtk.h> +#include <stdio.h> +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + + +# Configure paths for The GIMP +# Oliver Rauch 2000-12-28 + +dnl AM_PATH_GIMP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GIMP, and define GIMP_CFLAGS and GIMP_LIBS +dnl +AC_DEFUN(AM_PATH_GIMP, +[dnl +dnl Get the cflags and libraries from the gimp-config script +dnl + AC_ARG_WITH(gimp-prefix,[ --with-gimp-prefix=PFX Prefix where GIMP is installed (optional)], + gimp_config_prefix="$withval", gimp_config_prefix="") + AC_ARG_WITH(gimp-exec-prefix,[ --with-gimp-exec-prefix=PFX Exec prefix where GIMP is installed (optional)], + gimp_config_exec_prefix="$withval", gimp_config_exec_prefix="") + AC_ARG_ENABLE(gimptest, [ --disable-gimptest Do not try to compile and run a test GIMP program], , enable_gimptest=yes) + + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + ac_save_GTK_CFLAGS="$GTK_CFLAGS" + ac_save_GTK_LIBS="$GTK_LIBS" + + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_exec_prefix/bin/gimp-config + fi + fi + + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_prefix/bin/gimp-config + fi + fi + + AC_PATH_PROG(GIMP_CONFIG, gimp-config, no) + if test "$GIMP_CONFIG" = "no" ; then + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_exec_prefix/bin/gimptool + fi + fi + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_prefix/bin/gimptool + fi + fi + AC_PATH_PROG(GIMP_TOOL, gimptool, no) + GIMP_CONFIG=$GIMP_TOOL + fi + + min_gimp_version=ifelse([$1], ,1.0.0,$1) + no_gimp="" + + if test "$GIMP_CONFIG" = "no" ; then +dnl we do not have gimp-config (gimp-1.0.x does not have gimp-config) +dnl so we have to use the GTK_* things for testing for gimp.h and gimpfeatures.h + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" + AC_CHECK_HEADERS(libgimp/gimp.h, GIMP_LIBS="-lgimp", no_gimp=yes) + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) + CPPFLAGS="$ac_save_CPPFLAGS" + CFLAGS="${CFLAGS} ${GTK_CFLAGS}" + LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + if test "x$no_gimp" = x ; then + AC_MSG_CHECKING(GIMP compilation) + gimp_config_major_version=-1 + gimp_config_minor_version=0 + gimp_config_micro_version=0 + fi + else +dnl Ok, we have gimp-config and so we do not need the GTK_* things because they are +dnl included in the output of gimp-config +# GTK_CFLAGS="" +# GTK_LIBS="" + GIMP_CFLAGS=`$GIMP_CONFIG $gimp_config_args --cflags` + GIMP_LIBS=`$GIMP_CONFIG $gimp_config_args --libs`" -lgimp" + gimp_config_major_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gimp_config_minor_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gimp_config_micro_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + CFLAGS="${CFLAGS} ${GIMP_CFLAGS}" + LIBS="${LIBS} ${GIMP_LIBS}" + AC_MSG_CHECKING(for GIMP - version >= $min_gimp_version) + fi + +dnl +dnl Now check if the installed GIMP is sufficiently new. (Also sanity +dnl checks the results of gimp-config to some extent +dnl + if test "x$no_gimp" = x ; then + if test "x$enable_gimptest" = "xyes" ; then + rm -f conf.gimptest + AC_TRY_RUN([ +#include <libgimp/gimp.h> +#include <stdio.h> + +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, NULL, NULL, NULL +}; + + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gimptest"); + + if (sscanf("$min_gimp_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gimp_version"); + exit(1); + } + + if ( ($gimp_config_major_version != -1) && + ((gimp_major_version != $gimp_config_major_version) || + (gimp_minor_version != $gimp_config_minor_version) || + (gimp_micro_version != $gimp_config_micro_version)) ) + { + printf("\n*** 'gimp-config --version' returned %d.%d.%d, but GIMP (%d.%d.%d)\n", + $gimp_config_major_version, $gimp_config_minor_version, $gimp_config_micro_version, + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf ("*** was found! If gimp-config was correct, then it is best\n"); + printf ("*** to remove the old version of GIMP. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gimp-config was wrong, set the environment variable GIMP_CONFIG\n"); + printf("*** to point to the correct copy of gimp-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gimp_major_version > major) || + ((gimp_major_version == major) && (gimp_minor_version > minor)) || + ((gimp_major_version == major) && (gimp_minor_version == minor) && (gimp_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GIMP (%d.%d.%d) was found.\n", + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf("*** You need a version of GIMP newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GIMP is always available from ftp://ftp.gimp.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gimp-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GIMP, but you can also set the GIMP_CONFIG environment to point to the\n"); + printf("*** correct copy of gimp-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +], , no_gimp=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + fi + fi + + if test "x$no_gimp" = x ; then +dnl gimp test succeeded or not tested + if test "x$enable_gimptest" = "xyes" ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(not tested) + fi + if test "$GIMP_CONFIG" != "no" ; then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GIMP_CFLAGS}" + AC_CHECK_HEADERS(libgimp/gimp.h) + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) + CPPFLAGS="$ac_save_CPPFLAGS" + fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test -f conf.gimptest ; then + : + else + echo "*** Could not run GIMP test program, checking why..." + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$LIBS $GIMP_LIBS" + AC_TRY_LINK([ +#include <libgimp/gimp.h> +#include <stdio.h> +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif +GimpPlugInInfo PLUG_IN_INFO = { NULL, NULL, NULL, NULL }; +], [ return ((gimp_major_version) || (gimp_minor_version) || (gimp_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GIMP or finding the wrong" + echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "***" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi +dnl ok, gimp does not work, so we have to use the gtk_* things again + GIMP_CFLAGS="" + GIMP_LIBS="" +# GTK_CFLAGS="$ac_save_GTK_CFLAGS" +# GTK_LIBS="$ac_save_GTK_LIBS" +# CFLAGS="${CFLAGS} ${GTK_CFLAGS}" +# LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GIMP_CFLAGS) + AC_SUBST(GIMP_LIBS) + rm -f conf.gimptest +]) + + +# ******************************************************************** +# Configure paths for SANE +# Oliver Rauch 2000-10-30 + +dnl AM_PATH_SANE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SANE, and define SANE_CFLAGS and SANE_LIBS +dnl +AC_DEFUN(AM_PATH_SANE, +[dnl +dnl Get the cflags and libraries from the sane-config script +dnl +AC_ARG_WITH(sane-prefix,[ --with-sane-prefix=PFX Prefix where SANE is installed (optional)], + sane_config_prefix="$withval", sane_config_prefix="") +AC_ARG_WITH(sane-exec-prefix,[ --with-sane-exec-prefix=PFX Exec prefix where SANE is installed (optional)], + sane_config_exec_prefix="$withval", sane_config_exec_prefix="") +AC_ARG_ENABLE(sanetest, [ --disable-sanetest Do not try to compile and run a test SANE program], , enable_sanetest=yes) + + if test x$sane_config_exec_prefix != x ; then + sane_config_args="$sane_config_args --exec-prefix=$sane_config_exec_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_exec_prefix/bin/sane-config + fi + fi + if test x$sane_config_prefix != x ; then + sane_config_args="$sane_config_args --prefix=$sane_config_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_prefix/bin/sane-config + fi + fi + + AC_PATH_PROG(SANE_CONFIG, sane-config, no) + min_sane_version=ifelse([$1], ,1.0.0,$1) + AC_MSG_CHECKING(for SANE - version >= $min_sane_version) + no_sane="" + if test "$SANE_CONFIG" = "no" ; then + no_sane=yes + else + SANE_CFLAGS=`$SANE_CONFIG $sane_config_args --cflags` + SANE_LDFLAGS=`$SANE_CONFIG $sane_config_args --ldflags` +# SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs` + SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs | sed -e 's/-lintl//g'` + SANE_PREFIX=`$SANE_CONFIG $sane_config_args --prefix` + sane_config_major_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sane_config_minor_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sane_config_micro_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sanetest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SANE_CFLAGS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + LIBS="$LIBS $SANE_LIBS" +dnl +dnl Now check if the installed SANE is sufficiently new. (Also sanity +dnl checks the results of sane-config to some extent +dnl + rm -f conf.sanetest + AC_TRY_RUN([ +#include <sane/sane.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.sanetest"); + + if (sscanf("$min_sane_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sane_version"); + exit(1); + } + + if ( ($sane_config_major_version == major) && + ( ($sane_config_minor_version > minor) || + ( ($sane_config_minor_version == minor) && ($sane_config_micro_version >= micro)))) + { + return 0; + } + else if ($sane_config_major_version > major) + { + printf("\n*** A too new version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE with the major version number %d.\n", major); + } + else + { + printf("\n*** An old version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + } + + printf("*** SANE is always available from http://www.sane-project.org\n"); + printf("***\n"); + printf("*** If you have already installed a sufficient version, this error\n"); + printf("*** probably means that the wrong copy of the sane-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of SANE, but you can also set the SANE_CONFIG environment to point to the\n"); + printf("*** correct copy of sane-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + + return 1; +} +],, no_sane=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sane" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SANE_CONFIG" = "no" ; then + echo "*** The sane-config script installed by SANE could not be found" + echo "*** If SANE was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SANE_CONFIG environment variable to the" + echo "*** full path to sane-config." + else + if test -f conf.sanetest ; then + : + else + echo "*** Could not run SANE test program, checking why..." + CFLAGS="$CFLAGS $SANE_CFLAGS" + LIBS="$LIBS $SANE_LIBS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + AC_TRY_LINK([ +#include <sane/sane.h> +#include <stdio.h> +], [ return (SANE_CURRENT_MAJOR); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SANE or finding the wrong" + echo "*** version of SANE. If it is not finding SANE, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location. Also, make sure you have run ldconfig if that" + echo "*** is required on your system." + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SANE was incorrectly installed" + echo "*** or that you have moved SANE since it was installed. In the latter case, you" + echo "*** may want to edit the sane-config script: $SANE_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SANE_CFLAGS="" + SANE_LDFLAGS="" + SANE_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SANE_LDFLAGS) + AC_SUBST(SANE_CFLAGS) + AC_SUBST(SANE_LIBS) + AC_SUBST(SANE_PREFIX) + rm -f conf.sanetest +]) + +# ******************************************************************** + + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +# Configure paths for GTK+ +# Owen Taylor 1997-2001 + +dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, +dnl pass to pkg-config +dnl +AC_DEFUN(AM_PATH_GTK_2_0, +[dnl +dnl Get the cflags and libraries from pkg-config +dnl +AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], + , enable_gtktest=yes) + + pkg_config_args=gtk+-2.0 + for module in . $4 + do + case "$module" in + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + no_gtk="" + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + if test x$PKG_CONFIG != xno ; then + if pkg-config --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_gtk=yes + PKG_CONFIG=no + fi + else + no_gtk=yes + fi + + min_gtk_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" + enable_gtktest=no + fi + + if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then + : + else + no_gtk=yes + fi + fi + + if test x"$no_gtk" = x ; then + GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` + GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` + gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" +dnl +dnl Now check if the installed GTK+ is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent) +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include <gtk/gtk.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://pkgconfig.sourceforge.net" + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK+ test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include <gtk/gtk.h> +#include <stdio.h> +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK+ or finding the wrong" + echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + +# Configure paths for GIMP-2.0 +# Manish Singh, Sven Neumann +# Large parts shamelessly stolen from Owen Taylor + +dnl AM_PATH_GIMP_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GIMP, and define GIMP_CFLAGS and GIMP_LIBS +dnl +AC_DEFUN([AM_PATH_GIMP_2_0], +[dnl +dnl Get the cflags and libraries from pkg-config +dnl + +AC_ARG_ENABLE(gimptest, [ --disable-gimptest do not try to compile and run a test GIMP program],, enable_gimptest=yes) + + pkg_name=gimp-2.0 + pkg_config_args="$pkg_name gimpui-2.0" + + no_gimp="" + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + if test x$PKG_CONFIG != xno ; then + if pkg-config --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_gimp=yes + PKG_CONFIG=no + fi + else + no_gimp=yes + fi + + min_gimp_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GIMP - version >= $min_gimp_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GIMP found in PKG_CONFIG_PATH" + enable_gimptest=no + fi + + if $PKG_CONFIG --atleast-version $min_gimp_version $pkg_config_args; then + : + else + no_gimp=yes + fi + fi + + if test x"$no_gimp" = x ; then + GIMP_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` + GIMP_LIBS=`$PKG_CONFIG $pkg_config_args --libs` + GIMP_CFLAGS_NOUI=`$PKG_CONFIG $pkg_name --cflags` + GIMP_LIBS_NOUI=`$PKG_CONFIG $pkg_name --libs` + GIMP_DATA_DIR=`$PKG_CONFIG $pkg_name --variable=gimpdatadir` + GIMP_PLUGIN_DIR=`$PKG_CONFIG $pkg_name --variable=gimplibdir` + + gimp_pkg_major_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gimp_pkg_minor_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gimp_pkg_micro_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gimptest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$GIMP_LIBS $LIBS" + +dnl +dnl Now check if the installed GIMP is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent +dnl + rm -f conf.gimptest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> + +#include <libgimp/gimp.h> + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + NULL, /* query_proc */ + NULL /* run_proc */ +}; + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gimptest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gimp_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gimp_version"); + exit(1); + } + + if (($gimp_pkg_major_version > major) || + (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version > minor)) || + (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version == minor) && ($gimp_pkg_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'pkg-config --modversion %s' returned %d.%d.%d, but the minimum version\n", "$pkg_name", $gimp_pkg_major_version, $gimp_pkg_minor_version, $gimp_pkg_micro_version); + printf("*** of GIMP required is %d.%d.%d. If pkg-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct the correct configuration files\n"); + return 1; + } +} + +],, no_gimp=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gimp" = x ; then + AC_MSG_RESULT(yes (version $gimp_pkg_major_version.$gimp_pkg_minor_version.$gimp_pkg_micro_version)) + ifelse([$2], , :, [$2]) + else + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.gimptest ; then + : + else + echo "*** Could not run GIMP test program, checking why..." + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$LIBS $GIMP_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <libgimp/gimp.h> + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + NULL, /* query_proc */ + NULL /* run_proc */ +}; +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GIMP or finding the wrong" + echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GIMP is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GIMP_CFLAGS="" + GIMP_LIBS="" + GIMP_CFLAGS_NOUI="" + GIMP_LIBS_NOUI="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GIMP_CFLAGS) + AC_SUBST(GIMP_LIBS) + AC_SUBST(GIMP_CFLAGS_NOUI) + AC_SUBST(GIMP_LIBS_NOUI) + AC_SUBST(GIMP_DATA_DIR) + AC_SUBST(GIMP_PLUGIN_DIR) + rm -f conf.gimptest +]) + diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..6e51082 --- /dev/null +++ b/config.guess @@ -0,0 +1,1435 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2004-01-24' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +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 -q "$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 ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pegasos:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # 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 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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -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 + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + 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 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *: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 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|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 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 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) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..463186d --- /dev/null +++ b/config.sub @@ -0,0 +1,1537 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2004-01-05' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + 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 + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + 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 + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + 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 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-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*) + # 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* \ + | -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 + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -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 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..de16eb2 --- /dev/null +++ b/configure @@ -0,0 +1,10153 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 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 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+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="include/sane/config.h.in" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION SANE_MAJOR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE build build_cpu build_vendor build_os host host_cpu host_vendor host_os ALLOCA RANLIB ac_ct_RANLIB SANE_CONFIG SANE_LDFLAGS SANE_CFLAGS SANE_LIBS SANE_PREFIX PKG_CONFIG GTK_CFLAGS GTK_LIBS GTK_CONFIG GIMP_CONFIG GIMP_TOOL GIMP_CFLAGS GIMP_LIBS GIMP_CFLAGS_NOUI GIMP_LIBS_NOUI GIMP_DATA_DIR GIMP_PLUGIN_DIR INCLUDES BINPROGS V_MAJOR V_MINOR V_BUILD DLL_PRELOAD LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-guis do not compile graphical user interfaces (GUIs) + --disable-gtk2 do not use GTK2 + --disable-gimp do not include GIMP plugin mode + --enable-gimp12 include GIMP 1.2 plugin mode (this enables GIMP =< 1.2 plugin, defaults to GIMP 2.0) + --disable-sanetest Do not try to compile and run a test SANE program + --disable-gtktest do not try to compile and run a test GTK+ program + --disable-gtktest Do not try to compile and run a test GTK program + --disable-gimptest Do not try to compile and run a test GIMP program + --disable-gimptest do not try to compile and run a test GIMP program + +Used environment variables that can be set by user: + CFLAGS, CPPFLAGS, LDFLAGS, LIBS + +To add include or library paths call: + env CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-sane-prefix=PFX Prefix where SANE is installed (optional) + --with-sane-exec-prefix=PFX Exec prefix where SANE is installed (optional) + --with-gtk-prefix=PFX Prefix where GTK is installed (optional) + --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional) + --with-gimp-prefix=PFX Prefix where GIMP is installed (optional) + --with-gimp-exec-prefix=PFX Exec prefix where GIMP is installed (optional) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# 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_sep= +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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + ac_config_headers="$ac_config_headers include/sane/config.h" + +# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +# AC_ARG_PROGRAM + +# version code: +V_MAJOR=1 +V_MINOR=0 +V_BUILD=14 +V_EXTRA= + +PACKAGE=sane-frontends + +GUIPROGS="xscanimage xcam" +BINPROGS="scanadf" + +# languages +# ALL_LINGUAS="cs de fr sv it tr" + +SANE_V_MAJOR=1 +VERSION=${V_MAJOR}.${V_MINOR}.${V_BUILD}${V_EXTRA} +PACKAGE_VERSION="$PACKAGE-$VERSION" + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + + + + + +# Check whether --enable-guis or --disable-guis was given. +if test "${enable_guis+set}" = set; then + enableval="$enable_guis" + USE_GUI=$enableval +else + USE_GUI=yes +fi; + +# Check whether --enable-gtk2 or --disable-gtk2 was given. +if test "${enable_gtk2+set}" = set; then + enableval="$enable_gtk2" + USE_GTK2=$enableval +else + USE_GTK2=yes +fi; + +echo "$as_me:$LINENO: checking whether GIMP plugin is requested" >&5 +echo $ECHO_N "checking whether GIMP plugin is requested... $ECHO_C" >&6 +# Check whether --enable-gimp or --disable-gimp was given. +if test "${enable_gimp+set}" = set; then + enableval="$enable_gimp" + USE_GIMP=$enableval +else + USE_GIMP=yes +fi; +# Check whether --enable-gimp12 or --disable-gimp12 was given. +if test "${enable_gimp12+set}" = set; then + enableval="$enable_gimp12" + USE_GIMP12=$enableval +else + USE_GIMP12="no" +fi; +if test "${USE_GIMP12}" = "yes"; then + echo "$as_me:$LINENO: result: yes, GIMP 1.2" >&5 +echo "${ECHO_T}yes, GIMP 1.2" >&6 + USE_GIMP="no" + USE_GTK2="no" +else + echo "$as_me:$LINENO: result: $USE_GIMP, GIMP 2.0" >&5 +echo "${ECHO_T}$USE_GIMP, GIMP 2.0" >&6 +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.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. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* 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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + +echo "$as_me:$LINENO: checking for AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef _AIX + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest* + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo "$as_me:$LINENO: checking for minix/config.h" >&5 +echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking minix/config.h usability" >&5 +echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <minix/config.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking minix/config.h presence" >&5 +echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <minix/config.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for minix/config.h" >&5 +echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_minix_config_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 + +fi +if test $ac_cv_header_minix_config_h = yes; then + MINIX=yes +else + MINIX= +fi + + +if test "$MINIX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_1_SOURCE 2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _MINIX 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + +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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* 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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/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_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sgtty.h> +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <termio.h> +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +INCLUDES="${INCLUDES} -I/usr/local/include" +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" +if test "${ac_cv_c_compiler_gnu}" = "yes"; then + CFLAGS="${CFLAGS} -Wall" +fi + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +case "$host_os" in + aix*) #enable .so libraries, disable archives + LDFLAGS="$LDFLAGS -Wl,-brtl" + ;; +esac + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + + + +for ac_header in os2.h fcntl.h unistd.h libc.h sys/time.h sys/types.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <signal.h> +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_pid_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 +if test "${ac_cv_type_ssize_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((ssize_t *) 0) + return 0; +if (sizeof (ssize_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_ssize_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 +if test $ac_cv_type_ssize_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_char" >&5 +echo $ECHO_N "checking for u_char... $ECHO_C" >&6 +if test "${ac_cv_type_u_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_char *) 0) + return 0; +if (sizeof (u_char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_char=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_char" >&5 +echo "${ECHO_T}$ac_cv_type_u_char" >&6 +if test $ac_cv_type_u_char = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_char unsigned char +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int" >&5 +echo $ECHO_N "checking for u_int... $ECHO_C" >&6 +if test "${ac_cv_type_u_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_int *) 0) + return 0; +if (sizeof (u_int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int" >&5 +echo "${ECHO_T}$ac_cv_type_u_int" >&6 +if test $ac_cv_type_u_int = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int unsigned int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_long" >&5 +echo $ECHO_N "checking for u_long... $ECHO_C" >&6 +if test "${ac_cv_type_u_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_long *) 0) + return 0; +if (sizeof (u_long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_long" >&5 +echo "${ECHO_T}$ac_cv_type_u_long" >&6 +if test $ac_cv_type_u_long = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_long unsigned long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int8_t" >&5 +echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int8_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_int8_t *) 0) + return 0; +if (sizeof (u_int8_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int8_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6 +if test $ac_cv_type_u_int8_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int8_t unsigned char +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int16_t" >&5 +echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int16_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_int16_t *) 0) + return 0; +if (sizeof (u_int16_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int16_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6 +if test $ac_cv_type_u_int16_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int16_t unsigned short +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((u_int32_t *) 0) + return 0; +if (sizeof (u_int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 +if test $ac_cv_type_u_int32_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int32_t unsigned int +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking for sqrt in -lm" >&5 +echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_sqrt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sqrt (); +int +main () +{ +sqrt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_sqrt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_sqrt=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5 +echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6 +if test $ac_cv_lib_m_sqrt = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + + +if test "`uname`" != "IRIX" -a "`uname`" != "IRIX64"; then + +echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +int +main () +{ +socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_socket=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_socket=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 +if test $ac_cv_lib_socket_socket = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF + + LIBS="-lsocket $LIBS" + +fi + + +echo "$as_me:$LINENO: checking for syslog in -lsyslog" >&5 +echo $ECHO_N "checking for syslog in -lsyslog... $ECHO_C" >&6 +if test "${ac_cv_lib_syslog_syslog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsyslog $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char syslog (); +int +main () +{ +syslog (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_syslog_syslog=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_syslog_syslog=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_syslog_syslog" >&5 +echo "${ECHO_T}$ac_cv_lib_syslog_syslog" >&6 +if test $ac_cv_lib_syslog_syslog = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSYSLOG 1 +_ACEOF + + LIBS="-lsyslog $LIBS" + +fi + # OS/2 needs this +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <alloca.h> +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_working_alloca_h=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA_H 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_alloca_works=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA 1 +_ACEOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=alloca.$ac_objext + +cat >>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <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 $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + exit (find_stack_direction () < 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_stack_direction=-1 +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 + +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + + + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <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 $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include <fcntl.h> +#include <sys/mman.h> + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP 1 +_ACEOF + +fi +rm -f conftest.mmap + + + + + + + + + + + + + + + + + +for ac_func in atexit mkdir sigprocmask strdup strndup strftime strstr \ + strsep strtod snprintf usleep strcasecmp strncasecmp getenv isfdtype vsyslog +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <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 $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +if test "$ac_cv_header_os2_h" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define strncasecmp strnicmp +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define strcasecmp stricmp +_ACEOF + +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + +# Check whether --with-sane-prefix or --without-sane-prefix was given. +if test "${with_sane_prefix+set}" = set; then + withval="$with_sane_prefix" + sane_config_prefix="$withval" +else + sane_config_prefix="" +fi; + +# Check whether --with-sane-exec-prefix or --without-sane-exec-prefix was given. +if test "${with_sane_exec_prefix+set}" = set; then + withval="$with_sane_exec_prefix" + sane_config_exec_prefix="$withval" +else + sane_config_exec_prefix="" +fi; +# Check whether --enable-sanetest or --disable-sanetest was given. +if test "${enable_sanetest+set}" = set; then + enableval="$enable_sanetest" + +else + enable_sanetest=yes +fi; + + if test x$sane_config_exec_prefix != x ; then + sane_config_args="$sane_config_args --exec-prefix=$sane_config_exec_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_exec_prefix/bin/sane-config + fi + fi + if test x$sane_config_prefix != x ; then + sane_config_args="$sane_config_args --prefix=$sane_config_prefix" + if test x${SANE_CONFIG+set} != xset ; then + SANE_CONFIG=$sane_config_prefix/bin/sane-config + fi + fi + + # Extract the first word of "sane-config", so it can be a program name with args. +set dummy sane-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_SANE_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SANE_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SANE_CONFIG="$SANE_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SANE_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_SANE_CONFIG" && ac_cv_path_SANE_CONFIG="no" + ;; +esac +fi +SANE_CONFIG=$ac_cv_path_SANE_CONFIG + +if test -n "$SANE_CONFIG"; then + echo "$as_me:$LINENO: result: $SANE_CONFIG" >&5 +echo "${ECHO_T}$SANE_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_sane_version=1.0.0 + echo "$as_me:$LINENO: checking for SANE - version >= $min_sane_version" >&5 +echo $ECHO_N "checking for SANE - version >= $min_sane_version... $ECHO_C" >&6 + no_sane="" + if test "$SANE_CONFIG" = "no" ; then + no_sane=yes + else + SANE_CFLAGS=`$SANE_CONFIG $sane_config_args --cflags` + SANE_LDFLAGS=`$SANE_CONFIG $sane_config_args --ldflags` +# SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs` + SANE_LIBS=`$SANE_CONFIG $sane_config_args --libs | sed -e 's/-lintl//g'` + SANE_PREFIX=`$SANE_CONFIG $sane_config_args --prefix` + sane_config_major_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + sane_config_minor_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + sane_config_micro_version=`$SANE_CONFIG $sane_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_sanetest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SANE_CFLAGS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + LIBS="$LIBS $SANE_LIBS" + rm -f conf.sanetest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <sane/sane.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.sanetest"); + + if (sscanf("$min_sane_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sane_version"); + exit(1); + } + + if ( ($sane_config_major_version == major) && + ( ($sane_config_minor_version > minor) || + ( ($sane_config_minor_version == minor) && ($sane_config_micro_version >= micro)))) + { + return 0; + } + else if ($sane_config_major_version > major) + { + printf("\n*** A too new version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE with the major version number %d.\n", major); + } + else + { + printf("\n*** An old version of SANE (%d.%d.%d) was found.\n", + $sane_config_major_version, $sane_config_minor_version, $sane_config_micro_version); + printf("*** You need a version of SANE newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + } + + printf("*** SANE is always available from http://www.sane-project.org\n"); + printf("***\n"); + printf("*** If you have already installed a sufficient version, this error\n"); + printf("*** probably means that the wrong copy of the sane-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of SANE, but you can also set the SANE_CONFIG environment to point to the\n"); + printf("*** correct copy of sane-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_sane=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sane" = x ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + HAVE_SANE=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$SANE_CONFIG" = "no" ; then + echo "*** The sane-config script installed by SANE could not be found" + echo "*** If SANE was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SANE_CONFIG environment variable to the" + echo "*** full path to sane-config." + else + if test -f conf.sanetest ; then + : + else + echo "*** Could not run SANE test program, checking why..." + CFLAGS="$CFLAGS $SANE_CFLAGS" + LIBS="$LIBS $SANE_LIBS" + LDFLAGS="$LDFLAGS $SANE_LDFLAGS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <sane/sane.h> +#include <stdio.h> + +int +main () +{ + return (SANE_CURRENT_MAJOR); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SANE or finding the wrong" + echo "*** version of SANE. If it is not finding SANE, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location. Also, make sure you have run ldconfig if that" + echo "*** is required on your system." + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SANE was incorrectly installed" + echo "*** or that you have moved SANE since it was installed. In the latter case, you" + echo "*** may want to edit the sane-config script: $SANE_CONFIG" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SANE_CFLAGS="" + SANE_LDFLAGS="" + SANE_LIBS="" + : + fi + + + + + rm -f conf.sanetest + +if test "x${HAVE_SANE}" = "x"; then + echo "**********************************************************************" + echo "ERROR: Couldn't find SANE libraries (sane-backends). Possible reasons:" + echo " - sane-backends isn't installed (install sane-backends before" + echo " sane-frontends)" + echo " - the SANE header files aren't installed (if you installed" + echo " SANE as RPM make sure you also included the sane-devel RPM)" + echo " - the SANE libraries can't be found because /usr/local/lib/ isn't" + echo " searched by the dynamic linker (see INSTALL for details)" + echo "**********************************************************************" + echo "" + exit +fi + +# check for GTK2 or GTK >= 0.99.13 +if test "${USE_GUI}" = "yes"; then + + if test "${USE_GTK2}" = "yes" || test "${USE_GIMP}" = "yes"; then + # Check whether --enable-gtktest or --disable-gtktest was given. +if test "${enable_gtktest+set}" = set; then + enableval="$enable_gtktest" + +else + enable_gtktest=yes +fi; + + pkg_config_args=gtk+-2.0 + for module in . + do + case "$module" in + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + no_gtk="" + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test x$PKG_CONFIG != xno ; then + if pkg-config --atleast-pkgconfig-version 0.7 ; then + : + else + echo "*** pkg-config too old; version 0.7 or better required." + no_gtk=yes + PKG_CONFIG=no + fi + else + no_gtk=yes + fi + + min_gtk_version=2.0.0 + echo "$as_me:$LINENO: checking for GTK+ - version >= $min_gtk_version" >&5 +echo $ECHO_N "checking for GTK+ - version >= $min_gtk_version... $ECHO_C" >&6 + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" + enable_gtktest=no + fi + + if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then + : + else + no_gtk=yes + fi + fi + + if test x"$no_gtk" = x ; then + GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` + GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` + gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" + rm -f conf.gtktest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <gtk/gtk.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_gtk=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + echo "$as_me:$LINENO: result: yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&5 +echo "${ECHO_T}yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6 + HAVE_GTK=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://pkgconfig.sourceforge.net" + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK+ test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK+ or finding the wrong" + echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK+ is incorrectly installed." +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + + if test "${USE_GIMP}" = "yes"; then + { echo "$as_me:$LINENO: WARNING: *** GIMP 2.0 plugin requested, but GTK+ 2.0 not found, falling back to GIMP/GTK+ < 2.0 if possible ***" >&5 +echo "$as_me: WARNING: *** GIMP 2.0 plugin requested, but GTK+ 2.0 not found, falling back to GIMP/GTK+ < 2.0 if possible ***" >&2;} + USE_GIMP=no + USE_GIMP12=yes + else + { echo "$as_me:$LINENO: WARNING: *** GTK+ 2.0 not found, falling back to GTK+ < 2.0 if possible ***" >&5 +echo "$as_me: WARNING: *** GTK+ 2.0 not found, falling back to GTK+ < 2.0 if possible ***" >&2;} + fi + fi + + + rm -f conf.gtktest + + fi + + # fallback to GTK < 2 if GTK2 isn't available + if test "${HAVE_GTK}" != "yes"; then + +# Check whether --with-gtk-prefix or --without-gtk-prefix was given. +if test "${with_gtk_prefix+set}" = set; then + withval="$with_gtk_prefix" + gtk_config_prefix="$withval" +else + gtk_config_prefix="" +fi; + +# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. +if test "${with_gtk_exec_prefix+set}" = set; then + withval="$with_gtk_exec_prefix" + gtk_config_exec_prefix="$withval" +else + gtk_config_exec_prefix="" +fi; +# Check whether --enable-gtktest or --disable-gtktest was given. +if test "${enable_gtktest+set}" = set; then + enableval="$enable_gtktest" + +else + enable_gtktest=yes +fi; + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + # Extract the first word of "gtk-config", so it can be a program name with args. +set dummy gtk-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GTK_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GTK_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTK_CONFIG="$GTK_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" + ;; +esac +fi +GTK_CONFIG=$ac_cv_path_GTK_CONFIG + +if test -n "$GTK_CONFIG"; then + echo "$as_me:$LINENO: result: $GTK_CONFIG" >&5 +echo "${ECHO_T}$GTK_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_gtk_version=0.99.13 + echo "$as_me:$LINENO: checking for GTK - version >= $min_gtk_version" >&5 +echo $ECHO_N "checking for GTK - version >= $min_gtk_version... $ECHO_C" >&6 + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + rm -f conf.gtktest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gtktest"); + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_gtk=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + HAVE_GTK=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + : + fi + + + rm -f conf.gtktest + + fi + + if test "${USE_GIMP12}" = "yes"; then + +# Check whether --with-gimp-prefix or --without-gimp-prefix was given. +if test "${with_gimp_prefix+set}" = set; then + withval="$with_gimp_prefix" + gimp_config_prefix="$withval" +else + gimp_config_prefix="" +fi; + +# Check whether --with-gimp-exec-prefix or --without-gimp-exec-prefix was given. +if test "${with_gimp_exec_prefix+set}" = set; then + withval="$with_gimp_exec_prefix" + gimp_config_exec_prefix="$withval" +else + gimp_config_exec_prefix="" +fi; + # Check whether --enable-gimptest or --disable-gimptest was given. +if test "${enable_gimptest+set}" = set; then + enableval="$enable_gimptest" + +else + enable_gimptest=yes +fi; + + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + ac_save_GTK_CFLAGS="$GTK_CFLAGS" + ac_save_GTK_LIBS="$GTK_LIBS" + + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_exec_prefix/bin/gimp-config + fi + fi + + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_CONFIG+set} != xset ; then + GIMP_CONFIG=$gimp_config_prefix/bin/gimp-config + fi + fi + + # Extract the first word of "gimp-config", so it can be a program name with args. +set dummy gimp-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GIMP_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GIMP_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_GIMP_CONFIG="$GIMP_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GIMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GIMP_CONFIG" && ac_cv_path_GIMP_CONFIG="no" + ;; +esac +fi +GIMP_CONFIG=$ac_cv_path_GIMP_CONFIG + +if test -n "$GIMP_CONFIG"; then + echo "$as_me:$LINENO: result: $GIMP_CONFIG" >&5 +echo "${ECHO_T}$GIMP_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$GIMP_CONFIG" = "no" ; then + if test x$gimp_config_exec_prefix != x ; then + gimp_config_args="$gimp_config_args --exec-prefix=$gimp_config_exec_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_exec_prefix/bin/gimptool + fi + fi + if test x$gimp_config_prefix != x ; then + gimp_config_args="$gimp_config_args --prefix=$gimp_config_prefix" + if test x${GIMP_TOOL+set} != xset ; then + GIMP_TOOL=$gimp_config_prefix/bin/gimptool + fi + fi + # Extract the first word of "gimptool", so it can be a program name with args. +set dummy gimptool; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GIMP_TOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GIMP_TOOL in + [\\/]* | ?:[\\/]*) + ac_cv_path_GIMP_TOOL="$GIMP_TOOL" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GIMP_TOOL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GIMP_TOOL" && ac_cv_path_GIMP_TOOL="no" + ;; +esac +fi +GIMP_TOOL=$ac_cv_path_GIMP_TOOL + +if test -n "$GIMP_TOOL"; then + echo "$as_me:$LINENO: result: $GIMP_TOOL" >&5 +echo "${ECHO_T}$GIMP_TOOL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + GIMP_CONFIG=$GIMP_TOOL + fi + + min_gimp_version=1.0.0 + no_gimp="" + + if test "$GIMP_CONFIG" = "no" ; then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" + +for ac_header in libgimp/gimp.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + GIMP_LIBS="-lgimp" +else + no_gimp=yes +fi + +done + + +for ac_header in libgimp/gimpfeatures.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CPPFLAGS="$ac_save_CPPFLAGS" + CFLAGS="${CFLAGS} ${GTK_CFLAGS}" + LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + if test "x$no_gimp" = x ; then + echo "$as_me:$LINENO: checking GIMP compilation" >&5 +echo $ECHO_N "checking GIMP compilation... $ECHO_C" >&6 + gimp_config_major_version=-1 + gimp_config_minor_version=0 + gimp_config_micro_version=0 + fi + else +# GTK_CFLAGS="" +# GTK_LIBS="" + GIMP_CFLAGS=`$GIMP_CONFIG $gimp_config_args --cflags` + GIMP_LIBS=`$GIMP_CONFIG $gimp_config_args --libs`" -lgimp" + gimp_config_major_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gimp_config_minor_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gimp_config_micro_version=`$GIMP_CONFIG $gimp_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + CFLAGS="${CFLAGS} ${GIMP_CFLAGS}" + LIBS="${LIBS} ${GIMP_LIBS}" + echo "$as_me:$LINENO: checking for GIMP - version >= $min_gimp_version" >&5 +echo $ECHO_N "checking for GIMP - version >= $min_gimp_version... $ECHO_C" >&6 + fi + + if test "x$no_gimp" = x ; then + if test "x$enable_gimptest" = "xyes" ; then + rm -f conf.gimptest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <libgimp/gimp.h> +#include <stdio.h> + +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, NULL, NULL, NULL +}; + + +int +main () +{ + int major, minor, micro; + + system ("touch conf.gimptest"); + + if (sscanf("$min_gimp_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gimp_version"); + exit(1); + } + + if ( ($gimp_config_major_version != -1) && + ((gimp_major_version != $gimp_config_major_version) || + (gimp_minor_version != $gimp_config_minor_version) || + (gimp_micro_version != $gimp_config_micro_version)) ) + { + printf("\n*** 'gimp-config --version' returned %d.%d.%d, but GIMP (%d.%d.%d)\n", + $gimp_config_major_version, $gimp_config_minor_version, $gimp_config_micro_version, + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf ("*** was found! If gimp-config was correct, then it is best\n"); + printf ("*** to remove the old version of GIMP. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gimp-config was wrong, set the environment variable GIMP_CONFIG\n"); + printf("*** to point to the correct copy of gimp-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else + { + if ((gimp_major_version > major) || + ((gimp_major_version == major) && (gimp_minor_version > minor)) || + ((gimp_major_version == major) && (gimp_minor_version == minor) && (gimp_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GIMP (%d.%d.%d) was found.\n", + gimp_major_version, gimp_minor_version, gimp_micro_version); + printf("*** You need a version of GIMP newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GIMP is always available from ftp://ftp.gimp.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gimp-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GIMP, but you can also set the GIMP_CONFIG environment to point to the\n"); + printf("*** correct copy of gimp-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_gimp=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + fi + + if test "x$no_gimp" = x ; then + if test "x$enable_gimptest" = "xyes" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: not tested" >&5 +echo "${ECHO_T}not tested" >&6 + fi + if test "$GIMP_CONFIG" != "no" ; then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} ${GIMP_CFLAGS}" + +for ac_header in libgimp/gimp.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in libgimp/gimpfeatures.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CPPFLAGS="$ac_save_CPPFLAGS" + fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + HAVE_GIMP=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test -f conf.gimptest ; then + : + else + echo "*** Could not run GIMP test program, checking why..." + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$LIBS $GIMP_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <libgimp/gimp.h> +#include <stdio.h> +#define GIMP_TEST_CHECK_VERSION(major, minor, micro) \ + ($gimp_config_major_version > (major) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version > (minor)) || \ + ($gimp_config_major_version == (major) && $gimp_config_minor_version == (minor) && \ + $gimp_config_micro_version >= (micro))) + +#if !GIMP_TEST_CHECK_VERSION(1,1,25) +# define GimpPlugInInfo GPlugInInfo /* do test with gimp interface version 1.0 */ +#endif +GimpPlugInInfo PLUG_IN_INFO = { NULL, NULL, NULL, NULL }; + +int +main () +{ + return ((gimp_major_version) || (gimp_minor_version) || (gimp_micro_version)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GIMP or finding the wrong" + echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "***" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + GIMP_CFLAGS="" + GIMP_LIBS="" +# GTK_CFLAGS="$ac_save_GTK_CFLAGS" +# GTK_LIBS="$ac_save_GTK_LIBS" +# CFLAGS="${CFLAGS} ${GTK_CFLAGS}" +# LIBS="${LIBS} ${GTK_LIBS} ${GIMP_LIBS}" + : + fi + + + rm -f conf.gimptest + + if test "${HAVE_GIMP}" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_GIMP_1_2 1 +_ACEOF + + fi + fi + + if test "${USE_GIMP}" = "yes"; then + +# Check whether --enable-gimptest or --disable-gimptest was given. +if test "${enable_gimptest+set}" = set; then + enableval="$enable_gimptest" + +else + enable_gimptest=yes +fi; + + pkg_name=gimp-2.0 + pkg_config_args="$pkg_name gimpui-2.0" + + no_gimp="" + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test x$PKG_CONFIG != xno ; then + if pkg-config --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_gimp=yes + PKG_CONFIG=no + fi + else + no_gimp=yes + fi + + min_gimp_version=1.3.23 + echo "$as_me:$LINENO: checking for GIMP - version >= $min_gimp_version" >&5 +echo $ECHO_N "checking for GIMP - version >= $min_gimp_version... $ECHO_C" >&6 + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GIMP found in PKG_CONFIG_PATH" + enable_gimptest=no + fi + + if $PKG_CONFIG --atleast-version $min_gimp_version $pkg_config_args; then + : + else + no_gimp=yes + fi + fi + + if test x"$no_gimp" = x ; then + GIMP_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` + GIMP_LIBS=`$PKG_CONFIG $pkg_config_args --libs` + GIMP_CFLAGS_NOUI=`$PKG_CONFIG $pkg_name --cflags` + GIMP_LIBS_NOUI=`$PKG_CONFIG $pkg_name --libs` + GIMP_DATA_DIR=`$PKG_CONFIG $pkg_name --variable=gimpdatadir` + GIMP_PLUGIN_DIR=`$PKG_CONFIG $pkg_name --variable=gimplibdir` + + gimp_pkg_major_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gimp_pkg_minor_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gimp_pkg_micro_version=`$PKG_CONFIG --modversion $pkg_name | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_gimptest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$GIMP_LIBS $LIBS" + + rm -f conf.gimptest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <stdio.h> +#include <stdlib.h> + +#include <libgimp/gimp.h> + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + NULL, /* query_proc */ + NULL /* run_proc */ +}; + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gimptest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gimp_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gimp_version"); + exit(1); + } + + if (($gimp_pkg_major_version > major) || + (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version > minor)) || + (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version == minor) && ($gimp_pkg_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'pkg-config --modversion %s' returned %d.%d.%d, but the minimum version\n", "$pkg_name", $gimp_pkg_major_version, $gimp_pkg_minor_version, $gimp_pkg_micro_version); + printf("*** of GIMP required is %d.%d.%d. If pkg-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct the correct configuration files\n"); + return 1; + } +} + + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_gimp=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gimp" = x ; then + echo "$as_me:$LINENO: result: yes (version $gimp_pkg_major_version.$gimp_pkg_minor_version.$gimp_pkg_micro_version)" >&5 +echo "${ECHO_T}yes (version $gimp_pkg_major_version.$gimp_pkg_minor_version.$gimp_pkg_micro_version)" >&6 + HAVE_GIMP=yes + else + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.gimptest ; then + : + else + echo "*** Could not run GIMP test program, checking why..." + CFLAGS="$CFLAGS $GIMP_CFLAGS" + LIBS="$LIBS $GIMP_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <stdio.h> +#include <libgimp/gimp.h> + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + NULL, /* query_proc */ + NULL /* run_proc */ +}; + +int +main () +{ + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GIMP or finding the wrong" + echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GIMP is incorrectly installed." +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GIMP_CFLAGS="" + GIMP_LIBS="" + GIMP_CFLAGS_NOUI="" + GIMP_LIBS_NOUI="" + : + fi + + + + + + + rm -f conf.gimptest + + if test "${HAVE_GIMP}" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBGIMP_GIMP_H 1 +_ACEOF + + fi + fi + + if test "x${HAVE_GTK}" = "x"; then + echo "****************************************************************" + echo "WARNING: GTK-0.99.13 or newer is needed for compiling the GUI" + echo " frontends. If you installed gtk as rpm make sure" + echo " you also installed gtk-devel." + echo " ===> GUIs will be deactivated" + echo "****************************************************************" + echo "" + echo "You may need to remove $cache_file before you run configure again." + echo "" + else + BINPROGS=${BINPROGS}" "${GUIPROGS} + fi +fi + + + + + +CPPFLAGS="${CPPFLAGS} \ + -DPATH_SANE_DATA_DIR=\$(sanedatadir) \ + -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DV_BUILD=${V_BUILD} -DSANE_V_MAJOR=${SANE_V_MAJOR}" + + + + + + + + +# Check whether --enable-foo1 or --disable-foo1 was given. +if test "${enable_foo1+set}" = set; then + enableval="$enable_foo1" + +fi; + +# Check whether --enable-foo2 or --disable-foo2 was given. +if test "${enable_foo2+set}" = set; then + enableval="$enable_foo2" + +fi; + + ac_config_files="$ac_config_files Makefile lib/Makefile src/Makefile sanei/Makefile doc/Makefile include/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, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet 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 + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +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 +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "sanei/Makefile" ) CONFIG_FILES="$CONFIG_FILES sanei/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/sane/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/sane/config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@SANE_MAJOR@,$SANE_MAJOR,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@SANE_CONFIG@,$SANE_CONFIG,;t t +s,@SANE_LDFLAGS@,$SANE_LDFLAGS,;t t +s,@SANE_CFLAGS@,$SANE_CFLAGS,;t t +s,@SANE_LIBS@,$SANE_LIBS,;t t +s,@SANE_PREFIX@,$SANE_PREFIX,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t +s,@GTK_LIBS@,$GTK_LIBS,;t t +s,@GTK_CONFIG@,$GTK_CONFIG,;t t +s,@GIMP_CONFIG@,$GIMP_CONFIG,;t t +s,@GIMP_TOOL@,$GIMP_TOOL,;t t +s,@GIMP_CFLAGS@,$GIMP_CFLAGS,;t t +s,@GIMP_LIBS@,$GIMP_LIBS,;t t +s,@GIMP_CFLAGS_NOUI@,$GIMP_CFLAGS_NOUI,;t t +s,@GIMP_LIBS_NOUI@,$GIMP_LIBS_NOUI,;t t +s,@GIMP_DATA_DIR@,$GIMP_DATA_DIR,;t t +s,@GIMP_PLUGIN_DIR@,$GIMP_PLUGIN_DIR,;t t +s,@INCLUDES@,$INCLUDES,;t t +s,@BINPROGS@,$BINPROGS,;t t +s,@V_MAJOR@,$V_MAJOR,;t t +s,@V_MINOR@,$V_MINOR,;t t +s,@V_BUILD@,$V_BUILD,;t t +s,@DLL_PRELOAD@,$DLL_PRELOAD,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + +echo "****************************************************************" +echo "* *" +echo "* SANE-FRONTENDS configure status: *" +echo "* -------------------------------- *" + +if test "x${HAVE_GTK}" != "x"; then + echo "* - GUIs activated (xcam + xscanimage) *" + if test "${GIMP_LIBS}set" != "set"; then + echo "* - GIMP plugin activated for xscanimage *" + else + echo "* - GIMP plugin deactivated for xscanimage *" + fi +else + if test "${USE_GUI}" = "yes"; then + echo "* * GTK not found: GUIs deactivated *" + else + echo "* - GUIs deactivated (xcam + xscanimage) *" + fi +fi + +echo "* *" +echo "****************************************************************" +echo "* *" +echo "* To compile SANE-FRONTENDS: *" +echo "* -------------------------- *" +echo "* make *" +echo "* make install *" +echo "* *" +echo "* ------------------------------------------------------------ *" +echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING SANE ... *" +echo "* ------------------------------------------------------------ *" +echo "* *" +echo "* If you experience any problems with sane-frontends please *" +echo "* write to the sane mailing list or contact: *" +echo "* Oliver Rauch <Oliver.Rauch@Rauch-domain.de> *" +echo "* *" +echo "****************************************************************" diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..ef43528 --- /dev/null +++ b/configure.in @@ -0,0 +1,241 @@ +dnl Process this file with autoconf to produce a configure script. -*-sh-*- +AC_INIT(include/sane/config.h.in) +AC_CONFIG_HEADER(include/sane/config.h) +# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +# AC_ARG_PROGRAM + +# version code: +V_MAJOR=1 +V_MINOR=0 +V_BUILD=14 +V_EXTRA= + +PACKAGE=sane-frontends + +GUIPROGS="xscanimage xcam" +BINPROGS="scanadf" + +# languages +# ALL_LINGUAS="cs de fr sv it tr" + +SANE_V_MAJOR=1 +VERSION=${V_MAJOR}.${V_MINOR}.${V_BUILD}${V_EXTRA} +PACKAGE_VERSION="$PACKAGE-$VERSION" +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of the distribution.]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define to the version of the distribution.]) +AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION", [Define to the name and the version of the distribution.]) +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(PACKAGE_VERSION) +AC_SUBST(SANE_MAJOR) + +dnl Check if GUIs shall be compiled +AC_ARG_ENABLE(guis, [ --disable-guis do not compile graphical user interfaces (GUIs)], USE_GUI=$enableval, USE_GUI=yes) + +dnl Check if GTK2 support is wanted +AC_ARG_ENABLE(gtk2, [ --disable-gtk2 do not use GTK2], USE_GTK2=$enableval, USE_GTK2=yes) + +dnl Check for gimp plugin support +AC_MSG_CHECKING([whether GIMP plugin is requested]) +dnl Default is enabled GIMP plugin +AC_ARG_ENABLE(gimp, [ --disable-gimp do not include GIMP plugin mode], USE_GIMP=$enableval, USE_GIMP=yes) +AC_ARG_ENABLE(gimp12, [ --enable-gimp12 include GIMP 1.2 plugin mode (this enables GIMP =< 1.2 plugin, defaults to GIMP 2.0)], USE_GIMP12=$enableval, USE_GIMP12="no") +if test "${USE_GIMP12}" = "yes"; then + AC_MSG_RESULT([yes, GIMP 1.2]) + USE_GIMP="no" + USE_GTK2="no" +else + AC_MSG_RESULT([$USE_GIMP, GIMP 2.0]) +fi + +dnl Checks for programs. +AC_PROG_CC +AC_AIX +AC_MINIX +AC_ISC_POSIX +AM_PROG_CC_STDC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL + +INCLUDES="${INCLUDES} -I/usr/local/include" +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" +if test "${ac_cv_prog_gcc}" = "yes"; then + CFLAGS="${CFLAGS} -Wall" +fi + +AC_CANONICAL_HOST +dnl special LDFLAGS +case "$host_os" in + aix*) #enable .so libraries, disable archives + LDFLAGS="$LDFLAGS -Wl,-brtl" + ;; +esac + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(os2.h fcntl.h unistd.h libc.h sys/time.h sys/types.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T +AC_TYPE_PID_T +AC_CHECK_TYPE(ssize_t, long) +AC_CHECK_TYPE(u_char, unsigned char) +AC_CHECK_TYPE(u_int, unsigned int) +AC_CHECK_TYPE(u_long, unsigned long) +AC_CHECK_TYPE(u_int8_t, unsigned char) +AC_CHECK_TYPE(u_int16_t, unsigned short) +AC_CHECK_TYPE(u_int32_t, unsigned int) + +dnl Checks for libraries. +AC_CHECK_LIB(m, sqrt) + +if test "`uname`" != "IRIX" -a "`uname`" != "IRIX64"; then + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(syslog, syslog) # OS/2 needs this +fi + +dnl Checks for library functions. +AC_FUNC_ALLOCA +AC_FUNC_MMAP +AC_CHECK_FUNCS(atexit mkdir sigprocmask strdup strndup strftime strstr \ + strsep strtod snprintf usleep strcasecmp strncasecmp getenv isfdtype vsyslog) + +if test "$ac_cv_header_os2_h" = "yes" ; then + AC_DEFINE(strncasecmp, strnicmp, [Define for OS/2 only]) + AC_DEFINE(strcasecmp, stricmp, [Define for OS/2 only]) +fi + +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AM_PATH_SANE(1.0.0, HAVE_SANE=yes, ) +dnl Print error message if sane is missing +if test "x${HAVE_SANE}" = "x"; then + echo "**********************************************************************" + echo "ERROR: Couldn't find SANE libraries (sane-backends). Possible reasons:" + echo " - sane-backends isn't installed (install sane-backends before" + echo " sane-frontends)" + echo " - the SANE header files aren't installed (if you installed" + echo " SANE as RPM make sure you also included the sane-devel RPM)" + echo " - the SANE libraries can't be found because /usr/local/lib/ isn't" + echo " searched by the dynamic linker (see INSTALL for details)" + echo "**********************************************************************" + echo "" + exit +fi + +# check for GTK2 or GTK >= 0.99.13 +if test "${USE_GUI}" = "yes"; then + + if test "${USE_GTK2}" = "yes" || test "${USE_GIMP}" = "yes"; then + AM_PATH_GTK_2_0(2.0.0, HAVE_GTK=yes, [ + if test "${USE_GIMP}" = "yes"; then + AC_MSG_WARN([*** GIMP 2.0 plugin requested, but GTK+ 2.0 not found, falling back to GIMP/GTK+ < 2.0 if possible ***]) + USE_GIMP=no + USE_GIMP12=yes + else + AC_MSG_WARN([*** GTK+ 2.0 not found, falling back to GTK+ < 2.0 if possible ***]) + fi]) + fi + + # fallback to GTK < 2 if GTK2 isn't available + if test "${HAVE_GTK}" != "yes"; then + AM_PATH_GTK(0.99.13, HAVE_GTK=yes, ) + fi + + if test "${USE_GIMP12}" = "yes"; then + AM_PATH_GIMP(1.0.0, HAVE_GIMP=yes) + if test "${HAVE_GIMP}" = "yes"; then + AC_DEFINE([ENABLE_GIMP_1_2], 1, [Define to 1 if GIMP 1.2 support wanted]) + fi + fi + + if test "${USE_GIMP}" = "yes"; then + AM_PATH_GIMP_2_0(1.3.23, HAVE_GIMP=yes) + if test "${HAVE_GIMP}" = "yes"; then + AC_DEFINE([HAVE_LIBGIMP_GIMP_H], 1, [Define to 1 if you have the <libgimp/gimp.h> header file.]) + fi + fi + + if test "x${HAVE_GTK}" = "x"; then + echo "****************************************************************" + echo "WARNING: GTK-0.99.13 or newer is needed for compiling the GUI" + echo " frontends. If you installed gtk as rpm make sure" + echo " you also installed gtk-devel." + echo " ===> GUIs will be deactivated" + echo "****************************************************************" + echo "" + echo "You may need to remove $cache_file before you run configure again." + echo "" + else + BINPROGS=${BINPROGS}" "${GUIPROGS} + fi +fi + +AC_SUBST(INCLUDES) +AC_SUBST(BINPROGS) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) +CPPFLAGS="${CPPFLAGS} \ + -DPATH_SANE_DATA_DIR=\$(sanedatadir) \ + -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DV_BUILD=${V_BUILD} -DSANE_V_MAJOR=${SANE_V_MAJOR}" + + + +AC_SUBST(V_MAJOR) +AC_SUBST(V_MINOR) +AC_SUBST(V_BUILD) +AC_SUBST(DLL_PRELOAD) + +AC_ARG_ENABLE(foo1, [ +Used environment variables that can be set by user: + CFLAGS, CPPFLAGS, LDFLAGS, LIBS]) + +AC_ARG_ENABLE(foo2, [ +To add include or library paths call: + [env] CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure]) + +AC_OUTPUT([Makefile lib/Makefile src/Makefile sanei/Makefile doc/Makefile + include/Makefile],) + +echo "****************************************************************" +echo "* *" +echo "* SANE-FRONTENDS configure status: *" +echo "* -------------------------------- *" + +if test "x${HAVE_GTK}" != "x"; then + echo "* - GUIs activated (xcam + xscanimage) *" + if test "${GIMP_LIBS}set" != "set"; then + echo "* - GIMP plugin activated for xscanimage *" + else + echo "* - GIMP plugin deactivated for xscanimage *" + fi +else + if test "${USE_GUI}" = "yes"; then + echo "* * GTK not found: GUIs deactivated *" + else + echo "* - GUIs deactivated (xcam + xscanimage) *" + fi +fi + +echo "* *" +echo "****************************************************************" +echo "* *" +echo "* To compile SANE-FRONTENDS: *" +echo "* -------------------------- *" +echo "* make *" +echo "* make install *" +echo "* *" +echo "* ------------------------------------------------------------ *" +echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING SANE ... *" +echo "* ------------------------------------------------------------ *" +echo "* *" +echo "* If you experience any problems with sane-frontends please *" +echo "* write to the sane mailing list or contact: *" +echo "* Oliver Rauch <Oliver.Rauch@Rauch-domain.de> *" +echo "* *" +echo "****************************************************************" diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8e5d929 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,540 @@ +sane-frontends (1.0.14-9) unstable; urgency=low + + * debian/control: + + Bump Standards-Version to 3.8.3 (no changes). + + * debian/patches/06_word_list_fix.dpatch: + + Added; fix word list handling when the current value is not part of the + list (closes: #556166). + + -- Julien BLACHE <jblache@debian.org> Sat, 14 Nov 2009 10:46:58 +0100 + +sane-frontends (1.0.14-8) unstable; urgency=low + + * debian/control: + + Bump Standards-Version to 3.8.2 (no changes). + + * debian/patches/04_cap_always_settable.dpatch: + + Added; remove check for SANE_CAP_ALWAYS_SETTABLE which has been removed + upstream in SANE 1.0.20 (and was never used, not part of the standard). + * debian/patches/05_xcam_off_by_one.dpatch: + + Added; fix an off-by-one in xcam. + + -- Julien BLACHE <jblache@debian.org> Fri, 26 Jun 2009 13:51:25 +0200 + +sane-frontends (1.0.14-7) unstable; urgency=low + + * debian/control: + + Bump Standards-Version to 3.8.0 (no changes). + * debian/patches/03_scanadf_options_fix.dpatch: + + Added; get option descriptor 0 before getting the value for option 0. + This is a standard-compliance fix needed for proper operation with the + net backend. + + -- Julien BLACHE <jblache@debian.org> Tue, 05 Aug 2008 12:01:06 +0200 + +sane-frontends (1.0.14-6) unstable; urgency=low + + * debian/patches/02_xcam_man_typo.dpatch: + + Updated; more typo fixes (closes: #466593). + * debian/control: + + Bump Standards-Version to 3.7.3 (no changes). + + -- Julien BLACHE <jblache@debian.org> Sat, 01 Mar 2008 15:35:24 +0100 + +sane-frontends (1.0.14-5) unstable; urgency=low + + * debian/patches/02_xcam_man_typo.dpatch: + + Added; Fix typo in xcam(1) (closes: #445715). + + -- Julien BLACHE <jblache@debian.org> Sun, 14 Oct 2007 11:49:00 +0200 + +sane-frontends (1.0.14-4) unstable; urgency=low + + * debian/sane.menu: + + Update for the new menu structure. + + -- Julien BLACHE <jblache@debian.org> Sun, 05 Aug 2007 18:13:01 +0200 + +sane-frontends (1.0.14-3) unstable; urgency=low + + * debian/control: + + Remove Conflicts/Replaces on the old sane-gimp1.{2,3} packages. + * debian/rules: + + Do not ignore make distclean errors. + + -- Julien BLACHE <jblache@debian.org> Thu, 02 Aug 2007 18:01:02 +0200 + +sane-frontends (1.0.14-2) unstable; urgency=low + + * debian/control: + + Bumped Standards-Version to 3.7.2 (no changes). + + Remove Uploaders. + + Thank you Aurélien JARNO for your help during these years. + + -- Julien BLACHE <jblache@debian.org> Sun, 15 Oct 2006 17:22:54 +0200 + +sane-frontends (1.0.14-1) unstable; urgency=low + + * New upstream release. + + Bugfixes and improvements for xcam and scanadf. + * debian/control: + + Bumped Standards-Version to 3.6.2 (no changes). + * debian/copyright: + + Update ftp URL. + + Update FSF address. + * debian/patches/01_sanei_update.dpatch: + + Removed. + * debian/patches/01_xcam.c_dead_code.dpatch: + + Added; kills dead code in xcam.c::load_defaults(). + + -- Julien BLACHE <jblache@debian.org> Tue, 20 Sep 2005 19:32:05 +0200 + +sane-frontends (1.0.13-2) unstable; urgency=medium + + * debian/patches/01_sanei_update.dpatch: + + Added; update sanei from sane-backends 1.0.15 to fix a deadlock when + scanning over the network (both saned and xscanimage attempt to read at + the same time) (closes: #284320). + + -- Julien BLACHE <jblache@debian.org> Thu, 9 Dec 2004 15:38:41 +0100 + +sane-frontends (1.0.13-1) unstable; urgency=low + + * New upstream release. + * debian/patches: + + All patches removed, merged upstream. + * debian/control: + + Removed unneeded build-dependency on xlibs-dev. + * debian/menu, debian/rules: + + Added icon for xscanimage/xcam (closes: #244489). + + -- Julien BLACHE <jblache@debian.org> Sun, 17 Oct 2004 19:15:09 +0200 + +sane-frontends (1.0.12-2) unstable; urgency=low + + * debian/control: + + added build-depends on dpatch. + * debian/rules: + + support dpatch. + * debian/patches/10_preview_resize.dpatch: + + added, fixes the selection when the preview window has been + resized (closes: #242003). + * debian/patches/11_xcam_layout.dpatch: + + added, fixes the xcam window layout when resized. + * debian/patches/12_gsgdialog_type_fix.dpatch: + + added, type mismatch in the GSGDialog type definition. + + -- Julien BLACHE <jblache@debian.org> Thu, 29 Apr 2004 21:23:36 +0200 + +sane-frontends (1.0.12-1) unstable; urgency=low + + * New upstream release. + * debian/copyright: s/Copyright/License/ (closes: #242000). + + -- Julien BLACHE <jblache@debian.org> Sat, 17 Apr 2004 15:10:55 +0200 + +sane-frontends (1.0.11+cvs20040402-1) unstable; urgency=low + + * Pulled from CVS, for proper GIMP 2.0 support. + * Built with GIMP 2.0 support (closes: #183698). + * Build-Depends on GIMP 2.0 and GTK+ 2.0. + + -- Julien BLACHE <jblache@debian.org> Fri, 2 Apr 2004 10:44:38 +0200 + +sane-frontends (1.0.11-3) unstable; urgency=low + + * gimp1.2 has been renamed to gimp, reflect this change in the control file. + * Bumped Standards-Version to 3.6.1 (no changes). + * debian/compat: use DH_COMPAT=4. + + -- Julien BLACHE <jblache@debian.org> Sun, 14 Sep 2003 15:43:59 +0200 + +sane-frontends (1.0.11-2) unstable; urgency=medium + + * Rebuild against libsane (>= 1.0.11-3) to get rid of the libgphoto2-2 + dependency. + + -- Julien BLACHE <jblache@debian.org> Sun, 4 May 2003 14:28:53 +0200 + +sane-frontends (1.0.11-1) unstable; urgency=low + + * New upstream release. + * All patches from 1.0.10-1 were applied upstream. + * Killed sane-gimp1.2 for good, now Conflicts: sane-gimp1.2. + * Bumped Standards-Version to 3.5.9 (no changes). + + -- Julien BLACHE <jblache@debian.org> Sat, 26 Apr 2003 18:12:03 +0200 + +sane-frontends (1.0.10-1) unstable; urgency=low + + * New upstream release. + * Pulled xscanimage.c from CVS + * In GIMP, scanners are now available from File/Acquire/xscanimage/* + (closes: #176430). + * In GIMP, the resolution of the resulting image is set according to the + scanner's settings (closes: #176428). + * Build sane with GIMP 1.2 support, which means sane-gimp1.2 is now a dummy + package for a smooth upgrade (closes: #176754). + * Bumped Standards-Version to 3.5.8. + + -- Julien BLACHE <jblache@debian.org> Sun, 2 Feb 2003 18:31:11 +0100 + +sane-frontends (1.0.9-4) unstable; urgency=low + + * Various patches to xscanimage + * Pack the options in a scrolled window (closes: #174132). + * Use radio menu items for the length unit (#174132 too). + * It is now impossible to hit the "Browse" button twice (closes: #174137). + + -- Julien BLACHE <jblache@debian.org> Tue, 24 Dec 2002 15:29:07 +0100 + +sane-frontends (1.0.9-3) unstable; urgency=low + + * Rebuilt against new libgphoto2. + * Changed Uploaders: field so that Aurélien's uploads won't be tagged as + NMU again. + * Build-Depends updated. + + -- Julien BLACHE <jblache@debian.org> Sun, 1 Dec 2002 11:38:49 +0100 + +sane-frontends (1.0.9-2) unstable; urgency=low + + * Added a build rule to debian/rules to be Policy-compliant (closes: #167415). + * distclean may fail in clean-nogimp. + * Explain how the build takes place. + * Updated libusb build-depends. + * Improved description wrt scanadf. + + -- Julien BLACHE <jblache@debian.org> Sat, 2 Nov 2002 10:57:38 +0100 + +sane-frontends (1.0.9-1) unstable; urgency=low + + * New upstream release. + * Fixed packages descriptions (wrt #165138). + + -- Julien BLACHE <jblache@debian.org> Thu, 24 Oct 2002 19:34:51 +0200 + +sane-frontends (1.0.8-2) unstable; urgency=low + + * New maintainers. + * New upstream release (closes: #103109, #135264). + * xcam and find-scanner manpages added (closes: #39470). + * xscanimage now refers to sane-find-scanner (closes: 109428). + * Repackaged from scratch, using debhelper. + * Standards-Version bumped to 3.5.6. + * Build-Depends updated (closes: #115272, #95381). + * Copyright updated (closes: #146055). + * Build sane and sane-gimp1.2 flavours. + * Removed README.Debian, libsane's one is far more complete. + + -- Julien BLACHE <jblache@debian.org> Sat, 12 Oct 2002 11:31:23 +0200 + +sane-frontends (1.0.8-1) unstable; urgency=low + + * New upstream release. New frontend scanadf, focusing on scanners with + automatic document feeders. + + -- Kevin Dalley <kevind@rahul.net> Sun, 6 Oct 2002 18:14:23 -0700 + +sane-frontends (1.0.7-2.1) unstable; urgency=medium + + * Non-Maintainer Upload. + * Remove libc6-dev Build-Depends, as it's build-essential (closes: Bug#115272). + * Build-Depends on libusb-dev >= 0.1.5-2. + * Update config.{sub,guess} on build, avoiding problems on newer architectures. + Thus added Build-Depends on autotools-dev. + * Strip .note and .comment sections. + + -- Julien BLACHE <jblache@debian.org> Mon, 1 Apr 2002 13:12:51 +0200 + +sane-frontends (1.0.7-2) unstable; urgency=low + + * relink with libusb-0.1-4. + + -- Kevin Dalley <kevind@rahul.net> Fri, 15 Mar 2002 18:33:29 +0000 + +sane-frontends (1.0.7-1) unstable; urgency=low + + * new upstream release. + + -- Kevin Dalley <kevind@rahul.net> Thu, 14 Mar 2002 00:18:10 +0000 + +sane-frontends (1.0.6-1) unstable; urgency=low + + * new upstream release. + + -- Kevin Dalley <kevind@rahul.net> Mon, 28 Jan 2002 00:21:42 -0800 + +sane-frontends (1.0.5-3) unstable; urgency=low + + * rebuilt with new version of libgimp-1.2.2-2. (closes: #110065). + + -- Kevin Dalley <kevind@rahul.net> Tue, 2 Oct 2001 22:31:06 -0700 + +sane-frontends (1.0.5-1) unstable; urgency=low + + * new upstream release of sane. + + -- Kevin Dalley <kevind@rahul.net> Mon, 13 Aug 2001 01:13:12 -0700 + +sane-frontends (1.0.4-1) unstable; urgency=low + + * new upstream release of sane + * frontends are now separate from backends. + * improved description of package (closes: #81481) + + -- Kevin Dalley <kevind@rahul.net> Sun, 28 Jan 2001 11:25:28 -0800 + +sane (1.0.1-1999-10-21-12) frozen unstable; urgency=low + + * add libjpeg62-dev, tetex-bin, tetex-extra to Build-Depends (closes: + #61834, 61835). + + -- Kevin Dalley <kevind@rahul.net> Wed, 5 Apr 2000 10:37:38 -0700 + +sane (1.0.1-1999-10-21-11) frozen unstable; urgency=low + + * Add Build-Depends to control files for sane and sane-gimp1.1 (closes: + #60923). + + -- Kevin Dalley <kevind@rahul.net> Mon, 27 Mar 2000 03:16:55 -0800 + +sane (1.0.1-1999-10-21-10) frozen unstable; urgency=low + + * Improve description in control file (closes: #57032). + * link sane-gimp1.1 with libgimp1.1.17, which is the most recent + libgimp1.1 in frozen. + + -- Kevin Dalley <kevind@rahul.net> Mon, 28 Feb 2000 02:37:20 +0000 + +sane (1.0.1-1999-10-21-9) frozen unstable; urgency=low + + * link sane-gimp1.1 with libgimp1.1.15, which is the most recent + libgimp1.1 in frozen. + + -- Kevin Dalley <kevind@rahul.net> Sat, 22 Jan 2000 01:57:55 -0800 + +sane (1.0.1-1999-10-21-8) unstable; urgency=low + + * sane now conflicts with gimp1.1, which increases the chances of + getting the correct versions of gimp with each version of sane + (closes: #55070). Unfortunately, sane-gimp1.1 cannot conflict with + gimp, since gimp1.1 provides gimp. + + -- Kevin Dalley <kevind@rahul.net> Sun, 16 Jan 2000 11:41:52 -0800 + +sane (1.0.1-1999-10-21-7) unstable; urgency=low + + * link with libgimp1.1.14 (closes: #53982) + * remove conflict of libsane-gimp1.1 with itself (closes: #49709). + * Each version of sane and sane-gimp1.1 now depend upon the same release + of libsane (closes: #50927). + * shlibs dependencies is updated to ">= 1.0.1-1999-10-21-7" to reduce + chances of problem #50927. + + -- Kevin Dalley <kevind@rahul.net> Sun, 9 Jan 2000 13:22:57 -0800 + +sane (1.0.1-1999-10-21-6) unstable; urgency=low + + * add conflict between libsane and older version of sane, sane-gimp1.1 + due to moving documentation from sane to libsane (closes: #50735). + + -- Kevin Dalley <kevind@rahul.net> Sat, 20 Nov 1999 15:15:30 -0400 + +sane (1.0.1-1999-10-21-5) unstable; urgency=low + + * added link for /usr/lib/libsane-dll.so, again. + + -- Kevin Dalley <kevind@rahul.net> Fri, 19 Nov 1999 00:03:40 -0400 + +sane (1.0.1-1999-10-21-4) unstable; urgency=low + + * corrected problematic stripping of "libsane.la" (closes: #50099). + * move much of documentation from sane package to libsane and + libsane-dev package. + * move find-scanner to libsane + + -- Kevin Dalley <kevind@rahul.net> Wed, 17 Nov 1999 23:08:44 -0400 + +sane (1.0.1-1999-10-21-3) unstable; urgency=low + + * added link for /usr/lib/libsane-dll.so + + -- Kevin Dalley <kevind@rahul.net> Mon, 25 Oct 1999 01:24:30 -0700 + +sane (1.0.1-1999-10-21-2) unstable; urgency=low + + * corrected link of libsane.so.1 + + -- Kevin Dalley <kevind@rahul.net> Sun, 24 Oct 1999 14:43:14 -0700 + +sane (1.0.1-1999-10-21-1) unstable; urgency=low + + * cvs server version from 1999-10-21 + * many bugs fixed in various backends + + -- Kevin Dalley <kevind@rahul.net> Fri, 22 Oct 1999 22:06:52 -0700 + +sane (1.0.1-6) unstable; urgency=low + + * relink sane-gimp1.1 with libgimp1.1.10 + + -- Kevin Dalley <kevind@rahul.net> Thu, 14 Oct 1999 23:33:18 -0700 + +sane (1.0.1-5) unstable; urgency=low + + * relink sane-gimp1.1 with libgimp1.1.9 + * separate sane-gimp1.1 from sane + + -- Kevin Dalley <kevind@rahul.net> Sun, 10 Oct 1999 03:42:37 -0700 + +sane (1.0.1-4) unstable; urgency=low + + * added sane-gimp1.1 (used with gimp1.1) at the same time as sane for + gimp-1.0.x. + + -- Kevin Dalley <kevind@rahul.net> Wed, 30 Jun 1999 00:54:57 -0700 + +sane (1.0.1-3) unstable; urgency=low + + * try to fix problems with shared libraries. Install libsane-dll.so in + /usr/lib so that programs linked with libsane will run. (Needed to + fix xsane bug #37756). + + -- Kevin Dalley <kevind@rahul.net> Mon, 31 May 1999 22:15:16 -0700 + +sane (1.0.1-2) unstable; urgency=low + + * remove dependencies for libsane + + -- Kevin Dalley <kevind@rahul.net> Fri, 30 Apr 1999 23:08:50 -0700 + +sane (1.0.1-1) unstable; urgency=low + + * version 1.0.1 + * new backend for Sharp scanner + * update backends for Kodak DC25, HP, Microtek, Micro, Mustek, Nikon + Coolscan, snapscan, UMAX. + * fixes problem with HP scanner (closes #32516) + * includes backend for dc210 (closes #31377) + + -- Kevin Dalley <kevind@rahul.net> Tue, 27 Apr 1999 01:24:33 -0700 + +sane (1.00-2) unstable; urgency=low + + * removed examples directory. Moved examples/tools to tools directory. + + -- Kevin Dalley <kevind@rahul.net> Mon, 5 Apr 1999 02:04:53 -0700 + +sane (1.00-1) unstable; urgency=low + + * 1.00 is released + * artec is back in dll.conf + * many more scanner supported and more changes + + -- Kevin Dalley <kevind@rahul.net> Sat, 5 Dec 1998 01:00:30 -0800 + +sane (0.74-2) unstable; urgency=low + + * temporarily comment out artec in dll.conf, due to bad interaction with + Umax scanner. If artec is used as a scanner, uncomment artec from + dll.conf + * automatically generates conffiles, thanks for + Roman.Hodek@informatik.uni-erlangen.de (fixes bug #26545) + * fixes problem with creation of /usr/share/sane during build process + (bug #26314) + + -- Kevin Dalley <kevind@rahul.net> Sun, 20 Sep 1998 18:00:28 -0700 + +sane (0.74-1) unstable; urgency=low + + * first release of 0.74 + + -- Kevin Dalley <kevind@rahul.net> Sat, 22 Aug 1998 23:06:26 -0700 + +sane (0.72-1) frozen unstable; urgency=low + + * first official release which supports libgtk1-0.99.9 + + -- Kevin Dalley <kevind@rahul.net> Fri, 10 Apr 1998 02:29:52 -0700 + +sane (0.71-2) frozen unstable; urgency=low + + * fixed spelling in control files (fixes bug# 19003) + * modified to match latest change in libgtk-0.99.5 + * change datadir to /usr/share/sane + * compatible with libgtk1-0.99.8 (fixes bug #19595) + + -- Kevin Dalley <kevind@rahul.net> Sun, 22 Mar 1998 19:44:10 -0800 + +sane (0.71-1) unstable; urgency=low + + * new release, which adds support for the following scanners: + Polaroid Digital Microscope Camera (DMC) backend + Apple scanner backend + Nikon CoolScan backend + * removed execute permission in doc directory (fixes: bug #17949) + * modified manual page referring to symbolic link of xscanimage (fixes: + bug #18071) + + -- Kevin Dalley <kevind@rahul.net> Fri, 27 Feb 1998 23:03:08 -0800 + +sane (0.70-1) unstable; urgency=low + + * update to version 0.70 of sane, adds AGFA SnapScan backend, updates + UMAX backend + + * add patches 2-5 to SnapScan backend which allows other scanners + to work + + -- Kevin Dalley <kevind@rahul.net> Sat, 31 Jan 1998 17:32:53 -0800 + +sane (0.69-2) unstable; urgency=low + + * correct umax-scanner.h so that Astra 1200S is legal + + -- Kevin Dalley <kevind@rahul.net> Sun, 25 Jan 1998 09:44:45 -0800 + +sane (0.69-1) unstable; urgency=low + + * update to version 0.69 of sane + + -- Kevin Dalley <kevind@rahul.net> Fri, 23 Jan 1998 20:24:01 -0800 + +sane (0.68-4) unstable; urgency=low + + * modified gtkglue.c to correspond with changes to libgtk1 + + -- Kevin Dalley <kevind@rahul.net> Tue, 6 Jan 1998 22:24:14 -0800 + +sane (0.68-3) unstable; urgency=low + + * change plug-in directory to 0.99 to match gimp changes, add explicit + gimp dependency. + * added README.debian + * install find-scanner + * install many documentation files + + -- Kevin Dalley <kevind@rahul.net> Fri, 2 Jan 1998 21:51:52 -0800 + +sane (0.68-2) unstable; urgency=low + + * corrected control file + + -- Kevin Dalley <kevind@rahul.net> Sun, 21 Dec 1997 18:26:23 -0800 + +sane (0.68-1) unstable; urgency=low + + * update to version 0.68 of sane + + -- Kevin Dalley <kevind@rahul.net> Fri, 5 Dec 1997 00:42:27 -0800 + +sane (0.67-1) unstable; urgency=low + + * first Debian release of sane + + -- Kevin Dalley <kevind@rahul.net> Tue, 18 Nov 1997 21:38:41 -0800 + + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b6c7ba5 --- /dev/null +++ b/debian/control @@ -0,0 +1,29 @@ +Source: sane-frontends +Section: graphics +Priority: optional +Maintainer: Julien BLACHE <jblache@debian.org> +Standards-Version: 3.8.3 +Build-Depends: debhelper (>= 5), dpatch, libgimp2.0-dev (>= 2.0.0), libgtk2.0-dev, libsane-dev (>= 1.0.11-3), autotools-dev + +Package: sane +Section: graphics +Architecture: any +Depends: ${shlibs:Depends} +Suggests: gimp +Description: scanner graphical frontends + This package includes : + o xscanimage, a scanner graphical frontend with GIMP 2.0 support + o scanadf, a command-line frontend for scanners with Automatic Document Feeder + o xcam, for acquiring images continuously from cameras. + . + An alternative to xscanimage called xsane is packaged separately. + . + The scanner frontends use SANE. SANE stands for "Scanner Access Now + Easy" and is an application programming interface (API) that provides + standardized access to any raster image scanner hardware (flatbed + scanner, hand-held scanner, video- and still-cameras, frame-grabbers, + etc.). The SANE standard is free and its discussion and development are + open to everybody. The current source code is written to support several + operating systems, including GNU/Linux, OS/2, Win32 and various Unices + and is available under the GNU General Public License (commercial + applications and backends are welcome, too, however). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8c5b2d6 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,36 @@ +This package was first debianized by Kevin Dalley kevind@rahul.net. +It is now maintained by Julien BLACHE <jblache@debian.org> and +Aurélien JARNO <aurel32@debian.org>. + +It was downloaded from: ftp://ftp.sane-project.org/pub/sane/ + +Upstream Authors: + see /usr/share/doc/sane/AUTHORS + +Copyright: + Copyright (C) 1995 Spencer Kimball + Copyright (C) 1995 Peter Mattis + Copyright (C) 1997, 1998 David Mosberger + Copyright (C) 1997 Tristan Tarrant + Copyright (C) 1997, 1998 Andreas Beck + Copyright (C) 1999 Tom Martone + +License: + + 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 St, Fifth Floor, Boston, MA 02110-1301 USA + + +On Debian systems, a copy of the GNU General Public License (GPL) is available +in the file /usr/share/common-licenses/GPL. diff --git a/debian/patches/00list b/debian/patches/00list new file mode 100644 index 0000000..d65c845 --- /dev/null +++ b/debian/patches/00list @@ -0,0 +1,7 @@ +01_xcam.c_dead_code +02_xcam_man_typo +03_scanadf_options_fix +04_cap_always_settable +05_xcam_off_by_one +06_word_list_fix + diff --git a/debian/patches/01_xcam.c_dead_code.dpatch b/debian/patches/01_xcam.c_dead_code.dpatch new file mode 100644 index 0000000..41a33e0 --- /dev/null +++ b/debian/patches/01_xcam.c_dead_code.dpatch @@ -0,0 +1,29 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_xcam.c_dead_code.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Remove dead code in src/xcam.c::load_defaults() + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/src/xcam.c sane-frontends-1.0.14/src/xcam.c +--- sane-frontends-1.0.14~/src/xcam.c 2005-09-20 19:30:01.000000000 +0200 ++++ sane-frontends-1.0.14/src/xcam.c 2005-09-20 19:30:59.289245755 +0200 +@@ -536,16 +536,14 @@ + load_defaults (int silent) + { + char filename[PATH_MAX]; +- int fd; + + DBG (DBG_debug, "xcam, load_defaults: enter\n"); + if (make_default_filename (sizeof (filename), filename, dialog->dev_name) + < 0) + return; +- if (fd < 0) +- return; ++ + load_settings (filename, silent); +- sanei_load_values (fd, dialog->dev); ++ + DBG (DBG_debug, "xcam, load_defaults: exit\n"); + } + diff --git a/debian/patches/02_xcam_man_typo.dpatch b/debian/patches/02_xcam_man_typo.dpatch new file mode 100644 index 0000000..cd35ecc --- /dev/null +++ b/debian/patches/02_xcam_man_typo.dpatch @@ -0,0 +1,39 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02_xcam_man_typo.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix various typos in xcam.man. + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/doc/xcam.man sane-frontends-1.0.14/doc/xcam.man +--- sane-frontends-1.0.14~/doc/xcam.man 2008-03-01 15:30:54.000000000 +0100 ++++ sane-frontends-1.0.14/doc/xcam.man 2008-03-01 15:32:35.802703418 +0100 +@@ -1,4 +1,4 @@ +-.TH xcam 1 "11 April 2005" ++.TH xcam 1 "19 February 2008" + .IX xcam + .SH NAME + xcam - a graphical camera frontend for SANE +@@ -12,7 +12,7 @@ + .B xcam + provides a graphical user-interface to control an image + acquisition device such as a flatbed scanner or a camera. It allows +-scanning invidual images and can be invoked directly from the command-line. ++scanning individual images and can be invoked directly from the command-line. + + .B xcam + acts as a stand-alone program that saves acquired images in a suitable +@@ -43,12 +43,11 @@ + .PP + The + .B --help (-h) +-.B xcam + flag prints a short summary of options. + .PP + .TP + .B SANE_DEBUG_XCAM +-This environment variable controls the debug level xscanimage. Higher ++This environment variable controls the debug level of xcam. Higher + debug levels increase the verbosity of the output. + + Value Descsription diff --git a/debian/patches/03_scanadf_options_fix.dpatch b/debian/patches/03_scanadf_options_fix.dpatch new file mode 100644 index 0000000..4c1b8cb --- /dev/null +++ b/debian/patches/03_scanadf_options_fix.dpatch @@ -0,0 +1,46 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 03_scanadf_options_fix.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Get option descriptor 0 before getting the value for option 0. + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/src/scanadf.c sane-frontends-1.0.14/src/scanadf.c +--- sane-frontends-1.0.14~/src/scanadf.c 2005-09-18 13:51:00.000000000 +0200 ++++ sane-frontends-1.0.14/src/scanadf.c 2008-08-05 12:00:14.826083326 +0200 +@@ -550,15 +550,33 @@ + const SANE_Option_Descriptor * opt; + SANE_Int num_dev_options; + int i, option_count; ++ SANE_Status status; + + /* and now build the full table of long options: */ + +- sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_dev_options, 0); ++ opt = sane_get_option_descriptor (device, 0); ++ if (opt == NULL) ++ { ++ fprintf (stderr, "Could not get option descriptor for option 0\n"); ++ exit (1); ++ } ++ ++ status = sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_dev_options, 0); ++ if (status != SANE_STATUS_GOOD) ++ { ++ fprintf (stderr, "Could not get value for option 0: %s\n", sane_strstatus (status)); ++ exit (1); ++ } + + option_count = 0; +- for (i = 0; i < num_dev_options; ++i) ++ for (i = 1; i < num_dev_options; ++i) + { + opt = sane_get_option_descriptor (device, i); ++ if (opt == NULL) ++ { ++ fprintf (stderr, "Could not get option descriptor for option %d\n", i); ++ exit (1); ++ } + + if (!SANE_OPTION_IS_SETTABLE (opt->cap)) + continue; diff --git a/debian/patches/04_cap_always_settable.dpatch b/debian/patches/04_cap_always_settable.dpatch new file mode 100644 index 0000000..e812c3d --- /dev/null +++ b/debian/patches/04_cap_always_settable.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 04_cap_always_settable.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Remove check for SANE_CAP_ALWAYS_SETTABLE; the flag is not part +## DP: of the standard and has been removed upstream in SANE 1.0.20. + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/src/gtkglue.c sane-frontends-1.0.14/src/gtkglue.c +--- sane-frontends-1.0.14~/src/gtkglue.c 2005-04-16 15:12:07.000000000 +0200 ++++ sane-frontends-1.0.14/src/gtkglue.c 2009-06-26 13:32:04.997585725 +0200 +@@ -1476,8 +1476,7 @@ + || opt->type == SANE_TYPE_GROUP || !dialog->element[i].widget) + continue; + +- if (!(opt->cap & SANE_CAP_ALWAYS_SETTABLE)) +- gtk_widget_set_sensitive (dialog->element[i].widget, sensitive); ++ gtk_widget_set_sensitive (dialog->element[i].widget, sensitive); + } + } + diff --git a/debian/patches/05_xcam_off_by_one.dpatch b/debian/patches/05_xcam_off_by_one.dpatch new file mode 100644 index 0000000..deb56a0 --- /dev/null +++ b/debian/patches/05_xcam_off_by_one.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 05_xcam_off_by_one.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix an off-by-one. + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/src/xcam.c sane-frontends-1.0.14/src/xcam.c +--- sane-frontends-1.0.14~/src/xcam.c 2009-06-26 13:50:19.000000000 +0200 ++++ sane-frontends-1.0.14/src/xcam.c 2009-06-26 13:50:47.774585321 +0200 +@@ -1289,7 +1289,7 @@ + + /* test for pnm formats */ + strncpy (testfilename, preferences.filename, sizeof (testfilename)); +- testfilename[sizeof (testfilename)] = 0; ++ testfilename[sizeof (testfilename) - 1] = 0; + g_strreverse (testfilename); + if (!((!strncmp (testfilename, "mnp.", 4)) || + (!strncmp (testfilename, "mgp.", 4)) || diff --git a/debian/patches/06_word_list_fix.dpatch b/debian/patches/06_word_list_fix.dpatch new file mode 100644 index 0000000..90d223c --- /dev/null +++ b/debian/patches/06_word_list_fix.dpatch @@ -0,0 +1,42 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 06_word_list_fix.dpatch by <jblache@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix word list handling when current value is not part of the list. + +@DPATCH@ +diff -urNad sane-frontends-1.0.14~/src/gtkglue.c sane-frontends-1.0.14/src/gtkglue.c +--- sane-frontends-1.0.14~/src/gtkglue.c 2009-11-14 10:46:03.248492255 +0100 ++++ sane-frontends-1.0.14/src/gtkglue.c 2009-11-14 10:46:07.941492660 +0100 +@@ -913,6 +913,7 @@ + char **str_list; + int i, j; + int num_vector_opts = 0, *vector_opts; ++ SANE_Bool val_in_list; + + main_hbox = gtk_hbox_new (FALSE, 2); + +@@ -1073,13 +1074,23 @@ + case SANE_CONSTRAINT_WORD_LIST: + /* use a "list-selection" widget */ + num_words = opt->constraint.word_list[0]; ++ if (num_words == 0) ++ { ++ fprintf (stderr, "panel_build: empty word list!\n"); ++ break; ++ } ++ val_in_list = SANE_FALSE; + str_list = malloc ((num_words + 1) * sizeof (str_list[0])); + for (j = 0; j < num_words; ++j) + { ++ if (opt->constraint.word_list[j + 1] == val) ++ val_in_list = SANE_TRUE; + sprintf (str, "%d", opt->constraint.word_list[j + 1]); + str_list[j] = strdup (str); + } + str_list[j] = 0; ++ if (!val_in_list) ++ val = opt->constraint.word_list[1]; + sprintf (str, "%d", val); + option_menu_new (parent, title, str_list, str, elem, + dialog->tooltips, opt->desc, diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2db7de8 --- /dev/null +++ b/debian/rules @@ -0,0 +1,100 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# Include dpatch rules +include /usr/share/dpatch/dpatch.make + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +autotools: autotools-stamp +autotools-stamp: + rm -f config.sub config.guess + ln -s /usr/share/misc/config.sub config.sub + ln -s /usr/share/misc/config.guess config.guess + touch autotools-stamp + +config.status: autotools-stamp configure + dh_testdir + # Add here commands to configure the package. + ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info --datadir=\$${prefix}/share + +build: build-stamp +build-stamp: patch-stamp config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: real-clean unpatch +real-clean: + dh_testdir + dh_testroot + rm -f build-stamp autotools-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) distclean + + rm -f config.sub config.guess + + dh_clean + + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/sane + $(MAKE) install prefix=$(CURDIR)/debian/sane/usr + + cp $(CURDIR)/debian/xscanimage-icon-32x32-2.xpm $(CURDIR)/debian/sane/usr/share/sane + +# Build architecture-independent files here. +binary-indep: +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs +# dh_installexamples + dh_installmenu + dh_installman +# dh_installinfo +# dh_undocumented + dh_installchangelogs Changelog + dh_link usr/bin/xscanimage usr/lib/gimp/2.0/plug-ins/xscanimage + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install patch unpatch real-clean autotools diff --git a/debian/sane.dirs b/debian/sane.dirs new file mode 100644 index 0000000..a356f1d --- /dev/null +++ b/debian/sane.dirs @@ -0,0 +1 @@ +usr/lib/gimp/2.0/plug-ins diff --git a/debian/sane.docs b/debian/sane.docs new file mode 100644 index 0000000..9731ce9 --- /dev/null +++ b/debian/sane.docs @@ -0,0 +1,4 @@ +AUTHORS +NEWS +PROBLEMS +README diff --git a/debian/sane.menu b/debian/sane.menu new file mode 100644 index 0000000..c803ed2 --- /dev/null +++ b/debian/sane.menu @@ -0,0 +1,12 @@ +?package(sane):command="/usr/bin/xscanimage" needs="X11" \ + section="Applications/Graphics" title="xscanimage" \ + icon="/usr/share/sane/xscanimage-icon-32x32-2.xpm" \ + description="xscanimage provides a graphical \ + user interface to control an image acquisition device \ + such as a flatbed scanner or a camera." +?package(sane):command="/usr/bin/xcam" needs="X11" \ + section="Applications/Graphics" title="xcam" \ + icon="/usr/share/sane/xscanimage-icon-32x32-2.xpm" \ + description="xcam provides a graphical \ + user interface to control an image acquisition device \ + such as a flatbed scanner or a camera." diff --git a/debian/xscanimage-icon-32x32-2.xpm b/debian/xscanimage-icon-32x32-2.xpm new file mode 100644 index 0000000..67e3657 --- /dev/null +++ b/debian/xscanimage-icon-32x32-2.xpm @@ -0,0 +1,192 @@ +/* XPM */ +static char *xscanimage-icon-32x32-2[] = { +/* columns rows colors chars-per-pixel */ +"32 32 154 2", +" c #000000", +". c #0B0B0B", +"X c #131313", +"o c #171817", +"O c #1C1C1C", +"+ c #222222", +"@ c #272827", +"# c #2C2C2C", +"$ c #333333", +"% c #3B3B3B", +"& c #434343", +"* c #484847", +"= c #4C4C4B", +"- c #545454", +"; c #5C5B5B", +": c #4E5C6A", +"> c #575C61", +", c #525E68", +"< c #4D6377", +"1 c #5E646A", +"2 c #5A6775", +"3 c #5D6E79", +"4 c #636364", +"5 c #696867", +"6 c #6C6C6B", +"7 c #606971", +"8 c #6C6F74", +"9 c #6F777F", +"0 c #747373", +"q c #787675", +"w c #7B7B7B", +"e c #57768F", +"r c #5A7387", +"t c #577690", +"y c #687E8F", +"u c #717B85", +"i c #787E85", +"p c #638097", +"a c #68879E", +"s c #738C9F", +"d c #7E8992", +"f c #7E99AD", +"g c #7498B1", +"h c #7D9AB2", +"j c #7FA0B5", +"k c #719EC1", +"l c #7AA3C4", +"z c #7CA7C9", +"x c #7BA9CD", +"c c #807F7E", +"v c #838384", +"b c #81868C", +"n c #878887", +"m c #888887", +"M c #8D8C8C", +"N c #8F908F", +"B c #8B9096", +"V c #8E9398", +"C c #949493", +"Z c #9D9D9D", +"A c #8192A0", +"S c #8194AA", +"D c #849EB4", +"F c #939CA4", +"G c #9FA09F", +"H c #87A0AE", +"J c #83A3BE", +"K c #94A0AB", +"L c #9DA2A4", +"P c #90A7BB", +"I c #9BADBB", +"U c #A3A3A3", +"Y c #A8A8A7", +"T c #ABABAB", +"R c #A2AEB9", +"E c #ABADB0", +"W c #AFB2B4", +"Q c #ACB4BC", +"! c #B0B0AF", +"~ c #B3B3B3", +"^ c #B3B7BB", +"/ c #B3BABF", +"( c #B8B7B7", +") c #BCBCBC", +"_ c #8DA8C0", +"` c #8AB0CC", +"' c #8EB9D7", +"] c #91AEC4", +"[ c #99AFC1", +"{ c #94B3CC", +"} c #9BB3C3", +"| c #91BFDF", +" . c #9ABDD3", +".. c #A7B7C7", +"X. c #A5BCCF", +"o. c #ADB8C4", +"O. c #AABFCC", +"+. c #B9BEC4", +"@. c #99C2DB", +"#. c #ADC0C9", +"$. c #A2C3D8", +"%. c #B3CDDA", +"&. c #BBCFDC", +"*. c #BAD2DF", +"=. c #A1C8E0", +"-. c #A9CEE6", +";. c #A3DAFE", +":. c #ACD8F2", +">. c #ABDEFF", +",. c #B2D3E7", +"<. c #B1D6EB", +"1. c #B7DBEF", +"2. c #BDD5E5", +"3. c #BCDAEC", +"4. c #B9DFF4", +"5. c #B4E3FF", +"6. c #BBE5FE", +"7. c #C0BFC0", +"8. c #C4C4C4", +"9. c #C8C8C7", +"0. c #CBCBCB", +"q. c #CDD1D5", +"w. c #D4D4D4", +"e. c #D8D7D6", +"r. c #DCDBDB", +"t. c #C4D9E6", +"y. c #C7DFEE", +"u. c #DEDEE1", +"i. c #C0E6FC", +"p. c #C3E8FD", +"a. c #CAEBFD", +"s. c #D4E3ED", +"d. c #D4E4F0", +"f. c #D7ECF7", +"g. c #D2EEFE", +"h. c #DDE9F0", +"j. c #D6F2FE", +"k. c #DFF1FC", +"l. c #E0DFDF", +"z. c #E4E4E4", +"x. c #E8E7E6", +"c. c #ECECEC", +"v. c #E3ECF2", +"b. c #E8EFF2", +"n. c #E4F4FE", +"m. c #ECF7FD", +"M. c #EDF8FE", +"N. c #F0EFEE", +"B. c #F1F0EF", +"V. c #F1F1F0", +"C. c #F1F7FC", +"Z. c #F4FAFE", +"A. c #FCFCFE", +"S. c None", +/* pixels */ +"S.S.S.S.S.S.X . . S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.", +"S.S.S.S.S.& ; & + . . S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.", +"S.S.S.S.S.- Z w.! w ; % o X . S.S.S.S.S.S.S.S.S.S.S.S.S.S.", +"S.S.S.S.S.+ ; Y l.c.z.w.~ M - # O . . . S.S.S.S.S.S.S.S.S.S.S.", +"S.S.S.S.S.. X + - 5 w ! 9.u.x.e.! v > % O X . S.S.S.S.S.S.", +"S.S.S.S.S.S. . X $ = > 4 0 m U 8.r.r.0.! M - $ + . . S.S.S.", +"S.S.S.S.S.S.S. X O % = = & = - 4 w Y ) w.r.w.! w ; % O . . ", +"S.S.S.S.S.S.S.S. . X * ; & & & & & & - 5 w Z ) w.q.) U 0 % O ", +"S.S.S.S.S.S.S. . o ; M q 0 q 5 - = * & % & * = - 0 m Z Y ) 4 ", +"S.S.S.S.S.S.S. . 5 ~ i y H p u 9 8 5 ; ; = & & % $ $ % = 4 % ", +"S.S.S.S.S.S.S. . - ) b y &.v.v.s.$.f s r 2 1 5 4 - & & $ $ + o ", +"S.S.S.S.S.S. . - ) V a t.C.A.A.A.Z.Z.n.2.X.g e < , > ; - = $ O ", +"S.S.S.S.S.. X ; 9.F f y.Z.A.A.A.Z.Z.A.Z.Z.Z.M.h.%.j e , ; = % + ", +"S.S.S.S.. o 5 0.T R b.A.A.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.c.O.3 ; & & + ", +"S.S.S.X @ w e.) I b.A.A.A.A.Z.Z.Z.Z.Z.Z.M.Z.Z.M.M.Z.O.7 - % % + ", +"S.S.. # w r.8.D h.A.A.A.A.A.A.A.Z.Z.Z.Z.M.M.M.M.m.m.D q = * + O ", +"S.. O 6 r.9.D -.g.k.Z.A.A.A.A.A.A.A.A.A.Z.Z.M.n.Z.3.b w = = O + ", +". O ; u.r.H @.6.;.>.6.a.n.Z.A.A.A.A.A.A.A.A.Z.Z.M.P v 6 - $ O + ", +"O ; e.V.o.g :.i.i.5.>.>.5.6.g.n.Z.A.A.A.A.A.A.A.s.s n ; - @ + O ", +"O ~ A.c.w.{ l x | 6.a.a.6.6.5.6.p.g.n.Z.A.A.A.Z.X.B c ; = O O X ", +"X T c.c.B.N.l.q...J l @.,.p.j.a.i.6.6.i.f.n.Z.d.f Z 6 ; % O O X ", +". Z w.q.e.l.c.N.N.x.q.o.P [ { ,.f.g.a.p.6.i.k.` F C ; 4 + O O ", +"X C 0.8.8.9.9.q.r.x.N.N.x.e.#.o.I .*.1.g.j.1.h Y w 4 = O + X ", +"X ; U ~ ) 7.) ) 8.8.9.w.l.x.N.x.r.0.Q I I ' z K U 5 4 % O O . ", +" X O $ 6 v Y ( ~ ( ( ) ) 8.0.r.z.x.l.w.8.( ~ ! M 4 4 + + O ", +"S. . . X o & - m U T ! ! T ! ( ( ) 9.q.w.e.w.~ 0 5 - + + X S.", +"S.S. . . . O + - w Z Y Y T Y T T ! ~ ) 8.! 5 0 $ O O . S.", +"S.S.S.S. . X X $ * 6 C Z Y U U U Y Y G 6 6 + O o . S.S.", +"S.S.S.S.S.S.S.S. . . o + * 6 v U U Z F N q = O O . S.S.", +"S.S.S.S.S.S.S.S.S.S. . X X + & 4 M Z C w % O O . S.S.", +"S.S.S.S.S.S.S.S.S.S.S.S.S.S. . . . X O $ - - + O o S.S.S.", +"S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S. . . . . X o O . S.S.S." +}; diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..2212f24 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,99 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane +docdir=$(prefix)/doc/sane-@VERSION@ + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +LN_S = @LN_S@ + +@SET_MAKE@ + +SECT1 = xscanimage.1 xcam.1 scanadf.1 +MANPAGES = $(SECT1) +LATEX = TEXINPUTS=$(srcdir):$$TEXINPUTS latex +DLH = TEXINPUTS=$(srcdir):$$TEXINPUTS dlh +MAN2HTML= nroff -man |\ + man2html -compress -topm 6 -botm 6 -nodepage \ + -title $${page} -cgiurl '$$title.$$section.html'|\ + sed 's,<BODY>,<BODY BGCOLOR=\#FFFFFF TEXT=\#000000><H1 ALIGN=CENTER><IMG SRC="/images/sane.png" HEIGHT=117 WIDTH=346></H1>,' + +DISTFILES = Makefile.in sane.png xcam.man xscanimage.man scanadf.man + +.PHONY: all clean depend dist html html-man install ps uninstall + +all: $(MANPAGES) + +%.1: %.man + @sed -e 's|@DATADIR@|$(datadir)|g' \ + -e 's|@CONFIGDIR@|$(configdir)|g' \ + -e 's|@LIBDIR@|$(libdir)|g' \ + -e 's|@BINDIR@|$(bindir)|g' \ + -e 's|@SBINDIR@|$(sbindir)|g' $^ >$@ + @echo Generating manpage $@... + +install: $(MANPAGES) + $(MKDIR) $(DESTDIR)$(mandir)/man1 + @for page in $(SECT1); do \ + echo installing $${page} in $(mandir)/man1/$${page}...; \ + $(INSTALL_DATA) $${page} $(DESTDIR)$(mandir)/man1/$${page} \ + || exit 1; \ + done + +uninstall: + @for page in $(SECT1); do \ + echo Removing $${page} in $(mandir)/man1/$${page}...; \ + rm -f $(mandir)/man1/$${page} ; \ + done + +html-man: $(MANPAGES) + @for page in $(MANPAGES); do \ + echo "translating $${page} to $${page}.html..."; \ + cat $${page} | $(MAN2HTML) > $${page}.html; \ + done + +clean: + rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.blg *.idx *.cb + rm -f *.ilg + +distclean: clean + rm -f $(MANPAGES) + for manpage in $(MANPAGES) ; do \ + rm -f $${manpage}.html ; \ + done + rm -f Makefile *~ + rm -f *.lot *.lof *.ind + +depend: + +dist: $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file $(distdir)/doc 2> /dev/null \ + || cp -p $$file $(distdir)/doc ; \ + done diff --git a/doc/sane.png b/doc/sane.png Binary files differnew file mode 100644 index 0000000..d8a9890 --- /dev/null +++ b/doc/sane.png diff --git a/doc/scanadf.man b/doc/scanadf.man new file mode 100644 index 0000000..f20243e --- /dev/null +++ b/doc/scanadf.man @@ -0,0 +1,268 @@ +.TH scanadf 1 "30 Oct 2004" +.IX scanadf +.SH NAME +scanadf - acquire multiple images from a scanner equipped with an ADF +.SH SYNOPSIS +.B scanadf +.RB [ -d | --device-name +.IR dev ] +.RB [ -h | --help ] +.RB [ -L | --list-devices ] +.RB [ -v | --verbose ] +.RB [ -V | --version ] +.RB [ -o | --output-file +.IR name ] +.RB [ -N | --no-overwrite ] +.RB [ -S | --scan-script +.IR name ] +.RB [ --script-wait ] +.RB [ -s | --start-count +.IR num ] +.RB [ -e | --end-count +.IR num ] +.RB [ -r | --raw ] +.RI [ device-specific-options ] +.SH DESCRIPTION +.B scanadf +is a command-line interface to control image acquisition devices which +are capable of returning a series of images (e.g. a scanner with an +automatic document feeder (ADF)). The device is controlled via +command-line options. After command-line processing, +.B scanadf +normally proceeds to acquire a series of images until the device returns +the +.B SANE_STATUS_NO_DOCS +status code. +.PP +The images are written to output files, specified by the +.B --output-file +option. These files are typically written in one of the PNM (portable aNyMaP) +formats (PBM for black-and-white images, PGM for grayscale images, +and PPM for color images). Several optional frame formats (SANE_FRAME_JPEG, +SANE_FRAME_G31D, SANE_FRAME_G32D, SANE_FRAME_G42D, and SANE_FRAME_TEXT) +are supported. In each case, the data is written out to the output file +as-is without a header. Unrecognized frame formats are handled in +the same way, although a warning message is printed in verbose mode. +.PP +Typically, the optional frame formats are used in conjunction with a scan +script (specified by the +.B --scanscript +option) which is invoked for each acquired image. The script is provided +with a series of environment variables which describe the parameters +and format of the image file. + +.B scanadf +accesses image acquisition devices through the SANE (Scanner Access +Now Easy) interface and can thus support any device for which there +exists a SANE backend (try "apropos sane\-" to get a list of available +backends). +.SH OPTIONS +.PP +The +.B -d +or +.B --device-name +options must be followed by a SANE device-name. A (partial) list of +available devices can be obtained with the +.B --list-devices +option (see below). If no device-name is specified explicitly, +.B scanadf +will attempt to open the first available device. +.PP +The +.B -h +or +.B --help +options request help information. The information is printed on +standard output and in this case, no attempt will be made to acquire +an image. +.PP +The +.B -L +or +.B --list-devices +option requests a (partial) list of devices that are available. The +list is not complete since some devices may be available, but are not +listed in any of the configuration files (which are typically stored +in directory @CONFIGDIR@). This is particularly the case when +accessing scanners through the network. If a device is not listed in +a configuration file, the only way to access it is by its full device +name. You may need to consult your system administrator to find out +the names of such devices. +.PP +The +.B -v +or +.B --verbose +options increase the verbosity of the operation of +.B scanadf. +The option may be specified repeatedly, each time increasing the verbosity +level. + +The +.B -V +or +.B --version +option requests that +.B scanadf +print the program and package name, as well as the version number of +the SANE distribution that it came with. + +.PP +The +.B -o +or +.B --output-file +option specifies a format string used to generate the name of file to +write the image data to. You can use %d replacement in the output file +name; this will be replaced with the current page number. The default +format string is image-%04d. + +.PP +The +.B -N +or +.B --no-overwrite +option prevents +.B scanadf +from overwriting existing image files. + +.PP +The +.B -S +or +.B --scan-script +option specifies the name of script to run after each scanned image +is acquired. The script receives the name of the image output file +as its first and only command line argument. Additionally the scan +script can reference the following environment variables to get +information about the parameters of the image. + +.PP +.RS +.B SCAN_RES +- the image resolution (in DPI) +.br +.B SCAN_WIDTH +- the image width (in pixels) +.br +.B SCAN_HEIGHT +- the image height (in pixels) +.br +.B SCAN_DEPTH +- the image bit-depth (in bits) +.br +.B SCAN_FORMAT +- a string representing the image format (e.g. gray, g42d, text, etc) +.br +.B SCAN_FORMAT_ID +- the numeric image format identifier +.br +.RE + +.PP +If the +.B --scipt-wait +option is given, scanadf will wait until all scan-scripts have been finished before +exiting. That will be useful if scanadf is used in conjunction with tools to modify +the scanned images. + +.PP +The +.B -s +or +.B --start-count +option specifies the page number of first scanned image. + +.PP +The +.B -e +or +.B --end-count +option specifies the last page number to scan. Using this option, +you can request a specific number of pages to be scanned, rather than +scanning until there are no more images available. + +.PP +The +.B -r +or +.B --raw +option specifies that the raw image data be written to the output file +as-is without interpretation. This disables the writing of the PNM +header for basic frame types. This feature is usually used in +conjunction with the +.B --scan-script +option where the scan script uses the environment variables to +understand the format and parameters of the image and converts +the file to a more useful format. NOTE: With support for the +optional frame types and the default handling of unrecognized +frametypes, this option becomes less and less useful. + +As you might imagine, much of the power of +.B scanadf +comes from the fact that it can control any SANE backend. Thus, the +exact set of command-line options depends on the capabilities of the +selected device. To see the options for a device named +.IR dev , +invoke +.B scanadf +via a command-line of the form: +.PP +.RS +scanadf --help --device +.I dev +.RE +.PP +The documentation for the device-specific options printed by +.B --help +is explained in the manual page for +.B scanimage. + +.SH FILES +.TP +.I @CONFIGDIR@ +This directory holds various configuration files. For details, please +refer to the manual pages listed below. +.SH "SEE ALSO" +scanimage(1), xscanimage(1), sane(7) + +.SH AUTHOR +scanadf is an adaptation by Tom Martone of scanimage by David Mosberger, +Andreas Beck, and Gordon Matzigkeit following closely the features of +bnhscan by Sean Reifschneider of tummy.com, ltd. + +.SH BUGS +Please send reports to +.IR sane\-devel@lists.alioth.debian.org . +.PP +This program relies on the backend to return the +.B SANE_STATUS_NO_DOCS +status code when the automatic document feeder is out of paper. Use of +this program with backends that do not support ADFs (e.g. flatbed scanners) +will likely result in repeated scans of the same document. In this +case, it is essential to use the start-count and end-count to +control the number of images acquired. + +.PP +Only a subset of the SANE backends support feeders and return +SANE_STATUS_NO_DOCS appropriately. Backends which are known to +work at this time are: + +.RS +.br +.B sane-bh +- Bell+Howell Copiscan II series scanners. +.br +.B sane-hp +- Hewlett Packard scanners. A patch to the sane-hp backend +is necessary. The --scantype=ADF option must be specified (earlier +versions of the backend used the --scan-from-adf option, instead). +.br +.B sane-umax +- UMAX scanners. Support exists in build 12 and later. +The --source="Automatic Document Feeder" option must be specified. +.br +.RE + + diff --git a/doc/xcam.man b/doc/xcam.man new file mode 100644 index 0000000..036bcb3 --- /dev/null +++ b/doc/xcam.man @@ -0,0 +1,79 @@ +.TH xcam 1 "11 April 2005" +.IX xcam +.SH NAME +xcam - a graphical camera frontend for SANE +.SH SYNOPSIS +.B xcam +.RB [ --buffer | -B ] +.RB [ --version | -V ] +.RB [ --help | -h ] + +.SH DESCRIPTION +.B xcam +provides a graphical user-interface to control an image +acquisition device such as a flatbed scanner or a camera. It allows +scanning invidual images and can be invoked directly from the command-line. + +.B xcam +acts as a stand-alone program that saves acquired images in a suitable +PNM format (PBM for black-and-white images, PGM for grayscale images, +and PPM for color images). + +.B xcam +accesses image acquisition devices through the SANE (Scanner Access +Now Easy) interface. The list of available devices depends on +installed hardware and configuration. + +.B xcam +presents a menu listing of all known and available devices. + +.SH OPTIONS +.PP +If the +.B --Buffer (-B) +option is given, +.B xcam +will use a 1024 kByte input buffer instead of the default 32 kByte. +.PP +If the +.B --version (-V) +option is given, +.B xcam +will output its version number. +.PP +The +.B --help (-h) +.B xcam +flag prints a short summary of options. +.PP +.TP +.B SANE_DEBUG_XCAM +This environment variable controls the debug level xscanimage. Higher +debug levels increase the verbosity of the output. + + Value Descsription + 0 print fatal errors + 1 print errors + 2 print warnings + 3 print information messages + 4 print everything + + Example: + SANE_DEBUG_XCAM=3 + +.SH FILES +.TP +.I $HOME/.sane/xcam/devicename.rc +For each device, there is one rc-file that holds the saved settings +for that particular device. Normally, this file should not be +manipulated directly. Instead, the user should use the +.B xcam +interface to select appropriate values and then save the device +settings using the "Preferences->Save as default settings" menubar entry. + +.SH "SEE ALSO" +sane(7), xscanimage(1), scanimage(1), sane\-dll(5) and the backend manpages +.SH AUTHOR +David Mosberger-Tang + +Gerard Klaver (2005 update) diff --git a/doc/xscanimage.man b/doc/xscanimage.man new file mode 100644 index 0000000..58cfe39 --- /dev/null +++ b/doc/xscanimage.man @@ -0,0 +1,165 @@ +.TH xscanimage 1 "1 Feb 2003" +.IX xscanimage +.SH NAME +xscanimage \- scan an image +.SH SYNOPSIS +.B xscanimage +.RB [ --version | -V ] +.RB [ --help | -h ] +.RB [ --display +.IR d ] +.RB [ --no-xshm ] +.RB [ --sync ] +.RI [ devicename ] +.SH DESCRIPTION +.B xscanimage +provides a graphical user-interface to control an image +acquisition device such as a flatbed scanner or a camera. It allows +previewing and scanning invidual images and can be invoked either +directly from the command-line or through The GIMP image manipulation +program. In the former case, +.B xscanimage +acts as a stand-alone program that saves acquired images in a suitable +PNM format (PBM for black-and-white images, PGM for grayscale images, +and PPM for color images). In the latter case, the images are +directly passed to The GIMP for further processing. + +.B xscanimage +accesses image acquisition devices through the SANE (Scanner Access +Now Easy) interface. The list of available devices depends on +installed hardware and configuration. When invoked without an +explicit devicename argument, +.B xscanimage +presents a dialog listing of all known and available devices. If the +environment variable SANE_DEFAULT_DEVICE is set to the devicename, the device +is preselected in the dialog. To access an available device that is not known +to the system, the devicename must be specified explicitly. The format of +devicename is backendname:devicefile (e.g. umax:/dev/sga). +.SH RUNNING UNDER THE GIMP +To run +.B xscanimage +under the +.BR gimp (1), +simply copy it to one of the +.BR gimp (1) +plug-ins directories. If you want to conserve disk-space, you can +create a symlink instead. For example, for gimp-1.0.x the command +.PP +ln -s @BINDIR@/xscanimage ~/.gimp/plug-ins/ +.PP +and for gimp-1.2.x the command +.PP +ln -s @BINDIR@/xscanimage ~/.gimp-1.2/plug-ins/ +.PP +adds a symlink for the +.B xscanimage +binary to the user's plug-ins directory. After creating this symlink, +.B xscanimage +will be queried by +.BR gimp (1) +the next time it's invoked. From then on, +.B xscanimage +can be invoked through "File->Acquire->Xscanimage->Device dialog..." menu entry. + +You'll also find that the "File->Acquire->Xscanimage" menu contains short-cuts +to the SANE devices that were available at the time +.B xscanimage +was queried. For example, the first PNM pseudo-device is typically +available as the short-cut "File->Acquire->Xscanimage->pnm:0". +Note that +.BR gimp (1) +caches these short-cuts in ~/.gimp/pluginrc. Thus, when the list of +available devices changes (e.g., a new scanner is installed), then it +is typically desirable to rebuild this cache. To do this, you can +either +.BR touch (1) +the +.B xscanimage +binary (e.g., "touch @BINDIR@/xscanimage") or delete the plug-ins cache +(e.g., "rm ~/.gimp/plug-ins"). Either way, invoking +.BR gimp (1) +afterwards will cause the pluginrc to be rebuilt. +.SH OPTIONS +.PP +If the +.B --version (-V) +option is given, +.B xscanimage +will output its version number. +.PP +The +.B --help (-h) +flag prints a short summary of options. +.PP +The +.B --display +flag selects the X11 display used to present the graphical user-interface +(see +.BR X (1) +for details). +.PP +The +.B --no-xshm +flag requests not to use shared memory images. Shared memory images +usually enhance performance but cause problems with some buggy X11 +servers. Unless your X11 server dies when running this program, there +is no need or advantage to specify this flag. +.PP +The +.B --sync +flag requests a synchronous connection with the X11 server. This is for +debugging purposes only. +.SH ENVIRONMENT +.TP +.B SANE_DEFAULT_DEVICE +The default device-name. Example: SANE_DEFAULT_DEVICE="hp:/dev/scanner". +.TP +.B SANE_DEBUG_XSCANIMAGE +This environment variable controls the debug level xscanimage. Higher +debug levels increase the verbosity of the output. + + Value Descsription + 0 print fatal errors + 1 print errors + 2 print warnings + 3 print information messages + 4 print everything + + Example: + SANE_DEBUG_XSCANIMAGE=3 +.SH FILES +.TP +.I $HOME/.sane/xscanimage/xscanimage.rc +This files holds the user preferences. Normally, this file should not +be manipulated directly. Instead, the user should customize the +program through the "Preferences" dialog. +.TP +.I $HOME/.sane/xscanimage/devicename.rc +For each device, there is one rc-file that holds the saved settings +for that particular device. Normally, this file should not be +manipulated directly. Instead, the user should use the +.B xscanimage +interface to select appropriate values and then save the device +settings using the "Preferences->Save Device Settings" menubar entry. +.TP +.I $HOME/.sane/preview-devicename.ppm +After acquiring a preview, +.B xscanimage +normally saves the preview image in this device-specific file. Thus, +next time the program is started up, the program can present the old +preview image. This feature can be turned off through the +"Preferences->Preview Options..." dialog. +.TP +.I @DATADIR@/sane-style.rc +This system-wide file controls the aspects of the user-interface such +as colors and fonts. It is a GTK style file and provides fine control +over the visual aspects of the user-interface. +.TP +.I $HOME/.sane/sane-style.rc +This file serves the same purpose as the system-wide style file. If +present, it takes precedence over the system wide style file. +.SH "SEE ALSO" +sane(7), gimp(1), xcam(1), scanimage(1), scanadf(1), sane-scsi(5), +sane\-dll(5), sane\-net(5), sane\-"backendname"(5) +.SH AUTHOR +Tristan Tarrant, Andreas Beck, David Mosberger, and Henning Meier-Geinitz diff --git a/include/Makefile.in b/include/Makefile.in new file mode 100644 index 0000000..7ef48dd --- /dev/null +++ b/include/Makefile.in @@ -0,0 +1,71 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane +docdir=$(prefix)/doc/sane-@VERSION@ + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +LN_S = @LN_S@ + +@SET_MAKE@ + +SANE_INCLUDES = $(addprefix $(top_srcdir)/include/sane/,config.h.in sanei.h \ + sanei_codec_ascii.h sanei_codec_bin.h sanei_debug.h sanei_wire.h) +OTHER_INCLUDES = $(addprefix $(top_srcdir)/include/,Makefile.in getopt.h \ + lalloca.h) + +DISTFILES = $(SANE_INCLUDES) $(OTHER_INCLUDES) + +.PHONY: all clean depend dist install uninstall + +all: + +dist: $(DISTFILES) + $(MKDIR) $(distdir)/include/sane + for file in $(OTHER_INCLUDES); do \ + ln $$file $(distdir)/include 2> /dev/null \ + || cp -p $$file $(distdir)/include; \ + done + for file in $(SANE_INCLUDES); do \ + ln $$file $(distdir)/include/sane 2> /dev/null \ + || cp -p $$file $(distdir)/include/sane; \ + done + +install: + +uninstall: + +clean: + +depend: + +distclean: clean + rm -f *~ sane/*~ + rm -f sane/config.h + rm -f Makefile diff --git a/include/getopt.h b/include/getopt.h new file mode 100644 index 0000000..aa7877f --- /dev/null +++ b/include/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/include/lalloca.h b/include/lalloca.h new file mode 100644 index 0000000..0fd4fc1 --- /dev/null +++ b/include/lalloca.h @@ -0,0 +1,47 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 The Free Software Foundation + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file implements a dynamic linking based SANE meta backend. It + allows managing an arbitrary number of SANE backends by using + dynamic linking to load backends on demand. */ + +#ifndef lalloca_h +#define lalloca_h + +/* AIX requires this to be the first thing in the file. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# if __STDC__ +void *alloca (); +# else +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +#endif /* lalloca_h */ diff --git a/include/sane/config.h.in b/include/sane/config.h.in new file mode 100644 index 0000000..baf35be --- /dev/null +++ b/include/sane/config.h.in @@ -0,0 +1,219 @@ +/* include/sane/config.h.in. Generated from configure.in by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if GIMP 1.2 support wanted */ +#undef ENABLE_GIMP_1_2 + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `getenv' function. */ +#undef HAVE_GETENV + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isfdtype' function. */ +#undef HAVE_ISFDTYPE + +/* Define to 1 if you have the <libc.h> header file. */ +#undef HAVE_LIBC_H + +/* Define to 1 if you have the <libgimp/gimpfeatures.h> header file. */ +#undef HAVE_LIBGIMP_GIMPFEATURES_H + +/* Define to 1 if you have the <libgimp/gimp.h> header file. */ +#undef HAVE_LIBGIMP_GIMP_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define to 1 if you have the `syslog' library (-lsyslog). */ +#undef HAVE_LIBSYSLOG + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mkdir' function. */ +#undef HAVE_MKDIR + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the <os2.h> header file. */ +#undef HAVE_OS2_H + +/* Define to 1 if you have the `sigprocmask' function. */ +#undef HAVE_SIGPROCMASK + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* 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 `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* 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 `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtod' function. */ +#undef HAVE_STRTOD + +/* 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/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `vsyslog' function. */ +#undef HAVE_VSYSLOG + +/* Define to the name of the distribution. */ +#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 name and the version of the distribution. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to the version of the distribution. */ +#undef VERSION + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define to `long' if <sys/types.h> does not define. */ +#undef ssize_t + +/* Define for OS/2 only */ +#undef strcasecmp + +/* Define for OS/2 only */ +#undef strncasecmp + +/* Define to `unsigned char' if <sys/types.h> does not define. */ +#undef u_char + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef u_int + +/* Define to `unsigned short' if <sys/types.h> does not define. */ +#undef u_int16_t + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef u_int32_t + +/* Define to `unsigned char' if <sys/types.h> does not define. */ +#undef u_int8_t + +/* Define to `unsigned long' if <sys/types.h> does not define. */ +#undef u_long diff --git a/include/sane/sanei.h b/include/sane/sanei.h new file mode 100644 index 0000000..d736b17 --- /dev/null +++ b/include/sane/sanei.h @@ -0,0 +1,173 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1996 David Mosberger-Tang and Andreas Beck + Copyright (C) 2002, 2003 Henning Meier-Geinitz + + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. +*/ + +/** @file sanei.h + * Convenience macros and function declarations for backends + * @sa sanei_backend.h sanei_thread.h + */ + +/* Doxygen documentation */ + +/** @mainpage SANEI (SANE internal routines) documentation + * + * @image html ../images/sane-logo2.jpg + * @section intro Introduction + * + * The header files in the include/sane/ directory named sanei_*.h provide + * function declarations and macros that can be used by every SANE backend. + * Their implementations can be found in the sanei/ directory. The code aims + * to be platform-independent to avoid lots of \#ifdef code in the backends. + * Please use the SANEI functions wherever possible. + * + * This documentation was created by the use of doxygen, the + * doc/doxygen-sanei.conf configuration file and dcoumentation in the sanei_*.h + * files. + * + * This documenation is far from complete. Any help is appreciated. + * + * @section additional Additional documentation + * - The SANE standard can be found at <a + * href="http://www.sane-project.org/html/">the SANE webserver</a>. + * - Information on how to write a backend: <a + * href="../backend-writing.txt">backend-writing.txt</a>. + * - General SANE documentation is on <a + * href="http://www.sane-project.org/docs.html>the SANE documentation + * page</a>. + * + * @section contact Contact + * + * The common way to contact the developers of SANE is the sane-devel + * mailing list. See the <a + * href="http://www.sane-project.org/mailing-lists.html">mailing list webpage</a> + * for details. That's the place to ask questions, report bugs, or announce + * a new backend. + * + */ + +#ifndef sanei_h +#define sanei_h + +#include <sane/sane.h> + +/** @name Public macros and functions + * @{ + */ +/** @def STRINGIFY(x) + * Turn parameter into string. + */ +/** @def PASTE(x,y) + * Concatenate parameters. + * + */ +/** @def NELEMS(a) + * Return number of elements of an array. + * + */ + +/** @fn extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt, void * value); + * Check the constraints of a SANE option. + * + * @param opt option to check + * @param value value of the option + * + * @return + * - SANE_STATUS_GOOD - on success + * - SANE_STATUS_INVAL - if the value doesn't fit inside the constraint + * or any other error occured + * @sa sanei_constrain_value() + */ + +/** @fn extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value, SANE_Word * info); + * Check the constraints of a SANE option and adjust its value if necessary. + * + * Depending on the type of the option and constraint, value is modified + * to fit inside constraint. + * + * @param opt option to check + * @param value value of the option + * @param info info is set to SANE_INFO_INEXACT if value was changed + * + * @return + * - SANE_STATUS_GOOD - on success + * - SANE_STATUS_INVAL - if the function wasn't able to fit value into the + * constraint or any other error occured + * @sa sanei_check_value() + */ + +/* @} */ + +/** @name Private macros + * @{ + */ +/** @def STRINGIFY1(x) + * Internal use only. + */ +/** @def PASTE1(x,y) + * Internal use only. + */ +/* @} */ + +/* A few convenience macros: */ +/** @hideinitializer */ +#define NELEMS(a) ((int)(sizeof (a) / sizeof (a[0]))) + +/** @hideinitializer */ +#define STRINGIFY1(x) #x +/** @hideinitializer */ +#define STRINGIFY(x) STRINGIFY1(x) + +/** @hideinitializer */ +#define PASTE1(x,y) x##y +/** @hideinitializer */ +#define PASTE(x,y) PASTE1(x,y) + +extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt, + void * value); + +extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt, + void * value, SANE_Word * info); + + +extern int sanei_save_values (int fd, SANE_Handle device); +extern int sanei_load_values (int fd, SANE_Handle device); + +#endif /* sanei_h */ diff --git a/include/sane/sanei_codec_ascii.h b/include/sane/sanei_codec_ascii.h new file mode 100644 index 0000000..991499a --- /dev/null +++ b/include/sane/sanei_codec_ascii.h @@ -0,0 +1,62 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1996 David Mosberger-Tang and Andreas Beck + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. +*/ + +/** @file sanei_codec_ascii.h + * ASCII codec for network and file transmissions + * + * Instead translating data to a byte stream this codec uses ASCII hex numbers. + * Therefore it can be used for streams that are not 8-bit clean or which can + * only use printable characters. It's currently used for saving/restoring + * data to/from disk. + * + * @sa sanei_codec_bin.h sanei_net.h sanei_wire.h + */ +#ifndef sanei_codec_ascii_h +#define sanei_codec_ascii_h + +/** Initialize the ascii codec + * + * Set the i/o functions of the Wire to those of the ASCII codec. + * + * @param w Wire + */ +extern void sanei_codec_ascii_init (Wire *w); + +#endif /* sanei_codec_ascii_h */ diff --git a/include/sane/sanei_codec_bin.h b/include/sane/sanei_codec_bin.h new file mode 100644 index 0000000..ba17bac --- /dev/null +++ b/include/sane/sanei_codec_bin.h @@ -0,0 +1,61 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1996 David Mosberger-Tang and Andreas Beck + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. +*/ + +/** @file sanei_codec_bin.h + * Binary codec for network transmissions + * + * Transtale data to a byte stream while taking byte order problems into + * account. This codec is currently used for saned and the network backend. + * + * @sa sanei_codec_ascii.h sanei_net.h sanei_wire.h + */ + +#ifndef sanei_codec_bin_h +#define sanei_codec_bin_h + +/** Initialize the binary codec + * + * Set the i/o functions of the Wire to those of the binary codec. + * + * @param w Wire + */ +extern void sanei_codec_bin_init (Wire *w); + +#endif /* sanei_codec_bin_h */ diff --git a/include/sane/sanei_debug.h b/include/sane/sanei_debug.h new file mode 100644 index 0000000..5cf2e45 --- /dev/null +++ b/include/sane/sanei_debug.h @@ -0,0 +1,176 @@ +/** @file sanei_debug.h + * Support for printing debug messages. + * + * Use the functions of this header file to print debug or warning messages. + */ + +#ifndef _SANEI_DEBUG_H +#define _SANEI_DEBUG_H + +#include <sane/sanei.h> + +/** @name Public macros + * These macros can be used in backends and other SANE-related + * code. + * + * Before including sanei_debug.h, the following macros must be set: + * + * - BACKEND_NAME - The name of your backend without double-quotes (must be set in any case) + * - STUBS - If this is defined, no macros will be included. Used in + * backends consisting of more than one .c file. + * - DEBUG_DECLARE_ONLY - Generates prototypes instead of functions. Used in + * backends consisting of more than one .c file. + * - DEBUG_NOT_STATIC - Doesn't generate static functions. Used in header files if + * they are include in more than one .c file. + * + * @{ + */ + +/** @def DBG_INIT() + * Initialize sanei_debug. + * + * Call this function before you use any DBG function. + */ + +/** @def DBG(level, fmt, ...) + * Print a message at debug level `level' or higher using a printf-like + * function. Example: DBG(1, "sane_open: opening fd \%d\\n", fd). + * + * @param level debug level + * @param fmt format (see man 3 printf for details) + * @param ... additional arguments + */ + +/** @def IF_DBG(x) + * Compile code only if debugging is enabled. + * + * Expands to x if debug support is enabled at compile-time. If NDEBUG is + * defined at compile-time this macro expands to nothing. + * + * @param x code to expand when debugging is enabled + */ + +/** + * @def DBG_LEVEL + * Current debug level. + * + * You can only read this "variable". + */ + +/** @def ENTRY(name) + * Expands to sane_BACKEND_NAME_name. + * + * Example: ENTRY(init) in mustek.c will expand to sane_mustek_init. + */ + +/* @} */ + +/** @name Internal macros and functions + * Do not use in your own code. + * @{ + */ + +/** @def DBG_LOCAL + * Do not use in backends directly. + * + * Internal wrapper for printing function. + */ + +/** @fn extern void sanei_init_debug (const char * backend, int * debug_level_var); + * Do not use in backends directly. + * + * Actual init function. + */ + +/** @fn extern void sanei_debug_msg (int level, int max_level, const char *be, const char *fmt, va_list ap); + * Do not use in backends directly. + * + * Actual printing function. + */ +/* @} */ + + /** @hideinitializer*/ +#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name) + +#ifdef NDEBUG + +extern void sanei_debug_ndebug (int level, const char *msg, ...); + +# define DBG_LEVEL (0) +# define DBG_INIT() +# define DBG sanei_debug_ndebug +# define IF_DBG(x) + +#else /* !NDEBUG */ + + /** @hideinitializer*/ +# define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME) + +# if defined(BACKEND_NAME) && !defined(STUBS) +# ifdef DEBUG_DECLARE_ONLY +extern int DBG_LEVEL; +# else /* !DEBUG_DECLARE_ONLY */ +int DBG_LEVEL = 0; +# endif /* DEBUG_DECLARE_ONLY */ +# endif /* BACKEND_NAME && !STUBS */ + + /** @hideinitializer*/ +# define DBG_INIT() \ + sanei_init_debug (STRINGIFY(BACKEND_NAME), &DBG_LEVEL) + + /** @hideinitializer*/ +# define DBG_LOCAL PASTE(DBG_LEVEL,_call) + + +# ifndef STUBS + +# ifdef DEBUG_DECLARE_ONLY + +extern void DBG_LOCAL (int level, const char *msg, ...) +#ifdef __GNUC__ +__attribute__ ((format (printf, 2, 3))) +#endif +; + +# else /* !DEBUG_DECLARE_ONLY */ + +# include <stdarg.h> + +extern void sanei_debug_msg + (int level, int max_level, const char *be, const char *fmt, va_list ap); + +#ifdef __GNUC__ +# ifndef DEBUG_NOT_STATIC +static +# endif /* !DEBUG_NOT_STATIC */ +void DBG_LOCAL (int level, const char *msg, ...) __attribute__ ((format (printf, 2, 3))); +#endif /* __GNUC__ */ + +# ifndef DEBUG_NOT_STATIC +static +# endif /* !DEBUG_NOT_STATIC */ +void +DBG_LOCAL (int level, const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + sanei_debug_msg (level, DBG_LEVEL, STRINGIFY(BACKEND_NAME), msg, ap); + va_end (ap); +} + +# endif /* DEBUG_DECLARE_ONLY */ + +# endif /* !STUBS */ + + /** @hideinitializer*/ +# define DBG DBG_LOCAL + +extern void sanei_init_debug (const char * backend, int * debug_level_var); + + /** @hideinitializer*/ +# define IF_DBG(x) x + +#endif /* NDEBUG */ + +#endif /* _SANEI_DEBUG_H */ diff --git a/include/sane/sanei_wire.h b/include/sane/sanei_wire.h new file mode 100644 index 0000000..95be5cf --- /dev/null +++ b/include/sane/sanei_wire.h @@ -0,0 +1,132 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. + + Support routines to translate internal datatypes into a wire-format + (used for RPCs and to save/restore options). */ + +#ifndef sanei_wire_h +#define sanei_wire_h + +#include <sys/types.h> + +#define MAX_MEM (1024 * 1024) + +typedef enum + { + WIRE_ENCODE = 0, + WIRE_DECODE, + WIRE_FREE + } +WireDirection; + +struct Wire; + +typedef void (*WireCodecFunc) (struct Wire *w, void *val_ptr); +typedef ssize_t (*WireReadFunc) (int fd, void * buf, size_t len); +typedef ssize_t (*WireWriteFunc) (int fd, const void * buf, size_t len); + +typedef struct Wire + { + int version; /* protocol version in use */ + WireDirection direction; + int status; + int allocated_memory; + struct + { + WireCodecFunc w_byte; + WireCodecFunc w_char; + WireCodecFunc w_word; + WireCodecFunc w_string; + } + codec; + struct + { + size_t size; + char *curr; + char *start; + char *end; + } + buffer; + struct + { + int fd; + WireReadFunc read; + WireWriteFunc write; + } + io; + } +Wire; + +extern void sanei_w_init (Wire *w, void (*codec_init)(Wire *)); +extern void sanei_w_exit (Wire *w); +extern void sanei_w_space (Wire *w, size_t howmuch); +extern void sanei_w_void (Wire *w); +extern void sanei_w_byte (Wire *w, SANE_Byte *v); +extern void sanei_w_char (Wire *w, SANE_Char *v); +extern void sanei_w_word (Wire *w, SANE_Word *v); +extern void sanei_w_bool (Wire *w, SANE_Bool *v); +extern void sanei_w_ptr (Wire *w, void **v, WireCodecFunc w_value, + size_t value_size); +extern void sanei_w_string (Wire *w, SANE_String *v); +extern void sanei_w_status (Wire *w, SANE_Status *v); +extern void sanei_w_constraint_type (Wire *w, SANE_Constraint_Type *v); +extern void sanei_w_value_type (Wire *w, SANE_Value_Type *v); +extern void sanei_w_unit (Wire *w, SANE_Unit *v); +extern void sanei_w_action (Wire *w, SANE_Action *v); +extern void sanei_w_frame (Wire *w, SANE_Frame *v); +extern void sanei_w_range (Wire *w, SANE_Range *v); +extern void sanei_w_range_ptr (Wire *w, SANE_Range **v); +extern void sanei_w_device (Wire *w, SANE_Device *v); +extern void sanei_w_device_ptr (Wire *w, SANE_Device **v); +extern void sanei_w_option_descriptor (Wire *w, SANE_Option_Descriptor *v); +extern void sanei_w_option_descriptor_ptr (Wire *w, + SANE_Option_Descriptor **v); +extern void sanei_w_parameters (Wire *w, SANE_Parameters *v); + +extern void sanei_w_array (Wire *w, SANE_Word *len, void **v, + WireCodecFunc w_element, size_t element_size); + +extern void sanei_w_set_dir (Wire *w, WireDirection dir); +extern void sanei_w_call (Wire *w, SANE_Word proc_num, + WireCodecFunc w_arg, void *arg, + WireCodecFunc w_reply, void *reply); +extern void sanei_w_reply (Wire *w, WireCodecFunc w_reply, void *reply); +extern void sanei_w_free (Wire *w, WireCodecFunc w_reply, void *reply); + +#endif /* sanei_wire_h */ diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..178cdac --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# 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. +# +# 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. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/lib/Makefile.in b/lib/Makefile.in new file mode 100644 index 0000000..f305185 --- /dev/null +++ b/lib/Makefile.in @@ -0,0 +1,95 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +RANLIB = @RANLIB@ + +CC = @CC@ +INCLUDES = -I. -I$(srcdir) \ + -I$(top_builddir)/include/sane -I$(top_srcdir)/include +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +DEFS = @DEFS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) + +@SET_MAKE@ + +LIBLIB_OBJS = alloca.o getopt.o getopt1.o strndup.o \ + strdup.o strsep.o snprintf.o usleep.o isfdtype.o \ + vsyslog.o getenv.o +LIBLIB_LTOBJS = alloca.lo getopt.lo getopt1.lo strndup.lo \ + strdup.lo strsep.lo snprintf.lo usleep.lo isfdtype.lo \ + vsyslog.lo getenv.lo + +TARGETS = $(LIBLIB_OBJS) +TARGETS = liblib.a + +DISTFILES = Makefile.in alloca.c getenv.c getopt.c getopt1.c isfdtype.c \ + snprintf.c strdup.c strndup.c strsep.c usleep.c vsyslog.c + +.PHONY: all check clean depend dist distclean install uninstall + +.SUFFIXES: +.SUFFIXES: .c .o +.c.o: + $(COMPILE) $< + @test -f $@ || $(COMPILE) $< + +all: $(TARGETS) + +liblib.a: $(LIBLIB_OBJS) + ar r $@ $(LIBLIB_OBJS) + $(RANLIB) $@ + +install: all + +uninstall: + +check: + +depend: + makedepend -I. -I../include *.c + +clean: + rm -f *.out *.o *.lo *~ *.a *.bak $(TESTPROGRAMS) + rm -rf .libs + +distclean: clean + rm -f Makefile + +dist: $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file $(distdir)/lib 2> /dev/null \ + || cp -p $$file $(distdir)/lib ; \ + done diff --git a/lib/alloca.c b/lib/alloca.c new file mode 100644 index 0000000..b7424cd --- /dev/null +++ b/lib/alloca.c @@ -0,0 +1,493 @@ +/* alloca.c -- allocate automatically reclaimed memory + (Mostly) portable public-domain implementation -- D A Gwyn + + This implementation of the PWB library alloca function, + which is used to allocate space off the run-time stack so + that it is automatically reclaimed upon procedure exit, + was inspired by discussions with J. Q. Johnson of Cornell. + J.Otto Tennant <jot@cray.com> contributed the Cray support. + + There are some preprocessor constants that can + be defined when compiling for your specific system, for + improved efficiency; however, the defaults should be okay. + + The general concept of this implementation is to keep + track of all alloca-allocated blocks, and reclaim any + that are found to be deeper in the stack than the current + invocation. This heuristic does not reclaim storage as + soon as it becomes invalid, but it will do so eventually. + + As a special case, alloca(0) reclaims storage without + allocating any. It is a good idea to use alloca(0) in + your main control loop, etc. to force garbage collection. */ + +#ifdef HAVE_CONFIG_H +#include <../include/sane/config.h> +#endif + +#ifndef HAVE_ALLOCA + +#ifdef emacs +#include "blockinput.h" +#endif + +/* If compiling with GCC 2, this file's not needed. */ +#if !defined (__GNUC__) || __GNUC__ < 2 + +/* If someone has defined alloca as a macro, + there must be some other way alloca is supposed to work. */ +#ifndef alloca + +#ifdef emacs +#ifdef static +/* actually, only want this if static is defined as "" + -- this is for usg, in which emacs must undefine static + in order to make unexec workable + */ +#ifndef STACK_DIRECTION +you +lose +-- must know STACK_DIRECTION at compile-time +#endif /* STACK_DIRECTION undefined */ +#endif /* static */ +#endif /* emacs */ + +/* If your stack is a linked list of frames, you have to + provide an "address metric" ADDRESS_FUNCTION macro. */ + +#if defined (CRAY) && defined (CRAY_STACKSEG_END) +long i00afunc (); +#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) +#else +#define ADDRESS_FUNCTION(arg) &(arg) +#endif + +#if __STDC__ +typedef void *pointer; +#else +typedef char *pointer; +#endif + +#define NULL 0 + +/* Different portions of Emacs need to call different versions of + malloc. The Emacs executable needs alloca to call xmalloc, because + ordinary malloc isn't protected from input signals. On the other + hand, the utilities in lib-src need alloca to call malloc; some of + them are very simple, and don't have an xmalloc routine. + + Non-Emacs programs expect this to call xmalloc. + + Callers below should use malloc. */ + +extern pointer malloc (); + +/* Define STACK_DIRECTION if you know the direction of stack + growth for your system; otherwise it will be automatically + deduced at run-time. + + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ + +#ifndef STACK_DIRECTION +#define STACK_DIRECTION 0 /* Direction unknown. */ +#endif + +#if STACK_DIRECTION != 0 + +#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ + +#else /* STACK_DIRECTION == 0; need run-time code. */ + +static int stack_dir; /* 1 or -1 once known. */ +#define STACK_DIR stack_dir + +static void +find_stack_direction () +{ + static char *addr = NULL; /* Address of first `dummy', once known. */ + auto char dummy; /* To get stack address. */ + + if (addr == NULL) + { /* Initial entry. */ + addr = ADDRESS_FUNCTION (dummy); + + find_stack_direction (); /* Recurse once. */ + } + else + { + /* Second entry. */ + if (ADDRESS_FUNCTION (dummy) > addr) + stack_dir = 1; /* Stack grew upward. */ + else + stack_dir = -1; /* Stack grew downward. */ + } +} + +#endif /* STACK_DIRECTION == 0 */ + +/* An "alloca header" is used to: + (a) chain together all alloca'ed blocks; + (b) keep track of stack depth. + + It is very important that sizeof(header) agree with malloc + alignment chunk size. The following default should work okay. */ + +#ifndef ALIGN_SIZE +#define ALIGN_SIZE sizeof(double) +#endif + +typedef union hdr +{ + char align[ALIGN_SIZE]; /* To force sizeof(header). */ + struct + { + union hdr *next; /* For chaining headers. */ + char *deep; /* For stack depth measure. */ + } h; +} header; + +static header *last_alloca_header = NULL; /* -> last alloca header. */ + +/* Return a pointer to at least SIZE bytes of storage, + which will be automatically reclaimed upon exit from + the procedure that called alloca. Originally, this space + was supposed to be taken from the current stack frame of the + caller, but that method cannot be made to work for some + implementations of C, for example under Gould's UTX/32. */ + +pointer +alloca (size) + unsigned size; +{ + auto char probe; /* Probes stack depth: */ + register char *depth = ADDRESS_FUNCTION (probe); + +#if STACK_DIRECTION == 0 + if (STACK_DIR == 0) /* Unknown growth direction. */ + find_stack_direction (); +#endif + + /* Reclaim garbage, defined as all alloca'd storage that + was allocated from deeper in the stack than currently. */ + + { + register header *hp; /* Traverses linked list. */ + +#ifdef emacs + BLOCK_INPUT; +#endif + + for (hp = last_alloca_header; hp != NULL;) + if ((STACK_DIR > 0 && hp->h.deep > depth) + || (STACK_DIR < 0 && hp->h.deep < depth)) + { + register header *np = hp->h.next; + + free ((pointer) hp); /* Collect garbage. */ + + hp = np; /* -> next header. */ + } + else + break; /* Rest are not deeper. */ + + last_alloca_header = hp; /* -> last valid storage. */ + +#ifdef emacs + UNBLOCK_INPUT; +#endif + } + + if (size == 0) + return NULL; /* No allocation required. */ + + /* Allocate combined header + user data storage. */ + + { + register pointer new = malloc (sizeof (header) + size); + /* Address of header. */ + + ((header *) new)->h.next = last_alloca_header; + ((header *) new)->h.deep = depth; + + last_alloca_header = (header *) new; + + /* User storage begins just after header. */ + + return (pointer) ((char *) new + sizeof (header)); + } +} + +#if defined (CRAY) && defined (CRAY_STACKSEG_END) + +#ifdef DEBUG_I00AFUNC +#include <stdio.h> +#endif + +#ifndef CRAY_STACK +#define CRAY_STACK +#ifndef CRAY2 +/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ +struct stack_control_header + { + long shgrow:32; /* Number of times stack has grown. */ + long shaseg:32; /* Size of increments to stack. */ + long shhwm:32; /* High water mark of stack. */ + long shsize:32; /* Current size of stack (all segments). */ + }; + +/* The stack segment linkage control information occurs at + the high-address end of a stack segment. (The stack + grows from low addresses to high addresses.) The initial + part of the stack segment linkage control information is + 0200 (octal) words. This provides for register storage + for the routine which overflows the stack. */ + +struct stack_segment_linkage + { + long ss[0200]; /* 0200 overflow words. */ + long sssize:32; /* Number of words in this segment. */ + long ssbase:32; /* Offset to stack base. */ + long:32; + long sspseg:32; /* Offset to linkage control of previous + segment of stack. */ + long:32; + long sstcpt:32; /* Pointer to task common address block. */ + long sscsnm; /* Private control structure number for + microtasking. */ + long ssusr1; /* Reserved for user. */ + long ssusr2; /* Reserved for user. */ + long sstpid; /* Process ID for pid based multi-tasking. */ + long ssgvup; /* Pointer to multitasking thread giveup. */ + long sscray[7]; /* Reserved for Cray Research. */ + long ssa0; + long ssa1; + long ssa2; + long ssa3; + long ssa4; + long ssa5; + long ssa6; + long ssa7; + long sss0; + long sss1; + long sss2; + long sss3; + long sss4; + long sss5; + long sss6; + long sss7; + }; + +#else /* CRAY2 */ +/* The following structure defines the vector of words + returned by the STKSTAT library routine. */ +struct stk_stat + { + long now; /* Current total stack size. */ + long maxc; /* Amount of contiguous space which would + be required to satisfy the maximum + stack demand to date. */ + long high_water; /* Stack high-water mark. */ + long overflows; /* Number of stack overflow ($STKOFEN) calls. */ + long hits; /* Number of internal buffer hits. */ + long extends; /* Number of block extensions. */ + long stko_mallocs; /* Block allocations by $STKOFEN. */ + long underflows; /* Number of stack underflow calls ($STKRETN). */ + long stko_free; /* Number of deallocations by $STKRETN. */ + long stkm_free; /* Number of deallocations by $STKMRET. */ + long segments; /* Current number of stack segments. */ + long maxs; /* Maximum number of stack segments so far. */ + long pad_size; /* Stack pad size. */ + long current_address; /* Current stack segment address. */ + long current_size; /* Current stack segment size. This + number is actually corrupted by STKSTAT to + include the fifteen word trailer area. */ + long initial_address; /* Address of initial segment. */ + long initial_size; /* Size of initial segment. */ + }; + +/* The following structure describes the data structure which trails + any stack segment. I think that the description in 'asdef' is + out of date. I only describe the parts that I am sure about. */ + +struct stk_trailer + { + long this_address; /* Address of this block. */ + long this_size; /* Size of this block (does not include + this trailer). */ + long unknown2; + long unknown3; + long link; /* Address of trailer block of previous + segment. */ + long unknown5; + long unknown6; + long unknown7; + long unknown8; + long unknown9; + long unknown10; + long unknown11; + long unknown12; + long unknown13; + long unknown14; + }; + +#endif /* CRAY2 */ +#endif /* not CRAY_STACK */ + +#ifdef CRAY2 +/* Determine a "stack measure" for an arbitrary ADDRESS. + I doubt that "lint" will like this much. */ + +static long +i00afunc (long *address) +{ + struct stk_stat status; + struct stk_trailer *trailer; + long *block, size; + long result = 0; + + /* We want to iterate through all of the segments. The first + step is to get the stack status structure. We could do this + more quickly and more directly, perhaps, by referencing the + $LM00 common block, but I know that this works. */ + + STKSTAT (&status); + + /* Set up the iteration. */ + + trailer = (struct stk_trailer *) (status.current_address + + status.current_size + - 15); + + /* There must be at least one stack segment. Therefore it is + a fatal error if "trailer" is null. */ + + if (trailer == 0) + abort (); + + /* Discard segments that do not contain our argument address. */ + + while (trailer != 0) + { + block = (long *) trailer->this_address; + size = trailer->this_size; + if (block == 0 || size == 0) + abort (); + trailer = (struct stk_trailer *) trailer->link; + if ((block <= address) && (address < (block + size))) + break; + } + + /* Set the result to the offset in this segment and add the sizes + of all predecessor segments. */ + + result = address - block; + + if (trailer == 0) + { + return result; + } + + do + { + if (trailer->this_size <= 0) + abort (); + result += trailer->this_size; + trailer = (struct stk_trailer *) trailer->link; + } + while (trailer != 0); + + /* We are done. Note that if you present a bogus address (one + not in any segment), you will get a different number back, formed + from subtracting the address of the first block. This is probably + not what you want. */ + + return (result); +} + +#else /* not CRAY2 */ +/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. + Determine the number of the cell within the stack, + given the address of the cell. The purpose of this + routine is to linearize, in some sense, stack addresses + for alloca. */ + +static long +i00afunc (long address) +{ + long stkl = 0; + + long size, pseg, this_segment, stack; + long result = 0; + + struct stack_segment_linkage *ssptr; + + /* Register B67 contains the address of the end of the + current stack segment. If you (as a subprogram) store + your registers on the stack and find that you are past + the contents of B67, you have overflowed the segment. + + B67 also points to the stack segment linkage control + area, which is what we are really interested in. */ + + stkl = CRAY_STACKSEG_END (); + ssptr = (struct stack_segment_linkage *) stkl; + + /* If one subtracts 'size' from the end of the segment, + one has the address of the first word of the segment. + + If this is not the first segment, 'pseg' will be + nonzero. */ + + pseg = ssptr->sspseg; + size = ssptr->sssize; + + this_segment = stkl - size; + + /* It is possible that calling this routine itself caused + a stack overflow. Discard stack segments which do not + contain the target address. */ + + while (!(this_segment <= address && address <= stkl)) + { +#ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); +#endif + if (pseg == 0) + break; + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + this_segment = stkl - size; + } + + result = address - this_segment; + + /* If you subtract pseg from the current end of the stack, + you get the address of the previous stack segment's end. + This seems a little convoluted to me, but I'll bet you save + a cycle somewhere. */ + + while (pseg != 0) + { +#ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o\n", pseg, size); +#endif + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + result += size; + } + return (result); +} + +#endif /* not CRAY2 */ +#endif /* CRAY */ + +#endif /* no alloca */ +#endif /* not GCC version 2 */ + +#endif /* !HAVE_ALLOCA */ diff --git a/lib/getenv.c b/lib/getenv.c new file mode 100644 index 0000000..c450659 --- /dev/null +++ b/lib/getenv.c @@ -0,0 +1,18 @@ +#include "../include/sane/config.h" + +#ifndef HAVE_GETENV + +char * +getenv(const char *name) +{ + char *retval = 0; +#ifdef HAVE_OS2_H + if (0 != DosScanEnv (buf, &retval)) + retval = 0; +#else +# error "Missing getenv() on this platform. Please implement." +#endif + return retval; +} + +#endif /* !HAVE_GETENV */ diff --git a/lib/getopt.c b/lib/getopt.c new file mode 100644 index 0000000..8b42321 --- /dev/null +++ b/lib/getopt.c @@ -0,0 +1,831 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. + Ditto for AIX 3.2 and <stdlib.h>. */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include <../include/sane/config.h> +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include <stdlib.h> +#if defined (_LIBC) || defined (HAVE_UNISTD_H) +#include <unistd.h> +#endif +#endif /* GNU C library. */ + +#ifdef VMS +#include <unixlib.h> +#if HAVE_STRING_H - 0 +#include <string.h> +#endif +#endif + +#ifdef WIN32 +/* It's not Unix, really. See? Capital letters. */ +#include <windows.h> +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include <libintl.h> +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include <string.h> +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +static const char *nonoption_flags; +static int nonoption_flags_len; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (const char *); +#endif +static const char * +_getopt_initialize (optstring) + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + if (posixly_correct == NULL) + { + /* Bash 2.0 puts a special variable in the environment for each + command it runs, specifying which ARGV elements are the results of + file name wildcard expansion and therefore should not be + considered as options. */ + char var[100]; + sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); + nonoption_flags = getenv (var); + if (nonoption_flags == NULL) + nonoption_flags_len = 0; + else + nonoption_flags_len = strlen (nonoption_flags); + } + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0) + { + optstring = _getopt_initialize (optstring); + optind = 1; /* Don't scan ARGV[0], the program name. */ + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. */ +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && nonoption_flags[optind] == '1')) + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + +#ifdef lint /* Suppress `used before initialized' warning. */ + indfound = 0; +#endif + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if (nameend - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/getopt1.c b/lib/getopt1.c new file mode 100644 index 0000000..140ea10 --- /dev/null +++ b/lib/getopt1.c @@ -0,0 +1,180 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include <../include/sane/config.h> +#endif + +#include "getopt.h" + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include <stdlib.h> +#else +char *getenv (); +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +#include <stdio.h> + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/isfdtype.c b/lib/isfdtype.c new file mode 100644 index 0000000..8e51516 --- /dev/null +++ b/lib/isfdtype.c @@ -0,0 +1,25 @@ +#include "../include/sane/config.h" + +#ifndef HAVE_ISFDTYPE + +#include <sys/stat.h> + +int +isfdtype(int fd, int fdtype) +{ + struct stat st; + + if (fstat(fd, &st) == -1) return 0; /* couldn't stat fd */ + + if (st.st_mode == 0) + return 1; /* At least Irix doesn't seem to know socket type */ +#if defined(S_ISSOCK) + return S_ISSOCK(st.st_mode) != 0; +#elif defined(S_IFSOCK) && defined(S_IFMT) + return (st.st_mode & S_IFMT) == S_IFSOCK; +#else + return 0; +#endif +} + +#endif /* !HAVE_ISFDTYPE */ diff --git a/lib/snprintf.c b/lib/snprintf.c new file mode 100644 index 0000000..6f6f8bb --- /dev/null +++ b/lib/snprintf.c @@ -0,0 +1,532 @@ +#include <../include/sane/config.h> + +#ifndef HAVE_SNPRINTF + +/*************************************************************************** + * LPRng - An Extended Print Spooler System + * + * Copyright 1988-1997, Patrick Powell, San Diego, CA + * papowell@sdsu.edu + * See below for conditions of use. + * + *************************************************************************** + * MODULE: snprintf.c + * PURPOSE: LPRng version of printf - absolutely bombproof (hopefully!) + **************************************************************************/ +#if 0 + + The "Artistic License" + + Preamble + +The intent of this document is to state the conditions under which a +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to make +reasonable modifications. + +Definitions: + + "Package" refers to the collection of files distributed by the + Copyright Holder, and derivatives of that collection of files + created through textual modification. + + "Standard Version" refers to such a Package if it has not been + modified, or has been modified in accordance with the wishes + of the Copyright Holder as specified below. + + "Copyright Holder" is whoever is named in the copyright or + copyrights for the package. + + "You" is you, if you are thinking about copying or distributing + this Package. + + "Reasonable copying fee" is whatever you can justify on the + basis of media cost, duplication charges, time of people involved, + and so on. (You will not be required to justify it to the + Copyright Holder, but only to the computing community at large + as a market that must bear the fee.) + + "Freely Available" means that no fee is charged for the item + itself, though there may be fees involved in handling the item. + It also means that recipients of the item may redistribute it + under the same conditions they received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A Package +modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least ONE of the +following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or + an equivalent medium, or placing the modifications on a major archive + site such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided, and provide + a separate manual page for each non-standard executable that clearly + documents how it differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or +executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + + b) accompany the distribution with the machine-readable source of + the Package with your modifications. + + c) give non-standard executables non-standard names, and clearly + document the differences in manual pages (or equivalent), together + with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this +Package. You may not charge a fee for this Package itself. However, +you may distribute this Package in aggregate with other (possibly +commercial) programs as part of a larger (possibly commercial) software +distribution provided that you do not advertise this Package as a +product of your own. + +6. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +7. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + The End +#include "lp.h" +#endif + +#include <stdarg.h> +#include <errno.h> +#include <sys/types.h> +#define HAVE_STDARGS /* let's hope that works everywhere (mj) */ +#define VA_LOCAL_DECL va_list ap; +#define VA_START(f) va_start(ap, f) +#define VA_SHIFT(v,t) ; /* no-op for ANSI */ +#define VA_END va_end(ap) + +/**** ENDINCLUDE ****/ + +static char *const _id = "$Id: snprintf.c,v 1.2 2001/08/03 21:32:56 hmg Exp $"; + +/* + * dopr(): poor man's version of doprintf + */ + +static char * plp_Errormsg ( int err ); +static void dopr( char *buffer, const char *format, va_list args ); +static void fmtstr( char *value, int ljust, int len, int zpad, int precision ); +static void fmtnum( long value, int base, int dosign, + int ljust, int len, int zpad, int precision ); +static void fmtdouble( int fmt, double value, + int ljust, int len, int zpad, int precision ); +static void dostr( char * ); +static char *output; +static void dopr_outch( int c ); +static char *end; +int visible_control = 1; + +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * plp_snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + **************************************************************/ + +int vsnprintf(char *str, size_t count, const char *fmt, va_list args) +{ + str[0] = 0; + end = str+count-1; + dopr( str, fmt, args ); + if( count>0 ){ + end[0] = 0; + } + return(strlen(str)); +} + +/* VARARGS3 */ +#ifdef HAVE_STDARGS +int snprintf (char *str,size_t count,const char *fmt,...) +#else +int snprintf (va_alist) va_dcl +#endif +{ +#ifndef HAVE_STDARGS + char *str; + size_t count; + char *fmt; +#endif + VA_LOCAL_DECL + + VA_START (fmt); + VA_SHIFT (str, char *); + VA_SHIFT (count, size_t ); + VA_SHIFT (fmt, char *); + (void) vsnprintf ( str, count, fmt, ap); + VA_END; + return( strlen( str ) ); +} + +static void dopr( char *buffer, const char *format, va_list args ) +{ + int ch; + long value; + int longflag = 0; + char *strvalue; + int ljust; + int len; + int zpad; + int precision; + int set_precision; + double dval; + int err = errno; + + output = buffer; + while( (ch = *format++) ){ + switch( ch ){ + case '%': + ljust = len = zpad = 0; + precision = -1; set_precision = 0; + nextch: + ch = *format++; + switch( ch ){ + case 0: + dostr( "**end of format**" ); + return; + case '-': ljust = 1; goto nextch; + case '.': set_precision = 1; precision = 0; goto nextch; + case '*': len = va_arg( args, int ); goto nextch; + case '0': /* set zero padding if len not set */ + if(len==0 && set_precision == 0 ) zpad = '0'; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + if( set_precision ){ + precision = precision*10 + ch - '0'; + } else { + len = len*10 + ch - '0'; + } + goto nextch; + case 'l': longflag = 1; goto nextch; + case 'u': case 'U': + /*fmtnum(value,base,dosign,ljust,len, zpad, precision) */ + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 10,0, ljust, len, zpad, precision ); break; + case 'o': case 'O': + /*fmtnum(value,base,dosign,ljust,len, zpad, precision) */ + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 8,0, ljust, len, zpad, precision ); break; + case 'd': case 'D': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 10,1, ljust, len, zpad, precision ); break; + case 'x': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 16,0, ljust, len, zpad, precision ); break; + case 'X': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value,-16,0, ljust, len, zpad, precision ); break; + case 's': + strvalue = va_arg( args, char *); + fmtstr( strvalue,ljust,len, zpad, precision ); + break; + case 'c': + ch = va_arg( args, int ); + { char b[2]; + int vsb = visible_control; + b[0] = ch; + b[1] = 0; + visible_control = 0; + fmtstr( b,ljust,len, zpad, precision ); + visible_control = vsb; + } + break; + case 'f': case 'g': + dval = va_arg( args, double ); + fmtdouble( ch, dval,ljust,len, zpad, precision ); break; + case 'm': + fmtstr( plp_Errormsg(err),ljust,len, zpad, precision ); break; + case '%': dopr_outch( ch ); continue; + default: + dostr( "???????" ); + } + longflag = 0; + break; + default: + dopr_outch( ch ); + break; + } + } + *output = 0; +} + +/* + * Format '%[-]len[.precision]s' + * - = left justify (ljust) + * len = minimum length + * precision = numbers of chars in string to use + */ +static void +fmtstr( char *value, int ljust, int len, int zpad, int precision ) +{ + int padlen, strlen, i, c; /* amount to pad */ + + if( value == 0 ){ + value = "<NULL>"; + } + if( precision > 0 ){ + strlen = precision; + } else { + /* cheap strlen so you do not have library call */ + for( strlen = 0; (c=value[strlen]); ++ strlen ){ + if( visible_control && iscntrl( c ) && !isspace( c ) ){ + ++strlen; + } + } + } + padlen = len - strlen; + if( padlen < 0 ) padlen = 0; + if( ljust ) padlen = -padlen; + while( padlen > 0 ) { + dopr_outch( ' ' ); + --padlen; + } + /* output characters */ + for( i = 0; (c = value[i]); ++i ){ + if( visible_control && iscntrl( c ) && !isspace( c ) ){ + dopr_outch('^'); + c = ('@' | (c & 0x1F)); + } + dopr_outch(c); + } + while( padlen < 0 ) { + dopr_outch( ' ' ); + ++padlen; + } +} + +static void +fmtnum( long value, int base, int dosign, int ljust, + int len, int zpad, int precision ) +{ + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int padlen = 0; /* amount to pad */ + int caps = 0; + + /* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n", + value, base, dosign, ljust, len, zpad )); */ + uvalue = value; + if( dosign ){ + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } + } + if( base < 0 ){ + caps = 1; + base = -base; + } + do{ + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + }while(uvalue); + convert[place] = 0; + padlen = len - place; + if( padlen < 0 ) padlen = 0; + if( ljust ) padlen = -padlen; + /* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n", + convert,place,signvalue,padlen)); */ + if( zpad && padlen > 0 ){ + if( signvalue ){ + dopr_outch( signvalue ); + --padlen; + signvalue = 0; + } + while( padlen > 0 ){ + dopr_outch( zpad ); + --padlen; + } + } + while( padlen > 0 ) { + dopr_outch( ' ' ); + --padlen; + } + if( signvalue ) dopr_outch( signvalue ); + while( place > 0 ) dopr_outch( convert[--place] ); + while( padlen < 0 ){ + dopr_outch( ' ' ); + ++padlen; + } +} + +static void +fmtdouble( int fmt, double value, int ljust, int len, int zpad, int precision ) +{ + char convert[128]; + char fmtstr[128]; + int l; + + if( len == 0 ) len = 10; + if( len > sizeof(convert) - 10 ){ + len = sizeof(convert) - 10; + } + if( precision > sizeof(convert) - 10 ){ + precision = sizeof(convert) - 10; + } + if( precision > len ) precision = len; + strcpy( fmtstr, "%" ); + if( ljust ) strcat(fmtstr, "-" ); + if( len ){ + sprintf( fmtstr+strlen(fmtstr), "%d", len ); + } + if( precision > 0 ){ + sprintf( fmtstr+strlen(fmtstr), ".%d", precision ); + } + l = strlen( fmtstr ); + fmtstr[l] = fmt; + fmtstr[l+1] = 0; + sprintf( convert, fmtstr, value ); + dostr( convert ); +} + +static void dostr( char *str ) +{ + while(*str) dopr_outch(*str++); +} + +static void dopr_outch( int c ) +{ + if( end == 0 || output < end ){ + *output++ = c; + } +} + + +/**************************************************************************** + * static char *plp_errormsg( int err ) + * returns a printable form of the + * errormessage corresponding to the valie of err. + * This is the poor man's version of sperror(), not available on all systems + * Patrick Powell Tue Apr 11 08:05:05 PDT 1995 + ****************************************************************************/ +/****************************************************************************/ +#if !defined(HAVE_STRERROR) + +# if defined(HAVE_SYS_NERR) +# if !defined(HAVE_SYS_NERR_DEF) + extern int sys_nerr; +# endif +# define num_errors (sys_nerr) +# else +# define num_errors (-1) /* always use "errno=%d" */ +# endif + +# if defined(HAVE_SYS_ERRLIST) +# if !defined(HAVE_SYS_ERRLIST_DEF) + extern const char *const sys_errlist[]; +# endif +# else +# undef num_errors +# define num_errors (-1) /* always use "errno=%d" */ +# endif + +#endif + +static char * plp_Errormsg ( int err ) +{ + char *cp; + +#if defined(HAVE_STRERROR) + cp = (void *)strerror(err); +#else +# if defined(HAVE_SYS_ERRLIST) + if (err >= 0 && err < num_errors) { + cp = (void *)sys_errlist[err]; + } else +# endif + { + static char msgbuf[32]; /* holds "errno=%d". */ + /* SAFE use of sprintf */ + (void) sprintf (msgbuf, "errno=%d", err); + cp = msgbuf; + } +#endif + return (cp); +} + +#if defined(TEST) +#include <stdio.h> +int main( void ) +{ + char buffer[128]; + char *t; + char *test1 = "01234"; + errno = 1; + plp_snprintf( buffer, sizeof(buffer), (t="errno '%m'")); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%s"), test1 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%12s"), test1 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%-12s"), test1 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%12.2s"), test1 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%-12.2s"), test1 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%g"), 1.25 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%g"), 1.2345 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%12g"), 1.25 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%12.2g"), 1.25 ); printf( "%s = '%s'\n", t, buffer ); + plp_snprintf( buffer, sizeof(buffer), (t = "%0*d"), 6, 1 ); printf( "%s = '%s'\n", t, buffer ); + return(0); +} +#endif + + +#endif /* HAVE_SNPRINTF */ diff --git a/lib/strdup.c b/lib/strdup.c new file mode 100644 index 0000000..1286b8e --- /dev/null +++ b/lib/strdup.c @@ -0,0 +1,38 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C 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. + +The GNU C 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 the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <../include/sane/config.h> + +#include <stdlib.h> +#include <string.h> + +#ifndef HAVE_STRDUP + +char * +strdup (const char * s) +{ + char *clone; + size_t size; + + size = strlen (s) + 1; + clone = malloc (size); + memcpy (clone, s, size); + return clone; +} + +#endif /* !HAVE_STRDUP */ diff --git a/lib/strndup.c b/lib/strndup.c new file mode 100644 index 0000000..35c0597 --- /dev/null +++ b/lib/strndup.c @@ -0,0 +1,39 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C 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. + +The GNU C 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 the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <../include/sane/config.h> + +#ifndef HAVE_STRNDUP + +#include <stdlib.h> +#include <string.h> + +#include <sys/types.h> + +char * +strndup (const char * s, size_t n) +{ + char *clone; + + clone = malloc (n + 1); + strncpy (clone, s, n); + clone[n] = '\0'; + return clone; +} + +#endif /* !HAVE_STRNDUP */ diff --git a/lib/strsep.c b/lib/strsep.c new file mode 100644 index 0000000..5ac58ae --- /dev/null +++ b/lib/strsep.c @@ -0,0 +1,49 @@ +/* Copyright (C) 1992, 1993, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C 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. + +The GNU C 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 the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <../include/sane/config.h> + +#include <string.h> + +#ifndef HAVE_STRSEP + +char * +strsep (char **stringp, const char *delim) +{ + char *begin, *end; + + begin = *stringp; + if (! begin || *begin == '\0') + return NULL; + + /* Find the end of the token. */ + end = strpbrk (begin, delim); + if (end) + { + /* Terminate the token and set *STRINGP past NUL character. */ + *end++ = '\0'; + *stringp = end; + } + else + /* No more delimiters; this is the last token. */ + *stringp = NULL; + + return begin; +} + +#endif /* !HAVE_STRSEP */ diff --git a/lib/usleep.c b/lib/usleep.c new file mode 100644 index 0000000..0be9dd0 --- /dev/null +++ b/lib/usleep.c @@ -0,0 +1,64 @@ +/* Copyright (C) 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C 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. + +The GNU C 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 the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifdef __TANDEM +#include <floss.h> +#endif + +#include <../include/sane/config.h> + +#ifndef HAVE_USLEEP + +#include <sys/types.h> +#ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +#endif + +#ifdef HAVE_SYS_SELECT_H +# include <sys/select.h> +#endif + +#ifdef apollo +# include <apollo/base.h> +# include <apollo/time.h> + static time_$clock_t DomainTime100mS = + { + 0, 100000/4 + }; + static status_$t DomainStatus; +#endif + +/* Sleep USECONDS microseconds, or until a previously set timer goes off. */ +unsigned int +usleep (unsigned int useconds) +{ +#ifdef apollo + /* The usleep function does not work under the SYS5.3 environment. + Use the Domain/OS time_$wait call instead. */ + time_$wait (time_$relative, DomainTime100mS, &DomainStatus); +#else + struct timeval delay; + + delay.tv_sec = 0; + delay.tv_usec = useconds; + select (0, 0, 0, 0, &delay); + return 0; +#endif +} + +#endif /* !HAVE_USLEEP */ diff --git a/lib/vsyslog.c b/lib/vsyslog.c new file mode 100644 index 0000000..ce86301 --- /dev/null +++ b/lib/vsyslog.c @@ -0,0 +1,17 @@ +#include "../include/sane/config.h" + +#include "stdio.h" +#include <syslog.h> +#include <stdarg.h> + +#ifndef HAVE_VSYSLOG + +void +vsyslog(int priority, const char *format, va_list args) +{ + char buf[1024]; + vsnprintf(buf, sizeof(buf), format, args); + syslog(priority, "%s", buf); +} + +#endif /* !HAVE_VSYSLOG */ diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..cc8783e --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,36 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/sane-frontends.lsm b/sane-frontends.lsm new file mode 100644 index 0000000..c90bd09 --- /dev/null +++ b/sane-frontends.lsm @@ -0,0 +1,29 @@ +Begin4 +Title: sane-frontends +Version: _VERSION_ +Entered-date: _DATE_ +Description: sane-frontends contains applications for SANE (Scanner Access + Now Easy). This package provides the graphical frontends + xscanimage and xcam. Both use the GTK+ toolkit. xscanimage is + used for scanners, xcam for cameras. xscanimage can also be + used as gimp plugin. The package also provides the command-line + frontend scanadf which is based on scanimage and is intended + for scanners that use automatic document feeders. +Keywords: camera, scanner, sane, frontend, application, ADF +Author: David.Mosberger@acm.org (David Mosberger-Tang) + becka@sunserver1.rz.uni-duesseldorf.de (Andreas Beck) + ttarrant@etnoteam.it (Tristan Tarrant) +Maintained-by: henning@meier-geinitz.de (Henning Meier-Geinitz) + Oliver.Rauch@rauch-domain.de (Oliver Rauch) +Primary-site: ftp.sane-project.org /pub/sane/sane-_VERSION_ + _T_S_ kB sane-frontends-_VERSION_.tar.gz + _L_S_ kB sane-frontends-_VERSION_.lsm +Alternate-site: sunsite.unc.edu /pub/Linux/apps/graphics/capture +Platforms: AIX, Digital Unix, HP Apollo Domain/OS, FreeBSD, HP-UX, IRIX, + Linux (Alpha, m68k, SPARC, x86), NetBSD, OpenBSD, + OpenStep (x86), SCO OpenServer 5.x (x86), OS/2, + Solaris (SPARC, x86), SunOS. + GNU make, sane-backends, and gtk+ is needed. The gimp libraries + are recommended (for usage as gimp-plugin). +Copying-policy: GPL +End diff --git a/sanei/Makefile.in b/sanei/Makefile.in new file mode 100644 index 0000000..eca6cbd --- /dev/null +++ b/sanei/Makefile.in @@ -0,0 +1,95 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +RANLIB = @RANLIB@ + +CC = @CC@ +INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ @SANE_CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +DEFS = @DEFS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +MCOMP = --mode=compile +MLINK = --mode=link + +@SET_MAKE@ + +LIBSANEI_OBJS = sanei_init_debug.o \ + sanei_wire.o sanei_codec_ascii.o sanei_codec_bin.o \ + sanei_save_values.o sanei_load_values.o + +LIBSANEI_LTOBJS = sanei_init_debug.lo \ + sanei_wire.lo sanei_codec_ascii.lo sanei_codec_bin.lo \ + sanei_save_values.lo sanei_load_values.lo + +TARGETS = libsanei.a + +DISTFILES = Makefile.in sanei_codec_ascii.c sanei_codec_bin.c \ + sanei_init_debug.c sanei_load_values.c sanei_save_values.c \ + sanei_thread.c sanei_wire.c + +.PHONY: all install check depend clean distclean uninstall dist + +.SUFFIXES: +.SUFFIXES: .c .o +.c.o: + $(COMPILE) $< + @test -f $@ || $(COMPILE) $< + +all: $(TARGETS) + +libsanei.a: $(LIBSANEI_OBJS) + ar r $@ $(LIBSANEI_OBJS) + $(RANLIB) $@ + +install: + +uninstall: + +depend: + makedepend -I. -I../include *.c + +clean: + rm -f *.out *.o *.lo *~ *.a *.bak $(OBJS) + rm -rf .libs + +distclean: clean + rm -f Makefile + +dist: $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file $(distdir)/sanei 2> /dev/null \ + || cp -p $$file $(distdir)/sanei ; \ + done diff --git a/sanei/sanei_codec_ascii.c b/sanei/sanei_codec_ascii.c new file mode 100644 index 0000000..220d0f4 --- /dev/null +++ b/sanei/sanei_codec_ascii.c @@ -0,0 +1,345 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ + +#include "sane/config.h" + +#include <ctype.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> + +#include <sane/sane.h> +#include "../include/sane/sanei_wire.h" +#include "../include/sane/sanei_codec_ascii.h" + +static const char *hexdigit = "0123456789abcdef"; + +static void +skip_ws (Wire *w) +{ + while (1) + { + sanei_w_space (w, 1); + if (w->status != 0) + return; + + if (!isspace (*w->buffer.curr)) + return; + + ++w->buffer.curr; + } +} + +static unsigned +get_digit (Wire *w) +{ + unsigned digit; + + sanei_w_space (w, 1); + digit = tolower(*w->buffer.curr++) - '0'; + if (digit > 9) + digit -= 'a' - ('9' + 1); + if (digit > 0xf) + { + w->status = EINVAL; + return 0; + } + return digit; +} + +static SANE_Byte +get_byte (Wire *w) +{ + return get_digit (w) << 4 | get_digit (w); +} + +static void +ascii_w_byte (Wire *w, void *v) +{ + SANE_Byte *b = v; + + switch (w->direction) + { + case WIRE_ENCODE: + sanei_w_space (w, 3); + *w->buffer.curr++ = hexdigit[(*b >> 4) & 0x0f]; + *w->buffer.curr++ = hexdigit[(*b >> 0) & 0x0f]; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + skip_ws (w); + *b = get_byte (w); + break; + + case WIRE_FREE: + break; + } +} + +static void +ascii_w_char (Wire *w, void *v) +{ + SANE_Char *c = v; + + switch (w->direction) + { + case WIRE_ENCODE: + sanei_w_space (w, 5); + *w->buffer.curr++ = '\''; + if (*c == '\'' || *c == '\\') + *w->buffer.curr++ = '\\'; + *w->buffer.curr++ = *c; + *w->buffer.curr++ = '\''; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + sanei_w_space (w, 4); + if (*w->buffer.curr++ != '\'') + { + w->status = EINVAL; + return; + } + *c = *w->buffer.curr++; + if (*c == '\\') + { + sanei_w_space (w, 2); + *c = *w->buffer.curr++; + } + if (*w->buffer.curr++ != '\'') + { + w->status = EINVAL; + return; + } + break; + + case WIRE_FREE: + break; + } +} + +static void +ascii_w_string (Wire *w, void *v) +{ + size_t len, alloced_len; + SANE_String *s = v; + char * str, ch; + int done; + + switch (w->direction) + { + case WIRE_ENCODE: + if (*s) + { + sanei_w_space (w, 1); + *w->buffer.curr++ = '"'; + str = *s; + while ((ch = *str++)) + { + sanei_w_space (w, 2); + if (ch == '"' || ch == '\\') + *w->buffer.curr++ = '\\'; + *w->buffer.curr++ = ch; + } + *w->buffer.curr++ = '"'; + } + else + { + sanei_w_space (w, 5); + *w->buffer.curr++ = '('; + *w->buffer.curr++ = 'n'; + *w->buffer.curr++ = 'i'; + *w->buffer.curr++ = 'l'; + *w->buffer.curr++ = ')'; + } + sanei_w_space (w, 1); + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + skip_ws (w); + sanei_w_space (w, 1); + ch = *w->buffer.curr++; + if (ch == '"') + { + alloced_len = len = 0; + str = 0; + done = 0; + do + { + sanei_w_space (w, 1); + if (w->status != 0) + return; + + ch = *w->buffer.curr++; + if (ch == '"') + done = 1; + + if (ch == '\\') + { + sanei_w_space (w, 1); + ch = *w->buffer.curr++; + } + + if (len >= alloced_len) + { + alloced_len += 1024; + if (!str) + str = malloc (alloced_len); + else + str = realloc (str, alloced_len); + + if (str == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + str[len++] = ch; + } + while (!done); + + str[len - 1] = '\0'; + *s = realloc (str, len); + + if (*s == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + return; + } + } + else if (ch == '(') + { + sanei_w_space (w, 4); + if ( *w->buffer.curr++ != 'n' + || *w->buffer.curr++ != 'i' + || *w->buffer.curr++ != 'l' + || *w->buffer.curr++ != ')') + { + w->status = EINVAL; + return; + } + *s = 0; + } + else + { + w->status = EINVAL; + return; + } + break; + + case WIRE_FREE: + if (*s) + free (*s); + break; + } +} + +static void +ascii_w_word (Wire *w, void *v) +{ + SANE_Word val, *word = v; + int i, is_negative = 0; + char buf[16]; + + switch (w->direction) + { + case WIRE_ENCODE: + val = *word; + i = sizeof (buf) - 1; + if (val < 0) + { + is_negative = 1; + val = -val; + } + do + { + buf[i--] = '0' + (val % 10); + val /= 10; + } + while (val); + if (is_negative) + buf[i--] = '-'; + + sanei_w_space (w, sizeof (buf) - i); + memcpy (w->buffer.curr, buf + i + 1, sizeof (buf) - i - 1); + w->buffer.curr += sizeof (buf) - i - 1; + *w->buffer.curr++ = '\n'; + break; + + case WIRE_DECODE: + skip_ws (w); + val = 0; + sanei_w_space (w, 1); + if (*w->buffer.curr == '-') + { + is_negative = 1; + ++w->buffer.curr; + } + while (1) + { + sanei_w_space (w, 1); + if (w->status != 0) + return; + + if (!isdigit (*w->buffer.curr)) + break; + + val = 10*val + (*w->buffer.curr++ - '0'); + } + *word = is_negative ? -val : val; + break; + + case WIRE_FREE: + break; + } +} + +void +sanei_codec_ascii_init (Wire *w) +{ + w->codec.w_byte = ascii_w_byte; + w->codec.w_char = ascii_w_char; + w->codec.w_word = ascii_w_word; + w->codec.w_string = ascii_w_string; +} diff --git a/sanei/sanei_codec_bin.c b/sanei/sanei_codec_bin.c new file mode 100644 index 0000000..4347825 --- /dev/null +++ b/sanei/sanei_codec_bin.c @@ -0,0 +1,139 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ + +#include "sane/config.h" + +#include <errno.h> +#include <stdlib.h> +#include <string.h> + +#include <sane/sane.h> +#include "../include/sane/sanei_wire.h" +#include "../include/sane/sanei_codec_bin.h" + +static void +bin_w_byte (Wire *w, void *v) +{ + SANE_Byte *b = v; + + sanei_w_space (w, 1); + if (w->status) + return; + + switch (w->direction) + { + case WIRE_ENCODE: + *w->buffer.curr++ = *b; + break; + + case WIRE_DECODE: + *b = *w->buffer.curr++; + break; + + case WIRE_FREE: + break; + } +} + +static void +bin_w_string (Wire *w, void *v) +{ + SANE_Word len; + SANE_String *s = v; + + if (w->direction != WIRE_DECODE) + { + len = 0; + if (*s) + len = strlen (*s) + 1; + } + sanei_w_array (w, &len, v, w->codec.w_byte, 1); + + if (w->direction == WIRE_DECODE) + { + if (len == 0) + *s = 0; + else if (w->status == 0) + *(*s + len - 1) = '\0'; + } +} + +static void +bin_w_word (Wire *w, void *v) +{ + SANE_Word val, *word = v; + + sanei_w_space (w, 4); + if (w->status) + return; + switch (w->direction) + { + case WIRE_ENCODE: + val = *word; + /* store in bigendian byte-order: */ + w->buffer.curr[0] = (val >> 24) & 0xff; + w->buffer.curr[1] = (val >> 16) & 0xff; + w->buffer.curr[2] = (val >> 8) & 0xff; + w->buffer.curr[3] = (val >> 0) & 0xff; + w->buffer.curr += 4; + break; + + case WIRE_DECODE: + val = ( ((w->buffer.curr[0] & 0xff) << 24) + | ((w->buffer.curr[1] & 0xff) << 16) + | ((w->buffer.curr[2] & 0xff) << 8) + | ((w->buffer.curr[3] & 0xff) << 0)); + *word = val; + w->buffer.curr += 4; + break; + + case WIRE_FREE: + break; + } +} + +void +sanei_codec_bin_init (Wire *w) +{ + w->codec.w_byte = bin_w_byte; + w->codec.w_char = bin_w_byte; + w->codec.w_word = bin_w_word; + w->codec.w_string = bin_w_string; +} diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c new file mode 100644 index 0000000..62fed63 --- /dev/null +++ b/sanei/sanei_init_debug.c @@ -0,0 +1,133 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Beck + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ + +#include "sane/config.h" + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <string.h> +#include <stdarg.h> +#include <syslog.h> +#ifdef HAVE_OS2_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#include <sys/stat.h> + +#ifdef HAVE_OS2_H +# define INCL_DOS +# include <os2.h> +#endif + +#define BACKEND_NAME sanei_debug +#include "../include/sane/sanei_debug.h" + +void +sanei_init_debug (const char * backend, int * var) +{ + char ch, buf[256] = "SANE_DEBUG_"; + const char * val; + unsigned int i; + + *var = 0; + + for (i = 11; (ch = backend[i - 11]) != 0; ++i) + { + if (i >= sizeof (buf) - 1) + break; + buf[i] = toupper(ch); + } + buf[i] = '\0'; + + val = getenv (buf); + + if (!val) + return; + + *var = atoi (val); + + DBG (0, "Setting debug level of %s to %d.\n", backend, *var); +} + +void +sanei_debug_msg + (int level, int max_level, const char *be, const char *fmt, va_list ap) +{ + char *msg; + + if (max_level >= level) + { + if ( 1 == isfdtype(fileno(stderr), S_IFSOCK) ) + { + msg = (char *)malloc (sizeof(char) * (strlen(be) + strlen(fmt) + 4)); + if (msg == NULL) + { + syslog (LOG_DEBUG, "[sanei_debug] malloc() failed\n"); + vsyslog (LOG_DEBUG, fmt, ap); + } + else + { + sprintf (msg, "[%s] %s", be, fmt); + vsyslog(LOG_DEBUG, msg, ap); + free (msg); + } + } + else + { + fprintf (stderr, "[%s] ", be); + vfprintf (stderr, fmt, ap); + } + + } +} + +#ifdef NDEBUG +void +sanei_debug_ndebug (int level, const char *fmt, ...) +{ + /* this function is never called */ +} +#endif diff --git a/sanei/sanei_load_values.c b/sanei/sanei_load_values.c new file mode 100644 index 0000000..01c8e42 --- /dev/null +++ b/sanei/sanei_load_values.c @@ -0,0 +1,207 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. + + This file implements a routine to restore option values saved to a + file (using sanei_save_values()). This is a bit tricky since + setting an option may change the availability of other options. + The problem is that we don't know the order of the set-value calls + that resulted in the saved set of option values. One solution + might be to simply keep setting all option values until we no + longer get any changes to the option value set. However, that has + the potential for live-lock. Instead, we keep track of what + options caused a SANE_INFO_RELOAD_OPTIONS. For such options, their + value is set exactly once. This guarantees convergence after a + bounded (and usually small) number of iterations. The resulting + value set is guaranteed to be the desired (saved) one as long as + setting an option that affects availability of other options does + not "lose" its value by setting another option. I don't think any + sane backend would do this and since this is SANE, we just proved + that this algorithm works perfectly. */ + +#ifdef __TANDEM +#include <floss.h> +#endif + +#ifdef _AIX +# include <lalloca.h> /* MUST come first for AIX! */ +#endif + +#include "sane/config.h" +#include <lalloca.h> + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#ifdef HAVE_LIBC_H +# include <libc.h> /* NeXTStep/OpenStep */ +#endif + +#include <sane/sane.h> +#include "../include/sane/sanei_wire.h" +#include "../include/sane/sanei_codec_ascii.h" + +#define BITS_PER_LONG (8*sizeof (u_long)) + +#define SET(set, bit) \ + ((set)[(bit)/BITS_PER_LONG] |= (1UL << (bit)%BITS_PER_LONG)) +#define IS_SET(set, bit) \ + (((set)[(bit)/BITS_PER_LONG] & (1UL << (bit)%BITS_PER_LONG)) != 0) + +int +sanei_load_values (int fd, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + SANE_Word *word_array; + SANE_String name, str; + u_long *caused_reload; + SANE_Int num_options; + SANE_Status status; + int i, keep_going; + SANE_Word word; + SANE_Int info; + off_t offset; + size_t size; + char *buf; + Wire w; + + offset = lseek (fd, 0, SEEK_CUR); + w.io.fd = fd; +#ifdef __TANDEM + w.io.read = floss_read; + w.io.write = floss_write; +#else + w.io.read = read; + w.io.write = write; +#endif + sanei_w_init (&w, sanei_codec_ascii_init); + sanei_w_set_dir (&w, WIRE_DECODE); + keep_going = 0; + + sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_options, 0); + size = (num_options + BITS_PER_LONG - 1) / BITS_PER_LONG * sizeof (long); + caused_reload = alloca (size); + memset (caused_reload, 0, size); + + while (1) + { + sanei_w_space (&w, 3); + + if (!w.status) + sanei_w_string (&w, &name); + + if (w.status) + { + if (keep_going) + { + lseek (fd, offset, SEEK_SET); + sanei_w_set_dir (&w, WIRE_DECODE); + keep_going = 0; + continue; + } + return 0; + } + + status = SANE_STATUS_GOOD; + info = 0; + for (i = 1; (opt = sane_get_option_descriptor (device, i)); ++i) + { + if (!opt->name || strcmp (opt->name, name) != 0) + continue; + + if (IS_SET(caused_reload, i)) + continue; + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof (SANE_Word)) + { + sanei_w_word (&w, &word); + status = sane_control_option (device, i, + SANE_ACTION_SET_VALUE, + &word, &info); + } + else + { + SANE_Int len; + + sanei_w_array (&w, &len, (void **) &word_array, + (WireCodecFunc) sanei_w_word, + sizeof (SANE_Word)); + status = sane_control_option (device, i, + SANE_ACTION_SET_VALUE, + word_array, &info); + w.direction = WIRE_FREE; + sanei_w_array (&w, &len, (void **) &word_array, + (WireCodecFunc) sanei_w_word, + sizeof (SANE_Word)); + w.direction = WIRE_DECODE; + } + break; + + case SANE_TYPE_STRING: + sanei_w_string (&w, &str); + buf = malloc (opt->size); + strncpy (buf, str, opt->size); + buf[opt->size - 1] = '\0'; + sanei_w_free (&w, (WireCodecFunc) sanei_w_string, &str); + + status = sane_control_option (device, i, SANE_ACTION_SET_VALUE, + buf, &info); + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + break; + } + break; + } + sanei_w_free (&w, (WireCodecFunc) sanei_w_string, &name); + + if (status == SANE_STATUS_GOOD && (info & SANE_INFO_RELOAD_OPTIONS)) + { + SET (caused_reload, i); + keep_going = 1; + } + } + return 0; +} diff --git a/sanei/sanei_save_values.c b/sanei/sanei_save_values.c new file mode 100644 index 0000000..195947c --- /dev/null +++ b/sanei/sanei_save_values.c @@ -0,0 +1,169 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ + +#ifdef __TANDEM +#include <floss.h> +#endif + +#include "sane/config.h" + +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#ifdef HAVE_LIBC_H +# include <libc.h> /* NeXTStep/OpenStep */ +#endif + +#include <sane/sane.h> +#include "../include/sane/sanei_wire.h" +#include "../include/sane/sanei_codec_ascii.h" + +int +sanei_save_values (int fd, SANE_Handle device) +{ + const SANE_Option_Descriptor *opt; + size_t word_array_size = 0; + SANE_Word *word_array = 0; + size_t str_size = 0; + SANE_String str = 0; + SANE_Word word; + Wire w; + int i; + + w.io.fd = fd; +#ifdef __TANDEM + w.io.read = floss_read; + w.io.write = floss_write; +#else + w.io.read = read; + w.io.write = write; +#endif + sanei_w_init (&w, sanei_codec_ascii_init); + sanei_w_set_dir (&w, WIRE_ENCODE); + + for (i = 0; (opt = sane_get_option_descriptor (device, i)); ++i) + { + if ((opt->cap & (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT)) + != (SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT) + || !opt->name) + /* if we can't query AND set the option, don't bother saving it */ + continue; + + switch (opt->type) + { + case SANE_TYPE_BOOL: + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + if (opt->size == sizeof (SANE_Word)) + { + if (sane_control_option (device, i, SANE_ACTION_GET_VALUE, + &word, 0) + != SANE_STATUS_GOOD) + continue; + sanei_w_string (&w, (SANE_String *) &opt->name); + sanei_w_word (&w, &word); + } + else + { + SANE_Int len = opt->size / sizeof (SANE_Word); + + if (opt->size > word_array_size) + { + word_array_size = + ((opt->size + 32*sizeof (SANE_Word)) + & ~(32*sizeof (SANE_Word) - 1)); + if (word_array) + word_array = realloc (word_array, word_array_size); + else + word_array = malloc (word_array_size); + + if (word_array == 0) + { + /* Malloc failed, so return an error. */ + w.status = ENOMEM; + return 1; + } + } + if (sane_control_option (device, i, SANE_ACTION_GET_VALUE, + word_array, 0) + != SANE_STATUS_GOOD) + continue; + sanei_w_string (&w, (SANE_String *) &opt->name); + sanei_w_array (&w, &len, (void **) &word_array, + (WireCodecFunc) sanei_w_word, sizeof (SANE_Word)); + } + break; + + case SANE_TYPE_STRING: + if (opt->size > str_size) + { + str_size = (opt->size + 1024) & ~1023; + if (str) + str = realloc (str, str_size); + else + str = malloc (str_size); + + if (str == 0) + { + /* Malloc failed, so return an error. */ + w.status = ENOMEM; + return 1; + } + } + if (sane_control_option (device, i, SANE_ACTION_GET_VALUE, str, 0) + != SANE_STATUS_GOOD) + continue; + sanei_w_string (&w, (SANE_String *) &opt->name); + sanei_w_string (&w, &str); + break; + + case SANE_TYPE_BUTTON: + case SANE_TYPE_GROUP: + break; + } + } + sanei_w_set_dir (&w, WIRE_DECODE); + + if (word_array) + free (word_array); + if (str) + free (str); + return 0; +} diff --git a/sanei/sanei_thread.c b/sanei/sanei_thread.c new file mode 100644 index 0000000..0c95fdb --- /dev/null +++ b/sanei/sanei_thread.c @@ -0,0 +1,425 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1998-2001 Yuri Dario + Copyright (C) 2003-2004 Gerhard Jaeger (pthread/process support) + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. + + OS/2 + Helper functions for the OS/2 port (using threads instead of forked + processes). Don't use them in the backends, they are used automatically by + macros. + + Other OS: + use this lib, if you intend to let run your reader function within its own + task (thread or process). Depending on the OS and/or the configure settings + pthread or fork is used to achieve this goal. +*/ + +#include "sane/config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <signal.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#ifdef HAVE_OS2_H +# define INCL_DOSPROCESS +# include <os2.h> +#endif +#if !defined USE_PTHREAD && !defined HAVE_OS2_H +# include <sys/wait.h> +#endif +#if defined USE_PTHREAD +# include <pthread.h> +#endif + +#define BACKEND_NAME sanei_thread /**< name of this module for debugging */ + +#include <sane/sane.h> +#include "../include/sane/sanei_debug.h" +#include "../include/sane/sanei_thread.h" + +#ifndef _VAR_NOT_USED +# define _VAR_NOT_USED(x) ((x)=(x)) +#endif + +typedef struct { + + int (*func)( void* ); + SANE_Status status; + void *func_data; + +} ThreadDataDef, *pThreadDataDef; + +static ThreadDataDef td; + +/** for init issues - here only for the debug output + */ +void +sanei_thread_init( void ) +{ + DBG_INIT(); + + memset( &td, 0, sizeof(ThreadDataDef)); + td.status = SANE_STATUS_GOOD; +} + +SANE_Bool +sanei_thread_is_forked( void ) +{ +#if defined USE_PTHREAD || defined HAVE_OS2_H + return SANE_FALSE; +#else + return SANE_TRUE; +#endif +} + +int +sanei_thread_kill( int pid ) +{ + DBG(2, "sanei_thread_kill() will kill %d\n", (int)pid); +#ifdef USE_PTHREAD +#if defined (__APPLE__) && defined (__MACH__) + return pthread_kill((pthread_t)pid, SIGUSR2); +#else + return pthread_cancel((pthread_t)pid); +#endif +#elif defined HAVE_OS2_H + return DosKillThread(pid); +#else + return kill( pid, SIGTERM ); +#endif +} + +#ifdef HAVE_OS2_H + +static void +local_thread( void *arg ) +{ + pThreadDataDef ltd = (pThreadDataDef)arg; + + DBG( 2, "thread started, calling func() now...\n" ); + ltd->status = ltd->func( ltd->func_data ); + + DBG( 2, "func() done - status = %d\n", ltd->status ); + _endthread(); +} + +/* + * starts a new thread or process + * parameters: + * star address of reader function + * args pointer to scanner data structure + * + */ +int +sanei_thread_begin( int (*func)(void *args), void* args ) +{ + int pid; + + td.func = func; + td.func_data = args; + + pid = _beginthread( local_thread, NULL, 1024*1024, (void*)&td ); + if ( pid == -1 ) { + DBG( 1, "_beginthread() failed\n" ); + return -1; + } + + DBG( 2, "_beginthread() created thread %d\n", pid ); + return pid; +} + +int +sanei_thread_waitpid( int pid, int *status ) +{ + if (status) + *status = 0; + return pid; /* DosWaitThread( (TID*) &pid, DCWW_WAIT);*/ +} + +int +sanei_thread_sendsig( int pid, int sig ) +{ + return 0; +} + +#else /* HAVE_OS2_H */ + +#ifdef USE_PTHREAD + +/* seems to be undefined in MacOS X */ +#ifndef PTHREAD_CANCELED +# define PTHREAD_CANCELED ((void *) -1) +#endif + +/** + */ +#if defined (__APPLE__) && defined (__MACH__) +static void +thread_exit_handler( int signo ) +{ + DBG( 2, "signal(%i) caught, calling pthread_exit now...\n", signo ); + pthread_exit( PTHREAD_CANCELED ); +} +#endif + + +static void* +local_thread( void *arg ) +{ + static int status; + pThreadDataDef ltd = (pThreadDataDef)arg; + +#if defined (__APPLE__) && defined (__MACH__) + struct sigaction act; + + sigemptyset(&(act.sa_mask)); + act.sa_flags = 0; + act.sa_handler = thread_exit_handler; + sigaction( SIGUSR2, &act, 0 ); +#else + int old; + + pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, &old ); + pthread_setcanceltype ( PTHREAD_CANCEL_ASYNCHRONOUS, &old ); +#endif + + DBG( 2, "thread started, calling func() now...\n" ); + + status = ltd->func( ltd->func_data ); + + /* so sanei_thread_get_status() will work correctly... */ + ltd->status = status; + + DBG( 2, "func() done - status = %d\n", status ); + + /* return the status, so pthread_join is able to get it*/ + pthread_exit((void*)&status ); +} + +/** + */ +static void +restore_sigpipe( void ) +{ + struct sigaction act; + + if( sigaction( SIGPIPE, NULL, &act ) == 0 ) { + + if( act.sa_handler == SIG_IGN ) { + sigemptyset( &act.sa_mask ); + act.sa_flags = 0; + act.sa_handler = SIG_DFL; + + DBG( 2, "restoring SIGPIPE to SIG_DFL\n" ); + sigaction( SIGPIPE, &act, NULL ); + } + } +} + +#else /* the process stuff */ + +static int +eval_wp_result( int pid, int wpres, int pf ) +{ + int retval = SANE_STATUS_IO_ERROR; + + if( wpres == pid ) { + + if( WIFEXITED(pf)) { + retval = WEXITSTATUS(pf); + } else { + + if( !WIFSIGNALED(pf)) { + retval = SANE_STATUS_GOOD; + } else { + DBG( 1, "Child terminated by signal %d\n", WTERMSIG(pf)); + if( WTERMSIG(pf) == SIGTERM ) + retval = SANE_STATUS_GOOD; + } + } + } + return retval; +} +#endif + +int +sanei_thread_begin( int (func)(void *args), void* args ) +{ + int pid; +#ifdef USE_PTHREAD + struct sigaction act; + pthread_t thread; + + /* if signal handler for SIGPIPE is SIG_DFL, replace by SIG_IGN */ + if( sigaction( SIGPIPE, NULL, &act ) == 0 ) { + + if( act.sa_handler == SIG_DFL ) { + sigemptyset( &act.sa_mask ); + act.sa_flags = 0; + act.sa_handler = SIG_IGN; + + DBG( 2, "setting SIGPIPE to SIG_IGN\n" ); + sigaction( SIGPIPE, &act, NULL ); + } + } + + td.func = func; + td.func_data = args; + + pid = pthread_create( &thread, NULL, local_thread, &td ); + usleep( 1 ); + + if ( pid != 0 ) { + DBG( 1, "pthread_create() failed with %d\n", pid ); + return -1; + } + + DBG( 2, "pthread_create() created thread %d\n", (int)thread ); + return (int)thread; +#else + pid = fork(); + if( pid < 0 ) { + DBG( 1, "fork() failed\n" ); + return -1; + } + + if( pid == 0 ) { + + /* run in child context... */ + int status = func( args ); + + /* don't use exit() since that would run the atexit() handlers */ + _exit( status ); + } + + /* parents return */ + return pid; +#endif +} + +int +sanei_thread_sendsig( int pid, int sig ) +{ +#ifdef USE_PTHREAD + DBG(2, "sanei_thread_sendsig() %d to thread(id=%d)\n", sig, pid); + return pthread_kill((pthread_t)pid, sig ); +#else + DBG(2, "sanei_thread_sendsig() %d to process (id=%d)\n", sig, pid); + return kill( pid, sig ); +#endif +} + +int +sanei_thread_waitpid( int pid, int *status ) +{ +#ifdef USE_PTHREAD + int *ls; +#else + int ls; +#endif + int result, stat; + + stat = 0; + + DBG(2, "sanei_thread_waitpid() - %d\n", pid); +#ifdef USE_PTHREAD + result = pthread_join((pthread_t)pid, (void*)&ls ); + + if( 0 == result ) { + if( PTHREAD_CANCELED == ls ) { + DBG(2, "* thread has been canceled!\n" ); + stat = SANE_STATUS_GOOD; + } else { + stat = *ls; + } + DBG(2, "* result = %d (%p)\n", stat, (void*)status ); + result = pid; + } + /* call detach in any case to make sure that the thread resources + * will be freed, when the thread has terminated + */ + DBG(2, "* detaching thread(%d)\n", pid ); + pthread_detach((pthread_t)pid); + if (status) + *status = stat; + + restore_sigpipe(); +#else + result = waitpid( pid, &ls, 0 ); + if((result < 0) && (errno == ECHILD)) { + stat = SANE_STATUS_GOOD; + result = pid; + } else { + stat = eval_wp_result( pid, result, ls ); + DBG(2, "* result = %d (%p)\n", stat, (void*)status ); + } + if( status ) + *status = stat; +#endif + return result; +} + +#endif /* HAVE_OS2_H */ + +SANE_Status +sanei_thread_get_status( int pid ) +{ +#if defined USE_PTHREAD || defined HAVE_OS2_H + _VAR_NOT_USED( pid ); + + return td.status; +#else + int ls, stat, result; + + stat = SANE_STATUS_IO_ERROR; + if( pid > 0 ) { + + result = waitpid( pid, &ls, WNOHANG ); + + stat = eval_wp_result( pid, result, ls ); + } + return stat; +#endif +} + +/* END sanei_thread.c .......................................................*/ diff --git a/sanei/sanei_wire.c b/sanei/sanei_wire.c new file mode 100644 index 0000000..7f56639 --- /dev/null +++ b/sanei/sanei_wire.c @@ -0,0 +1,694 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + 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, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ + +#include "sane/config.h" + +#include <errno.h> +#include <stdlib.h> +#include <string.h> + +#include <sys/types.h> + +#include <sane/sane.h> +#include "../include/sane/sanei_wire.h" + +#define BACKEND_NAME sanei_wire +#include "../include/sane/sanei_debug.h" + +void +sanei_w_space (Wire * w, size_t howmuch) +{ + size_t nbytes, left_over; + int fd = w->io.fd; + ssize_t nread, nwritten; + + DBG (3, "sanei_w_space: %lu bytes for wire %d\n", (u_long) howmuch, fd); + + if (howmuch > w->buffer.size) + DBG (2, "sanei_w_space: bigger than buffer (%lu bytes), " + "may be flush()\n", (u_long) w->buffer.size); + + if (w->status != 0) + { + DBG (1, "sanei_w_space: wire is in invalid state %d\n", + w->status); + return; + } + + if (w->buffer.curr + howmuch > w->buffer.end) + { + DBG (4, "sanei_w_space: free buffer size is %lu\n", + (u_long) (w->buffer.end - w->buffer.curr)); + switch (w->direction) + { + case WIRE_ENCODE: + nbytes = w->buffer.curr - w->buffer.start; + w->buffer.curr = w->buffer.start; + DBG (4, "sanei_w_space: ENCODE: sending %lu bytes\n", + (u_long) nbytes); + while (nbytes > 0) + { + nwritten = (*w->io.write) (fd, w->buffer.curr, nbytes); + if (nwritten < 0) + { + DBG (1, "sanei_w_space: ENCODE: write failed (%d)\n", errno); + w->status = errno; + return; + } + w->buffer.curr += nwritten; + nbytes -= nwritten; + } + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + w->buffer.size; + DBG (4, "sanei_w_space: ENCODE: free buffer is now %lu\n", + (u_long) w->buffer.size); + break; + + case WIRE_DECODE: + left_over = w->buffer.end - w->buffer.curr; + + if ((signed) left_over < 0) + { + DBG (1, "sanei_w_space: DECODE: buffer underflow\n"); + return; + } + + if (left_over) + { + DBG (4, "sanei_w_space: DECODE: %lu bytes left in buffer\n", + (u_long) left_over); + memmove (w->buffer.start, w->buffer.curr, left_over); + } + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + left_over; + + DBG (4, "sanei_w_space: DECODE: receiving data\n"); + do + { + nread = (*w->io.read) (fd, w->buffer.end, + w->buffer.size - left_over); + if (nread <= 0) + { + DBG (2, "sanei_w_space: DECODE: no data received (%d)\n", + errno); + if (nread == 0) + errno = EINVAL; + w->status = errno; + return; + } + left_over += nread; + w->buffer.end += nread; + } + while (left_over < howmuch); + DBG (4, "sanei_w_space: DECODE: %lu bytes read\n", + (u_long) (w->buffer.end - w->buffer.start)); + break; + + case WIRE_FREE: + DBG (4, "sanei_w_space: FREE: doing nothing for free operation\n"); + break; + } + } + DBG (4, "sanei_w_space: done\n"); +} + +void +sanei_w_void (Wire * w) +{ + DBG (3, "sanei_w_void: wire %d (void debug output)\n", w->io.fd); +} + +void +sanei_w_array (Wire * w, SANE_Word * len_ptr, void **v, + WireCodecFunc w_element, size_t element_size) +{ + SANE_Word len; + char *val; + int i; + + DBG (3, "sanei_w_array: wire %d, elements of size %lu\n", w->io.fd, + (u_long) element_size); + + if (w->direction == WIRE_FREE) + { + if (*len_ptr && *v) + { + DBG (4, "sanei_w_array: FREE: freeing array (%d elements)\n", + *len_ptr); + val = *v; + for (i = 0; i < *len_ptr; ++i) + { + (*w_element) (w, val); + val += element_size; + } + free (*v); + w->allocated_memory -= (*len_ptr * element_size); + } + else + DBG (1, "sanei_w_array: FREE: tried to free array but *len_ptr or *v " + "was NULL\n"); + + DBG (4, "sanei_w_array: FREE: done\n"); + return; + } + + if (w->direction == WIRE_ENCODE) + len = *len_ptr; + DBG (4, "sanei_w_array: send/receive array length\n"); + sanei_w_word (w, &len); + + if (w->status) + { + DBG (1, "sanei_w_array: bad status: %d\n", w->status); + return; + } + DBG (4, "sanei_w_array: array has %d elements\n", len); + + if (w->direction == WIRE_DECODE) + { + *len_ptr = len; + if (len) + { + if (((unsigned int) len) > MAX_MEM + || ((unsigned int) len * element_size) > MAX_MEM + || (w->allocated_memory + len * element_size) > MAX_MEM) + { + DBG (0, "sanei_w_array: DECODE: maximum amount of allocated memory " + "exceeded (limit: %u, new allocation: %u, total: %u bytes)\n", + MAX_MEM, len * element_size, MAX_MEM + len * element_size); + w->status = ENOMEM; + return; + } + *v = malloc (len * element_size); + if (*v == 0) + { + /* Malloc failed, so return an error. */ + DBG (1, "sanei_w_array: DECODE: not enough free memory\n"); + w->status = ENOMEM; + return; + } + memset (*v, 0, len * element_size); + w->allocated_memory += (len * element_size); + } + else + *v = 0; + } + + val = *v; + DBG (4, "sanei_w_array: transferring array elements\n"); + for (i = 0; i < len; ++i) + { + (*w_element) (w, val); + val += element_size; + if (w->status) + { + DBG (1, "sanei_w_array: bad status: %d\n", w->status); + return; + } + } + DBG (4, "sanei_w_array: done\n"); +} + +void +sanei_w_ptr (Wire * w, void **v, WireCodecFunc w_value, size_t value_size) +{ + SANE_Word is_null; + + DBG (3, "sanei_w_ptr: wire %d, value pointer at is %lu bytes\n", w->io.fd, + (u_long) value_size); + + if (w->direction == WIRE_FREE) + { + if (*v && value_size) + { + DBG (4, "sanei_w_ptr: FREE: freeing value\n"); + (*w_value) (w, *v); + free (*v); + w->allocated_memory -= value_size; + } + else + DBG (1, "sanei_w_ptr: FREE: tried to free value but *v or value_size " + "was NULL\n"); + + DBG (4, "sanei_w_ptr: FREE: done\n"); + return; + } + if (w->direction == WIRE_ENCODE) + is_null = (*v == 0); + + DBG (4, "sanei_w_ptr: send/receive is_null\n"); + sanei_w_word (w, &is_null); + if (w->status) + { + DBG (1, "sanei_w_ptr: bad status: %d\n", w->status); + return; + } + + if (!is_null) + { + if (w->direction == WIRE_DECODE) + { + DBG (4, "sanei_w_ptr: DECODE: receive data pointed at\n"); + if (value_size > MAX_MEM) + { + DBG (0, "sanei_w_ptr: DECODE: maximum amount of allocated memory " + "exceeded (limit: %u, new allocation: %u, total: %u bytes)\n", + MAX_MEM, value_size, (w->allocated_memory + value_size)); + w->status = ENOMEM; + return; + } + + *v = malloc (value_size); + if (*v == 0) + { + /* Malloc failed, so return an error. */ + DBG (1, "sanei_w_ptr: DECODE: not enough free memory\n"); + w->status = ENOMEM; + return; + } + w->allocated_memory += value_size; + memset (*v, 0, value_size); + } + (*w_value) (w, *v); + } + else if (w->direction == WIRE_DECODE) + *v = 0; + + DBG (4, "sanei_w_ptr: done\n"); +} + +void +sanei_w_byte (Wire * w, SANE_Byte * v) +{ + DBG (3, "sanei_w_byte: wire %d\n", w->io.fd); + (*w->codec.w_byte) (w, v); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_byte: value = %d\n", *v); +} + +void +sanei_w_char (Wire * w, SANE_Char * v) +{ + DBG (3, "sanei_w_char: wire %d\n", w->io.fd); + (*w->codec.w_char) (w, v); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_char: value = %d\n", *v); +} + +void +sanei_w_word (Wire * w, SANE_Word * v) +{ + DBG (3, "sanei_w_word: wire %d\n", w->io.fd); + (*w->codec.w_word) (w, v); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_word: value = %d\n", *v); +} + +void +sanei_w_string (Wire * w, SANE_String * v) +{ + DBG (3, "sanei_w_string: wire %d\n", w->io.fd); + (*w->codec.w_string) (w, v); + if (w->direction != WIRE_FREE && w->status == 0) + DBG (4, "sanei_w_string: value = %s\n", *v); +} + +void +sanei_w_status (Wire * w, SANE_Status * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_status: wire %d\n", w->io.fd); + + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_status: value = %d\n", word); +} + +void +sanei_w_bool (Wire * w, SANE_Bool * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_bool: wire %d\n", w->io.fd); + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_bool: value = %s\n", + ((word == SANE_TRUE) ? ("true") : ("false"))); +} + +void +sanei_w_constraint_type (Wire * w, SANE_Constraint_Type * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_constraint_type: wire %d\n", w->io.fd); + + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_constraint_type: value = %d\n", word); +} + +void +sanei_w_value_type (Wire * w, SANE_Value_Type * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_value_type: wire %d\n", w->io.fd); + + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_value_type: value = %d\n", word); +} + +void +sanei_w_unit (Wire * w, SANE_Unit * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_unit: wire %d\n", w->io.fd); + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_unit: value = %d\n", word); + /* gosh... all the sane_w_something should be a macro or something */ +} + +void +sanei_w_action (Wire * w, SANE_Action * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_action: wire %d\n", w->io.fd); + + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_action: value = %d\n", word); +} + +void +sanei_w_frame (Wire * w, SANE_Frame * v) +{ + SANE_Word word = *v; + + DBG (3, "sanei_w_frame: wire %d\n", w->io.fd); + + sanei_w_word (w, &word); + if (w->direction == WIRE_DECODE) + *v = word; + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_frame: value = %d\n", word); +} + +void +sanei_w_range (Wire * w, SANE_Range * v) +{ + DBG (3, "sanei_w_range: wire %d\n", w->io.fd); + sanei_w_word (w, &v->min); + sanei_w_word (w, &v->max); + sanei_w_word (w, &v->quant); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_range: min/max/step = %f/%f/%f\n", + SANE_UNFIX (v->min), SANE_UNFIX (v->max), SANE_UNFIX (v->quant)); +} + +void +sanei_w_device (Wire * w, SANE_Device * v) +{ + DBG (3, "sanei_w_device: wire %d\n", w->io.fd); + sanei_w_string (w, (SANE_String *) & v->name); + sanei_w_string (w, (SANE_String *) & v->vendor); + sanei_w_string (w, (SANE_String *) & v->model); + sanei_w_string (w, (SANE_String *) & v->type); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_device: %s %s from %s (%s)\n", v->name, v->model, + v->vendor, v->type); +} + +void +sanei_w_device_ptr (Wire * w, SANE_Device ** v) +{ + DBG (3, "sanei_w_device_ptr: wire %d\n", w->io.fd); + sanei_w_ptr (w, (void **) v, (WireCodecFunc) sanei_w_device, sizeof (**v)); + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_device_ptr: device struct at %p\n", *v); +} + +void +sanei_w_option_descriptor (Wire * w, SANE_Option_Descriptor * v) +{ + SANE_Word len; + + DBG (3, "sanei_w_option_descriptor: wire %d\n", w->io.fd); + + sanei_w_string (w, (SANE_String *) & v->name); + sanei_w_string (w, (SANE_String *) & v->title); + sanei_w_string (w, (SANE_String *) & v->desc); + sanei_w_value_type (w, &v->type); + sanei_w_unit (w, &v->unit); + sanei_w_word (w, &v->size); + sanei_w_word (w, &v->cap); + sanei_w_constraint_type (w, &v->constraint_type); + + if (w->direction != WIRE_FREE) + DBG (4, "sanei_w_option_descriptor: option %s\n", v->name); + + switch (v->constraint_type) + { + case SANE_CONSTRAINT_NONE: + break; + + case SANE_CONSTRAINT_RANGE: + sanei_w_ptr (w, (void **) &v->constraint.range, + (WireCodecFunc) sanei_w_range, sizeof (SANE_Range)); + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (w->direction != WIRE_DECODE) + len = v->constraint.word_list[0] + 1; + sanei_w_array (w, &len, (void **) &v->constraint.word_list, + w->codec.w_word, sizeof (SANE_Word)); + break; + + case SANE_CONSTRAINT_STRING_LIST: + if (w->direction != WIRE_DECODE) + { + for (len = 0; v->constraint.string_list[len]; ++len); + ++len; /* send NULL string, too */ + } + sanei_w_array (w, &len, (void **) &v->constraint.string_list, + w->codec.w_string, sizeof (SANE_String)); + break; + } + DBG (4, "sanei_w_option_descriptor: done\n"); +} + +void +sanei_w_option_descriptor_ptr (Wire * w, SANE_Option_Descriptor ** v) +{ + DBG (3, "sanei_w_option_descriptor_ptr: wire %d\n", w->io.fd); + sanei_w_ptr (w, (void **) v, + (WireCodecFunc) sanei_w_option_descriptor, sizeof (**v)); + DBG (4, "sanei_w_option_descriptor_ptr: done\n"); +} + +void +sanei_w_parameters (Wire * w, SANE_Parameters * v) +{ + DBG (3, "sanei_w_parameters: wire %d\n", w->io.fd); + sanei_w_frame (w, &v->format); + sanei_w_bool (w, &v->last_frame); + sanei_w_word (w, &v->bytes_per_line); + sanei_w_word (w, &v->pixels_per_line); + sanei_w_word (w, &v->lines); + sanei_w_word (w, &v->depth); + if (w->direction != WIRE_FREE) + DBG (4, + "sanei_w_parameters: format/last/bpl/ppl/lines/depth = " + "%d/%d/%d/%d/%d/%d\n", v->format, v->last_frame, v->bytes_per_line, + v->pixels_per_line, v->lines, v->depth); +} + +static void +flush (Wire * w) +{ + DBG (3, "flush: wire %d\n", w->io.fd); + if (w->direction == WIRE_ENCODE) + sanei_w_space (w, w->buffer.size + 1); + else if (w->direction == WIRE_DECODE) + w->buffer.curr = w->buffer.end = w->buffer.start; + if (w->status != 0) + DBG (2, "flush: error status %d\n", w->status); + DBG (4, "flush: wire flushed\n"); +} + +void +sanei_w_set_dir (Wire * w, WireDirection dir) +{ + DBG (3, "sanei_w_set_dir: wire %d, old direction WIRE_%s\n", w->io.fd, + w->direction == WIRE_ENCODE ? "ENCODE" : + (w->direction == WIRE_DECODE ? "DECODE" : "FREE")); + if (w->direction == WIRE_DECODE && w->buffer.curr != w->buffer.end) + DBG (1, "sanei_w_set_dir: WARNING: will delete %lu bytes from buffer\n", + (u_long) (w->buffer.end - w->buffer.curr)); + flush (w); + w->direction = dir; + DBG (4, "sanei_w_set_dir: direction changed\n"); + flush (w); + DBG (3, "sanei_w_set_dir: wire %d, new direction WIRE_%s\n", w->io.fd, + dir == WIRE_ENCODE ? "ENCODE" : + (dir == WIRE_DECODE ? "DECODE" : "FREE")); +} + +void +sanei_w_call (Wire * w, + SANE_Word procnum, + WireCodecFunc w_arg, void *arg, + WireCodecFunc w_reply, void *reply) +{ + + DBG (3, "sanei_w_call: wire %d (old status %d)\n", w->io.fd, w->status); + w->status = 0; + sanei_w_set_dir (w, WIRE_ENCODE); + + DBG (4, "sanei_w_call: sending request (procedure number: %d)\n", procnum); + sanei_w_word (w, &procnum); + (*w_arg) (w, arg); + + if (w->status == 0) + { + DBG (4, "sanei_w_call: receiving reply\n"); + sanei_w_set_dir (w, WIRE_DECODE); + (*w_reply) (w, reply); + } + + if (w->status != 0) + DBG (2, "sanei_w_call: error status %d\n", w->status); + DBG (4, "sanei_w_call: done\n"); +} + +void +sanei_w_reply (Wire * w, WireCodecFunc w_reply, void *reply) +{ + DBG (3, "sanei_w_reply: wire %d (old status %d)\n", w->io.fd, w->status); + w->status = 0; + sanei_w_set_dir (w, WIRE_ENCODE); + (*w_reply) (w, reply); + flush (w); + if (w->status != 0) + DBG (2, "sanei_w_reply: error status %d\n", w->status); + DBG (4, "sanei_w_reply: done\n"); +} + +void +sanei_w_free (Wire * w, WireCodecFunc w_reply, void *reply) +{ + WireDirection saved_dir = w->direction; + + DBG (3, "sanei_w_free: wire %d\n", w->io.fd); + + w->direction = WIRE_FREE; + (*w_reply) (w, reply); + w->direction = saved_dir; + + if (w->status != 0) + DBG (2, "sanei_w_free: error status %d\n", w->status); + DBG (4, "sanei_w_free: done\n"); +} + +void +sanei_w_init (Wire * w, void (*codec_init_func) (Wire *)) +{ + DBG_INIT (); + + DBG (3, "sanei_w_init: initializing\n"); + w->status = 0; + w->direction = WIRE_ENCODE; + w->buffer.size = 8192; + w->buffer.start = malloc (w->buffer.size); + + if (w->buffer.start == 0) + { + /* Malloc failed, so return an error. */ + w->status = ENOMEM; + DBG (1, "sanei_w_init: not enough free memory\n"); + } + + w->buffer.curr = w->buffer.start; + w->buffer.end = w->buffer.start + w->buffer.size; + if (codec_init_func != 0) + { + DBG (4, "sanei_w_init: initializing codec\n"); + (*codec_init_func) (w); + } + w->allocated_memory = 0; + DBG (4, "sanei_w_init: done\n"); +} + +void +sanei_w_exit (Wire * w) +{ + DBG (3, "sanei_w_exit: wire %d\n", w->io.fd); + if (w->buffer.start) + { + DBG (4, "sanei_w_exit: freeing buffer\n"); + free (w->buffer.start); + } + w->buffer.start = 0; + w->buffer.size = 0; + DBG (4, "sanei_w_exit: done\n"); +} diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..af064d0 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,120 @@ +SHELL = /bin/sh + +VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION) + +sane_prefix = @SANE_PREFIX@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +configdir = ${sysconfdir}/sane.d +sanedatadir = ${datadir}/sane + +MKDIR = $(top_srcdir)/mkinstalldirs +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +CC = @CC@ +INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include \ + @INCLUDES@ @GTK_CFLAGS@ @GIMP_CFLAGS@ +DEFS = @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ @SANE_CFLAGS@ +LDFLAGS = @LDFLAGS@ @SANE_LDFLAGS@ +LIBS = @LIBS@ @SANE_LIBS@ +GTK_LIBS = @GTK_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GIMP_LIBS = @GIMP_LIBS@ + +BINPROGS = @BINPROGS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(GTK_CFLAGS) +LINK = $(CC) $(LDFLAGS) -o $@ + +@SET_MAKE@ + +PROGRAMS = $(BINPROGS) +LIBLIB = ../lib/liblib.a +LIBSANEI = ../sanei/libsanei.a + +XSCANIMAGE_OBJS = xscanimage.o progress.o preview.o preferences.o gtkglue.o +XCAM_OBJS = xcam.o preferences.o gtkglue.o +SCANADF_OBJS = scanadf.o + +DISTFILES = Makefile.in gtkglue.c gtkglue.h preferences.c preferences.h \ + preview.c preview.h progress.c progress.h sane-style.rc xcam.c \ + xscanimage-gimp-1_0-compat.h xscanimage.c scanadf.c font_6x11.h + +.PHONY: all clean depend dist distclean install uninstall + +.c.o: + $(COMPILE) $< + +all: $(PROGRAMS) + +install: $(PROGRAMS) + @if test -z "$(BINPROGS)" ; then \ + echo "*** The list of frontends to install is empty." ; \ + echo "*** Check the output of configure and the file config.log," ; \ + echo "*** maybe the GTK libraries weren't found?" ; \ + exit 1 ; \ + fi + $(MKDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) $(DESTDIR)$(sanedatadir) + @for program in $(BINPROGS); do \ + echo installing $${program} in $(bindir)/$${program}... ; \ + $(INSTALL_PROGRAM) $${program} \ + $(DESTDIR)$(bindir)/$${program}; \ + done + $(INSTALL_DATA) $(srcdir)/sane-style.rc \ + $(DESTDIR)$(sanedatadir)/sane-style.rc + +uninstall: + @for program in $(BINPROGS); do \ + echo removing $(bindir)/$${program}...; \ + rm -f $(bindir)/$${program}; \ + done + rm -f $(sanedatadir)/sane-style.rc + +xscanimage: $(XSCANIMAGE_OBJS) $(LIBSANEI) $(LIBLIB) + $(LINK) $(XSCANIMAGE_OBJS) $(LIBSANEI) \ + $(LIBLIB) $(GIMP_LIBS) $(GTK_LIBS) $(LIBS) + +xcam: $(XCAM_OBJS) $(LIBSANEI) $(LIBLIB) + $(LINK) $(XCAM_OBJS) $(LIBSANEI) \ + $(LIBLIB) $(GTK_LIBS) $(LIBS) + +scanadf: $(SCANADF_OBJS) $(LIBLIB) + $(LINK) $(SCANADF_OBJS) $(LIBLIB) $(LIBS) + +clean: + rm -f *.o *~ .*~ *.bak + rm -rf .libs + +distclean: clean + rm -f Makefile $(PROGRAMS) + +depend: + makedepend $(INCLUDES) *.c + +dist: $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file $(distdir)/src 2> /dev/null \ + || cp -p $$file $(distdir)/src ; \ + done diff --git a/src/font_6x11.h b/src/font_6x11.h new file mode 100644 index 0000000..844ff4f --- /dev/null +++ b/src/font_6x11.h @@ -0,0 +1,3337 @@ +/**********************************************/ +/* */ +/* Font file generated by rthelen */ +/* */ +/**********************************************/ + +static unsigned char fontdata[] = { + + /* 0 0x00 '^A' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 1 0x01 '^B' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 2 0x02 '^C' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 3 0x03 '^D' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 4 0x04 '^E' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 5 0x05 '^F' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 6 0x06 '^G' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 7 0x07 '^H' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 8 0x08 '^I' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 9 0x09 '^J' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 10 0x0a '^K' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 11 0x0b '^L' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 12 0x0c '^M' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 13 0x0d '^N' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 14 0x0e '^O' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 15 0x0f '^P' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 16 0x10 '^Q' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 17 0x11 '^R' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x54, /* 0 0 0 00 */ + 0x38, /* 00 000 */ + 0x54, /* 0 0 0 00 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 18 0x12 '^S' */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x50, /* 0 0 0000 */ + 0x50, /* 0 0 0000 */ + 0x20, /* 00 00000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 19 0x13 '^T' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x7c, /* 0 00 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 20 0x14 '^U' */ + 0x18, /* 000 000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x7c, /* 0 00 */ + 0x78, /* 0 000 */ + 0x78, /* 0 000 */ + 0x7c, /* 0 00 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 21 0x15 '^V' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 22 0x16 '^W' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 23 0x17 '^X' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 24 0x18 '^Y' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 25 0x19 '^Z' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 26 0x1a '^[' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 27 0x1b '^\' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 28 0x1c '^]' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 29 0x1d '^^' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 30 0x1e '^_' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 31 0x1f '^`' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 32 0x20 ' ' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 33 0x21 '!' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 34 0x22 '"' */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 35 0x23 '#' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x7c, /* 0 00 */ + 0x28, /* 00 0 000 */ + 0x7c, /* 0 00 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 36 0x24 '$' */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x54, /* 0 0 0 00 */ + 0x50, /* 0 0 0000 */ + 0x38, /* 00 000 */ + 0x14, /* 000 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 37 0x25 '%' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x58, /* 0 0 000 */ + 0x28, /* 00 0 000 */ + 0x34, /* 00 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x48, /* 0 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 38 0x26 '&' */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x48, /* 0 00 000 */ + 0x50, /* 0 0 0000 */ + 0x20, /* 00 00000 */ + 0x54, /* 0 0 0 00 */ + 0x48, /* 0 00 000 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 39 0x27 ''' */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 40 0x28 '(' */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 41 0x29 ')' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 42 0x2a '*' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x54, /* 0 0 0 00 */ + 0x38, /* 00 000 */ + 0x54, /* 0 0 0 00 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 43 0x2b '+' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 44 0x2c ',' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + + /* 45 0x2d '-' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 46 0x2e '.' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 000 000 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 47 0x2f '/' */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x20, /* 00 00000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + + /* 48 0x30 '0' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x64, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 49 0x31 '1' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x18, /* 000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x1c, /* 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 50 0x32 '2' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 51 0x33 '3' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x04, /* 00000 00 */ + 0x18, /* 000 000 */ + 0x04, /* 00000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 52 0x34 '4' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x18, /* 000 000 */ + 0x28, /* 00 0 000 */ + 0x48, /* 0 00 000 */ + 0x7c, /* 0 00 */ + 0x08, /* 0000 000 */ + 0x1c, /* 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 53 0x35 '5' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 54 0x36 '6' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 55 0x37 '7' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 56 0x38 '8' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 57 0x39 '9' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x04, /* 00000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 58 0x3a ':' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 000 000 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x18, /* 000 000 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 59 0x3b ';' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x30, /* 00 0000 */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + + /* 60 0x3c '<' */ + 0x00, /* 00000000 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 61 0x3d '=' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 62 0x3e '>' */ + 0x00, /* 00000000 */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 63 0x3f '?' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 64 0x40 '@' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x74, /* 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 65 0x41 'A' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 66 0x42 'B' */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 67 0x43 'C' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 68 0x44 'D' */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 69 0x45 'E' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 70 0x46 'F' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 71 0x47 'G' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x4c, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 72 0x48 'H' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 73 0x49 'I' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 74 0x4a 'J' */ + 0x00, /* 00000000 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 75 0x4b 'K' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x48, /* 0 00 000 */ + 0x50, /* 0 0 0000 */ + 0x60, /* 0 00000 */ + 0x50, /* 0 0 0000 */ + 0x48, /* 0 00 000 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 76 0x4c 'L' */ + 0x00, /* 00000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 77 0x4d 'M' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x6c, /* 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 78 0x4e 'N' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x64, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x4c, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 79 0x4f 'O' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 80 0x50 'P' */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 81 0x51 'Q' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x54, /* 0 0 0 00 */ + 0x38, /* 00 000 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 82 0x52 'R' */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 83 0x53 'S' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x38, /* 00 000 */ + 0x04, /* 00000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 84 0x54 'T' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 85 0x55 'U' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 86 0x56 'V' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 87 0x57 'W' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x6c, /* 0 0 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 88 0x58 'X' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 89 0x59 'Y' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 90 0x5a 'Z' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x40, /* 0 000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 91 0x5b '[' */ + 0x0c, /* 0000 00 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x0c, /* 0000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 92 0x5c '\' */ + 0x20, /* 00 00000 */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x02, /* 000000 0 */ + 0x02, /* 000000 0 */ + 0x00, /* 00000000 */ + + /* 93 0x5d ']' */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x30, /* 00 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 94 0x5e '^' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 95 0x5f '_' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 0 0 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 96 0x60 '`' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 97 0x61 'a' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 98 0x62 'b' */ + 0x00, /* 00000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 99 0x63 'c' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 100 0x64 'd' */ + 0x00, /* 00000000 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 101 0x65 'e' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 102 0x66 'f' */ + 0x00, /* 00000000 */ + 0x0c, /* 0000 00 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 103 0x67 'g' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x04, /* 00000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + + /* 104 0x68 'h' */ + 0x00, /* 00000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 105 0x69 'i' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 106 0x6a 'j' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x60, /* 0 00000 */ + 0x00, /* 00000000 */ + + /* 107 0x6b 'k' */ + 0x00, /* 00000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x48, /* 0 00 000 */ + 0x50, /* 0 0 0000 */ + 0x70, /* 0 0000 */ + 0x48, /* 0 00 000 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 108 0x6c 'l' */ + 0x00, /* 00000000 */ + 0x30, /* 00 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 109 0x6d 'm' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 110 0x6e 'n' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x58, /* 0 0 000 */ + 0x64, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 111 0x6f 'o' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 112 0x70 'p' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x78, /* 0 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + + /* 113 0x71 'q' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + + /* 114 0x72 'r' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x58, /* 0 0 000 */ + 0x64, /* 0 00 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 115 0x73 's' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x40, /* 0 000000 */ + 0x38, /* 00 000 */ + 0x04, /* 00000 00 */ + 0x78, /* 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 116 0x74 't' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x0c, /* 0000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 117 0x75 'u' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 118 0x76 'v' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 119 0x77 'w' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 120 0x78 'x' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 121 0x79 'y' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x04, /* 00000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + + /* 122 0x7a 'z' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 123 0x7b '{' */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + + /* 124 0x7c '|' */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 125 0x7d '}' */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + + /* 126 0x7e '~' */ + 0x00, /* 00000000 */ + 0x34, /* 00 0 00 */ + 0x58, /* 0 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 127 0x7f '^?' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 128 0x80 '\200' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 129 0x81 '\201' */ + 0x28, /* 00 0 000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 130 0x82 '\202' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 131 0x83 '\203' */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x78, /* 0 000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 132 0x84 '\204' */ + 0x58, /* 0 0 000 */ + 0x44, /* 0 000 00 */ + 0x64, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x4c, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 133 0x85 '\205' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 134 0x86 '\206' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 135 0x87 '\207' */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 136 0x88 '\210' */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 137 0x89 '\211' */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 138 0x8a '\212' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 139 0x8b '\213' */ + 0x34, /* 00 0 00 */ + 0x58, /* 0 0 000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 140 0x8c '\214' */ + 0x18, /* 000 000 */ + 0x24, /* 00 00 00 */ + 0x18, /* 000 000 */ + 0x3c, /* 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 141 0x8d '\215' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + + /* 142 0x8e '\216' */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 143 0x8f '\217' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 144 0x90 '\220' */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 145 0x91 '\221' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x40, /* 0 000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 146 0x92 '\222' */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 147 0x93 '\223' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 148 0x94 '\224' */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 149 0x95 '\225' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 150 0x96 '\226' */ + 0x34, /* 00 0 00 */ + 0x58, /* 0 0 000 */ + 0x00, /* 00000000 */ + 0x58, /* 0 0 000 */ + 0x64, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 151 0x97 '\227' */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 152 0x98 '\230' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 153 0x99 '\231' */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 154 0x9a '\232' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 155 0x9b '\233' */ + 0x34, /* 00 0 00 */ + 0x58, /* 0 0 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 156 0x9c '\234' */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 157 0x9d '\235' */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 158 0x9e '\236' */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 159 0x9f '\237' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x34, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 160 0xa0 '\240' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 161 0xa1 '\241' */ + 0x18, /* 000 000 */ + 0x24, /* 00 00 00 */ + 0x24, /* 00 00 00 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 162 0xa2 '\242' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x54, /* 0 0 0 00 */ + 0x50, /* 0 0 0000 */ + 0x54, /* 0 0 0 00 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 163 0xa3 '\243' */ + 0x30, /* 00 0000 */ + 0x48, /* 0 00 000 */ + 0x40, /* 0 000000 */ + 0x70, /* 0 0000 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x44, /* 0 000 00 */ + 0x78, /* 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 164 0xa4 '\244' */ + 0x44, /* 0 000 00 */ + 0x24, /* 00 00 00 */ + 0x50, /* 0 0 0000 */ + 0x48, /* 0 00 000 */ + 0x24, /* 00 00 00 */ + 0x14, /* 000 0 00 */ + 0x48, /* 0 00 000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 165 0xa5 '\245' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x7c, /* 0 00 */ + 0x7c, /* 0 00 */ + 0x7c, /* 0 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 166 0xa6 '\246' */ + 0x3c, /* 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x3c, /* 00 00 */ + 0x14, /* 000 0 00 */ + 0x14, /* 000 0 00 */ + 0x14, /* 000 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 167 0xa7 '\247' */ + 0x18, /* 000 000 */ + 0x24, /* 00 00 00 */ + 0x44, /* 0 000 00 */ + 0x48, /* 0 00 000 */ + 0x48, /* 0 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x58, /* 0 0 000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 168 0xa8 '\250' */ + 0x00, /* 00000000 */ + 0x70, /* 0 0000 */ + 0x08, /* 0000 000 */ + 0x64, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x64, /* 0 00 00 */ + 0x58, /* 0 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 169 0xa9 '\251' */ + 0x00, /* 00000000 */ + 0x70, /* 0 0000 */ + 0x08, /* 0000 000 */ + 0x34, /* 00 0 00 */ + 0x44, /* 0 000 00 */ + 0x34, /* 00 0 00 */ + 0x08, /* 0000 000 */ + 0x70, /* 0 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 170 0xaa '\252' */ + 0x00, /* 00000000 */ + 0x7a, /* 0 0 0 */ + 0x2e, /* 00 0 0 */ + 0x2e, /* 00 0 0 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 171 0xab '\253' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 172 0xac '\254' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 173 0xad '\255' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 174 0xae '\256' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x50, /* 0 0 0000 */ + 0x50, /* 0 0 0000 */ + 0x78, /* 0 000 */ + 0x50, /* 0 0 0000 */ + 0x50, /* 0 0 0000 */ + 0x5c, /* 0 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 175 0xaf '\257' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x4c, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x64, /* 0 00 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 176 0xb0 '\260' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x6c, /* 0 0 00 */ + 0x54, /* 0 0 0 00 */ + 0x6c, /* 0 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 177 0xb1 '\261' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 178 0xb2 '\262' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 179 0xb3 '\263' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x04, /* 00000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x1c, /* 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 180 0xb4 '\264' */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x7c, /* 0 00 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 181 0xb5 '\265' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x48, /* 0 00 000 */ + 0x48, /* 0 00 000 */ + 0x48, /* 0 00 000 */ + 0x48, /* 0 00 000 */ + 0x74, /* 0 0 00 */ + 0x40, /* 0 000000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + + /* 182 0xb6 '\266' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x0c, /* 0000 00 */ + 0x14, /* 000 0 00 */ + 0x24, /* 00 00 00 */ + 0x24, /* 00 00 00 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 183 0xb7 '\267' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x24, /* 00 00 00 */ + 0x10, /* 000 0000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x24, /* 00 00 00 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 184 0xb8 '\270' */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 185 0xb9 '\271' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 186 0xba '\272' */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x60, /* 0 00000 */ + 0x00, /* 00000000 */ + + /* 187 0xbb '\273' */ + 0x00, /* 00000000 */ + 0x1c, /* 000 00 */ + 0x24, /* 00 00 00 */ + 0x24, /* 00 00 00 */ + 0x1c, /* 000 00 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 188 0xbc '\274' */ + 0x00, /* 00000000 */ + 0x18, /* 000 000 */ + 0x24, /* 00 00 00 */ + 0x24, /* 00 00 00 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 189 0xbd '\275' */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x6c, /* 0 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 190 0xbe '\276' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x54, /* 0 0 0 00 */ + 0x5c, /* 0 0 00 */ + 0x50, /* 0 0 0000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 191 0xbf '\277' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x4c, /* 0 00 00 */ + 0x54, /* 0 0 0 00 */ + 0x64, /* 0 00 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 192 0xc0 '\300' */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x20, /* 00 00000 */ + 0x40, /* 0 000000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 193 0xc1 '\301' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x08, /* 0000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 194 0xc2 '\302' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x04, /* 00000 00 */ + 0x04, /* 00000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 195 0xc3 '\303' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 0000 00 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x50, /* 0 0 0000 */ + 0x20, /* 00 00000 */ + 0x20, /* 00 00000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 196 0xc4 '\304' */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x60, /* 0 00000 */ + 0x00, /* 00000000 */ + + /* 197 0xc5 '\305' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x04, /* 00000 00 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x40, /* 0 000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 198 0xc6 '\306' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 199 0xc7 '\307' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x24, /* 00 00 00 */ + 0x48, /* 0 00 000 */ + 0x48, /* 0 00 000 */ + 0x24, /* 00 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 200 0xc8 '\310' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x48, /* 0 00 000 */ + 0x24, /* 00 00 00 */ + 0x24, /* 00 00 00 */ + 0x48, /* 0 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 201 0xc9 '\311' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x54, /* 0 0 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 202 0xca '\312' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 203 0xcb '\313' */ + 0x10, /* 000 0000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 204 0xcc '\314' */ + 0x58, /* 0 0 000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x7c, /* 0 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 205 0xcd '\315' */ + 0x58, /* 0 0 000 */ + 0x38, /* 00 000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 206 0xce '\316' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x50, /* 0 0 0000 */ + 0x50, /* 0 0 0000 */ + 0x58, /* 0 0 000 */ + 0x50, /* 0 0 0000 */ + 0x50, /* 0 0 0000 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 207 0xcf '\317' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x54, /* 0 0 0 00 */ + 0x5c, /* 0 0 00 */ + 0x50, /* 0 0 0000 */ + 0x2c, /* 00 0 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 208 0xd0 '\320' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 209 0xd1 '\321' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 0 0 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 210 0xd2 '\322' */ + 0x00, /* 00000000 */ + 0x14, /* 000 0 00 */ + 0x28, /* 00 0 000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 211 0xd3 '\323' */ + 0x00, /* 00000000 */ + 0x14, /* 000 0 00 */ + 0x14, /* 000 0 00 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 212 0xd4 '\324' */ + 0x00, /* 00000000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x18, /* 000 000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 213 0xd5 '\325' */ + 0x00, /* 00000000 */ + 0x18, /* 000 000 */ + 0x08, /* 0000 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 214 0xd6 '\326' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x7c, /* 0 00 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 215 0xd7 '\327' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x10, /* 000 0000 */ + 0x28, /* 00 0 000 */ + 0x44, /* 0 000 00 */ + 0x28, /* 00 0 000 */ + 0x10, /* 000 0000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 216 0xd8 '\330' */ + 0x00, /* 00000000 */ + 0x28, /* 00 0 000 */ + 0x00, /* 00000000 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x44, /* 0 000 00 */ + 0x3c, /* 00 00 */ + 0x04, /* 00000 00 */ + 0x38, /* 00 000 */ + 0x00, /* 00000000 */ + + /* 217 0xd9 '\331' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 0 0 */ + 0x00, /* 00000000 */ + 0x7e, /* 0 0 */ + 0x00, /* 00000000 */ + 0x7e, /* 0 0 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 218 0xda '\332' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 219 0xdb '\333' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 220 0xdc '\334' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 221 0xdd '\335' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 222 0xde '\336' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 223 0xdf '\337' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 224 0xe0 '\340' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 225 0xe1 '\341' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 226 0xe2 '\342' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 227 0xe3 '\343' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 228 0xe4 '\344' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 229 0xe5 '\345' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 230 0xe6 '\346' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 231 0xe7 '\347' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 232 0xe8 '\350' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 233 0xe9 '\351' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 234 0xea '\352' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 235 0xeb '\353' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 236 0xec '\354' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 237 0xed '\355' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 238 0xee '\356' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 239 0xef '\357' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 240 0xf0 '\360' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 241 0xf1 '\361' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 242 0xf2 '\362' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 243 0xf3 '\363' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 244 0xf4 '\364' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 245 0xf5 '\365' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 246 0xf6 '\366' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 247 0xf7 '\367' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 248 0xf8 '\370' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 249 0xf9 '\371' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 250 0xfa '\372' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 251 0xfb '\373' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 252 0xfc '\374' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 253 0xfd '\375' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 254 0xfe '\376' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 255 0xff '\377' */ + 0x00, /* 00000000 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x3c, /* 00 00 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + +}; diff --git a/src/gtkglue.c b/src/gtkglue.c new file mode 100644 index 0000000..ba5cbf5 --- /dev/null +++ b/src/gtkglue.c @@ -0,0 +1,1495 @@ +/* gtk/SANE-glue -- gtk interfacing routines for SANE + Uses the SANE library. + Copyright (C) 1997 David Mosberger and Tristan Tarrant + + 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. */ + +#ifdef _AIX +# include "../include/lalloca.h" /* MUST come first for AIX! */ +#endif + +#include "../include/sane/config.h" +#include "../include/lalloca.h" + +#include <assert.h> +#include <errno.h> +#include <memory.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/types.h> /* Apollo/DomainOS needs this _before_ sys/stat.h */ +#include <sys/stat.h> + +#include "gtkglue.h" + +#include "preferences.h" +#include <sane/sane.h> +#include <sane/saneopts.h> + +#define DBG_fatal 0 +#define DBG_error 1 +#define DBG_warning 2 +#define DBG_info 3 +#define DBG_debug 4 + +#define BACKEND_NAME gtkglue +#include "../include/sane/sanei_debug.h" + +int gsg_message_dialog_active = 0; + +/* forward declarations: */ +static void panel_rebuild (GSGDialog * dialog); + +static const char * +unit_string (SANE_Unit unit) +{ + double d; + + switch (unit) + { + case SANE_UNIT_NONE: + return "none"; + case SANE_UNIT_PIXEL: + return "pixel"; + case SANE_UNIT_BIT: + return "bit"; + case SANE_UNIT_DPI: + return "dpi"; + case SANE_UNIT_PERCENT: + return "%"; + case SANE_UNIT_MM: + d = preferences.length_unit; + if (d > 9.9 && d < 10.1) + return "cm"; + else if (d > 25.3 && d < 25.5) + return "in"; + return "mm"; + case SANE_UNIT_MICROSECOND: + return "us"; + } + return 0; +} + +static void +set_tooltip (GtkTooltips * tooltips, GtkWidget * widget, const char *desc) +{ + if (desc && desc[0]) +#ifdef HAVE_GTK_TOOLTIPS_SET_TIPS + /* pre 0.99.4: */ + gtk_tooltips_set_tips (tooltips, widget, (char *) desc); +#else + gtk_tooltips_set_tip (tooltips, widget, desc, 0); +#endif +} + +int +gsg_make_path (size_t buf_size, char *buf, + const char *prog_name, + const char *prefix, const char *dev_name, const char *postfix) +{ + struct passwd *pw; + size_t len, extra; + int i; + + /* first, make sure ~/.sane exists: */ + pw = getpwuid (getuid ()); + if (!pw) + { + snprintf (buf, buf_size, "Failed to determine home directory: %s.", + strerror (errno)); + gsg_error (buf); + return -1; + } + snprintf (buf, buf_size, "%s/.sane", pw->pw_dir); + mkdir (buf, 0777); /* ensure ~/.sane directory exists */ + + len = strlen (buf); + + if (prog_name) + { + extra = strlen (prog_name); + if (len + extra + 1 >= buf_size) + goto filename_too_long; + + buf[len++] = '/'; + memcpy (buf + len, prog_name, extra); + len += extra; + buf[len] = '\0'; + mkdir (buf, 0777); /* ensure ~/.sane/PROG_NAME directory exists */ + } + if (len >= buf_size) + goto filename_too_long; + + buf[len++] = '/'; + + if (prefix) + { + extra = strlen (prefix); + if (len + extra >= buf_size) + goto filename_too_long; + + memcpy (buf + len, prefix, extra); + len += extra; + } + + if (dev_name) + { + /* Turn devicename into valid filename by replacing slashes by + "+-". A lonely `+' gets translated into "++" so we can tell + it from a substituted slash. */ + + for (i = 0; dev_name[i]; ++i) + { + if (len + 2 >= buf_size) + goto filename_too_long; + + switch (dev_name[i]) + { + case '/': + buf[len++] = '+'; + buf[len++] = '-'; + break; + +#ifdef HAVE_OS2_H + case ':': /* OS2 can not handle colons in filenames */ + buf[len++] = '+'; + buf[len++] = '_'; + break; +#endif + + case '+': + buf[len++] = '+'; + default: + buf[len++] = dev_name[i]; + break; + } + } + } + + if (postfix) + { + extra = strlen (postfix); + if (len + extra >= buf_size) + goto filename_too_long; + memcpy (buf + len, postfix, extra); + len += extra; + } + if (len >= buf_size) + goto filename_too_long; + + buf[len++] = '\0'; + return 0; + +filename_too_long: + gsg_error ("Filename too long."); + errno = E2BIG; + return -1; +} + +static void +set_option (GSGDialog * dialog, int opt_num, void *val, SANE_Action action) +{ + SANE_Status status; + SANE_Int info; + char buf[256]; + + status = sane_control_option (dialog->dev, opt_num, action, val, &info); + if (status != SANE_STATUS_GOOD) + { + snprintf (buf, sizeof (buf), "Failed to set value of option %s: %s.", + sane_get_option_descriptor (dialog->dev, opt_num)->name, + sane_strstatus (status)); + gsg_error (buf); + return; + } + if (info & SANE_INFO_RELOAD_OPTIONS) + { + panel_rebuild (dialog); + if (dialog->option_reload_callback) + (*dialog->option_reload_callback) (dialog, dialog->option_reload_arg); + } + if ((info & SANE_INFO_RELOAD_PARAMS) && dialog->param_change_callback) + (*dialog->param_change_callback) (dialog, dialog->param_change_arg); +} + +void +gsg_close_dialog_callback (GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy (data); + gsg_message_dialog_active = 0; +} + +void +gsg_message (gchar * title, gchar * message) +{ + GtkWidget *main_vbox, *label; + GtkWidget *button, *message_dialog; + + if (gsg_message_dialog_active) + { + fprintf (stderr, "%s: %s\n", title, message); + return; + } + gsg_message_dialog_active = 1; + message_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_position (GTK_WINDOW (message_dialog), GTK_WIN_POS_MOUSE); + gtk_window_set_title (GTK_WINDOW (message_dialog), title); + + /* create the main vbox */ + main_vbox = gtk_vbox_new (TRUE, 5); + gtk_container_border_width (GTK_CONTAINER (main_vbox), 5); + gtk_widget_show (main_vbox); + + gtk_container_add (GTK_CONTAINER (message_dialog), main_vbox); + + /* the message */ + label = gtk_label_new (message); + gtk_container_add (GTK_CONTAINER (main_vbox), label); + gtk_widget_show (label); + + /* the confirmation button */ + button = gtk_button_new_with_label ("OK"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) gsg_close_dialog_callback, + message_dialog); + gtk_container_add (GTK_CONTAINER (main_vbox), button); + + gtk_widget_show (button); + gtk_widget_show (message_dialog); +} + +void +gsg_error (gchar * error) +{ + gsg_message ("Error", error); +} + +void +gsg_warning (gchar * warning) +{ + gsg_message ("Warning", warning); +} + +static void +get_filename_button_clicked (GtkWidget * w, gpointer data) +{ + int *clicked = data; + *clicked = 1; +} + +int +gsg_get_filename (const char *label, const char *default_name, + size_t max_len, char *filename) +{ + int cancel = 0, ok = 0; + GtkWidget *filesel; + + filesel = gtk_file_selection_new ((char *) label); + + gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); + + gtk_signal_connect (GTK_OBJECT + (GTK_FILE_SELECTION (filesel)->cancel_button), + "clicked", (GtkSignalFunc) get_filename_button_clicked, + &cancel); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->ok_button), + "clicked", (GtkSignalFunc) get_filename_button_clicked, + &ok); + if (default_name) + gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), + (char *) default_name); + + gtk_widget_show (filesel); + + while (!cancel && !ok) + { + if (!gtk_events_pending ()) + usleep (100000); + gtk_main_iteration (); + } + + if (ok) + { + size_t len, cwd_len; + char *cwd; + + strncpy (filename, + gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)), + max_len - 1); + filename[max_len - 1] = '\0'; + + len = strlen (filename); + cwd = alloca (len + 2); + getcwd (cwd, len + 1); + cwd_len = strlen (cwd); + cwd[cwd_len++] = '/'; + cwd[cwd_len] = '\0'; + if (strncmp (filename, cwd, cwd_len) == 0) + memcpy (filename, filename + cwd_len, len - cwd_len + 1); + } + gtk_widget_destroy (filesel); + return cancel ? -1 : 0; +} + +static gint +autobutton_update (GtkWidget * widget, GSGDialogElement * elem) +{ + GSGDialog *dialog = elem->dialog; + int opt_num = elem - dialog->element; + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Word val; + char buf[256]; + + opt = sane_get_option_descriptor (dialog->dev, opt_num); + if (GTK_TOGGLE_BUTTON (widget)->active) + set_option (dialog, opt_num, 0, SANE_ACTION_SET_AUTO); + else + { + status = sane_control_option (dialog->dev, opt_num, + SANE_ACTION_GET_VALUE, &val, 0); + if (status != SANE_STATUS_GOOD) + { + snprintf (buf, sizeof (buf), + "Failed to obtain value of option %s: %s.", + opt->name, sane_strstatus (status)); + gsg_error (buf); + } + set_option (dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + } + return FALSE; +} + +static void +autobutton_new (GtkWidget * parent, GSGDialogElement * elem, + GtkWidget * label, GtkTooltips * tooltips) +{ + GtkWidget *button, *alignment; + + button = gtk_check_button_new (); + gtk_container_border_width (GTK_CONTAINER (button), 0); + gtk_widget_set_usize (button, 20, 20); + gtk_signal_connect (GTK_OBJECT (button), "toggled", + (GtkSignalFunc) autobutton_update, elem); + set_tooltip (tooltips, button, "Turns on automatic mode."); + + alignment = gtk_alignment_new (0.0, 1.0, 0.5, 0.5); + gtk_container_add (GTK_CONTAINER (alignment), button); + + gtk_box_pack_end (GTK_BOX (parent), label, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (parent), alignment, FALSE, FALSE, 2); + + gtk_widget_show (alignment); + gtk_widget_show (button); +} + +static gint +button_update (GtkWidget * widget, GSGDialogElement * elem) +{ + GSGDialog *dialog = elem->dialog; + int opt_num = elem - dialog->element; + const SANE_Option_Descriptor *opt; + SANE_Word val = SANE_FALSE; + + opt = sane_get_option_descriptor (dialog->dev, opt_num); + if (GTK_TOGGLE_BUTTON (widget)->active) + val = SANE_TRUE; + set_option (dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + return FALSE; +} + +static void +button_new (GtkWidget * parent, const char *name, SANE_Word val, + GSGDialogElement * elem, GtkTooltips * tooltips, const char *desc, + gint is_settable) +{ + GtkWidget *button; + + button = gtk_check_button_new_with_label ((char *) name); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), val); + gtk_signal_connect (GTK_OBJECT (button), "toggled", + (GtkSignalFunc) button_update, elem); + gtk_box_pack_start (GTK_BOX (parent), button, FALSE, TRUE, 0); + if (!is_settable) + gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); + gtk_widget_show (button); + set_tooltip (tooltips, button, desc); + + elem->widget = button; +} + +static void +scale_update (GtkAdjustment * adj_data, GSGDialogElement * elem) +{ + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + SANE_Word val, new_val; + int opt_num; + double d; + SANE_Status status; + + DBG_INIT (); + + DBG (DBG_debug, "scale_update\n"); + + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor (dialog->dev, opt_num); + switch (opt->type) + { + case SANE_TYPE_INT: + val = adj_data->value + 0.5; + break; + + case SANE_TYPE_FIXED: + d = adj_data->value; + if (opt->unit == SANE_UNIT_MM) + d *= preferences.length_unit; + val = SANE_FIX (d); + break; + + default: + fprintf (stderr, "scale_update: unknown type %d\n", opt->type); + return; + } + set_option (dialog, opt_num, &val, SANE_ACTION_SET_VALUE); + status = + sane_control_option (dialog->dev, opt_num, SANE_ACTION_GET_VALUE, + &new_val, 0); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "scale_update: sane_control_option failed: %s\n", + sane_strstatus (status)); + return; + } + + if (new_val != val) + { + val = new_val; + goto value_changed; + } + return; /* value didn't change */ + +value_changed: + switch (opt->type) + { + case SANE_TYPE_INT: + adj_data->value = val; + break; + + case SANE_TYPE_FIXED: + d = SANE_UNFIX (val); + if (opt->unit == SANE_UNIT_MM) + d /= preferences.length_unit; + adj_data->value = d; + break; + + default: + break; + } + /* Let widget know that value changed _again_. This must converge + quickly---otherwise things would get very slow very quickly (as + in "infinite recursion"): */ + gtk_signal_emit_by_name (GTK_OBJECT (adj_data), "value_changed"); + return; +} + +static void +scale_new (GtkWidget * parent, const char *name, gfloat val, + gfloat min, gfloat max, gfloat quant, int automatic, + GSGDialogElement * elem, GtkTooltips * tooltips, const char *desc, + gint is_settable) +{ + GtkWidget *hbox, *label, *scale; + + hbox = gtk_hbox_new (FALSE, 2); + gtk_container_border_width (GTK_CONTAINER (hbox), 0); + gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new ((char *) name); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + + elem->data = gtk_adjustment_new (val, min, max, quant, 1.0, 0.0); + scale = gtk_hscale_new (GTK_ADJUSTMENT (elem->data)); + set_tooltip (tooltips, scale, desc); + gtk_widget_set_usize (scale, 200, 0); + + if (automatic) + autobutton_new (hbox, elem, scale, tooltips); + else + gtk_box_pack_end (GTK_BOX (hbox), scale, FALSE, FALSE, 0); + + gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_CONTINUOUS); + gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP); + if (quant - (int) quant == 0.0) + gtk_scale_set_digits (GTK_SCALE (scale), 0); + else + /* one place behind decimal point */ + gtk_scale_set_digits (GTK_SCALE (scale), 1); + + gtk_signal_connect (elem->data, "value_changed", + (GtkSignalFunc) scale_update, elem); + + gtk_widget_show (label); + gtk_widget_show (scale); + if (!is_settable) + gtk_widget_set_sensitive (GTK_WIDGET (hbox), FALSE); + + gtk_widget_show (hbox); + + elem->widget = scale; +} + +static void +push_button_callback (GtkWidget * widget, gpointer data) +{ + GSGDialogElement *elem = data; + GSGDialog *dialog = elem->dialog; + int opt_num; + + opt_num = elem - dialog->element; + set_option (dialog, opt_num, 0, SANE_ACTION_SET_VALUE); +} + +static int +option_menu_lookup (GSGMenuItem menu_items[], const char *string) +{ + int i; + + for (i = 0; strcmp (menu_items[i].label, string) != 0; ++i); + return i; +} + +static void +option_menu_callback (GtkWidget * widget, gpointer data) +{ + GSGMenuItem *menu_item = data; + GSGDialogElement *elem = menu_item->elem; + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + int opt_num; + double dval; + SANE_Word val; + void *valp = &val; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor (dialog->dev, opt_num); + switch (opt->type) + { + case SANE_TYPE_INT: + sscanf (menu_item->label, "%d", &val); + break; + + case SANE_TYPE_FIXED: + sscanf (menu_item->label, "%lg", &dval); + val = SANE_FIX (dval); + break; + + case SANE_TYPE_STRING: + valp = menu_item->label; + break; + + default: + fprintf (stderr, "option_menu_callback: unexpected type %d\n", + opt->type); + break; + } + set_option (dialog, opt_num, valp, SANE_ACTION_SET_VALUE); +} + +static void +option_menu_new (GtkWidget * parent, const char *name, char *str_list[], + const char *val, GSGDialogElement * elem, + GtkTooltips * tooltips, const char *desc, gint is_settable) +{ + GtkWidget *hbox, *label, *option_menu, *menu, *item; + GSGMenuItem *menu_items; + int i, num_items; + + hbox = gtk_hbox_new (FALSE, 2); + gtk_container_border_width (GTK_CONTAINER (hbox), 0); + gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new ((char *) name); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + + for (num_items = 0; str_list[num_items]; ++num_items); + menu_items = malloc (num_items * sizeof (menu_items[0])); + + menu = gtk_menu_new (); + for (i = 0; i < num_items; ++i) + { + item = gtk_menu_item_new_with_label (str_list[i]); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) option_menu_callback, + menu_items + i); + + gtk_widget_show (item); + + menu_items[i].label = str_list[i]; + menu_items[i].elem = elem; + menu_items[i].index = i; + } + + option_menu = gtk_option_menu_new (); + gtk_box_pack_end (GTK_BOX (hbox), option_menu, FALSE, FALSE, 2); + gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); + gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), + option_menu_lookup (menu_items, val)); + set_tooltip (tooltips, option_menu, desc); + + gtk_widget_show (label); + gtk_widget_show (option_menu); + if (!is_settable) + gtk_widget_set_sensitive (GTK_WIDGET (hbox), FALSE); + gtk_widget_show (hbox); + + elem->widget = option_menu; + elem->menu_size = num_items; + elem->menu = menu_items; +} + +static void +text_entry_callback (GtkWidget * w, gpointer data) +{ + GSGDialogElement *elem = data; + const SANE_Option_Descriptor *opt; + GSGDialog *dialog = elem->dialog; + const gchar *text; + int opt_num; + char *buf; + + opt_num = elem - dialog->element; + opt = sane_get_option_descriptor (dialog->dev, opt_num); + + buf = alloca (opt->size); + buf[0] = '\0'; + + text = gtk_entry_get_text (GTK_ENTRY (elem->widget)); + if (text) + strncpy (buf, text, opt->size); + buf[opt->size - 1] = '\0'; + + set_option (dialog, opt_num, buf, SANE_ACTION_SET_VALUE); + + if (strcmp (buf, text) != 0) + /* the backend modified the option value; update widget: */ + gtk_entry_set_text (GTK_ENTRY (elem->widget), buf); +} + +static void +text_entry_new (GtkWidget * parent, const char *name, const char *val, + GSGDialogElement * elem, + GtkTooltips * tooltips, const char *desc, gint is_settable) +{ + GtkWidget *hbox, *text, *label; + + hbox = gtk_hbox_new (FALSE, 2); + gtk_container_border_width (GTK_CONTAINER (hbox), 0); + gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 0); + + label = gtk_label_new ((char *) name); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + + text = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (text), (char *) val); + gtk_box_pack_start (GTK_BOX (hbox), text, FALSE, TRUE, 0); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) text_entry_callback, elem); + set_tooltip (tooltips, text, desc); + + gtk_widget_show (hbox); + if (!is_settable) + gtk_widget_set_sensitive (GTK_WIDGET (hbox), FALSE); + gtk_widget_show (label); + gtk_widget_show (text); + + elem->widget = text; +} + +static GtkWidget * +group_new (GtkWidget * parent, const char *title) +{ + GtkWidget *frame, *vbox; + + frame = gtk_frame_new ((char *) title); + gtk_container_border_width (GTK_CONTAINER (frame), 4); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start (GTK_BOX (parent), frame, FALSE, FALSE, 0); + + vbox = gtk_vbox_new (FALSE, 4); + gtk_container_border_width (GTK_CONTAINER (vbox), 2); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gtk_widget_show (vbox); + return vbox; +} + +static GtkWidget * +curve_new (GSGDialog * dialog, int optnum) +{ + const SANE_Option_Descriptor *opt; + gfloat fmin, fmax, val, *vector; + SANE_Word *optval, min, max; + GtkWidget *curve, *gamma; + SANE_Status status; + SANE_Handle dev; + int i, optlen; + + gamma = gtk_gamma_curve_new (); + curve = GTK_GAMMA_CURVE (gamma)->curve; + dev = dialog->dev; + + opt = sane_get_option_descriptor (dev, optnum); + optlen = opt->size / sizeof (SANE_Word); + vector = alloca (optlen * (sizeof (vector[0]) + sizeof (optval[0]))); + optval = (SANE_Word *) (vector + optlen); + + min = max = 0; + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + min = opt->constraint.range->min; + max = opt->constraint.range->max; + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (opt->constraint.word_list[0] > 1) + { + min = max = opt->constraint.word_list[1]; + for (i = 2; i < opt->constraint.word_list[0]; ++i) + { + if (opt->constraint.word_list[i] < min) + min = opt->constraint.word_list[i]; + if (opt->constraint.word_list[i] > max) + max = opt->constraint.word_list[i]; + } + } + break; + + default: + break; + } + if (min == max) + { + fprintf (stderr, + "curve_new: warning: option `%s' has no value constraint\n", + opt->name); + fmin = 0; + fmax = 255; + } + else if (opt->type == SANE_TYPE_FIXED) + { + fmin = SANE_UNFIX (min); + fmax = SANE_UNFIX (max); + } + else + { + fmin = min; + fmax = max; + } + gtk_curve_set_range (GTK_CURVE (curve), 0, optlen - 1, fmin, fmax); + + status = sane_control_option (dev, optnum, SANE_ACTION_GET_VALUE, + optval, 0); + if (status == SANE_STATUS_GOOD) + { + for (i = 0; i < optlen; ++i) + { + if (opt->type == SANE_TYPE_FIXED) + val = SANE_UNFIX (optval[i]); + else + val = optval[i]; + vector[i] = val; + } + gtk_curve_set_vector (GTK_CURVE (curve), optlen, vector); + } + else + gtk_widget_set_sensitive (gamma, FALSE); + + return gamma; +} + +static void +vector_new (GSGDialog * dialog, GtkWidget * vbox, int num_vopts, int *vopts) +{ + GtkWidget *notebook, *label, *curve; + const SANE_Option_Descriptor *opt; + int i; + + notebook = gtk_notebook_new (); + gtk_container_border_width (GTK_CONTAINER (notebook), 4); + gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0); + + for (i = 0; i < num_vopts; ++i) + { + opt = sane_get_option_descriptor (dialog->dev, vopts[i]); + + label = gtk_label_new ((char *) opt->title); + vbox = gtk_vbox_new ( /* homogeneous */ FALSE, 0); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label); + gtk_widget_show (vbox); + gtk_widget_show (label); + + curve = curve_new (dialog, vopts[i]); + gtk_container_border_width (GTK_CONTAINER (curve), 4); + gtk_box_pack_start (GTK_BOX (vbox), curve, TRUE, TRUE, 0); + gtk_widget_show (curve); + + dialog->element[vopts[i]].widget = curve; + } + gtk_widget_show (notebook); +} + +static void +panel_destroy (GSGDialog * dialog) +{ + const SANE_Option_Descriptor *opt; + GSGDialogElement *elem; + int i, j; + +#ifdef HAVE_GTK_TOOLTIPS_SET_TIPS + /* pre 0.99.4: */ + gtk_tooltips_unref (dialog->tooltips); +#else +# if GTK_MAJOR_VERSION == 2 + gtk_object_sink (GTK_OBJECT (dialog->tooltips)); +# else + gtk_object_unref (GTK_OBJECT (dialog->tooltips)); +# endif /* GTK_MAJOR_VERSION == 2 */ +#endif + gtk_widget_destroy (dialog->main_hbox); + + /* free the menu labels of integer/fix-point word-lists: */ + for (i = 0; i < dialog->num_elements; ++i) + { + if (dialog->element[i].menu) + { + opt = sane_get_option_descriptor (dialog->dev, i); + elem = dialog->element + i; + if (opt->type != SANE_TYPE_STRING) + for (j = 0; j < elem->menu_size; ++j) + if (elem->menu[j].label) + { + free (elem->menu[j].label); + elem->menu[j].label = 0; + } + free (elem->menu); + elem->menu = 0; + } + } + memset (dialog->element, 0, + dialog->num_elements * sizeof (dialog->element[0])); +} + +static void +panel_build (GSGDialog * dialog) +{ + GtkWidget *main_hbox, *standard_vbox, *advanced_vbox, *option_vbox; + GtkWidget *parent, *vbox, *button, *label; + const SANE_Option_Descriptor *opt; + SANE_Handle dev = dialog->dev; + double dval, dmin, dmax, dquant; + char *buf, str[16], title[256]; + GSGDialogElement *elem; + SANE_Word quant, val; + SANE_Status status; + SANE_Int num_words; + char **str_list; + int i, j; + int num_vector_opts = 0, *vector_opts; + + main_hbox = gtk_hbox_new (FALSE, 2); + + if (dialog->twocolumn) + { + option_vbox = gtk_hbox_new (FALSE, 2); /* two column display */ + } + else + { + option_vbox = gtk_vbox_new (FALSE, 2); /* one column display */ + } + + gtk_box_pack_start (GTK_BOX (main_hbox), option_vbox, FALSE, FALSE, 0); + gtk_widget_show (option_vbox); + + /* standard options vbox */ + + standard_vbox = gtk_vbox_new ( /* homogeneous */ FALSE, 0); + gtk_widget_show (standard_vbox); + gtk_box_pack_start (GTK_BOX (option_vbox), standard_vbox, FALSE, FALSE, 0); + + /* advanced options page */ + + advanced_vbox = gtk_vbox_new ( /* homogeneous */ FALSE, 0); + gtk_box_pack_start (GTK_BOX (option_vbox), advanced_vbox, TRUE, TRUE, 0); + + /* use black as foreground: */ + dialog->tooltips = gtk_tooltips_new (); + dialog->tooltips_fg.red = 0; + dialog->tooltips_fg.green = 0; + dialog->tooltips_fg.blue = 0; + /* postit yellow (khaki) as background: */ + gdk_color_alloc (gtk_widget_get_colormap (main_hbox), &dialog->tooltips_fg); + dialog->tooltips_bg.red = 61669; + dialog->tooltips_bg.green = 59113; + dialog->tooltips_bg.blue = 35979; + gdk_color_alloc (gtk_widget_get_colormap (main_hbox), &dialog->tooltips_bg); + + /* GTK2 doesn't have the function (seems like it's not needed with GTK2 anyway) */ +#if GTK_MAJOR_VERSION < 2 + gtk_tooltips_set_colors (dialog->tooltips, + &dialog->tooltips_bg, &dialog->tooltips_fg); +#endif /* GTK_MAJOR_VERSION < 2 */ + + gsg_set_tooltips (dialog, preferences.tooltips_enabled); + + gtk_container_add (GTK_CONTAINER (dialog->window), main_hbox); + dialog->main_hbox = main_hbox; + dialog->advanced_vbox = advanced_vbox; + + /* reset well-known options: */ + dialog->well_known.preview = -1; + dialog->well_known.dpi = -1; + dialog->well_known.coord[GSG_TL_X] = -1; + dialog->well_known.coord[GSG_TL_Y] = -1; + dialog->well_known.coord[GSG_BR_X] = -1; + dialog->well_known.coord[GSG_BR_Y] = -1; + + vector_opts = alloca (dialog->num_elements * sizeof (int)); + + parent = standard_vbox; + for (i = 1; i < dialog->num_elements; ++i) + { + opt = sane_get_option_descriptor (dev, i); + if (!SANE_OPTION_IS_ACTIVE (opt->cap)) + continue; + /* pick up well-known options as we go: */ + if (opt->name) + { + if (strcmp (opt->name, SANE_NAME_PREVIEW) == 0 + && opt->type == SANE_TYPE_BOOL) + { + dialog->well_known.preview = i; + continue; + } + else if (strcmp (opt->name, SANE_NAME_SCAN_RESOLUTION) == 0 + && opt->unit == SANE_UNIT_DPI + && (opt->type == SANE_TYPE_INT + || opt->type == SANE_TYPE_FIXED)) + dialog->well_known.dpi = i; + else if (strcmp (opt->name, SANE_NAME_SCAN_TL_X) == 0) + dialog->well_known.coord[GSG_TL_X] = i; + else if (strcmp (opt->name, SANE_NAME_SCAN_TL_Y) == 0) + dialog->well_known.coord[GSG_TL_Y] = i; + else if (strcmp (opt->name, SANE_NAME_SCAN_BR_X) == 0) + dialog->well_known.coord[GSG_BR_X] = i; + else if (strcmp (opt->name, SANE_NAME_SCAN_BR_Y) == 0) + dialog->well_known.coord[GSG_BR_Y] = i; + } + + elem = dialog->element + i; + elem->dialog = dialog; + + if (opt->unit == SANE_UNIT_NONE) + strncpy (title, opt->title, sizeof (title)); + else + snprintf (title, sizeof (title), + "%s [%s]", opt->title, unit_string (opt->unit)); + + switch (opt->type) + { + case SANE_TYPE_GROUP: + /* group a set of options */ + vbox = standard_vbox; + if (opt->cap & SANE_CAP_ADVANCED) + vbox = advanced_vbox; + parent = group_new (vbox, title); + elem->widget = parent; + break; + + case SANE_TYPE_BOOL: + if ((opt->cap & SANE_CAP_ADVANCED) && !dialog->advanced) + break; + if (!(opt->cap & SANE_CAP_SOFT_DETECT)) + break; + assert (opt->size == sizeof (SANE_Word)); + status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE, + &val, 0); + if (status != SANE_STATUS_GOOD) + goto get_value_failed; + + button_new (parent, title, val, elem, dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + gtk_widget_show (parent->parent); + break; + + case SANE_TYPE_INT: + if ((opt->cap & SANE_CAP_ADVANCED) && !dialog->advanced) + break; + if (!(opt->cap & SANE_CAP_SOFT_DETECT)) + break; + if (opt->size != sizeof (SANE_Word)) + { + vector_opts[num_vector_opts++] = i; + break; + } + status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE, + &val, 0); + if (status != SANE_STATUS_GOOD) + goto get_value_failed; + + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + /* use a scale */ + quant = opt->constraint.range->quant; + if (quant == 0) + quant = 1; + scale_new (parent, title, val, + opt->constraint.range->min, + opt->constraint.range->max, quant, + (opt->cap & SANE_CAP_AUTOMATIC), elem, + dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + gtk_widget_show (parent->parent); + break; + + case SANE_CONSTRAINT_WORD_LIST: + /* use a "list-selection" widget */ + num_words = opt->constraint.word_list[0]; + str_list = malloc ((num_words + 1) * sizeof (str_list[0])); + for (j = 0; j < num_words; ++j) + { + sprintf (str, "%d", opt->constraint.word_list[j + 1]); + str_list[j] = strdup (str); + } + str_list[j] = 0; + sprintf (str, "%d", val); + option_menu_new (parent, title, str_list, str, elem, + dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + free (str_list); + gtk_widget_show (parent->parent); + break; + + case SANE_CONSTRAINT_NONE: + /* having no constraint for an int is strange but allowed + by the SANE standard so we just ignore such options here */ + break; + + default: + fprintf (stderr, "panel_build: unknown constraint %d!\n", + opt->constraint_type); + break; + } + break; + + case SANE_TYPE_FIXED: + if ((opt->cap & SANE_CAP_ADVANCED) && !dialog->advanced) + break; + if (!(opt->cap & SANE_CAP_SOFT_DETECT)) + break; + if (opt->size != sizeof (SANE_Word)) + { + vector_opts[num_vector_opts++] = i; + break; + } + status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE, + &val, 0); + if (status != SANE_STATUS_GOOD) + goto get_value_failed; + + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + /* use a scale */ + quant = opt->constraint.range->quant; + if (quant == 0) + quant = 1; + dval = SANE_UNFIX (val); + dmin = SANE_UNFIX (opt->constraint.range->min); + dmax = SANE_UNFIX (opt->constraint.range->max); + dquant = SANE_UNFIX (quant); + if (opt->unit == SANE_UNIT_MM) + { + dval /= preferences.length_unit; + dmin /= preferences.length_unit; + dmax /= preferences.length_unit; + dquant /= preferences.length_unit; + } + scale_new (parent, title, dval, dmin, dmax, dquant, + (opt->cap & SANE_CAP_AUTOMATIC), elem, + dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + gtk_widget_show (parent->parent); + break; + + case SANE_CONSTRAINT_WORD_LIST: + /* use a "list-selection" widget */ + num_words = opt->constraint.word_list[0]; + str_list = malloc ((num_words + 1) * sizeof (str_list[0])); + for (j = 0; j < num_words; ++j) + { + sprintf (str, "%g", + SANE_UNFIX (opt->constraint.word_list[j + 1])); + str_list[j] = strdup (str); + } + str_list[j] = 0; + sprintf (str, "%g", SANE_UNFIX (val)); + option_menu_new (parent, title, str_list, str, elem, + dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + free (str_list); + gtk_widget_show (parent->parent); + break; + + case SANE_CONSTRAINT_NONE: + /* having no constraint for a fixed is strange but allowed + by the SANE standard so we just ignore such options here */ + break; + + default: + fprintf (stderr, "panel_build: unknown constraint %d!\n", + opt->constraint_type); + break; + } + break; + + case SANE_TYPE_STRING: + if ((opt->cap & SANE_CAP_ADVANCED) && !dialog->advanced) + break; + if (!(opt->cap & SANE_CAP_SOFT_DETECT)) + break; + buf = malloc (opt->size); + status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE, + buf, 0); + if (status != SANE_STATUS_GOOD) + { + free (buf); + goto get_value_failed; + } + + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_STRING_LIST: + /* use a "list-selection" widget */ + option_menu_new (parent, title, + (char **) opt->constraint.string_list, buf, + elem, dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + gtk_widget_show (parent->parent); + break; + + case SANE_CONSTRAINT_NONE: + text_entry_new (parent, title, buf, elem, + dialog->tooltips, opt->desc, + SANE_OPTION_IS_SETTABLE (opt->cap)); + gtk_widget_show (parent->parent); + break; + + default: + fprintf (stderr, "panel_build: unknown constraint %d!\n", + opt->constraint_type); + break; + } + free (buf); + break; + + case SANE_TYPE_BUTTON: + if ((opt->cap & SANE_CAP_ADVANCED) && !dialog->advanced) + break; + button = gtk_button_new (); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) push_button_callback, elem); + set_tooltip (dialog->tooltips, button, opt->desc); + + label = gtk_label_new (title); + gtk_container_add (GTK_CONTAINER (button), label); + + gtk_box_pack_start (GTK_BOX (parent), button, FALSE, TRUE, 0); + + gtk_widget_show (label); + gtk_widget_show (button); + + elem->widget = button; + gtk_widget_show (parent->parent); + break; + + default: + fprintf (stderr, "panel_build: Unknown type %d\n", opt->type); + break; + } + continue; + + get_value_failed: + { + char msg[256]; + + sprintf (msg, "Failed to obtain value of option %s: %s.", + opt->name, sane_strstatus (status)); + gsg_error (msg); + } + } + + /* now add in vector editor, if necessary: */ + + if (num_vector_opts) + vector_new (dialog, main_hbox, num_vector_opts, vector_opts); + + if (dialog->advanced) + gtk_widget_show (dialog->advanced_vbox); + else + gtk_widget_hide (dialog->advanced_vbox); + gtk_widget_show (main_hbox); +} + +/* When an setting an option changes the dialog, everything may + change: the option titles, the activity-status of the option, its + constraints or what not. Thus, rather than trying to be clever in + detecting what exactly changed, we use a brute-force method of + rebuilding the entire dialog. */ +static void +panel_rebuild (GSGDialog * dialog) +{ + panel_destroy (dialog); + panel_build (dialog); +} + +GSGDialog * +gsg_create_dialog (GtkWidget * window, const char *device_name, + GSGCallback option_reload_callback, + void *option_reload_arg, GSGCallback param_change_callback, + void *param_change_arg) +{ + SANE_Int num_elements; + GSGDialog *dialog; + SANE_Status status; + SANE_Handle dev; + char buf[256]; + + status = sane_open (device_name, &dev); + if (status != SANE_STATUS_GOOD) + { + sprintf (buf, "Failed to open device `%s': %s.", + device_name, sane_strstatus (status)); + gsg_error (buf); + return 0; + } + + if (sane_control_option (dev, 0, SANE_ACTION_GET_VALUE, &num_elements, 0) + != SANE_STATUS_GOOD) + { + gsg_error ("Error obtaining option count."); + sane_close (dev); + return 0; + } + + dialog = malloc (sizeof (*dialog)); + memset (dialog, 0, sizeof (*dialog)); + + dialog->window = window; + dialog->dev = dev; + dialog->dev_name = strdup (device_name); + dialog->num_elements = num_elements; + dialog->option_reload_callback = option_reload_callback; + dialog->option_reload_arg = option_reload_arg; + dialog->param_change_callback = param_change_callback; + dialog->param_change_arg = param_change_arg; + dialog->advanced = preferences.advanced; + dialog->twocolumn = preferences.twocolumn_enabled; + + dialog->element = malloc (num_elements * sizeof (dialog->element[0])); + memset (dialog->element, 0, num_elements * sizeof (dialog->element[0])); + + panel_build (dialog); + return dialog; +} + +void +gsg_refresh_dialog (GSGDialog * dialog) +{ + panel_rebuild (dialog); + if (dialog->param_change_callback) + (*dialog->param_change_callback) (dialog, dialog->param_change_arg); +} + +void +gsg_update_scan_window (GSGDialog * dialog) +{ + const SANE_Option_Descriptor *opt; + double old_val, new_val; + GSGDialogElement *elem; + SANE_Status status; + SANE_Word word; + int i, optnum; + char str[64]; + + for (i = 0; i < 4; ++i) + if (dialog->well_known.coord[i] > 0) + { + optnum = dialog->well_known.coord[i]; + elem = dialog->element + optnum; + opt = sane_get_option_descriptor (dialog->dev, optnum); + + status = sane_control_option (dialog->dev, optnum, + SANE_ACTION_GET_VALUE, &word, 0); + if (status != SANE_STATUS_GOOD) + continue; /* sliently ignore errors */ + + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + if (opt->type == SANE_TYPE_INT) + { + old_val = GTK_ADJUSTMENT (elem->data)->value; + new_val = word; + GTK_ADJUSTMENT (elem->data)->value = new_val; + } + else + { + old_val = GTK_ADJUSTMENT (elem->data)->value; + new_val = SANE_UNFIX (word); + if (opt->unit == SANE_UNIT_MM) + new_val /= preferences.length_unit; + GTK_ADJUSTMENT (elem->data)->value = new_val; + } + if (old_val != new_val) + gtk_signal_emit_by_name (GTK_OBJECT (elem->data), + "value_changed"); + break; + + case SANE_CONSTRAINT_WORD_LIST: + if (opt->type == SANE_TYPE_INT) + sprintf (str, "%d", word); + else + sprintf (str, "%g", SANE_UNFIX (word)); + /* XXX maybe we should call this only when the value changes... */ + gtk_option_menu_set_history (GTK_OPTION_MENU (elem->widget), + option_menu_lookup (elem->menu, + str)); + break; + + default: + break; + } + } +} + +/* Ensure sure the device has up-to-date option values. Except for + vectors, all option values are kept current. Vectors are + downloaded into the device during this call. */ +void +gsg_sync (GSGDialog * dialog) +{ + const SANE_Option_Descriptor *opt; + gfloat val, *vector; + SANE_Word *optval; + int i, j, optlen; + GtkWidget *curve; + + for (i = 1; i < dialog->num_elements; ++i) + { + opt = sane_get_option_descriptor (dialog->dev, i); + if (!SANE_OPTION_IS_ACTIVE (opt->cap)) + continue; + + if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED) + continue; + + if (opt->size == sizeof (SANE_Word)) + continue; + + /* ok, we're dealing with an active vector */ + + optlen = opt->size / sizeof (SANE_Word); + optval = alloca (optlen * sizeof (optval[0])); + vector = alloca (optlen * sizeof (vector[0])); + + curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve; + gtk_curve_get_vector (GTK_CURVE (curve), optlen, vector); + for (j = 0; j < optlen; ++j) + { + val = vector[j]; + if (opt->type == SANE_TYPE_FIXED) + optval[j] = SANE_FIX (val); + else + optval[j] = val + 0.5; + } + + set_option (dialog, i, optval, SANE_ACTION_SET_VALUE); + } +} + +void +gsg_set_advanced (GSGDialog * dialog, int advanced) +{ + dialog->advanced = advanced; + panel_rebuild (dialog); +} + +void +gsg_set_tooltips (GSGDialog * dialog, int enable) +{ + if (!dialog->tooltips) + return; + + if (enable) + gtk_tooltips_enable (dialog->tooltips); + else + gtk_tooltips_disable (dialog->tooltips); +} + +void +gsg_set_twocolumn (GSGDialog * dialog, int twocolumn) +{ + dialog->twocolumn = twocolumn; + panel_rebuild (dialog); +} + +void +gsg_set_sensitivity (GSGDialog * dialog, int sensitive) +{ + const SANE_Option_Descriptor *opt; + int i; + + for (i = 0; i < dialog->num_elements; ++i) + { + opt = sane_get_option_descriptor (dialog->dev, i); + + if (!SANE_OPTION_IS_ACTIVE (opt->cap) + || opt->type == SANE_TYPE_GROUP || !dialog->element[i].widget) + continue; + + if (!(opt->cap & SANE_CAP_ALWAYS_SETTABLE)) + gtk_widget_set_sensitive (dialog->element[i].widget, sensitive); + } +} + +void +gsg_destroy_dialog (GSGDialog * dialog) +{ + SANE_Handle dev = dialog->dev; + + panel_destroy (dialog); + free ((void *) dialog->dev_name); + free (dialog->element); + free (dialog); + + sane_close (dev); +} diff --git a/src/gtkglue.h b/src/gtkglue.h new file mode 100644 index 0000000..00b1666 --- /dev/null +++ b/src/gtkglue.h @@ -0,0 +1,121 @@ +#ifndef gtkglue_h +#define gtkglue_h + +#include <sys/types.h> + +#include <gtk/gtk.h> + +#include "../include/sane/config.h" +#include <sane/sane.h> + +struct GSGDialog; + +typedef void (*GSGCallback) (struct GSGDialog *dialog, void *arg); + +typedef enum + { + GSG_TL_X, /* top-left x */ + GSG_TL_Y, /* top-left y */ + GSG_BR_X, /* bottom-right x */ + GSG_BR_Y /* bottom-right y */ + } +GSGCornerCoordinates; + +typedef struct + { + /* The option number of the well-known options. Each of these may + be -1 in case the backend doesn't define the respective option. */ + int preview; + int dpi; + int coord[4]; + } +GSGWellKnownOptions; + +typedef struct + { + gchar *label; + struct GSGDialogElement *elem; + gint index; + } +GSGMenuItem; + +typedef struct GSGDialogElement + { + struct GSGDialog *dialog; /* wasteful, but is there a better solution? */ + GtkWidget *automatic; /* auto button for options that support this */ + GtkWidget *widget; + GtkObject *data; + int menu_size; /* # of items in menu (if any) */ + GSGMenuItem *menu; + } +GSGDialogElement; + +typedef struct GSGDialog + { + GtkWidget *window; + GtkWidget *main_hbox; + GtkWidget *advanced_vbox; + int twocolumn; + GtkTooltips *tooltips; + GdkColor tooltips_fg; + GdkColor tooltips_bg; + SANE_Handle *dev; + const char *dev_name; + GSGWellKnownOptions well_known; + int num_elements; + GSGDialogElement *element; + gint idle_id; + u_int rebuild : 1; + u_int advanced : 1; + /* This callback gets invoked whenever the backend notifies us + that the option descriptors have changed. */ + GSGCallback option_reload_callback; + void *option_reload_arg; + /* This callback gets invoked whenever the backend notifies us + that the parameters have changed. */ + GSGCallback param_change_callback; + void *param_change_arg; + } +GSGDialog; + + +extern int gsg_message_dialog_active; + +/* Construct the path and return it in filename_ret (this buffer must + be at least max_len bytes long). The path is constructed as + follows: + + ~/.sane/${PROG_NAME}/${PREFIX}${DEV_NAME}${POSTFIX} + + If PROG_NAME is NULL, an empty string is used and the leading slash + is removed. On success, 0 is returned, on error a negative number and + ERRNO is set to the appropriate value. */ +extern int gsg_make_path (size_t max_len, char *filename_ret, + const char *prog_name, + const char *prefix, const char *dev_name, + const char *postfix); + +extern void gsg_message (gchar *title, gchar * message); +extern void gsg_error (gchar * error_message); +extern void gsg_warning (gchar * warning_message); +extern int gsg_get_filename (const char *label, const char *default_name, + size_t max_len, char *filename); + +extern GSGDialog *gsg_create_dialog (GtkWidget *window, + const char *device_name, + GSGCallback option_reload_callback, + void *option_reload_arg, + GSGCallback param_callback, + void *param_arg); +extern void gsg_sync (GSGDialog *dialog); +extern void gsg_refresh_dialog (GSGDialog *dialog); +extern void gsg_update_scan_window (GSGDialog *dialog); +extern void gsg_set_advanced (GSGDialog *dialog, int advanced); +extern void gsg_set_tooltips (GSGDialog *dialog, int enable); +extern void gsg_set_twocolumn (GSGDialog *dialog, int enable); +extern void gsg_set_sensitivity (GSGDialog *dialog, int sensitive); +extern void gsg_destroy_dialog (GSGDialog * dialog); + +#define gsg_dialog_get_device(dialog) ((dialog)->dev) + +#endif /* gtkglue_h */ diff --git a/src/preferences.c b/src/preferences.c new file mode 100644 index 0000000..16c3839 --- /dev/null +++ b/src/preferences.c @@ -0,0 +1,185 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "../include/sane/config.h" + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <preferences.h> +#include <sane/sane.h> +#include "../include/sane/sanei.h" +#include "../include/sane/sanei_wire.h" +#include "../include/sane/sanei_codec_ascii.h" + +#define POFFSET(field) ((char *) &((Preferences *) 0)->field - (char *) 0) +#define PFIELD(p,offset,type) (*((type *)(((char *)(p)) + (offset)))) + +Preferences preferences = + { + 0, /* no preferred device (must be 0 or malloced!) */ + 0, /* no default filename */ + 0, /* advanced user */ + 1, /* tooltips enabled */ + 1, /* two column enabled */ + 10.0, /* length unit */ + 1, /* preserve_preview */ + 0, /* preview_own_cmap */ + 1.0 /* preview_gamma */ + }; + +static void w_string (Wire *w, Preferences *p, long offset); +static void w_double (Wire *w, Preferences *p, long offset); +static void w_int (Wire *w, Preferences *p, long offset); + +static struct + { + SANE_String name; + void (*codec) (Wire *w, Preferences *p, long offset); + long offset; + } +desc[] = + { + {"device", w_string, POFFSET(device)}, + {"filename", w_string, POFFSET(filename)}, + {"advanced", w_int, POFFSET(advanced)}, + {"tool-tips", w_int, POFFSET(tooltips_enabled)}, + {"twocolumn", w_int, POFFSET(twocolumn_enabled)}, + {"length-unit", w_double, POFFSET(length_unit)}, + {"preserve-preview", w_int, POFFSET(preserve_preview)}, + {"preview-own-cmap", w_int, POFFSET(preview_own_cmap)}, + {"preview-gamma", w_double, POFFSET(preview_gamma)}, + }; + +static void +w_string (Wire *w, Preferences *p, long offset) +{ + SANE_String string; + + if (w->direction == WIRE_ENCODE) + string = PFIELD (p, offset, char *); + + sanei_w_string (w, &string); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + { + const char **field; + + field = &PFIELD (p, offset, const char *); + if (*field) + free ((char *) *field); + *field = string ? strdup (string) : 0; + } + sanei_w_free (w, (WireCodecFunc) sanei_w_string, &string); + } +} + +static void +w_double (Wire *w, Preferences *p, long offset) +{ + SANE_Word word; + + if (w->direction == WIRE_ENCODE) + word = SANE_FIX (PFIELD (p, offset, double)); + + sanei_w_word (w, &word); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + PFIELD (p, offset, double) = SANE_UNFIX (word); + sanei_w_free (w, (WireCodecFunc) sanei_w_word, &word); + } +} + +static void +w_int (Wire *w, Preferences *p, long offset) +{ + SANE_Word word; + + if (w->direction == WIRE_ENCODE) + word = PFIELD (p, offset, int); + + sanei_w_word (w, &word); + + if (w->direction == WIRE_DECODE) + { + if (w->status == 0) + PFIELD (p, offset, int) = word; + sanei_w_free (w, (WireCodecFunc) sanei_w_word, &word); + } +} + +void +preferences_save (int fd) +{ + Wire w; + int i; + + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + sanei_w_init (&w, sanei_codec_ascii_init); + sanei_w_set_dir (&w, WIRE_ENCODE); + + for (i = 0; i < NELEMS (desc); ++i) + { + sanei_w_string (&w, &desc[i].name); + (*desc[i].codec) (&w, &preferences, desc[i].offset); + } + + sanei_w_set_dir (&w, WIRE_DECODE); /* flush it out */ +} + +void +preferences_restore (int fd) +{ + SANE_String name; + Wire w; + int i; + + w.io.fd = fd; + w.io.read = read; + w.io.write = write; + sanei_w_init (&w, sanei_codec_ascii_init); + sanei_w_set_dir (&w, WIRE_DECODE); + + while (1) + { + sanei_w_space (&w, 3); + if (w.status) + return; + + sanei_w_string (&w, &name); + if (w.status || !name) + return; + + for (i = 0; i < NELEMS (desc); ++i) + { + if (strcmp (name, desc[i].name) == 0) + { + (*desc[i].codec) (&w, &preferences, desc[i].offset); + break; + } + } + } +} diff --git a/src/preferences.h b/src/preferences.h new file mode 100644 index 0000000..5c58df3 --- /dev/null +++ b/src/preferences.h @@ -0,0 +1,25 @@ +#ifndef preferences_h +#define preferences_h + +#include <sane/sane.h> + +typedef struct + { + const char *device; /* name of preferred device (or NULL) */ + const char *filename; /* default filename */ + int advanced; /* advanced user? */ + int tooltips_enabled; /* should tooltips be disabled? */ + int twocolumn_enabled; /* should two column be disabled? */ + double length_unit; /* 1.0==mm, 10.0==cm, 25.4==inches, etc. */ + int preserve_preview; /* save/restore preview image(s)? */ + int preview_own_cmap; /* install colormap for preview */ + double preview_gamma; /* gamma value for previews */ + } +Preferences; + +extern Preferences preferences; + +extern void preferences_save (int fd); +extern void preferences_restore (int fd); + +#endif /* preferences_h */ diff --git a/src/preview.c b/src/preview.c new file mode 100644 index 0000000..6fb21c0 --- /dev/null +++ b/src/preview.c @@ -0,0 +1,1536 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang and Tristan Tarrant + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* + The preview strategy is as follows: + + 1) A preview always acquires an image that covers the entire + scan surface. This is necessary so the user can see not + only what is, but also what isn't selected. + + 2) The preview must be zoomable so the user can precisely pick + the selection area even for small scans on a large scan + surface. The user also should have the option of resizing + the preview window. + + 3) We let the user/backend pick whether a preview is in color, + grayscale, lineart or what not. The only options that the + preview may (temporarily) modify are: + + - resolution (set so the preview fills the window) + - scan area options (top-left corner, bottom-right corner) + - preview option (to let the backend know we're doing a preview) + + 4) The size of the scan surface is determined based on the constraints + of the four corner coordinates. Missing constraints are replaced + by +/-INF as appropriate (-INF form top-left, +INF for bottom-right + coords). + + 5) The size of the preview window is determined based on the scan + surface size: + + If the surface area is specified in pixels and if that size + fits on the screen, we use that size. In all other cases, + we make the window of a size so that neither the width nor + the height is bigger than some fraction of the screen-size + while preserving the aspect ratio (a surface width or height + of INF implies an aspect ratio of 1). + + 6) Given the preview window size and the scan surface size, we + select the resolution so the acquired preview image just fits + in the preview window. The resulting resolution may be out + of range in which case we pick the minum/maximum if there is + a range or word-list constraint or a default value if there is + no such constraint. + + 7) Once a preview image has been acquired, we know the size of the + preview image (in pixels). An initial scale factor is chosen + so the image fits into the preview window. + + */ + +#include "../include/sane/config.h" + +#include <assert.h> +#include <math.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include <sys/param.h> + +#include "gtkglue.h" +#include "preview.h" +#include "preferences.h" + +#define DBG_fatal 0 +#define DBG_error 1 +#define DBG_warning 2 +#define DBG_info 3 +#define DBG_debug 4 + +#define BACKEND_NAME preview +#include "../include/sane/sanei_debug.h" + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +/* Anything bigger than 2G will do, since SANE coordinates are 32 bit + values. */ +#define INF 5.0e9 + +#define MM_PER_INCH 25.4 + +/* Cut fp conversion routines some slack: */ +#define GROSSLY_DIFFERENT(f1,f2) (fabs ((f1) - (f2)) > 1e-3) + +#ifdef __alpha__ + /* This seems to be necessary for at least some XFree86 3.1.2 + servers. It's known to be necessary for the XF86_TGA server for + Linux/Alpha. Fortunately, it's no great loss so we turn this on + by default for now. */ +# define XSERVER_WITH_BUGGY_VISUALS +#endif + +/* forward declarations */ +static void scan_start (Preview * p); +static void scan_done (Preview * p); + +static void +draw_rect (GdkWindow * win, GdkGC * gc, int coord[4]) +{ + gint x, y, w, h; + + x = coord[0]; + y = coord[1]; + w = coord[2] - x; + h = coord[3] - y; + if (w < 0) + { + x = coord[2]; + w = -w; + } + if (h < 0) + { + y = coord[3]; + h = -h; + } + gdk_draw_rectangle (win, gc, FALSE, x, y, w + 1, h + 1); +} + +static void +draw_selection (Preview * p) +{ + if (!p->gc) + /* window isn't mapped yet */ + return; + + if (p->previous_selection.active) + draw_rect (p->window->window, p->gc, p->previous_selection.coord); + + if (p->selection.active) + draw_rect (p->window->window, p->gc, p->selection.coord); + + p->previous_selection = p->selection; +} + +static void +update_selection (Preview * p) +{ + float min, max, normal, dev_selection[4]; + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Word val; + int i, optnum; + + p->previous_selection = p->selection; + + memcpy (dev_selection, p->surface, sizeof (dev_selection)); + for (i = 0; i < 4; ++i) + { + optnum = p->dialog->well_known.coord[i]; + if (optnum > 0) + { + opt = sane_get_option_descriptor (p->dialog->dev, optnum); + status = sane_control_option (p->dialog->dev, optnum, + SANE_ACTION_GET_VALUE, &val, 0); + if (status != SANE_STATUS_GOOD) + continue; + if (opt->type == SANE_TYPE_FIXED) + dev_selection[i] = SANE_UNFIX (val); + else + dev_selection[i] = val; + } + } + for (i = 0; i < 2; ++i) + { + min = p->surface[i]; + if (min <= -INF) + min = 0.0; + max = p->surface[i + 2]; + if (max >= INF) + max = p->preview_width; + + normal = ((i == 0) ? p->preview_width : p->preview_height) - 1; + normal /= (max - min); + p->selection.active = TRUE; + p->selection.coord[i] = ((dev_selection[i] - min) * normal) + 0.5; + p->selection.coord[i + 2] = + ((dev_selection[i + 2] - min) * normal) + 0.5; + if (p->selection.coord[i + 2] < p->selection.coord[i]) + p->selection.coord[i + 2] = p->selection.coord[i]; + } + draw_selection (p); +} + +static void +get_image_scale (Preview * p, float *xscalep, float *yscalep) +{ + float xscale, yscale; + + if (p->image_width == 0) + xscale = 1.0; + else + { + xscale = p->image_width / (float) p->preview_width; + if (p->image_height > 0 && p->preview_height * xscale < p->image_height) + xscale = p->image_height / (float) p->preview_height; + } + yscale = xscale; + + if (p->surface_unit == SANE_UNIT_PIXEL + && p->image_width <= p->preview_width + && p->image_height <= p->preview_height) + { + float swidth, sheight; + + assert (p->surface_type == SANE_TYPE_INT); + swidth = (p->surface[GSG_BR_X] - p->surface[GSG_TL_X] + 1); + sheight = (p->surface[GSG_BR_Y] - p->surface[GSG_TL_Y] + 1); + xscale = 1.0; + yscale = 1.0; + if (p->image_width > 0 && swidth < INF) + xscale = p->image_width / swidth; + if (p->image_height > 0 && sheight < INF) + yscale = p->image_height / sheight; + } + *xscalep = xscale; + *yscalep = yscale; +} + +static void +paint_image (Preview * p) +{ + float xscale, yscale, src_x, src_y; + int dst_x, dst_y, height, x, y, src_offset; + gint gwidth, gheight; + + gwidth = p->preview_width; + gheight = p->preview_height; + + get_image_scale (p, &xscale, &yscale); + + memset (p->preview_row, 0xff, 3 * gwidth); + + /* don't draw last line unless it's complete: */ + height = p->image_y; + if (p->image_x == 0 && height < p->image_height) + ++height; + + /* for now, use simple nearest-neighbor interpolation: */ + src_offset = 0; + src_x = src_y = 0.0; + for (dst_y = 0; dst_y < gheight; ++dst_y) + { + y = (int) (src_y + 0.5); + if (y >= height) + break; + src_offset = y * 3 * p->image_width; + + if (p->image_data) + for (dst_x = 0; dst_x < gwidth; ++dst_x) + { + x = (int) (src_x + 0.5); + if (x >= p->image_width) + break; + + p->preview_row[3 * dst_x + 0] = + p->image_data[src_offset + 3 * x + 0]; + p->preview_row[3 * dst_x + 1] = + p->image_data[src_offset + 3 * x + 1]; + p->preview_row[3 * dst_x + 2] = + p->image_data[src_offset + 3 * x + 2]; + src_x += xscale; + } + gtk_preview_draw_row (GTK_PREVIEW (p->window), p->preview_row, + 0, dst_y, gwidth); + src_x = 0.0; + src_y += yscale; + } +} + +static void +display_partial_image (Preview * p) +{ + paint_image (p); + + if (GTK_WIDGET_DRAWABLE (p->window)) + { + GtkPreview *preview = GTK_PREVIEW (p->window); + int src_x, src_y; + + src_x = (p->window->allocation.width - preview->buffer_width) / 2; + src_y = (p->window->allocation.height - preview->buffer_height) / 2; + gtk_preview_put (preview, p->window->window, p->window->style->black_gc, + src_x, src_y, + 0, 0, p->preview_width, p->preview_height); + } +} + +static void +display_maybe (Preview * p) +{ + time_t now; + + time (&now); + if (now > p->image_last_time_updated) + { + p->image_last_time_updated = now; + display_partial_image (p); + } +} + +static void +display_image (Preview * p) +{ + if (p->params.lines <= 0 && p->image_y < p->image_height) + { + p->image_height = p->image_y; + p->image_data = realloc (p->image_data, + 3 * p->image_width * p->image_height); + assert (p->image_data); + } + display_partial_image (p); + scan_done (p); +} + +static void +preview_area_resize (GtkWidget * widget) +{ + float min_x, max_x, min_y, max_y, xscale, yscale, f; + Preview *p; + + p = gtk_object_get_data (GTK_OBJECT (widget), "PreviewPointer"); + + p->preview_width = widget->allocation.width; + p->preview_height = widget->allocation.height; + + if (p->preview_row) + p->preview_row = realloc (p->preview_row, 3 * p->preview_width); + else + p->preview_row = malloc (3 * p->preview_width); + + /* set the ruler ranges: */ + + min_x = p->surface[GSG_TL_X]; + if (min_x <= -INF) + min_x = 0.0; + + max_x = p->surface[GSG_BR_X]; + if (max_x >= INF) + max_x = p->preview_width - 1; + + min_y = p->surface[GSG_TL_Y]; + if (min_y <= -INF) + min_y = 0.0; + + max_y = p->surface[GSG_BR_Y]; + if (max_y >= INF) + max_y = p->preview_height - 1; + + /* convert mm to inches if that's what the user wants: */ + + if (p->surface_unit == SANE_UNIT_MM) + { + double factor = 1.0 / preferences.length_unit; + min_x *= factor; + max_x *= factor; + min_y *= factor; + max_y *= factor; + } + + get_image_scale (p, &xscale, &yscale); + + if (p->surface_unit == SANE_UNIT_PIXEL) + f = 1.0 / xscale; + else if (p->image_width) + f = xscale * p->preview_width / p->image_width; + else + f = 1.0; + gtk_ruler_set_range (GTK_RULER (p->hruler), f * min_x, f * max_x, f * min_x, + /* max_size */ 20); + + if (p->surface_unit == SANE_UNIT_PIXEL) + f = 1.0 / yscale; + else if (p->image_height) + f = yscale * p->preview_height / p->image_height; + else + f = 1.0; + gtk_ruler_set_range (GTK_RULER (p->vruler), f * min_y, f * max_y, f * min_y, + /* max_size */ 20); + + paint_image (p); + update_selection (p); +} + +static void +get_bounds (const SANE_Option_Descriptor * opt, float *minp, float *maxp) +{ + float min, max; + int i; + + min = -INF; + max = INF; + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_RANGE: + min = opt->constraint.range->min; + max = opt->constraint.range->max; + break; + + case SANE_CONSTRAINT_WORD_LIST: + min = INF; + max = -INF; + for (i = 1; i <= opt->constraint.word_list[0]; ++i) + { + if (opt->constraint.word_list[i] < min) + min = opt->constraint.word_list[i]; + if (opt->constraint.word_list[i] > max) + max = opt->constraint.word_list[i]; + } + break; + + default: + break; + } + if (opt->type == SANE_TYPE_FIXED) + { + if (min > -INF && min < INF) + min = SANE_UNFIX (min); + if (max > -INF && max < INF) + max = SANE_UNFIX (max); + } + *minp = min; + *maxp = max; +} + +static void +save_option (Preview * p, int option, SANE_Word * save_loc, int *valid) +{ + SANE_Status status; + + if (option <= 0) + { + *valid = 0; + return; + } + status = sane_control_option (p->dialog->dev, option, SANE_ACTION_GET_VALUE, + save_loc, 0); + *valid = (status == SANE_STATUS_GOOD); +} + +static void +restore_option (Preview * p, int option, SANE_Word saved_value, int valid) +{ + const SANE_Option_Descriptor *opt; + SANE_Status status; + SANE_Handle dev; + + if (!valid) + return; + + dev = p->dialog->dev; + status = sane_control_option (dev, option, SANE_ACTION_SET_VALUE, + &saved_value, 0); + if (status != SANE_STATUS_GOOD) + { + char buf[256]; + opt = sane_get_option_descriptor (dev, option); + snprintf (buf, sizeof (buf), "Failed restore value of option %s: %s.", + opt->name, sane_strstatus (status)); + gsg_error (buf); + } +} + +static SANE_Status +set_option_float (Preview * p, int option, float value) +{ + const SANE_Option_Descriptor *opt; + SANE_Handle dev; + SANE_Word word; + SANE_Status status; + + if (option <= 0 || value <= -INF || value >= INF) + return SANE_STATUS_INVAL; + + dev = p->dialog->dev; + opt = sane_get_option_descriptor (dev, option); + if (opt->type == SANE_TYPE_FIXED) + word = SANE_FIX (value) + 0.5; + else + word = value + 0.5; + status = sane_control_option (dev, option, SANE_ACTION_SET_VALUE, &word, 0); + if (status != SANE_STATUS_GOOD) + { + char buf[256]; + opt = sane_get_option_descriptor (dev, option); + snprintf (buf, sizeof (buf), "Failed to set option %s: %s.", + opt->name, sane_strstatus (status)); + gsg_error (buf); + return status; + } + return SANE_STATUS_GOOD; +} + +static void +set_option_bool (Preview * p, int option, SANE_Bool value) +{ + SANE_Handle dev; + SANE_Status status; + + if (option <= 0) + return; + + dev = p->dialog->dev; + status = + sane_control_option (dev, option, SANE_ACTION_SET_VALUE, &value, 0); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "set_option_bool: sane_control_option failed: %s\n", + sane_strstatus (status)); + return; + } +} + +static int +increment_image_y (Preview * p) +{ + size_t extra_size, offset; + char buf[256]; + + p->image_x = 0; + ++p->image_y; + if (p->params.lines <= 0 && p->image_y >= p->image_height) + { + offset = 3 * p->image_width * p->image_height; + extra_size = 3 * 32 * p->image_width; + p->image_height += 32; + p->image_data = realloc (p->image_data, offset + extra_size); + if (!p->image_data) + { + snprintf (buf, sizeof (buf), + "Failed to reallocate image memory: %s.", + strerror (errno)); + gsg_error (buf); + scan_done (p); + return -1; + } + memset (p->image_data + offset, 0xff, extra_size); + } + return 0; +} + +static void +input_available (gpointer data, gint source, GdkInputCondition cond) +{ + SANE_Status status; + Preview *p = data; + u_char buf[8192]; + SANE_Handle dev; + SANE_Int len; + int i, j; + + DBG_INIT (); + + DBG (DBG_debug, "input_available: enter\n"); + + dev = p->dialog->dev; + while (1) + { + status = sane_read (dev, buf, sizeof (buf), &len); + if (status != SANE_STATUS_GOOD) + { + if (status == SANE_STATUS_EOF) + { + if (p->params.last_frame) + display_image (p); + else + { + if (p->input_tag < 0) + { + display_maybe (p); + while (gtk_events_pending ()) + gtk_main_iteration (); + } + else + { + gdk_input_remove (p->input_tag); + p->input_tag = -1; + } + scan_start (p); + break; + } + } + else + { + snprintf (buf, sizeof (buf), "Error during read: %s.", + sane_strstatus (status)); + gsg_error (buf); + } + scan_done (p); + return; + } + if (!len) /* out of data for now */ + { + if (p->input_tag < 0) + { + display_maybe (p); + while (gtk_events_pending ()) + gtk_main_iteration (); + continue; + } + else + break; + } + + switch (p->params.format) + { + case SANE_FRAME_RGB: + switch (p->params.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask = buf[i]; + + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0xff : 0x00; + + p->image_data[p->image_offset] = gl; + if (j != 0) + p->image_offset += 3; + else + { + if ((p->image_offset % 3) != 2) + p->image_offset -= 20; + else + p->image_offset++; + } + if (p->image_offset % 3 == 0) + { + if (++p->image_x >= p->image_width) + { + if (increment_image_y (p) < 0) + return; + } + } + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + p->image_data[p->image_offset++] = buf[i]; + if (p->image_offset % 3 == 0) + { + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + } + break; + case 16: + for (i = 0; i < len; ++i) + { + guint16 value = buf[i]; + if ((i % 2) == 1) + p->image_data[p->image_offset++] = *(guint8 *) (&value); + if (p->image_offset % 6 == 0) + { + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + } + break; + default: + goto bad_depth; + } + break; + + case SANE_FRAME_GRAY: + switch (p->params.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask = buf[i]; + + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0x00 : 0xff; + p->image_data[p->image_offset++] = gl; + p->image_data[p->image_offset++] = gl; + p->image_data[p->image_offset++] = gl; + if (++p->image_x >= p->image_width) + { + if (increment_image_y (p) < 0) + return; + break; /* skip padding bits */ + } + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + u_char gl = buf[i]; + p->image_data[p->image_offset++] = gl; + p->image_data[p->image_offset++] = gl; + p->image_data[p->image_offset++] = gl; + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + break; + case 16: + for (i = 0; i < len; ++i) + { + guint16 value = buf[i]; + if ((i % 2) == 1) + { + p->image_data[p->image_offset++] = *(guint8 *) (&value); + p->image_data[p->image_offset++] = *(guint8 *) (&value); + p->image_data[p->image_offset++] = *(guint8 *) (&value); + } + if (p->image_offset % 2 == 0) + { + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + } + break; + + default: + goto bad_depth; + } + break; + + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + switch (p->params.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask = buf[i]; + + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0xff : 0x00; + p->image_data[p->image_offset] = gl; + p->image_offset += 3; + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + p->image_data[p->image_offset] = buf[i]; + p->image_offset += 3; + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + break; + + case 16: + for (i = 0; i < len; ++i) + { + guint16 value = buf[i]; + if ((i % 2) == 1) + { + p->image_data[p->image_offset] = *(guint8 *) (&value); + p->image_offset += 3; + } + if (p->image_offset % 2 == 0) + { + if (++p->image_x >= p->image_width + && increment_image_y (p) < 0) + return; + } + } + break; + + default: + goto bad_depth; + } + break; + + default: + fprintf (stderr, "preview.input_available: bad frame format %d\n", + p->params.format); + scan_done (p); + return; + } + if (p->input_tag < 0) + { + display_maybe (p); + while (gtk_events_pending ()) + gtk_main_iteration (); + } + } + display_maybe (p); + return; + +bad_depth: + snprintf (buf, sizeof (buf), "Preview cannot handle depth %d.", + p->params.depth); + gsg_error (buf); + scan_done (p); + return; +} + +static void +scan_done (Preview * p) +{ + int i; + + p->scanning = FALSE; + if (p->input_tag >= 0) + { + gdk_input_remove (p->input_tag); + p->input_tag = -1; + } + sane_cancel (p->dialog->dev); + + restore_option (p, p->dialog->well_known.dpi, + p->saved_dpi, p->saved_dpi_valid); + for (i = 0; i < 4; ++i) + restore_option (p, p->dialog->well_known.coord[i], + p->saved_coord[i], p->saved_coord_valid[i]); + set_option_bool (p, p->dialog->well_known.preview, SANE_FALSE); + + gtk_widget_set_sensitive (p->cancel, FALSE); + gtk_widget_set_sensitive (p->preview, TRUE); + gsg_set_sensitivity (p->dialog, TRUE); + gtk_widget_set_sensitive (p->dialog->window->parent->parent->parent, TRUE); +} + +static void +scan_start (Preview * p) +{ + SANE_Handle dev = p->dialog->dev; + SANE_Status status; + char buf[256]; + int fd, y; + + gtk_widget_set_sensitive (p->cancel, TRUE); + gtk_widget_set_sensitive (p->preview, FALSE); + gsg_set_sensitivity (p->dialog, FALSE); + gtk_widget_set_sensitive (p->dialog->window->parent->parent->parent, FALSE); + + /* clear old preview: */ + memset (p->preview_row, 0xff, 3 * p->preview_width); + for (y = 0; y < p->preview_height; ++y) + gtk_preview_draw_row (GTK_PREVIEW (p->window), p->preview_row, + 0, y, p->preview_width); + + if (p->input_tag >= 0) + { + gdk_input_remove (p->input_tag); + p->input_tag = -1; + } + + gsg_sync (p->dialog); + + status = sane_start (dev); + if (status != SANE_STATUS_GOOD) + { + snprintf (buf, sizeof (buf), + "Failed to start scanner: %s.", sane_strstatus (status)); + gsg_error (buf); + scan_done (p); + return; + } + + status = sane_get_parameters (dev, &p->params); + if (status != SANE_STATUS_GOOD) + { + snprintf (buf, sizeof (buf), + "Failed to obtain parameters: %s.", sane_strstatus (status)); + gsg_error (buf); + scan_done (p); + return; + } + + if ((p->params.format >= SANE_FRAME_RGB && + p->params.format <= SANE_FRAME_BLUE) && + p->params.depth == 1 && p->params.pixels_per_line % 8 != 0) + { + snprintf (buf, sizeof (buf), + "Can't handle unaligned 1 bit RGB or three-pass mode."); + gsg_error (buf); + scan_done (p); + return; + } + + p->image_offset = p->image_x = p->image_y = 0; + + if (p->params.format >= SANE_FRAME_RED + && p->params.format <= SANE_FRAME_BLUE) + p->image_offset = p->params.format - SANE_FRAME_RED; + + if (!p->image_data || p->params.pixels_per_line != p->image_width + || (p->params.lines >= 0 && p->params.lines != p->image_height)) + { + /* image size changed */ + if (p->image_data) + free (p->image_data); + + p->image_width = p->params.pixels_per_line; + p->image_height = p->params.lines; + if (p->image_height < 0) + p->image_height = 32; /* may have to adjust as we go... */ + + p->image_data = malloc (p->image_width * p->image_height * 3); + if (!p->image_data) + { + snprintf (buf, sizeof (buf), + "Failed to allocate image memory: %s.", strerror (errno)); + gsg_error (buf); + scan_done (p); + return; + } + memset (p->image_data, 0xff, 3 * p->image_width * p->image_height); + } + + if (p->selection.active) + { + p->previous_selection = p->selection; + p->selection.active = FALSE; + draw_selection (p); + } + p->scanning = TRUE; + + if (sane_set_io_mode (dev, SANE_TRUE) == SANE_STATUS_GOOD + && sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD) + p->input_tag = + gdk_input_add (fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + input_available, p); + else + input_available (p, -1, GDK_INPUT_READ); +} + +static void +establish_selection (Preview * p) +{ + float min, max, normal, dev_selection[4]; + int i; + + memcpy (dev_selection, p->surface, sizeof (dev_selection)); + if (p->selection.active) + for (i = 0; i < 2; ++i) + { + min = p->surface[i]; + if (min <= -INF) + min = 0.0; + max = p->surface[i + 2]; + if (max >= INF) + max = p->preview_width; + + normal = + 1.0 / (((i == 0) ? p->preview_width : p->preview_height) - 1); + normal *= (max - min); + dev_selection[i] = p->selection.coord[i] * normal + min; + dev_selection[i + 2] = p->selection.coord[i + 2] * normal + min; + } + for (i = 0; i < 4; ++i) + set_option_float (p, p->dialog->well_known.coord[i], dev_selection[i]); + gsg_update_scan_window (p->dialog); + if (p->dialog->param_change_callback) + (*p->dialog->param_change_callback) (p->dialog, + p->dialog->param_change_arg); +} + +static int +make_preview_image_path (Preview * p, size_t filename_size, char *filename) +{ + return gsg_make_path (filename_size, filename, 0, "preview-", + p->dialog->dev_name, ".ppm"); +} + +static void +restore_preview_image (Preview * p) +{ + u_int psurface_type, psurface_unit; + char filename[PATH_MAX]; + int width, height; + float psurface[4]; + size_t nread; + FILE *in; + + /* See whether there is a saved preview and load it if present: */ + + if (make_preview_image_path (p, sizeof (filename), filename) < 0) + return; + + in = fopen (filename, "r"); + if (!in) + return; + + /* Be careful about consuming too many bytes after the final newline + (e.g., consider an image whose first image byte is 13 (`\r'). */ + if (fscanf (in, "P6\n# surface: %g %g %g %g %u %u\n%d %d\n255%*[\n]", + psurface + 0, psurface + 1, psurface + 2, psurface + 3, + &psurface_type, &psurface_unit, &width, &height) != 8) + return; + + if (GROSSLY_DIFFERENT (psurface[0], p->surface[0]) + || GROSSLY_DIFFERENT (psurface[1], p->surface[1]) + || GROSSLY_DIFFERENT (psurface[2], p->surface[2]) + || GROSSLY_DIFFERENT (psurface[3], p->surface[3]) + || psurface_type != p->surface_type || psurface_unit != p->surface_unit) + /* ignore preview image that was acquired for/with a different surface */ + return; + + p->image_width = width; + p->image_height = height; + if ((width == 0) || (height == 0)) + return; + p->image_data = malloc (3 * width * height); + if (!p->image_data) + return; + + nread = fread (p->image_data, 3, width * height, in); + + p->image_y = nread / width; + p->image_x = nread % width; +} + +/* This is executed _after_ the gtkpreview's expose routine. */ +static gint +expose_handler (GtkWidget * window, GdkEvent * event, gpointer data) +{ + Preview *p = data; + + p->selection.active = FALSE; + update_selection (p); + return FALSE; +} + +static gint +event_handler (GtkWidget * window, GdkEvent * event, gpointer data) +{ + Preview *p = data; + int i, tmp; + + if (event->type == GDK_EXPOSE) + { + if (!p->gc) + { + p->gc = gdk_gc_new (p->window->window); + gdk_gc_set_function (p->gc, GDK_INVERT); + gdk_gc_set_line_attributes (p->gc, 1, GDK_LINE_ON_OFF_DASH, + GDK_CAP_BUTT, GDK_JOIN_MITER); + paint_image (p); + } + else + { + p->selection.active = FALSE; + draw_selection (p); + } + } + else if (!p->scanning) + switch (event->type) + { + case GDK_UNMAP: + case GDK_MAP: + break; + + case GDK_BUTTON_PRESS: + p->selection.coord[0] = event->button.x; + p->selection.coord[1] = event->button.y; + p->selection_drag = TRUE; + break; + + case GDK_BUTTON_RELEASE: + if (!p->selection_drag) + break; + p->selection_drag = FALSE; + + p->selection.coord[2] = event->button.x; + p->selection.coord[3] = event->button.y; + p->selection.active = + (p->selection.coord[0] != p->selection.coord[2] + || p->selection.coord[1] != p->selection.coord[3]); + + if (p->selection.active) + { + for (i = 0; i < 2; i += 1) + if (p->selection.coord[i] > p->selection.coord[i + 2]) + { + tmp = p->selection.coord[i]; + p->selection.coord[i] = p->selection.coord[i + 2]; + p->selection.coord[i + 2] = tmp; + } + if (p->selection.coord[0] < 0) + p->selection.coord[0] = 0; + if (p->selection.coord[1] < 0) + p->selection.coord[1] = 0; + if (p->selection.coord[2] >= p->preview_width) + p->selection.coord[2] = p->preview_width - 1; + if (p->selection.coord[3] >= p->preview_height) + p->selection.coord[3] = p->preview_height - 1; + } + draw_selection (p); + establish_selection (p); + break; + + case GDK_MOTION_NOTIFY: + if (p->selection_drag) + { + p->selection.active = TRUE; + p->selection.coord[2] = event->motion.x; + p->selection.coord[3] = event->motion.y; + draw_selection (p); + } + break; + + default: +#if 0 + fprintf (stderr, "event_handler: unhandled event type %d\n", + event->type); +#endif + break; + } + return FALSE; +} + +static void +start_button_clicked (GtkWidget * widget, gpointer data) +{ + preview_scan (data); +} + +static void +cancel_button_clicked (GtkWidget * widget, gpointer data) +{ + scan_done (data); +} + +static void +top_destroyed (GtkWidget * widget, gpointer call_data) +{ + Preview *p = call_data; + + p->top = NULL; +} + +Preview * +preview_new (GSGDialog * dialog) +{ + static int first_time = 1; + GtkWidget *table, *frame; + GtkSignalFunc signal_func; + GtkWidgetClass *class; + GtkBox *vbox, *hbox; + Preview *p; + + p = malloc (sizeof (*p)); + if (!p) + return 0; + memset (p, 0, sizeof (*p)); + + p->dialog = dialog; + p->input_tag = -1; + + if (first_time) + { + first_time = 0; + gtk_preview_set_gamma (preferences.preview_gamma); + gtk_preview_set_install_cmap (preferences.preview_own_cmap); + } + +#ifndef XSERVER_WITH_BUGGY_VISUALS + gtk_widget_push_visual (gtk_preview_get_visual ()); +#endif + gtk_widget_push_colormap (gtk_preview_get_cmap ()); + + p->top = gtk_dialog_new (); + gtk_signal_connect (GTK_OBJECT (p->top), "destroy", + GTK_SIGNAL_FUNC (top_destroyed), p); + gtk_window_set_title (GTK_WINDOW (p->top), "xscanimage preview"); + vbox = GTK_BOX (GTK_DIALOG (p->top)->vbox); + hbox = GTK_BOX (GTK_DIALOG (p->top)->action_area); + + /* construct the preview area (table with sliders & preview window) */ + table = gtk_table_new (2, 2, /* homogeneous */ FALSE); + gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1); + gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1); + gtk_container_border_width (GTK_CONTAINER (table), 2); + gtk_box_pack_start (vbox, table, /* expand */ TRUE, /* fill */ TRUE, + /* padding */ 0); + + /* the empty box in the top-left corner */ + frame = gtk_frame_new ( /* label */ 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); + gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 0, 1, + GTK_FILL, GTK_FILL, 0, 0); + + /* the horizontal ruler */ + p->hruler = gtk_hruler_new (); + gtk_table_attach (GTK_TABLE (table), p->hruler, 1, 2, 0, 1, + GTK_FILL, 0, 0, 0); + + /* the vertical ruler */ + p->vruler = gtk_vruler_new (); + gtk_table_attach (GTK_TABLE (table), p->vruler, 0, 1, 1, 2, 0, + GTK_FILL, 0, 0); + + /* the preview area */ + + p->window = gtk_preview_new (GTK_PREVIEW_COLOR); + gtk_preview_set_expand (GTK_PREVIEW (p->window), TRUE); + gtk_widget_set_events (p->window, + GDK_EXPOSURE_MASK | + GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_HINT_MASK | + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + gtk_signal_connect (GTK_OBJECT (p->window), "event", + (GtkSignalFunc) event_handler, p); + gtk_signal_connect_after (GTK_OBJECT (p->window), "expose_event", + (GtkSignalFunc) expose_handler, p); + gtk_signal_connect_after (GTK_OBJECT (p->window), "size_allocate", + (GtkSignalFunc) preview_area_resize, 0); + gtk_object_set_data (GTK_OBJECT (p->window), "PreviewPointer", p); + + /* Connect the motion-notify events of the preview area with the + rulers. Nifty stuff! */ + +#if GTK_MAJOR_VERSION == 2 + class = GTK_WIDGET_CLASS (GTK_OBJECT_GET_CLASS (GTK_OBJECT (p->hruler))); +#else + class = GTK_WIDGET_CLASS (GTK_OBJECT (p->hruler)->klass); +#endif /* GTK_MAJOR_VERSION == 2 */ + signal_func = (GtkSignalFunc) class->motion_notify_event; + gtk_signal_connect_object (GTK_OBJECT (p->window), "motion_notify_event", + signal_func, GTK_OBJECT (p->hruler)); + +#if GTK_MAJOR_VERSION == 2 + class = GTK_WIDGET_CLASS (GTK_OBJECT_GET_CLASS (GTK_OBJECT (p->vruler))); +#else + class = GTK_WIDGET_CLASS (GTK_OBJECT (p->vruler)->klass); +#endif /* GTK_MAJOR_VERSION == 2 */ + signal_func = (GtkSignalFunc) class->motion_notify_event; + gtk_signal_connect_object (GTK_OBJECT (p->window), "motion_notify_event", + signal_func, GTK_OBJECT (p->vruler)); + + p->viewport = gtk_frame_new ( /* label */ 0); + gtk_frame_set_shadow_type (GTK_FRAME (p->viewport), GTK_SHADOW_IN); + gtk_container_add (GTK_CONTAINER (p->viewport), p->window); + + gtk_table_attach (GTK_TABLE (table), p->viewport, 1, 2, 1, 2, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, + GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); + + preview_update (p); + + /* fill in action area: */ + + /* Preview button */ + p->preview = gtk_button_new_with_label ("Acquire Preview"); + gtk_signal_connect (GTK_OBJECT (p->preview), "clicked", + (GtkSignalFunc) start_button_clicked, p); + gtk_box_pack_start (GTK_BOX (hbox), p->preview, TRUE, TRUE, 0); + gtk_widget_show (p->preview); + + /* Cancel button */ + p->cancel = gtk_button_new_with_label ("Cancel Preview"); + gtk_signal_connect (GTK_OBJECT (p->cancel), "clicked", + (GtkSignalFunc) cancel_button_clicked, p); + gtk_box_pack_start (GTK_BOX (hbox), p->cancel, TRUE, TRUE, 0); + gtk_widget_set_sensitive (p->cancel, FALSE); + + gtk_widget_show (p->cancel); + gtk_widget_show (p->viewport); + gtk_widget_show (p->window); + gtk_widget_show (p->hruler); + gtk_widget_show (p->vruler); + gtk_widget_show (frame); + gtk_widget_show (table); + gtk_widget_show (p->top); + + gtk_widget_pop_colormap (); +#ifndef XSERVER_WITH_BUGGY_VISUALS + gtk_widget_pop_visual (); +#endif + return p; +} + +void +preview_update (Preview * p) +{ + float val, width, height, max_width, max_height; + const SANE_Option_Descriptor *opt; + int i, surface_changed; + SANE_Value_Type type; + SANE_Unit unit; + float min, max; + + surface_changed = 0; + unit = SANE_UNIT_PIXEL; + type = SANE_TYPE_INT; + for (i = 0; i < 4; ++i) + { + val = (i & 2) ? INF : -INF; + if (p->dialog->well_known.coord[i] > 0) + { + opt = sane_get_option_descriptor (p->dialog->dev, + p->dialog->well_known.coord[i]); + assert (opt->unit == SANE_UNIT_PIXEL || opt->unit == SANE_UNIT_MM); + unit = opt->unit; + type = opt->type; + + get_bounds (opt, &min, &max); + if (i & 2) + val = max; + else + val = min; + } + if (p->surface[i] != val) + { + surface_changed = 1; + p->surface[i] = val; + } + } + if (p->surface_unit != unit) + { + surface_changed = 1; + p->surface_unit = unit; + } + if (p->surface_type != type) + { + surface_changed = 1; + p->surface_type = type; + } + if (surface_changed && p->image_data) + { + free (p->image_data); + p->image_data = 0; + p->image_width = 0; + p->image_height = 0; + } + + /* guess the initial preview window size: */ + + width = p->surface[GSG_BR_X] - p->surface[GSG_TL_X]; + height = p->surface[GSG_BR_Y] - p->surface[GSG_TL_Y]; + if (p->surface_type == SANE_TYPE_INT) + { + width += 1.0; + height += 1.0; + } + else + { + width += SANE_UNFIX (1.0); + height += SANE_UNFIX (1.0); + } + + assert (width > 0.0 && height > 0.0); + + if (width >= INF || height >= INF) + p->aspect = 1.0; + else + p->aspect = width / height; + + if (surface_changed) + { + max_width = 0.5 * gdk_screen_width (); + max_height = 0.5 * gdk_screen_height (); + } + else + { + max_width = p->window->allocation.width; + max_height = p->window->allocation.height; + } + + if (p->surface_unit != SANE_UNIT_PIXEL) + { + width = max_width; + height = width / p->aspect; + + if (height > max_height) + { + height = max_height; + width = height * p->aspect; + } + } + else + { + if (width > max_width) + width = max_width; + + if (height > max_height) + height = max_height; + } + + /* re-adjust so we maintain aspect without exceeding max size: */ + if (width / height != p->aspect) + { + if (p->aspect > 1.0) + height = width / p->aspect; + else + width = height * p->aspect; + } + + p->preview_width = width + 0.5; + p->preview_height = height + 0.5; + if (surface_changed) + { + gtk_widget_set_usize (GTK_WIDGET (p->window), + p->preview_width, p->preview_height); + if (GTK_WIDGET_DRAWABLE (p->window)) + preview_area_resize (p->window); + + if (preferences.preserve_preview) + restore_preview_image (p); + } + update_selection (p); +} + +void +preview_scan (Preview * p) +{ + float min, max, swidth, sheight, width, height, dpi = 0; + const SANE_Option_Descriptor *opt; + gint gwidth, gheight; + int i; + SANE_Status status; + + + save_option (p, p->dialog->well_known.dpi, + &p->saved_dpi, &p->saved_dpi_valid); + for (i = 0; i < 4; ++i) + save_option (p, p->dialog->well_known.coord[i], + &p->saved_coord[i], p->saved_coord_valid + i); + + /* determine dpi, if necessary: */ + + if (p->dialog->well_known.dpi > 0) + { + opt = sane_get_option_descriptor (p->dialog->dev, + p->dialog->well_known.dpi); + + gwidth = p->preview_width; + gheight = p->preview_height; + + height = gheight; + width = height * p->aspect; + if (width > gwidth) + { + width = gwidth; + height = width / p->aspect; + } + + swidth = (p->surface[GSG_BR_X] - p->surface[GSG_TL_X]); + if (swidth < INF) + dpi = MM_PER_INCH * width / swidth; + else + { + sheight = (p->surface[GSG_BR_Y] - p->surface[GSG_TL_Y]); + if (sheight < INF) + dpi = MM_PER_INCH * height / sheight; + else + dpi = 18.0; + } + get_bounds (opt, &min, &max); + if (dpi < min) + dpi = min; + if (dpi > max) + dpi = max; + status = set_option_float (p, p->dialog->well_known.dpi, dpi); + if (status != SANE_STATUS_GOOD) + return; + } + + /* set the scan window (necessary since backends may default to + non-maximum size): */ + for (i = 0; i < 4; ++i) + set_option_float (p, p->dialog->well_known.coord[i], p->surface[i]); + set_option_bool (p, p->dialog->well_known.preview, SANE_TRUE); + + /* OK, all set to go */ + scan_start (p); +} + +void +preview_destroy (Preview * p) +{ + char filename[PATH_MAX]; + FILE *out; + + if (p->scanning) + scan_done (p); /* don't save partial window */ + else if (preferences.preserve_preview && p->image_data + && make_preview_image_path (p, sizeof (filename), filename) >= 0) + { + /* save preview image */ + out = fopen (filename, "w"); + if (out) + { + /* always save it as a PPM image: */ + fprintf (out, "P6\n# surface: %g %g %g %g %u %u\n%d %d\n255\n", + p->surface[0], p->surface[1], p->surface[2], p->surface[3], + p->surface_type, p->surface_unit, + p->image_width, p->image_height); + fwrite (p->image_data, 3, p->image_width * p->image_height, out); + fclose (out); + } + } + if (p->image_data) + free (p->image_data); + if (p->preview_row) + free (p->preview_row); + if (p->gc) + gdk_gc_destroy (p->gc); + if (p->top) + gtk_widget_destroy (p->top); + free (p); +} diff --git a/src/preview.h b/src/preview.h new file mode 100644 index 0000000..5b0b585 --- /dev/null +++ b/src/preview.h @@ -0,0 +1,87 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1997 David Mosberger-Tang + This file is part of the SANE package. + + SANE 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. + + SANE 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 sane; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef preview_h +#define preview_h + +#include <sys/types.h> + +#include "../include/sane/config.h" +#include <sane/sane.h> + +typedef struct + { + GSGDialog *dialog; /* the dialog for this preview */ + + SANE_Value_Type surface_type; + SANE_Unit surface_unit; + float surface[4]; /* the corners of the scan surface (device coords) */ + float aspect; /* the aspect ratio of the scan surface */ + + int saved_dpi_valid; + SANE_Word saved_dpi; + int saved_coord_valid[4]; + SANE_Word saved_coord[4]; + + /* desired/user-selected preview-window size: */ + int preview_width; + int preview_height; + u_char *preview_row; + + int scanning; + time_t image_last_time_updated; + gint input_tag; + SANE_Parameters params; + int image_offset; + int image_x; + int image_y; + int image_width; + int image_height; + u_char *image_data; /* 3 * image_width * image_height bytes */ + + GdkGC *gc; + int selection_drag; + struct + { + int active; + int coord[4]; + } + selection, previous_selection; + + GtkWidget *top; /* top-level widget */ + GtkWidget *hruler; + GtkWidget *vruler; + GtkWidget *viewport; + GtkWidget *window; /* the preview window */ + GtkWidget *cancel; /* the cancel button */ + GtkWidget *preview; /* the preview button */ + } +Preview; + +/* Create a new preview based on the info in DIALOG. */ +extern Preview *preview_new (GSGDialog *dialog); + +/* Some of the parameters may have changed---update the preview. */ +extern void preview_update (Preview *p); + +/* Acquire a preview image and display it. */ +extern void preview_scan (Preview *p); + +/* Destroy a preview. */ +extern void preview_destroy (Preview *p); + +#endif /* preview_h */ diff --git a/src/progress.c b/src/progress.c new file mode 100644 index 0000000..4957295 --- /dev/null +++ b/src/progress.c @@ -0,0 +1,93 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * Hacked (C) 1996 Tristan Tarrant + * + * 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. + */ +#include "../include/sane/config.h" + +#include <stdlib.h> +#include <string.h> +#include <gtk/gtk.h> +#include "progress.h" + +static const int progress_x = 5; +static const int progress_y = 5; + +void +progress_cancel (GtkWidget * widget, gpointer data) +{ + Progress_t *p = (Progress_t *) data; + + (*p->callback) (); +} + + +Progress_t * +progress_new (char *title, char *text, + GtkSignalFunc callback, gpointer callback_data) +{ + GtkWidget *button, *label; + GtkBox *vbox, *hbox; + Progress_t *p; + + p = (Progress_t *) malloc (sizeof (Progress_t)); + p->callback = callback; + + p->shell = gtk_dialog_new (); + gtk_widget_set_uposition (p->shell, progress_x, progress_y); + gtk_window_set_title (GTK_WINDOW (p->shell), title); + vbox = GTK_BOX (GTK_DIALOG (p->shell)->vbox); + hbox = GTK_BOX (GTK_DIALOG (p->shell)->action_area); + + gtk_container_border_width (GTK_CONTAINER (vbox), 7); + + label = gtk_label_new (text); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_box_pack_start (vbox, label, FALSE, TRUE, 0); + + p->pbar = gtk_progress_bar_new (); + gtk_widget_set_usize (p->pbar, 200, 20); + gtk_box_pack_start (vbox, p->pbar, TRUE, TRUE, 0); + + button = gtk_toggle_button_new_with_label ("Cancel"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) progress_cancel, p); + gtk_box_pack_start (hbox, button, TRUE, TRUE, 0); + + gtk_widget_show (label); + gtk_widget_show (p->pbar); + gtk_widget_show (button); + gtk_widget_show (GTK_WIDGET (p->shell)); + gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), 0); + return p; +} + +void +progress_free (Progress_t * p) +{ + if (p) + { + gtk_widget_destroy (p->shell); + free (p); + } +} + +void +progress_update (Progress_t * p, gfloat newval) +{ + if (p) + gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), newval); +} diff --git a/src/progress.h b/src/progress.h new file mode 100644 index 0000000..13a924e --- /dev/null +++ b/src/progress.h @@ -0,0 +1,34 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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. + */ +#ifndef progress_h +#define progress_h + +typedef struct Progress_t + { + GtkSignalFunc callback; + gpointer callback_data; + GtkWidget *shell; + GtkWidget *pbar; + } +Progress_t; + +extern Progress_t *progress_new (char *, char *, GtkSignalFunc, void *); +extern void progress_free (Progress_t *); +extern void progress_update (Progress_t *, gfloat); + +#endif /* progress_h */ diff --git a/src/sane-style.rc b/src/sane-style.rc new file mode 100644 index 0000000..f85259c --- /dev/null +++ b/src/sane-style.rc @@ -0,0 +1,21 @@ +# style <name> [= <name>] +# { +# <option> +# } +# +# widget <widget_set> style <style_name> +# widget_class <widget_class_set> style <style_name> +# accelerator <widget_name> <accelerator> + +style "progressbar" +{ + bg[PRELIGHT] = { 22500, 53280, 22500 } # green +} + +style "curve" +{ + fg[NORMAL] = { 58000, 0, 0 } # red +} + +widget "*GtkCurve" style "curve" +widget "*GtkProgressBar" style "progressbar" diff --git a/src/scanadf.c b/src/scanadf.c new file mode 100644 index 0000000..d4ff566 --- /dev/null +++ b/src/scanadf.c @@ -0,0 +1,1590 @@ +/* saneadf - a SANE front end for document scanning + based on + bnhscan by tummy.com and + scanimage by Andreas Beck and David Mosberger + + Copyright (C) 1999 Tom Martone + + 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. */ + +#ifdef _AIX +# include <lalloca.h> /* MUST come first for AIX! */ +#endif + +#include "sane/config.h" +#include <lalloca.h> + +#include <assert.h> +#include <getopt.h> +#include <signal.h> +#include <unistd.h> +#include <errno.h> + +#include <limits.h> +#include <ctype.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> + +#include "sane/sane.h" +#include "sane/sanei.h" +#include "sane/saneopts.h" + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +#ifndef sane_isbasicframe +#define SANE_FRAME_TEXT 10 +#define SANE_FRAME_JPEG 11 +#define SANE_FRAME_G31D 12 +#define SANE_FRAME_G32D 13 +#define SANE_FRAME_G42D 14 +#define sane_strframe(f) ( (f) == SANE_FRAME_GRAY ? "gray" : \ + (f) == SANE_FRAME_RGB ? "RGB" : \ + (f) == SANE_FRAME_RED ? "red" : \ + (f) == SANE_FRAME_GREEN ? "green" : \ + (f) == SANE_FRAME_BLUE ? "blue" : \ + (f) == SANE_FRAME_TEXT ? "text" : \ + (f) == SANE_FRAME_JPEG ? "jpeg" : \ + (f) == SANE_FRAME_G31D ? "g31d" : \ + (f) == SANE_FRAME_G32D ? "g32d" : \ + (f) == SANE_FRAME_G42D ? "g42d" : \ + "unknown" ) + +#define sane_isbasicframe(f) ( (f) == SANE_FRAME_GRAY || \ + (f) == SANE_FRAME_RGB || \ + (f) == SANE_FRAME_RED || \ + (f) == SANE_FRAME_GREEN || \ + (f) == SANE_FRAME_BLUE ) + +#endif + +#ifndef HAVE_ATEXIT +# define atexit(func) on_exit(func, 0) /* works for SunOS, at least */ +#endif + +typedef struct + { + u_char *data; + int Bpp; /* bytes/pixel */ + int width; + int height; + int x; + int y; + } +Image; + +static struct option basic_options[] = +{ + {"device-name", required_argument, NULL, 'd'}, + {"list-devices", no_argument, NULL, 'L'}, + {"help", no_argument, NULL, 'h'}, + {"verbose", no_argument, NULL, 'v'}, + {"version", no_argument, NULL, 'V'}, + {"no-overwrite", no_argument, NULL, 'N'}, + + { "output-file", required_argument, 0, 'o' }, + { "start-count", required_argument, 0, 's' }, + { "end-count", required_argument, 0, 'e' }, + { "scan-script", required_argument, 0, 'S' }, + { "script-wait", no_argument, 0, 128 }, + { "raw", no_argument, 0, 'r' }, + {0, } +}; + +#define BASE_OPTSTRING "d:hLvVNTo:s:e:S:r" +#define STRIP_HEIGHT 256 /* # lines we increment image height */ + +static struct option * all_options; +static int option_number_len; +static int * option_number; +static SANE_Handle device; +static int verbose; +static int help; +static const char * prog_name; +static SANE_Option_Descriptor window_option[2]; +static int window[4]; +static int resolution_opt = -1, x_resolution_opt = -1, y_resolution_opt = -1; +static SANE_Word window_val[2]; +static int window_val_user[2]; /* is width/height user-specified? */ + +static const char usage[] = "Usage: %s [OPTION]...\n\ +\n\ +Start image acquisition on a scanner device and write image data to\n\ +output files.\n\ +\n\ + [ -d | --device-name <device> ] use a given scanner device.\n\ + [ -h | --help ] display this help message and exit.\n\ + [ -L | --list-devices ] show available scanner devices.\n\ + [ -v | --verbose ] give even more status messages.\n\ + [ -V | --version ] print version information.\n\ + [ -N | --no-overwrite ] don't overwrite existing files.\n\ +\n\ + [ -o | --output-file <name> ] name of file to write image data\n\ + (%%d replacement in output file name).\n\ + [ -S | --scan-script <name> ] name of script to run after every scan.\n\ + [ --script-wait ] wait for scripts to finish before exit\n\ + [ -s | --start-count <num> ] page count of first scanned image.\n\ + [ -e | --end-count <num> ] last page number to scan.\n\ + [ -r | --raw ] write raw image data to file.\n"; + +static RETSIGTYPE +sighandler (int signum) +{ + if (device) + { + fprintf (stderr, "%s: stopping scanner...\n", prog_name); + sane_cancel (device); + } +} + +static void +print_unit (SANE_Unit unit) +{ + switch (unit) + { + case SANE_UNIT_NONE: break; + case SANE_UNIT_PIXEL: fputs ("pel", stdout); break; + case SANE_UNIT_BIT: fputs ("bit", stdout); break; + case SANE_UNIT_MM: fputs ("mm", stdout); break; + case SANE_UNIT_DPI: fputs ("dpi", stdout); break; + case SANE_UNIT_PERCENT: fputc ('%', stdout); break; + case SANE_UNIT_MICROSECOND: fputs ("us", stdout); break; + } +} + +static void +print_option (SANE_Device *device, int opt_num, char short_name) +{ + const char *str, *last_break, *start; + const SANE_Option_Descriptor *opt; + SANE_Bool not_first = SANE_FALSE; + int i, column; + + opt = sane_get_option_descriptor (device, opt_num); + + if (short_name) + printf (" -%c", short_name); + else + printf (" --%s", opt->name); + + if (opt->type == SANE_TYPE_BOOL) + { + fputs ("[=(", stdout); + if (opt->cap & SANE_CAP_AUTOMATIC) + fputs ("auto|", stdout); + fputs ("yes|no)]", stdout); + } + else if (opt->type != SANE_TYPE_BUTTON) + { + fputc (' ', stdout); + if (opt->cap & SANE_CAP_AUTOMATIC) + { + fputs ("auto|", stdout); + not_first = SANE_TRUE; + } + switch (opt->constraint_type) + { + case SANE_CONSTRAINT_NONE: + switch (opt->type) + { + case SANE_TYPE_INT: fputs ("<int>", stdout); break; + case SANE_TYPE_FIXED: fputs ("<float>", stdout); break; + case SANE_TYPE_STRING: fputs ("<string>", stdout); break; + default: + break; + } + if (opt->type != SANE_TYPE_STRING && opt->size > sizeof (SANE_Word)) + fputs (",...", stdout); + break; + + case SANE_CONSTRAINT_RANGE: + if (opt->type == SANE_TYPE_INT) + { + printf ("%d..%d", + opt->constraint.range->min, opt->constraint.range->max); + print_unit (opt->unit); + if (opt->size > sizeof (SANE_Word)) + fputs (",...", stdout); + if (opt->constraint.range->quant) + printf (" (in steps of %d)", + opt->constraint.range->quant); + } + else + { + printf ("%g..%g", + SANE_UNFIX(opt->constraint.range->min), + SANE_UNFIX(opt->constraint.range->max)); + print_unit (opt->unit); + if (opt->size > sizeof (SANE_Word)) + fputs (",...", stdout); + if (opt->constraint.range->quant) + printf (" (in steps of %g)", + SANE_UNFIX(opt->constraint.range->quant)); + } + break; + + case SANE_CONSTRAINT_WORD_LIST: + for (i = 0; i < opt->constraint.word_list[0]; ++i) + { + if (not_first) + fputc ('|', stdout); + + not_first = SANE_TRUE; + + if (opt->type == SANE_TYPE_INT) + printf ("%d", opt->constraint.word_list[i + 1]); + else + printf ("%g", + SANE_UNFIX(opt->constraint.word_list[i + 1])); + } + print_unit (opt->unit); + if (opt->size > sizeof (SANE_Word)) + fputs (",...", stdout); + break; + + case SANE_CONSTRAINT_STRING_LIST: + for (i = 0; opt->constraint.string_list[i]; ++i) + { + if (i > 0) + fputc ('|', stdout); + + fputs (opt->constraint.string_list[i], stdout); + } + break; + } + } + if (opt->type == SANE_TYPE_STRING || + opt->type == SANE_TYPE_BOOL || + opt->type == SANE_TYPE_INT || + opt->type == SANE_TYPE_FIXED) + { + /* print current option value */ + fputs (" [", stdout); + if (SANE_OPTION_IS_ACTIVE(opt->cap)) + { + void * val = alloca (opt->size); + sane_control_option (device, opt_num, SANE_ACTION_GET_VALUE, val, 0); + switch (opt->type) + { + case SANE_TYPE_BOOL: + fputs (*(SANE_Bool *)val ? "yes" : "no", stdout); + break; + + case SANE_TYPE_INT: + printf ("%d", *(SANE_Int *)val); + break; + + case SANE_TYPE_FIXED: + printf ("%g", SANE_UNFIX(*(SANE_Fixed *)val)); + break; + + case SANE_TYPE_STRING: + fputs ((char *) val, stdout); + break; + + default: + break; + } + } + else + fputs ("inactive", stdout); + fputc (']', stdout); + } + fputs ("\n ", stdout); + + switch (short_name) + { + case 'x': + fputs ("Width of scan-area.", stdout); + break; + + case 'y': + fputs ("Height of scan-area.", stdout); + break; + + default: + column = 8; last_break = 0; start = opt->desc; + for (str = opt->desc; *str; ++str) + { + ++column; + if (*str == ' ') + last_break = str; + if (column >= 79 && last_break) + { + while (start < last_break) + fputc (*start++, stdout); + start = last_break + 1; /* skip blank */ + fputs ("\n ", stdout); + column = 8 + (str - start); + } + } + while (*start) + fputc (*start++, stdout); + } + fputc ('\n', stdout); +} + +/* A scalar has the following syntax: + + V [ U ] + + V is the value of the scalar. It is either an integer or a + floating point number, depending on the option type. + + U is an optional unit. If not specified, the default unit is used. + The following table lists which units are supported depending on + what the option's default unit is: + + Option's unit: Allowed units: + + SANE_UNIT_NONE: + SANE_UNIT_PIXEL: pel + SANE_UNIT_BIT: b (bit), B (byte) + SANE_UNIT_MM: mm (millimeter), cm (centimeter), in or " (inches), + SANE_UNIT_DPI: dpi + SANE_UNIT_PERCENT: % + SANE_UNIT_PERCENT: us + */ +static const char * +parse_scalar (const SANE_Option_Descriptor * opt, const char * str, + SANE_Word * value) +{ + char * end; + double v; + + if (opt->type == SANE_TYPE_FIXED) + v = strtod (str, &end) * (1 << SANE_FIXED_SCALE_SHIFT); + else + v = strtol (str, &end, 10); + + if (str == end) + { + fprintf (stderr, + "%s: option --%s: bad option value (rest of option: %s)\n", + prog_name, opt->name, str); + exit (1); + } + str = end; + + switch (opt->unit) + { + case SANE_UNIT_NONE: + case SANE_UNIT_PIXEL: + break; + + case SANE_UNIT_BIT: + if (*str == 'b' || *str == 'B') + { + if (*str++ == 'B') + v *= 8; + } + break; + + case SANE_UNIT_MM: + if (str[0] == '\0') + v *= 1.0; /* default to mm */ + else if (strcmp (str, "mm") == 0) + str += sizeof ("mm") - 1; + else if (strcmp (str, "cm") == 0) + { + str += sizeof ("cm") - 1; + v *= 10.0; + } + else if (strcmp (str, "in") == 0 || *str == '"') + { + if (*str++ != '"') + ++str; + v *= 25.4; /* 25.4 mm/inch */ + } + else + { + fprintf (stderr, + "%s: option --%s: illegal unit (rest of option: %s)\n", + prog_name, opt->name, str); + return 0; + } + break; + + case SANE_UNIT_DPI: + if (strcmp (str, "dpi") == 0) + str += sizeof ("dpi") - 1; + break; + + case SANE_UNIT_PERCENT: + if (*str == '%') + ++str; + break; + + case SANE_UNIT_MICROSECOND: + if (strcmp (str, "us") == 0) + str += sizeof ("us") - 1; + break; + } + *value = v + 0.5; + return str; +} + +/* A vector has the following syntax: + + [ '[' I ']' ] S { [','|'-'] [ '[' I ']' S } + + The number in brackets (I), if present, determines the index of the + vector element to be set next. If I is not present, the value of + last index used plus 1 is used. The first index value used is 0 + unless I is present. + + S is a scalar value as defined by parse_scalar(). + + If two consecutive value specs are separated by a comma (,) their + values are set independently. If they are separated by a dash (-), + they define the endpoints of a line and all vector values between + the two endpoints are set according to the value of the + interpolated line. For example, [0]15-[255]15 defines a vector of + 256 elements whose value is 15. Similarly, [0]0-[255]255 defines a + vector of 256 elements whose value starts at 0 and increases to + 255. */ +static void +parse_vector (const SANE_Option_Descriptor * opt, const char * str, + SANE_Word * vector, size_t vector_length) +{ + SANE_Word value, prev_value = 0; + int index = -1, prev_index = 0; + char * end, separator = '\0'; + + /* initialize vector to all zeroes: */ + memset (vector, 0, vector_length * sizeof (SANE_Word)); + + do { + if (*str == '[') + { + /* read index */ + index = strtol (++str, &end, 10); + if (str == end || *end != ']') + { + fprintf (stderr, "%s: option --%s: closing bracket missing " + "(rest of option: %s)\n", prog_name, opt->name, str); + exit (1); + } + str = end + 1; + } + else + ++index; + + if (index < 0 || index >= vector_length) + { + fprintf (stderr, "%s: option --%s: index %d out of range [0..%ld]\n", + prog_name, opt->name, index, (long) vector_length - 1); + exit (1); + } + + /* read value */ + str = parse_scalar (opt, str, &value); + if (!str) + exit (1); + + if (*str && *str != '-' && *str != ',') + { + fprintf (stderr, + "%s: option --%s: illegal separator (rest of option: %s)\n", + prog_name, opt->name, str); + exit (1); + } + + /* store value: */ + vector[index] = value; + if (separator == '-') + { + /* interpolate */ + double v, slope; + int i; + + v = (double) prev_value; + slope = ((double) value - v) / (index - prev_index); + + for (i = prev_index + 1; i < index; ++i) + { + v += slope; + vector[i] = (SANE_Word) v; + } + } + + prev_index = index; + prev_value = value; + separator = *str++; + } while (separator == ',' || separator == '-'); + + if (verbose > 2) + { + int i; + + fprintf (stderr, "%s: value for --%s is: ", prog_name, opt->name); + for (i = 0; i < vector_length; ++i) + if (opt->type == SANE_TYPE_FIXED) + fprintf (stderr, "%g ", SANE_UNFIX(vector[i])); + else + fprintf (stderr, "%d ", vector[i]); + fputc ('\n', stderr); + } +} + +void +fetch_options (SANE_Device * device) +{ + const SANE_Option_Descriptor * opt; + SANE_Int num_dev_options; + int i, option_count; + + /* and now build the full table of long options: */ + + sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_dev_options, 0); + + option_count = 0; + for (i = 0; i < num_dev_options; ++i) + { + opt = sane_get_option_descriptor (device, i); + + if (!SANE_OPTION_IS_SETTABLE (opt->cap)) + continue; + + option_number[option_count] = i; + + all_options[option_count].name = (char *) opt->name; + all_options[option_count].flag = 0; + all_options[option_count].val = 0; + + if (opt->type == SANE_TYPE_BOOL) + all_options[option_count].has_arg = optional_argument; + else if (opt->type == SANE_TYPE_BUTTON) + all_options[option_count].has_arg = no_argument; + else + all_options[option_count].has_arg = required_argument; + + /* Keep track of resolution options */ + if (strcmp (opt->name, SANE_NAME_SCAN_RESOLUTION) == 0) + { + resolution_opt = i; + } + else if (strcmp (opt->name, SANE_NAME_SCAN_X_RESOLUTION) == 0) + { + x_resolution_opt = i; + } + if (strcmp (opt->name, SANE_NAME_SCAN_Y_RESOLUTION) == 0) + { + y_resolution_opt = i; + } + + /* Keep track of top-left corner options (if they exist at + all) and replace the bottom-right corner options by a + width/height option (if they exist at all). */ + if ((opt->type == SANE_TYPE_FIXED || opt->type == SANE_TYPE_INT) + && opt->size == sizeof (SANE_Int) + && (opt->unit == SANE_UNIT_MM || opt->unit == SANE_UNIT_PIXEL)) + { + if (strcmp (opt->name, SANE_NAME_SCAN_TL_X) == 0) + { + window[2] = i; + all_options[option_count].val = 'l'; + } + else if (strcmp (opt->name, SANE_NAME_SCAN_TL_Y) == 0) + { + window[3] = i; + all_options[option_count].val = 't'; + } + else if (strcmp (opt->name, SANE_NAME_SCAN_BR_X) == 0) + { + window[0] = i; + all_options[option_count].name = "width"; + all_options[option_count].val = 'x'; + window_option[0] = *opt; + window_option[0].title = "Scan width"; + window_option[0].desc = "Width of scanning area."; + if (!window_val_user[0]) + sane_control_option (device, i, SANE_ACTION_GET_VALUE, + &window_val[0], 0); + } + else if (strcmp (opt->name, SANE_NAME_SCAN_BR_Y) == 0) + { + window[1] = i; + all_options[option_count].name = "height"; + all_options[option_count].val = 'y'; + window_option[1] = *opt; + window_option[1].title = "Scan height"; + window_option[1].desc = "Height of scanning area."; + if (!window_val_user[1]) + sane_control_option (device, i, SANE_ACTION_GET_VALUE, + &window_val[1], 0); + } + } + ++option_count; + } + memcpy (all_options + option_count, basic_options, sizeof (basic_options)); + option_count += NELEMS(basic_options); + memset (all_options + option_count, 0, sizeof (all_options[0])); + + /* Initialize width & height options based on backend default + values for top-left x/y and bottom-right x/y: */ + for (i = 0; i < 2; ++i) + { + if (window[i] && window[i + 2] && !window_val_user[i]) + { + SANE_Word pos; + sane_control_option (device, window[i + 2], + SANE_ACTION_GET_VALUE, &pos, 0); + window_val[i] = window_val[i] - pos + 1; + } + } +} + +static void +set_option (SANE_Handle device, int optnum, void * valuep) +{ + const SANE_Option_Descriptor * opt; + SANE_Status status; + SANE_Word orig = 0; + SANE_Int info; + + opt = sane_get_option_descriptor (device, optnum); + + if (opt->size == sizeof (SANE_Word) && opt->type != SANE_TYPE_STRING) + orig = *(SANE_Word *) valuep; + + status = sane_control_option (device, optnum, SANE_ACTION_SET_VALUE, + valuep, &info); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: setting of option --%s failed (%s)\n", + prog_name, opt->name, sane_strstatus (status)); + exit (1); + } + + if ((info & SANE_INFO_INEXACT) && opt->size == sizeof (SANE_Word)) + { + if (opt->type == SANE_TYPE_INT) + fprintf (stderr, "%s: rounded value of %s from %d to %d\n", + prog_name, opt->name, orig, *(SANE_Word *) valuep); + else if (opt->type == SANE_TYPE_FIXED) + fprintf (stderr, "%s: rounded value of %s from %g to %g\n", + prog_name, opt->name, + SANE_UNFIX(orig), SANE_UNFIX(*(SANE_Word *) valuep)); + } + + if (info & SANE_INFO_RELOAD_OPTIONS) + fetch_options (device); +} + +static void +process_backend_option (SANE_Handle device, int optnum, const char * optarg) +{ + static SANE_Word * vector = 0; + static size_t vector_size = 0; + const SANE_Option_Descriptor * opt; + size_t vector_length; + SANE_Status status; + SANE_Word value; + void * valuep; + + opt = sane_get_option_descriptor (device, optnum); + + if (!SANE_OPTION_IS_ACTIVE(opt->cap)) + { + fprintf (stderr, "%s: attempted to set inactive option %s\n", + prog_name, opt->name); + exit (1); + } + + if ((opt->cap & SANE_CAP_AUTOMATIC) && strncasecmp (optarg, "auto", 4) == 0) + { + status = sane_control_option (device, optnum, SANE_ACTION_SET_AUTO, + 0, 0); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: failed to set option --%s to automatic (%s)\n", + prog_name, opt->name, sane_strstatus (status)); + exit (1); + } + return; + } + + valuep = &value; + switch (opt->type) + { + case SANE_TYPE_BOOL: + value = 1; /* no argument means option is set */ + if (optarg) + { + if (strncasecmp (optarg, "yes", strlen (optarg)) == 0) + value = 1; + else if (strncasecmp (optarg, "no", strlen (optarg)) == 0) + value = 0; + else + { + fprintf (stderr, "%s: option --%s: bad option value `%s'\n", + prog_name, opt->name, optarg); + exit (1); + } + } + break; + + case SANE_TYPE_INT: + case SANE_TYPE_FIXED: + /* ensure vector is long enough: */ + vector_length = opt->size / sizeof (SANE_Word); + if (vector_size < vector_length) + { + vector_size = vector_length; + vector = realloc (vector, vector_length * sizeof (SANE_Word)); + if (!vector) + { + fprintf (stderr, "%s: out of memory\n", prog_name); + exit (1); + } + } + parse_vector (opt, optarg, vector, vector_length); + valuep = vector; + break; + + case SANE_TYPE_STRING: + valuep = (void *) optarg; + break; + + case SANE_TYPE_BUTTON: + value = 0; /* value doesn't matter */ + break; + + default: + fprintf (stderr, "%s: duh, got unknown option type %d\n", + prog_name, opt->type); + return; + } + set_option (device, optnum, valuep); +} + +static void +write_pnm_header_to_file (FILE *fp, SANE_Frame format, int width, int height, int depth) +{ + switch (format) + { + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + case SANE_FRAME_RGB: + fprintf (fp, "P6\n# SANE data follows\n%d %d\n255\n", width, height); + break; + + case SANE_FRAME_GRAY: + if (depth == 1) + fprintf (fp, "P4\n# SANE data follows\n%d %d\n", width, height); + else + fprintf (fp, "P5\n# SANE data follows\n%d %d\n255\n", width, height); + break; + default: + /* default action for unknown frametypes; don't write a header */ + break; + } +#ifdef __EMX__ /* OS2 - write in binary mode. */ + _fsetmode(fp, "b"); +#endif +} + +static void * +advance (Image *image) +{ + if (++image->x >= image->width) + { + image->x = 0; + if (++image->y >= image->height || !image->data) + { + size_t old_size = 0, new_size; + + if (image->data) + old_size = image->height * image->width * image->Bpp; + + image->height += STRIP_HEIGHT; + new_size = image->height * image->width * image->Bpp; + + if (image->data) + image->data = realloc (image->data, new_size); + else + image->data = malloc (new_size); + if (image->data) + memset (image->data + old_size, 0, new_size - old_size); + } + } + if (!image->data) + fprintf (stderr, "%s: can't allocate image buffer (%dx%d)\n", + prog_name, image->width, image->height); + return image->data; +} + +static SANE_Int +get_resolution(SANE_Device *device) +{ + SANE_Int res = 200; + SANE_Word val; + const SANE_Option_Descriptor *opt; + + if (resolution_opt >= 0) + { + opt = sane_get_option_descriptor (device, resolution_opt); + + sane_control_option (device, resolution_opt, + SANE_ACTION_GET_VALUE, &val, 0); + switch (opt->type) + { + case SANE_TYPE_INT: + res = val; + break; + + case SANE_TYPE_FIXED: + res = (SANE_Int) SANE_UNFIX(val); + break; + + case SANE_TYPE_STRING: + case SANE_TYPE_BOOL: + default: + if (verbose) + fprintf(stderr, + "Peculiar option data type for resolution, " + "using default value.\n"); + break; + } + } + else + { + if (verbose) + fprintf(stderr, "No resolution option found, using default value.\n"); + } + + return res; +} + +static SANE_Status +scan_it_raw (const char *fname, SANE_Bool raw, const char *script) +{ + int i, len, first_frame = 1, offset = 0, must_buffer = 0; + SANE_Byte buffer[32*1024], min = 0xff, max = 0; + SANE_Parameters parm; + SANE_Status status; + Image image = {0, }; + FILE *fp = NULL; + + do + { + status = sane_start (device); + if (status != SANE_STATUS_GOOD) + { + if (status != SANE_STATUS_NO_DOCS) + { + fprintf (stderr, "%s: sane_start: %s\n", + prog_name, sane_strstatus (status)); + } + goto cleanup; + } + + status = sane_get_parameters (device, &parm); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: sane_get_parameters: %s\n", + prog_name, sane_strstatus (status)); + goto cleanup; + } + + fp = fopen(fname, "wb"); + if (!fp) { + fprintf(stderr, "Error opening output `%s': %s (%d)\n", + fname, strerror(errno), errno); + status = SANE_STATUS_IO_ERROR; + goto cleanup; + } + + if (verbose) + { + if (first_frame) + { + if (sane_isbasicframe(parm.format)) + { + if (parm.lines >= 0) + fprintf (stderr, "%s: scanning image of size %dx%d pixels" + " at %d bits/pixel\n", + prog_name, parm.pixels_per_line, parm.lines, + 8 * parm.bytes_per_line / parm.pixels_per_line); + else + fprintf (stderr, "%s: scanning image %d pixels wide and " + "variable height at %d bits/pixel\n", + prog_name, parm.pixels_per_line, + 8 * parm.bytes_per_line / parm.pixels_per_line); + } + else + { + fprintf (stderr, "%s: receiving %s frame " + "bytes/line=%d, " + "pixels/line=%d, " + "lines=%d, " + "depth=%d\n", + prog_name, sane_strframe(parm.format), + parm.bytes_per_line, + parm.pixels_per_line, + parm.lines, + parm.depth); + } + } + fprintf (stderr, "%s: acquiring %s frame\n", prog_name, + sane_strframe(parm.format)); + } + + if (first_frame) + { + switch (parm.format) + { + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + assert (parm.depth == 8); + must_buffer = 1; + offset = parm.format - SANE_FRAME_RED; + break; + + case SANE_FRAME_RGB: + assert (parm.depth == 8); + case SANE_FRAME_GRAY: + assert (parm.depth == 1 || parm.depth == 8); + /* if we're writing raw, we skip the header and never + * have to buffer a single frame format. + */ + if (raw == SANE_FALSE) + { + if (parm.lines < 0) + { + must_buffer = 1; + offset = 0; + } + else + { + write_pnm_header_to_file (fp, parm.format, + parm.pixels_per_line, + parm.lines, parm.depth); + } + } + break; + + case SANE_FRAME_TEXT: + case SANE_FRAME_JPEG: + case SANE_FRAME_G31D: + case SANE_FRAME_G32D: + case SANE_FRAME_G42D: + if (!parm.last_frame) + { + status = SANE_STATUS_INVAL; + fprintf (stderr, "%s: bad %s frame: must be last_frame\n", + prog_name, sane_strframe (parm.format)); + goto cleanup; + } + /* write them out without a header; don't buffer */ + break; + + default: + /* Default action for unknown frametypes; write them out + * without a header; issue a warning in verbose mode. + * Since we're not writing a header, there's no need to + * buffer. + */ + if (verbose) + { + fprintf(stderr, "scanadf: unknown frame format %d\n", + (int) parm.format); + } + if (!parm.last_frame) + { + status = SANE_STATUS_INVAL; + fprintf (stderr, "%s: bad %s frame: must be last_frame\n", + prog_name, sane_strframe (parm.format)); + goto cleanup; + } + break; + } + + if (must_buffer) + { + /* We're either scanning a multi-frame image or the + scanner doesn't know what the eventual image height + will be (common for hand-held scanners). In either + case, we need to buffer all data before we can write + the image. */ + image.width = parm.pixels_per_line; + if (parm.lines >= 0) + /* See advance(); we allocate one extra line so we + don't end up realloc'ing in when the image has been + filled in. */ + image.height = parm.lines - STRIP_HEIGHT + 1; + else + image.height = 0; + image.Bpp = 3; + if (parm.format == SANE_FRAME_GRAY || + !sane_isbasicframe(parm.format)) + image.Bpp = 1; + image.x = image.width - 1; + image.y = -1; + if (!advance (&image)) + goto cleanup; + } + } + else + { + assert (parm.format >= SANE_FRAME_RED + && parm.format <= SANE_FRAME_BLUE); + offset = parm.format - SANE_FRAME_RED; + image.x = image.y = 0; + } + + while (1) + { + status = sane_read (device, buffer, sizeof (buffer), &len); + if (status != SANE_STATUS_GOOD) + { + if (verbose && parm.depth == 8) + fprintf (stderr, "%s: min/max graylevel value = %d/%d\n", + prog_name, min, max); + if (status != SANE_STATUS_EOF) + { + fprintf (stderr, "%s: sane_read: %s\n", + prog_name, sane_strstatus (status)); + goto cleanup; + } + break; + } + if (must_buffer) + { + switch (parm.format) + { + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + for (i = 0; i < len; ++i) + { + image.data[offset + 3*i] = buffer[i]; + if (!advance (&image)) + goto cleanup; + } + offset += 3*len; + break; + + case SANE_FRAME_RGB: + for (i = 0; i < len; ++i) + { + image.data[offset + i] = buffer[i]; + if ((offset + i) % 3 == 0 && !advance (&image)) + goto cleanup; + } + offset += len; + break; + + case SANE_FRAME_GRAY: + for (i = 0; i < len; ++i) + { + image.data[offset + i] = buffer[i]; + if (!advance (&image)) + goto cleanup; + } + offset += len; + break; + default: + /* optional frametypes are never buffered */ + fprintf(stderr, "%s: ERROR: trying to buffer %s" + " frametype\n", + prog_name, + sane_strframe(parm.format)); + break; + } + } + else + fwrite (buffer, 1, len, fp); + + if (verbose && parm.depth == 8) + { + for (i = 0; i < len; ++i) + if (buffer[i] >= max) + max = buffer[i]; + else if (buffer[i] < min) + min = buffer[i]; + } + } + first_frame = 0; + } + while (!parm.last_frame); + + if (must_buffer) + { + image.height = image.y; + if (raw == SANE_FALSE) + { + /* if we're writing raw, we skip the header */ + write_pnm_header_to_file (fp, parm.format, image.width, + image.height, parm.depth); + } + fwrite (image.data, image.Bpp, image.height * image.width, fp); + } + + if (fp) + { + fclose(fp); + fp = NULL; + } + + if (script) + { + static char cmd[PATH_MAX * 2]; + static char env[6][PATH_MAX * 2]; + int pid; + SANE_Int res; + SANE_Frame format; + extern char **environ; + + res = get_resolution(device); + + format = parm.format; + if (format == SANE_FRAME_RED || + format == SANE_FRAME_GREEN || + format == SANE_FRAME_BLUE) + { + /* the resultant format is RGB */ + format = SANE_FRAME_RGB; + } + sprintf(env[0], "SCAN_RES=%d", res); + if (putenv(env[0])) + fprintf(stderr, "putenv:failed\n"); + sprintf(env[1], "SCAN_WIDTH=%d", parm.pixels_per_line); + if (putenv(env[1])) + fprintf(stderr, "putenv:failed\n"); + sprintf(env[2], "SCAN_HEIGHT=%d", parm.lines); + if (putenv(env[2])) + fprintf(stderr, "putenv:failed\n"); + sprintf(env[3], "SCAN_FORMAT_ID=%d", (int) parm.format); + if (putenv(env[3])) + fprintf(stderr, "putenv:failed\n"); + sprintf(env[4], "SCAN_FORMAT=%s", + sane_strframe(parm.format)); + if (putenv(env[4])) + fprintf(stderr, "putenv:failed\n"); + sprintf(env[5], "SCAN_DEPTH=%d", parm.depth); + if (putenv(env[5])) + fprintf(stderr, "putenv:failed\n"); + signal(SIGCHLD, SIG_IGN); + switch ((pid = fork())) + { + case -1: + /* fork failed */ + fprintf(stderr, "Error forking: %s (%d)\n", strerror(errno), errno); + break; + + case 0: + /* in child process */ + sprintf(cmd, "%s '%s'", script, fname); + /* system(cmd); */ + execle(script, script, fname, NULL, environ); + exit(0); + + default: + if (verbose) + fprintf(stderr, "Started script `%s' as pid=%d\n", script, pid); + break; + } + } + +cleanup: + if (image.data) + free (image.data); + if (fp) fclose(fp); + + return status; +} + +static SANE_Int +scan_docs (int start, int end, int no_overwrite, SANE_Bool raw, const char *outfmt, const char *script) +{ + SANE_Status status = SANE_STATUS_GOOD; + SANE_Int scannedPages = 0; + SANE_Char fname[PATH_MAX]; + struct stat statbuf; + int res; + + while (end < 0 || start <= end) + { + /*!!! buffer overflow; need protection */ + sprintf(fname, outfmt, start); + + /* does the filename already exist? */ + if (no_overwrite) + { + res = stat (fname, &statbuf); + if (res == 0) + { + status = SANE_STATUS_INVAL; + fprintf (stderr, "Filename %s already exists; will not overwrite\n", fname); + } + } + + /* Scan the document */ + if (status == SANE_STATUS_GOOD) + status = scan_it_raw(fname, raw, script); + + /* Any scan errors? */ + if (status == SANE_STATUS_NO_DOCS) + { + /* out of paper in the hopper; this is our normal exit */ + status = SANE_STATUS_GOOD; + break; + } + else if (status == SANE_STATUS_EOF) + { + /* done with this doc */ + status = SANE_STATUS_GOOD; + fprintf(stderr, "Scanned document %s\n", fname); + scannedPages++; + start++; + } + else + { + /* unexpected error */ + fprintf(stderr, "%s\n", sane_strstatus(status)); + break; + } + } + + fprintf(stderr, "Scanned %d pages\n", scannedPages); + + return status; +} + +int +main (int argc, char **argv) +{ + int ch, i, index, all_options_len; + const SANE_Option_Descriptor * opt; + const SANE_Device ** device_list; + SANE_Int num_dev_options = 0; + const char * devname = 0; + SANE_Status status; + char *full_optstring; + SANE_Bool raw = SANE_FALSE; + const char *scanScript = NULL; /* script to run at end of scan */ + int scriptWait = 0; + const char *outputFile = "image-%04d"; /* file name(format) to write output to */ + int startNum = 1, endNum = -1; /* start/end numbers of pages to scan */ + int no_overwrite = 0; + + atexit (sane_exit); + + prog_name = strrchr (argv[0], '/'); + if (prog_name) + ++prog_name; + else + prog_name = argv[0]; + + sane_init (0, 0); + + /* make a first pass through the options with error printing and argument + permutation disabled: */ + opterr = 0; + while ((ch = getopt_long (argc, argv, "-" BASE_OPTSTRING, basic_options, + &index)) + != EOF) + { + switch (ch) + { + case ':': + case '?': + break; /* may be an option that we'll parse later on */ + + case 'd': devname = optarg; break; + case 'h': help = 1; break; + case 'N': no_overwrite = 1; break; + case 'v': ++verbose; break; + case 'L': + { + int i; + + status = sane_get_devices (&device_list, SANE_FALSE); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: sane_get_devices() failed: %s\n", + prog_name, sane_strstatus (status)); + exit (1); + } + + for (i = 0; device_list[i]; ++i) + { + printf ("device `%s' is a %s %s %s\n", + device_list[i]->name, device_list[i]->vendor, + device_list[i]->model, device_list[i]->type); + } + exit (0); + } + + case 'o': outputFile = optarg; break; + case 'S': scanScript = optarg; break; + case 128: scriptWait = 1; break; + case 's': startNum = atoi(optarg); break; + case 'e': endNum = atoi(optarg); break; + case 'r': raw = SANE_TRUE; break; + + case 'V': + printf ("scanadf (%s) %s\n", PACKAGE, VERSION); + exit (0); + + default: + break; /* ignore device specific options for now */ + } + } + + if (scriptWait && !scanScript) + scriptWait = 0; + + if (help) + printf (usage, prog_name); + + if (!devname) + { + /* If no device name was specified explicitly, we open the first + device we find (if any): */ + + status = sane_get_devices (&device_list, SANE_FALSE); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: sane_get_devices() failed: %s\n", + prog_name, sane_strstatus (status)); + exit (1); + } + if (!device_list[0]) + { + fprintf (stderr, "%s: no SANE devices found\n", prog_name); + exit (1); + } + devname = device_list[0]->name; + } + + status = sane_open (devname, &device); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: open of device %s failed: %s\n", + prog_name, devname, sane_strstatus (status)); + if (help) + device = 0; + else + exit (1); + } + + if (device) + { + /* We got a device, find out how many options it has: */ + status = sane_control_option (device, 0, SANE_ACTION_GET_VALUE, + &num_dev_options, 0); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: unable to determine option count\n", + prog_name); + exit (1); + } + + all_options_len = num_dev_options + NELEMS(basic_options) + 1; + all_options = malloc (all_options_len * sizeof (all_options[0])); + option_number_len = num_dev_options; + option_number = malloc (option_number_len * sizeof (option_number[0])); + if (!all_options || !option_number) + { + fprintf (stderr, "%s: out of memory in fetch_options()\n", + prog_name); + exit (1); + } + + fetch_options (device); + + { + char *larg, *targ, *xarg, *yarg; + larg = targ = xarg = yarg = ""; + + /* Maybe accept t, l, x, and y options. */ + if (window[0]) + xarg = "x:"; + + if (window[1]) + yarg = "y:"; + + if (window[2]) + larg = "l:"; + + if (window[3]) + targ = "t:"; + + /* Now allocate the full option list. */ + full_optstring = malloc (strlen (BASE_OPTSTRING) + + strlen (larg) + strlen (targ) + + strlen (xarg) + strlen (yarg) + 1); + + if (!full_optstring) + { + fprintf (stderr, "%s: out of memory\n", prog_name); + exit (1); + } + + strcpy (full_optstring, BASE_OPTSTRING); + strcat (full_optstring, larg); + strcat (full_optstring, targ); + strcat (full_optstring, xarg); + strcat (full_optstring, yarg); + } + + optind = 0; + opterr = 1; /* re-enable error printing and arg permutation */ + while ((ch = getopt_long (argc, argv, full_optstring, all_options, + &index)) + != EOF) + { + switch (ch) + { + case ':': + case '?': + exit (1); /* error message is printed by getopt_long() */ + + case 'd': case 'h': case 'v': case 'V': case 'T': + case 'o': case 'S': case 's': case 'e': case 'r': + + /* previously handled options */ + break; + + case 'x': + window_val_user[0] = 1; + parse_vector (&window_option[0], optarg, &window_val[0], 1); + break; + + case 'y': + window_val_user[1] = 1; + parse_vector (&window_option[1], optarg, &window_val[1], 1); + break; + + case 'l': /* tl-x */ + process_backend_option (device, window[2], optarg); + break; + + case 't': /* tl-y */ + process_backend_option (device, window[3], optarg); + break; + + case 0: + process_backend_option (device, option_number[index], optarg); + break; + } + } + + free (full_optstring); + + for (index = 0; index < 2; ++index) + if (window[index]) + { + SANE_Word val, pos; + + if (window[index + 2]) + sane_control_option (device, window[index + 2], + SANE_ACTION_GET_VALUE, &pos, 0); + val = pos + window_val[index] - 1; + set_option (device, window[index], &val); + } + if (help) + { + printf ("\nOptions specific to device `%s':\n", devname); + + for (i = 0; i < num_dev_options; ++i) + { + char short_name = '\0'; + int j; + + opt = 0; + for (j = 0; j < 4; ++j) + if (i == window[j]) + { + short_name = "xylt"[j]; + if (j < 2) + opt = window_option + j; + } + if (!opt) + opt = sane_get_option_descriptor (device, i); + + if (opt->type == SANE_TYPE_GROUP) + printf (" %s:\n", opt->title); + + if (!SANE_OPTION_IS_SETTABLE (opt->cap)) + continue; + + print_option (device, i, short_name); + } + if (num_dev_options) + fputc ('\n', stdout); + } + } + + if (help) + { + printf ("\ +Type ``%s --help -d DEVICE'' to get list of all options for DEVICE.\n\ +\n\ +List of available devices:", prog_name); + if (device) + sane_close(device); + + status = sane_get_devices (&device_list, SANE_FALSE); + if (status == SANE_STATUS_GOOD) + { + int column = 80; + + for (i = 0; device_list[i]; ++i) + { + if (column + strlen (device_list[i]->name) + 1 >= 80) + { + printf ("\n "); + column = 4; + } + if (column > 4) + { + fputc (' ', stdout); + column += 1; + } + fputs (device_list[i]->name, stdout); + column += strlen (device_list[i]->name); + } + } + fputc ('\n', stdout); + exit (0); + } + + signal (SIGHUP, sighandler); + signal (SIGINT, sighandler); + signal (SIGPIPE, sighandler); + signal (SIGTERM, sighandler); + + status = scan_docs (startNum, endNum, no_overwrite, raw, outputFile, scanScript); + + sane_cancel (device); + sane_close (device); + + if (scriptWait) + while (wait(NULL) != -1); + + return (status == SANE_STATUS_GOOD) ? 0 : 1; +} + diff --git a/src/xcam.c b/src/xcam.c new file mode 100644 index 0000000..2d494a5 --- /dev/null +++ b/src/xcam.c @@ -0,0 +1,1871 @@ +/* xcam -- X-based camera frontend + Uses the SANE library. + Copyright (C) 1997 David Mosberger and Tristan Tarrant + + Update 2005 Gerard Klaver + The add_text routine and font_6x11.h file are taken from the (GPLed) + webcam.c file, part of xawtv, (c) 1998-2002 Gerd Knorr. + add_text was modified for this program (xcam_add_text). + + 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. */ + +#include "../include/sane/config.h" + +#include "../include/lalloca.h" + +#include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <getopt.h> +#include <limits.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <time.h> + +/* for xcam_add-text routine */ +#include "font_6x11.h" +/*-----------------------*/ + + +#include <sys/types.h> +#include <sys/stat.h> + +#include "gtkglue.h" +#include "preferences.h" + +#include <sane/sane.h> +#include <sane/saneopts.h> +#include "../include/sane/sanei.h" + +#define BACKEND_NAME xcam +#include "../include/sane/sanei_debug.h" + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +#define OUTFILENAME "out.pnm" + +#define MAX_LUM 64 /* how many graylevels for 8 bit displays */ + +#ifndef HAVE_ATEXIT +# define atexit(func) on_exit(func, 0) /* works for SunOS, at least */ +#endif + +typedef struct Canvas +{ + GtkWidget *preview; + GdkGC *gc; + GdkImage *gdk_image; + GdkColormap *graylevel_cmap; /* for 8 bit displays */ + guint32 graylevel[MAX_LUM]; /* graylevel pixels */ + GdkColormap *cube_cmap; + GdkColor cube_colors[5 * 6 * 5]; +} +Canvas; + +static const char *prog_name; +static const SANE_Device **device; +static GSGDialog *dialog; +static char device_settings_filename[1024] = "device.rc"; + +#define DBG_fatal 0 +#define DBG_error 1 +#define DBG_warning 2 +#define DBG_info 3 +#define DBG_debug 4 + +static struct +{ + GtkWidget *shell; + GtkWidget *dialog_box; + GtkWidget *play_stop_label; + GtkWidget *info_label; + GtkWidget *device_info_label; + GtkWidget *save_frame_label; + GtkWidget *rgb_bgr_label; + GtkWidget *txt_label; + struct + { + GtkWidget *item; /* the menu bar item */ + GtkWidget *menu; /* the associated menu */ + } + devices; + Canvas canvas; + gint gdk_input_tag; /* tag returned by gdk_input_add () */ + int playing; /* are we playing video? */ + int saving; /* are we saving to file */ + + SANE_Byte *buf; + size_t buf_backend_size; + size_t remaining; + SANE_Parameters params; + gpointer data; /* image data */ + int x, y; /* x and y position */ + int input_tag; +/* for standalone mode: */ + GtkWidget *filename_entry; + FILE *out; + long header_size; + gboolean have_odd_byte; + guint8 odd_byte; + + int num_bytes; + int bytes_read; + char picmsg_ps[50]; + int value_rgb; + int value_txt; + + double fps; + double fps_av; + double fps_old1; + double fps_old2; + double fps_old3; + long f_count; + time_t time1; + time_t time2; + int i_time; +} +win; + +/* forward declarations: */ +int main (int argc, char **argv); + +static void rescan_devices (GtkWidget * widget, gpointer client_data, + gpointer call_data); +static void next_frame (void); + +static void save_frame (void); + +static void update_param (GSGDialog * dialog, void *arg); + +static void load_defaults (int silent); + +static struct option long_options[] = { + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {"buffersize", no_argument, NULL, 'B'}, + {0, 0, 0, 0} +}; + +/* Test if this machine is little endian (from coolscan.c) */ +/* static gboolean +calc_little_endian (void) +{ + SANE_Int testvalue = 255; + u_int8_t *firstbyte = (u_int8_t *) & testvalue; + + if (*firstbyte == 255) + return TRUE; + return FALSE; +} */ + +#define CANVAS_EVENT_MASK GDK_BUTTON1_MOTION_MASK | \ + GDK_EXPOSURE_MASK | \ + GDK_BUTTON_PRESS_MASK | \ + GDK_ENTER_NOTIFY_MASK + +static void +display_image (Canvas * canvas) +{ + if (canvas->gdk_image) + { + gdk_draw_image (canvas->preview->window, canvas->gc, canvas->gdk_image, + 0, 0, 0, 0, + canvas->gdk_image->width, canvas->gdk_image->height); + gdk_flush (); + } +} + +static gint +canvas_events (GtkWidget * widget, GdkEvent * event) +{ + Canvas *canvas = &win.canvas; + if (!canvas) + return FALSE; + + switch (event->type) + { + case GDK_EXPOSE: + if (!canvas->gc) + canvas->gc = gdk_gc_new (canvas->preview->window); + display_image (canvas); + break; + + case GDK_BUTTON_PRESS: + break; + + case GDK_BUTTON_RELEASE: + break; + + case GDK_MOTION_NOTIFY: + break; + + case GDK_ENTER_NOTIFY: +#if 0 + gdk_colors_store (win.canvas.cube_cmap, win.canvas.cube_colors, + NELEMS (win.canvas.cube_colors)); +#endif + break; + + default: + break; + } + return FALSE; +} + +static void +stop_camera (void) +{ + DBG (DBG_debug, "xcam: stop_camera: enter\n"); + + if (dialog) + sane_cancel (gsg_dialog_get_device (dialog)); + if (win.gdk_input_tag >= 0) + { + gdk_input_remove (win.gdk_input_tag); + } + else + win.playing = FALSE; + win.gdk_input_tag = -1; + if (!win.playing) + gtk_label_set (GTK_LABEL (win.play_stop_label), " Play "); + else + gtk_label_set (GTK_LABEL (win.play_stop_label), " Stop "); + + DBG (DBG_debug, "xcam: stop_camera: exit\n"); +} + +static void +switch_device (const SANE_Device * dev) +{ + char buf[512]; + + DBG (DBG_debug, "xcam: switch_device: enter\n"); + if (win.playing) + { + win.playing = FALSE; + stop_camera (); + } + + if (dialog) + gsg_destroy_dialog (dialog); + + dialog = gsg_create_dialog (GTK_WIDGET (win.dialog_box), dev->name, + 0, 0, 0, 0); + buf[0] = '\0'; + + if (dialog) + sprintf (buf, "%s %s %s", dev->vendor, dev->model, dev->type); + gtk_label_set (GTK_LABEL (win.device_info_label), buf); + DBG (DBG_debug, "xcam: switch_device: exit\n"); +} + +static void +switch_device_by_name (const char *device_name) +{ + SANE_Device dev_info; + int i; + + DBG (DBG_debug, "xcam: switch_device_by_name: enter\n"); + for (i = 0; device[i]; ++i) + if (strcmp (device[i]->name, device_name) == 0) + { + switch_device (device[i]); + return; + } + + /* the backends don't know about this device yet---make up an entry: */ + dev_info.name = device_name; + dev_info.vendor = "Unknown"; + dev_info.model = ""; + dev_info.type = ""; + switch_device (&dev_info); + DBG (DBG_debug, "xcam: switch_device_by_name: exit\n"); +} + +static void +save_settings (const char *filename) +{ + int fd; + + DBG (DBG_debug, "xcam: save_settings: enter\n"); + + fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd < 0) + { + char buf[256]; + + snprintf (buf, sizeof (buf), "Failed to create file: %s.", + strerror (errno)); + gsg_error (buf); + return; + } + write (fd, dialog->dev_name, strlen (dialog->dev_name)); + write (fd, "\n", 1); + sanei_save_values (fd, dialog->dev); + close (fd); + DBG (DBG_debug, "xcam: save_settings: exit\n"); +} + +#define MSG_MAXLEN 45 +#define CHAR_HEIGHT 11 +#define CHAR_WIDTH 6 +#define CHAR_START 4 + +static SANE_Status +xcam_add_text (SANE_Byte * image, int width, int height, char *txt) +{ + SANE_Status status; + time_t t; + struct tm *tm; + char line[MSG_MAXLEN + 1]; + SANE_Byte *ptr; + int i, x, y, f, len; + char fmtstring[25] = " %Y-%m-%d %H:%M:%S"; + char fmttxt[46]; + + DBG (DBG_debug, "xcam_add_text: enter\n"); + time (&t); + tm = localtime (&t); + if (strlen (txt) > (MSG_MAXLEN - 23)) + strncpy (fmttxt, txt, (MSG_MAXLEN - 23)); + else + strcpy (fmttxt, txt); + strcat (fmttxt, fmtstring); + + len = strftime (line, MSG_MAXLEN, fmttxt, tm); + + for (y = 0; y < CHAR_HEIGHT; y++) + { + ptr = image + 3 * width * (height - CHAR_HEIGHT - 2 + y) + 12; + + for (x = 0; x < len; x++) + { + f = fontdata[line[x] * CHAR_HEIGHT + y]; + for (i = CHAR_WIDTH - 1; i >= 0; i--) + { + if (f & (CHAR_START << i)) + { + ptr[0] = 255; + ptr[1] = 255; + ptr[2] = 255; + } + ptr += 3; + } /* for i */ + } /* for x */ + } /* for y */ + + DBG (DBG_debug, "xcam_add_text: exit vw=%d, vh=%d\n", width, height); + status = (SANE_STATUS_GOOD); + return status; + +} + + +/* Update the info line with the latest size information. */ +static void +update_param (GSGDialog * dialog, void *arg) +{ + gchar buf[200]; + + DBG (DBG_debug, "xcam: update_param: enter\n"); + + if (dialog == NULL) + return; + + if (!win.info_label) + return; + + if (sane_get_parameters (gsg_dialog_get_device (dialog), &win.params) + == SANE_STATUS_GOOD) + { + double size = + (double) win.params.bytes_per_line * (double) win.params.lines; + const char *unit = "B"; + + if (win.params.lines == -1) + { + snprintf (buf, sizeof (buf), "%dxunknown: unknown size", + win.params.pixels_per_line); + } + else + { + if (win.params.format >= SANE_FRAME_RED + && win.params.format <= SANE_FRAME_BLUE) + size *= 3; + + if (size >= 1024 * 1024) + { + size /= 1024 * 1024; + unit = "MByte"; + } + else if (size >= 1024) + { + size /= 1024; + unit = "kByte"; + } + snprintf (buf, sizeof (buf), + "%dx%d %1.1f %s \n%6ld f_count\n%2.2f fps %2.2f fps_av", + win.params.pixels_per_line, win.params.lines, size, unit, + win.f_count, win.fps, win.fps_av); + } + } + else + snprintf (buf, sizeof (buf), "Invalid parameters."); + gtk_label_set (GTK_LABEL (win.info_label), buf); + + DBG (DBG_debug, "xcam: update_param: exit\n"); +} + +static void +pref_xcam_save (void) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "xcam: pref_xcam_save: enter\n"); + /* first save xcam-specific preferences: */ + gsg_make_path (sizeof (filename), filename, "xcam", "xcam", 0, ".rc"); + fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd < 0) + { + char buf[256]; + + snprintf (buf, sizeof (buf), "Failed to create file: %s.", + strerror (errno)); + gsg_error (buf); + return; + } + preferences_save (fd); + close (fd); + DBG (DBG_debug, "xcam: pref_xcam_save: exit\n"); +} + +static void +pref_xcam_restore (void) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "xcam: pref_xcam_restore: enter\n"); + gsg_make_path (sizeof (filename), filename, "xcam", "xcam", 0, ".rc"); + fd = open (filename, O_RDONLY); + if (fd >= 0) + { + preferences_restore (fd); + close (fd); + } + if (!preferences.filename) + preferences.filename = strdup (OUTFILENAME); + DBG (DBG_debug, "xcam: pref_xcam_restore: exit\n"); +} + + +static void +load_settings (const char *filename, int silent) +{ + char buf[2 * PATH_MAX]; + char *end; + int fd; + + DBG (DBG_debug, "xcam: load_settings: enter\n"); + + fd = open (filename, O_RDONLY); + if (fd < 0) + { + if (!silent) + { + snprintf (buf, sizeof (buf), "Failed to open file %s: %s.", + filename, strerror (errno)); + gsg_error (buf); + } + return; /* fail silently */ + } + + /* first, read off the devicename that these settings are for: */ + read (fd, buf, sizeof (buf)); + buf[sizeof (buf) - 1] = '\0'; + end = strchr (buf, '\n'); + if (!end) + { + if (!silent) + { + snprintf (buf, sizeof (buf), "File %s is malformed.", filename); + gsg_error (buf); + } + return; + } + *end = '\0'; + if (strcmp (dialog->dev_name, buf) != 0) + switch_device_by_name (buf); + + /* position right behind device name: */ + lseek (fd, strlen (buf) + 1, SEEK_SET); + + sanei_load_values (fd, dialog->dev); + close (fd); + + gsg_refresh_dialog (dialog); + + DBG (DBG_debug, "xcam: load_settings: exit\n"); +} + +static int +make_default_filename (size_t buf_size, char *buf, const char *dev_name) +{ + return gsg_make_path (buf_size, buf, "xcam", 0, dev_name, ".rc"); +} + +static void +load_defaults (int silent) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "xcam, load_defaults: enter\n"); + if (make_default_filename (sizeof (filename), filename, dialog->dev_name) + < 0) + return; + if (fd < 0) + return; + load_settings (filename, silent); + sanei_load_values (fd, dialog->dev); + DBG (DBG_debug, "xcam, load_defaults: exit\n"); +} + +void +device_name_dialog_cancel (GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy (data); +} + +void +device_name_dialog_ok (GtkWidget * widget, gpointer data) +{ + GtkWidget *text = data; + const char *name; + + name = gtk_entry_get_text (GTK_ENTRY (text)); + if (!name) + return; /* huh? how come? */ + switch_device_by_name (name); + + gtk_widget_destroy (gtk_widget_get_toplevel (text)); +} + +static void +prompt_for_device_name (GtkWidget * widget, gpointer data) +{ + GtkWidget *vbox, *hbox, *label, *text; + GtkWidget *button, *dialog; + + DBG (DBG_debug, "xcam: prompt_for_device_name: enter\n"); + + dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); + gtk_window_set_title (GTK_WINDOW (dialog), "Device name"); + + /* create the main vbox */ + vbox = gtk_vbox_new (TRUE, 5); + gtk_container_border_width (GTK_CONTAINER (vbox), 5); + gtk_container_add (GTK_CONTAINER (dialog), vbox); + + hbox = gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (vbox), hbox); + + label = gtk_label_new ("Device name:"); + gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_widget_show (label); + + text = gtk_entry_new (); + gtk_container_add (GTK_CONTAINER (hbox), text); + + gtk_widget_show (hbox); + + /* the confirmation button */ + hbox = gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (vbox), hbox); + + button = gtk_button_new_with_label ("OK"); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) device_name_dialog_ok, text); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); + gtk_widget_grab_default (button); + gtk_widget_show (button); + + button = gtk_button_new_with_label ("Cancel"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) device_name_dialog_cancel, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); + gtk_widget_show (button); + + gtk_widget_show (hbox); + gtk_widget_show (text); + gtk_widget_show (vbox); + gtk_widget_show (dialog); + DBG (DBG_debug, "xcam: prompt_for_device_name: exit\n"); +} + +static void +exit_callback (GtkWidget * widget, gpointer data) +{ + if (dialog) + gsg_destroy_dialog (dialog); + dialog = 0; + exit (0); +} + +static void +save_defaults_callback (GtkWidget * widget, gpointer data) +{ + char buf[PATH_MAX]; + + if (make_default_filename (sizeof (buf), buf, dialog->dev_name) < 0) + return; + save_settings (buf); +} + +static void +load_defaults_callback (GtkWidget * widget, gpointer data) +{ + load_defaults (0); +} + +static void +save_as_callback (GtkWidget * widget, gpointer data) +{ + if (gsg_get_filename ("File to save settings to", device_settings_filename, + sizeof (device_settings_filename), + device_settings_filename) < 0) + return; + save_settings (device_settings_filename); +} + +static void +load_from_callback (GtkWidget * widget, gpointer data) +{ + if (gsg_get_filename + ("File to load settings from", device_settings_filename, + sizeof (device_settings_filename), device_settings_filename) < 0) + return; + load_settings (device_settings_filename, 0); +} + +static void +buttons_disable (void) +{ + + DBG (DBG_debug, "xcam: buttons_disable: enter\n"); + + gsg_set_sensitivity (dialog, FALSE); + gtk_widget_set_sensitive (win.play_stop_label, FALSE); + gtk_widget_set_sensitive (win.save_frame_label, FALSE); + gtk_widget_set_sensitive (win.rgb_bgr_label, FALSE); + gtk_widget_set_sensitive (win.txt_label, FALSE); + + DBG (DBG_debug, "xcam: buttons_disable: exit\n"); +} + +static void +buttons_enable (void) +{ + + DBG (DBG_debug, "xcam: buttons_enable: enter\n"); + + gsg_set_sensitivity (dialog, TRUE); + gtk_widget_set_sensitive (win.play_stop_label, TRUE); + gtk_widget_set_sensitive (win.save_frame_label, TRUE); + gtk_widget_set_sensitive (win.rgb_bgr_label, TRUE); + gtk_widget_set_sensitive (win.txt_label, TRUE); + + DBG (DBG_debug, "xcam: buttons_enable: exit\n"); +} + +static GtkWidget * +build_files_menu (void) +{ + GtkWidget *menu, *item; + + DBG (DBG_debug, "xcam: build_files_menu: enter\n"); + + menu = gtk_menu_new (); + + item = gtk_menu_item_new (); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Exit"); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) exit_callback, 0); + gtk_widget_show (item); + + DBG (DBG_debug, "xcam: build_files_menu: exit\n"); + return menu; +} + +static gint +delayed_switch (gpointer data) +{ + switch_device (data); + load_defaults (1); + return FALSE; +} + +static void +device_activate_callback (GtkWidget * widget, gpointer data) +{ + gtk_idle_add (delayed_switch, data); +} + +static GtkWidget * +build_device_menu (void) +{ + GtkWidget *menu, *item; + SANE_Status status; + int i; + + menu = gtk_menu_new (); + + status = sane_get_devices (&device, SANE_FALSE); + if (status != SANE_STATUS_GOOD) + { + fprintf (stderr, "%s: %s\n", prog_name, sane_strstatus (status)); + exit (1); + } + + for (i = 0; device[i]; ++i) + { + item = gtk_menu_item_new_with_label ((char *) device[i]->name); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) device_activate_callback, + (gpointer) device[i]); + gtk_widget_show (item); + } + + item = gtk_menu_item_new (); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Refresh device list..."); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) rescan_devices, 0); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Specify device name..."); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) prompt_for_device_name, 0); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + return menu; +} + +static void +pref_toggle_advanced (GtkWidget * widget, gpointer data) +{ + preferences.advanced = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_advanced (dialog, preferences.advanced); + pref_xcam_save (); +} + +static void +pref_toggle_tooltips (GtkWidget * widget, gpointer data) +{ + preferences.tooltips_enabled = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_tooltips (dialog, preferences.tooltips_enabled); + pref_xcam_save (); +} + +static void +pref_toggle_twocolumn (GtkWidget * widget, gpointer data) +{ + preferences.twocolumn_enabled = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_twocolumn (dialog, preferences.twocolumn_enabled); + pref_xcam_save (); +} + +static GtkWidget * +build_preferences_menu (GSGDialog * dialog) +{ + GtkWidget *menu, *item; + + menu = gtk_menu_new (); + + /* advanced user option: */ + item = gtk_check_menu_item_new_with_label ("Show advanced options"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.advanced); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_advanced, 0); + + /* tooltips submenu: */ + + item = gtk_check_menu_item_new_with_label ("Show tooltips"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.tooltips_enabled); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_tooltips, 0); + + /* twocolumn submenu: */ + + item = gtk_check_menu_item_new_with_label ("Show two column display"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.twocolumn_enabled); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_twocolumn, 0); + + item = gtk_menu_item_new (); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Save as default settings"); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) save_defaults_callback, 0); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Load default settings"); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) load_defaults_callback, 0); + gtk_widget_show (item); + + item = gtk_menu_item_new (); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Save settings as..."); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) save_as_callback, 0); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Load settings from..."); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) load_from_callback, 0); + gtk_widget_show (item); + + return menu; +} + +static void +rescan_devices (GtkWidget * widget, gpointer client_data, gpointer call_data) +{ + gtk_widget_destroy (GTK_WIDGET (win.devices.menu)); + win.devices.menu = build_device_menu (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (win.devices.item), + win.devices.menu); +} + +#define READ_SANE_PIXEL(buf, buf_end, format, depth, r, g, b) \ +{ \ + switch (format) \ + { \ + case SANE_FRAME_GRAY: \ + switch (depth) \ + { \ + case 1: \ + if (buf + 1 > buf_end) \ + goto end_of_buffer; \ + (r) = (g) = (b) = (*buf & src_mask) ? 0x0000 : 0xffff; \ + src_mask >>= 1; \ + if (src_mask == 0x00) \ + { \ + ++buf; \ + src_mask = 0x80; \ + } \ + break; \ + \ + case 8: \ + if (buf + 1 > buf_end) \ + goto end_of_buffer; \ + (r) = (g) = (b) = (*buf++ << 8); \ + break; \ + \ + case 16: \ + if (buf + 2 > buf_end) \ + goto end_of_buffer; \ + (r) = (g) = (b) = *((guint16 *) buf); \ + buf += 2; \ + break; \ + } \ + break; \ + \ + case SANE_FRAME_RGB: \ + switch (depth) \ + { \ + case 1: \ + case 8: \ + if (buf + 3 > buf_end) \ + goto end_of_buffer; \ + (r) = buf[0] << 8; (g) = buf[1] << 8; (b) = buf[2] << 8; \ + buf += 3; \ + break; \ + \ + case 16: \ + if (buf + 3 > buf_end) \ + goto end_of_buffer; \ + (r) = ((guint16 *)buf)[0]; \ + (g) = ((guint16 *)buf)[1]; \ + (b) = ((guint16 *)buf)[2]; \ + buf += 6; \ + break; \ + } \ + break; \ + \ + case SANE_FRAME_RED: \ + case SANE_FRAME_GREEN: \ + case SANE_FRAME_BLUE: \ + default: \ + fprintf (stderr, "%s: format %d not yet supported\n", \ + prog_name, (format)); \ + goto end_of_buffer; \ + } \ +} + +#define PUT_X11_PIXEL(buf, endian, depth, bpp, r, g, b, gl_map) \ +{ \ + switch (depth) \ + { \ + case 1: /* duh? A Sun3 or what?? */ \ + lum = 3*(r) + 5*(g) + 2*(b); \ + if (lum >= 5*0x8000) \ + *buf |= dst_mask; \ + dst_mask <<= 1; \ + if (dst_mask > 0xff) \ + { \ + buf += (bpp); \ + dst_mask = 0x01; \ + } \ + break; \ + \ + case 8: \ + lum = ((3*(r) + 5*(g) + 2*(b)) / (10 * 256/MAX_LUM)) >> 8; \ + if (lum >= MAX_LUM) \ + lum = MAX_LUM; \ + buf[0] = (gl_map)[lum]; \ + buf += (bpp); \ + break; \ + \ + case 15: \ + rgb = ( (((r) >> 11) << r_shift) /* 5 bits of red */ \ + | (((g) >> 11) << g_shift) /* 5 bits of green */ \ + | (((b) >> 11) << b_shift));/* 5 bits of blue */ \ + ((guint16 *)buf)[0] = rgb; \ + buf += (bpp); \ + break; \ + \ + case 16: \ + rgb = ( (((r) >> 11) << r_shift) /* 5 bits of red */ \ + | (((g) >> 10) << g_shift)/* 6 bits of green */ \ + | (((b) >> 11) << b_shift));/* 5 bits of blue */ \ + ((guint16 *)buf)[0] = rgb; \ + buf += (bpp); \ + break; \ + \ + case 24: \ + case 32: \ + if (bpp == 4) \ + { \ + rgb = ( (((r) >> 8) << r_shift) \ + | (((g) >> 8) << g_shift) \ + | (((b) >> 8) << b_shift)); \ + ((guint32 *)buf)[0] = rgb; \ + } \ + else \ + { \ + if ( ((endian) == GDK_LSB_FIRST && r_shift == 0) \ + || ((endian) == GDK_MSB_FIRST && b_shift == 0)) \ + { \ + buf[0] = (r) >> 8; buf[1] = (g) >> 8; buf[2] = (b) >> 8; \ + } \ + else \ + { \ + buf[0] = (b) >> 8; buf[1] = (g) >> 8; buf[2] = (r) >> 8; \ + } \ + } \ + buf += (bpp); \ + break; \ + } \ +} + +static void +input_available (gpointer ignore, gint source, GdkInputCondition cond) +{ + int x, pixels_per_line, bytes_per_line, dst_depth, src_depth; + guint32 r = 0, g = 0, b = 0, lum, rgb, src_mask, dst_mask; + gint r_shift, b_shift, g_shift; + size_t buf_size, remaining = win.remaining; + SANE_Byte *src, *src_end; + GdkByteOrder byte_order; + u_long bytes_per_pixel; + SANE_Frame format; + SANE_Status status; + SANE_Int len; + u_char *dst; + + double max_value = 60; /* min. 1 frame per min. */ + double frame_time = 50; /* dummy value */ + + DBG (DBG_debug, "xcam: input available: enter\n"); + + if (!win.playing) + /* looks like we got cancelled */ + goto stop_and_exit; + + buf_size = win.buf_backend_size; + format = win.params.format; + src_depth = win.params.depth; + dst_depth = win.canvas.gdk_image->depth; + pixels_per_line = win.params.pixels_per_line; + bytes_per_line = win.canvas.gdk_image->bpl; + bytes_per_pixel = win.canvas.gdk_image->bpp; + byte_order = win.canvas.gdk_image->byte_order; + + x = win.x; + dst = win.data; + src_mask = 0x80; /* SANE has left most bit is most significant bit */ + dst_mask = 0x01; + + r_shift = win.canvas.gdk_image->visual->red_shift; + g_shift = win.canvas.gdk_image->visual->green_shift; + b_shift = win.canvas.gdk_image->visual->blue_shift; + + while (1) + { + DBG (DBG_debug, "input available: enter sane_read\n"); + status = sane_read (gsg_dialog_get_device (dialog), + win.buf + remaining, buf_size - remaining, &len); + if (status != SANE_STATUS_GOOD) + { + if (status == SANE_STATUS_EOF) + { + display_image (&win.canvas); + stop_camera (); + if (win.playing) + { + next_frame (); /* arrange for next frame */ + return; + } + } + else + { + char buf[256]; + sprintf (buf, "Error during read: %s.", + sane_strstatus (status)); + gsg_error (buf); + } + win.playing = FALSE; + stop_camera (); + return; + } + win.f_count++; + update_param (dialog, 0); + win.i_time++; + if (win.i_time >= 30) + { + time (&win.time2); /* time marker */ + + frame_time = difftime (win.time2, win.time1); + + if (frame_time > max_value) + { + frame_time = max_value; + } + + win.fps_old3 = win.fps_old2; + win.fps_old2 = win.fps_old1; + win.fps_old1 = win.fps; + win.fps = 30 / frame_time; /* correction for loop 30 */ + /* avarage last 4 frames times */ + win.fps_av = + (win.fps_old3 + win.fps_old2 + win.fps_old1 + win.fps) / 4; + + DBG (DBG_debug, + "xcam: input_available fps count=%d, frame_time * 30 = %2.3f, fps=%2.3f, fps_av=%2.3f\n", + win.f_count, frame_time, win.fps, win.fps_av); + win.i_time = 0; + + time (&win.time1); /* time marker for new sequence */ + } + update_param (dialog, 0); + + if (!len) + break; + + if (win.value_txt == 1) + { + strcpy (win.picmsg_ps, "xcam "); + + status = + xcam_add_text (win.buf, win.params.pixels_per_line, + win.params.lines, win.picmsg_ps); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_info, "xcam: input available status NOK\n"); + return; + } + } + + src = win.buf; + src_end = src + len + remaining; + + while (1) + { + if (win.value_rgb == 0) + { + READ_SANE_PIXEL (src, src_end, format, src_depth, r, g, b); + } + else if (win.value_rgb == 1) + { + READ_SANE_PIXEL (src, src_end, format, src_depth, b, g, r); + } + PUT_X11_PIXEL (dst, byte_order, dst_depth, bytes_per_pixel, r, g, b, + win.canvas.graylevel); + if (++x >= pixels_per_line) + { + x = 0; + dst += bytes_per_line - pixels_per_line * bytes_per_pixel; + } + } + end_of_buffer: + remaining = src_end - src; + } + win.data = dst; + win.x = x; + win.remaining = remaining; + DBG (DBG_debug, "xcam: input available: exit\n"); + return; + +stop_and_exit: + win.playing = FALSE; + stop_camera (); + DBG (DBG_debug, "xcam: input available: stop and exit\n"); + return; +} + +static void +next_frame (void) +{ + char buf[256]; + SANE_Status status; + int fd; + DBG (DBG_debug, "xcam: next frame enter\n"); + buttons_disable (); + + DBG (DBG_debug, "xcam: next frame, start gsg_sync\n"); + gsg_sync (dialog); + + status = sane_start (gsg_dialog_get_device (dialog)); + if (status != SANE_STATUS_GOOD) + { + sprintf (buf, "Failed to start webcam: %s.", sane_strstatus (status)); + gsg_error (buf); + win.playing = FALSE; + stop_camera (); + return; + } + + status = sane_get_parameters (gsg_dialog_get_device (dialog), &win.params); + if (status != SANE_STATUS_GOOD) + { + sprintf (buf, "Failed to get parameters: %s.", sane_strstatus (status)); + gsg_error (buf); + win.playing = FALSE; + stop_camera (); + return; + } + + if (!win.canvas.gdk_image + || win.canvas.gdk_image->width != win.params.pixels_per_line + || win.canvas.gdk_image->height != win.params.lines) + { + GdkImageType image_type = GDK_IMAGE_FASTEST; + + if (win.canvas.gdk_image) + gdk_image_destroy (win.canvas.gdk_image); +#ifdef __alpha__ + /* Some X servers seem to have a problem with shared images that + have a width that is not a multiple of 8. Duh... ;-( */ + if (win.params.pixels_per_line % 8) + image_type = GDK_IMAGE_NORMAL; +#endif + win.canvas.gdk_image = + gdk_image_new (image_type, + gdk_window_get_visual (win.canvas.preview->window), + win.params.pixels_per_line, win.params.lines); + gtk_widget_set_usize (win.canvas.preview, + win.params.pixels_per_line, win.params.lines); + } + win.data = win.canvas.gdk_image->mem; + win.x = 0; + win.remaining = 0; + + + + buttons_enable (); + if (sane_set_io_mode (gsg_dialog_get_device (dialog), SANE_TRUE) + == SANE_STATUS_GOOD + && sane_get_select_fd (gsg_dialog_get_device (dialog), &fd) + == SANE_STATUS_GOOD) + win.gdk_input_tag = + gdk_input_add (fd, GDK_INPUT_READ, input_available, 0); + else + input_available (0, -1, 0); + + DBG (DBG_debug, "xcam: next frame: exit\n"); +} + +static void +play_stop_button (GtkWidget * widget, gpointer client_data, + gpointer call_data) +{ + DBG (DBG_debug, "xcam: play_stop_button: enter\n"); + if (!dialog) + return; + + if (win.playing) + { + win.playing = FALSE; + gtk_label_set (GTK_LABEL (win.play_stop_label), " Play "); + DBG (DBG_debug, "xcam: wait for play button to be pushed\n"); + } + else if (win.gdk_input_tag < 0) + { + win.playing = TRUE; + gtk_label_set (GTK_LABEL (win.play_stop_label), " Stop "); + DBG (DBG_debug, "xcam: wait for stop button to be pushed\n"); + next_frame (); + } + DBG (DBG_debug, "xcam: play_stop_button: exit\n"); +} + +/* Invoked when the save frame button is pressed */ +static void +save_frame_button (GtkWidget * widget, gpointer client_data, + gpointer call_data) +{ + char buf[256]; + char testfilename[256]; + + DBG (DBG_debug, "xcam: save_frame_button\n"); + if (!dialog) + return; + + if (win.saving) + win.saving = FALSE; + else if (win.gdk_input_tag < 0) + { + win.saving = TRUE; + gtk_label_set (GTK_LABEL (win.save_frame_label), "Saving started"); +/* ------------------------------------------ */ + + /* test for pnm formats */ + strncpy (testfilename, preferences.filename, sizeof (testfilename)); + testfilename[sizeof (testfilename)] = 0; + g_strreverse (testfilename); + if (!((!strncmp (testfilename, "mnp.", 4)) || + (!strncmp (testfilename, "mgp.", 4)) || + (!strncmp (testfilename, "mbp.", 4)) || + (!strncmp (testfilename, "mpp.", 4)) || + (!strncmp (testfilename, "MNP.", 4)) || + (!strncmp (testfilename, "MGP.", 4)) || + (!strncmp (testfilename, "MBP.", 4)) || + (!strncmp (testfilename, "MPP.", 4)))) + { + snprintf (buf, sizeof (buf), + "Failed to scan, wrong file extension, use pnm, pgm, pbm or ppm `%s'", + preferences.filename); + gsg_error (buf); + return; + } + win.out = fopen (preferences.filename, "w"); + if (!win.out) + { + snprintf (buf, sizeof (buf), "Failed to open `%s': %s", + preferences.filename, strerror (errno)); + gsg_error (buf); + return; + } + } + buttons_disable (); + save_frame (); + buttons_enable (); + gsg_sync (dialog); + gtk_label_set (GTK_LABEL (win.save_frame_label), "Save\nFrame"); + DBG (DBG_debug, "xcam: save_frame_button: exit\n"); +} + +/* Invoked when the TXT button is pressed */ +static void +txt_button (GtkWidget * widget, gpointer client_data, gpointer call_data) +{ + DBG (DBG_debug, "xcam: txt_button\n"); + if (!dialog) + return; + + if (win.saving) + { + win.saving = FALSE; + win.value_txt = 0; + gtk_label_set (GTK_LABEL (win.txt_label), " TXT \n OFF "); + } + else if (win.gdk_input_tag < 0) + { + win.saving = TRUE; + gtk_label_set (GTK_LABEL (win.txt_label), " TXT \n ON "); + win.value_txt = 1; + } + gsg_sync (dialog); + DBG (DBG_debug, "xcam: txt_button: exit\n"); +} + +/* Invoked when the RGB-BGR button is pressed */ +static void +rgb_bgr_button (GtkWidget * widget, gpointer client_data, gpointer call_data) +{ + DBG (DBG_debug, "xcam: rgb_bgr_button\n"); + if (!dialog) + return; + + if (win.saving) + { + win.saving = FALSE; + win.value_rgb = 0; + gtk_label_set (GTK_LABEL (win.rgb_bgr_label), "RGB"); + } + else if (win.gdk_input_tag < 0) + { + win.saving = TRUE; + gtk_label_set (GTK_LABEL (win.rgb_bgr_label), "BGR"); + win.value_rgb = 1; + } + gsg_sync (dialog); + DBG (DBG_debug, "xcam: rgb_bgr_button: exit\n"); +} + +static void +save_frame (void) +{ + SANE_Handle dev = gsg_dialog_get_device (dialog); + + const char *frame_type = 0; + char buf[256]; + int fd; + + DBG (DBG_debug, "xcam: save_frame: enter\n"); + + win.x = win.y = 0; + + win.num_bytes = win.params.lines * win.params.bytes_per_line; + win.bytes_read = 0; + win.have_odd_byte = FALSE; + + switch (win.params.format) + { + case SANE_FRAME_RGB: + frame_type = "RGB"; + break; + case SANE_FRAME_RED: + frame_type = "red"; + break; + case SANE_FRAME_GREEN: + frame_type = "green"; + break; + case SANE_FRAME_BLUE: + frame_type = "blue"; + break; + case SANE_FRAME_GRAY: + frame_type = "gray"; + break; + } + + if (!win.header_size) + { + switch (win.params.format) + { + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + if (win.params.depth > 8) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), + "Separate channel transfers are not supported " + "with %d bits/channel.", win.params.depth); + gsg_error (buf); + + buttons_enable (); + return; + } + /*FALLTHROUGH*/ case SANE_FRAME_RGB: + fprintf (win.out, "P6\n# SANE data follows\n%d %d\n%d\n", + win.params.pixels_per_line, win.params.lines, + (win.params.depth <= 8) ? 255 : 65535); + break; + + case SANE_FRAME_GRAY: + if (win.params.depth == 1) + fprintf (win.out, "P4\n# SANE data follows\n%d %d\n", + win.params.pixels_per_line, win.params.lines); + else + fprintf (win.out, "P5\n# SANE data follows\n%d %d\n%d\n", + win.params.pixels_per_line, win.params.lines, + (win.params.depth <= 8) ? 255 : 65535); + break; + } + win.header_size = ftell (win.out); + fwrite (win.buf, 1, win.num_bytes, win.out); + fclose (win.out); + win.out = 0; + } + if (win.params.format >= SANE_FRAME_RED + && win.params.format <= SANE_FRAME_BLUE) + fseek (win.out, + win.header_size + win.params.format - SANE_FRAME_RED, SEEK_SET); + snprintf (buf, sizeof (buf), "Receiving %s data for `%s'...", + frame_type, preferences.filename); + + win.input_tag = -1; + if (sane_set_io_mode (dev, SANE_TRUE) == SANE_STATUS_GOOD + && sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD) + win.input_tag = gdk_input_add (fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + input_available, 0); + else + { + while (gtk_events_pending ()) + gtk_main_iteration (); + input_available (0, -1, GDK_INPUT_READ); + } + + DBG (DBG_debug, "xcam: save_frame: exit\n"); +} + +static void +xcam_exit (void) +{ + static int active = 0; + + DBG (DBG_debug, "xcam: xcam_exit: enter\n"); + if (active) + return; + + active = 1; + pref_xcam_save (); + sane_exit (); + /* this has the habit of calling exit itself: */ + gtk_exit (0); + DBG (DBG_debug, "xcam: xcam_exit: exit\n"); +} + +/* Invoked when window manager's "delete" (or "close") function is + invoked. */ +static gint +xcam_win_delete (GtkWidget * w, gpointer data) +{ + xcam_exit (); + return FALSE; +} + +static void +browse_filename_callback (GtkWidget * widget, gpointer data) +{ + char filename[1024]; + + DBG (DBG_debug, "xcam: browse_filename_callback\n"); + if (preferences.filename) + { + strncpy (filename, preferences.filename, sizeof (filename)); + filename[sizeof (filename) - 1] = '\0'; + } + else + strcpy (filename, OUTFILENAME); + gsg_get_filename ("Output Filename", filename, sizeof (filename), filename); + gtk_entry_set_text (GTK_ENTRY (win.filename_entry), filename); + + if (preferences.filename) + free ((void *) preferences.filename); + preferences.filename = strdup (filename); + DBG (DBG_debug, "xcam: browse_filename_callback: exit\n"); +} + +static void +filename_changed_callback (GtkWidget * widget, gpointer data) +{ + DBG (DBG_debug, "xcam: filename_changed_callback\n"); + if (preferences.filename) + free ((void *) preferences.filename); + preferences.filename = strdup (gtk_entry_get_text (GTK_ENTRY (widget))); + pref_xcam_save (); + DBG (DBG_debug, "xcam: filename_changed_callbackcallback: exit\n"); +} + +static void +usage (void) +{ + printf ("Usage: %s [OPTION]... [DEVICE]\n\ +\n\ +Start up graphical user interface to access SANE (Scanner Access Now\n\ +Easy) devices.\n\ +\n\ +-h, --help display this help message and exit\n\ +-B, --buffersize set buffersize 1024 * 1024\n\ +-V, --version print version information\n", prog_name); +} + +int +main (int argc, char **argv) +{ + GtkWidget *menu, *menu_bar, *menu_bar_item, *preview_vbox; + GtkWidget *hbox, *vbox, *button, *alignment, *frame, *label, *text, + *scrolled_window; + int i; + int ch; + SANE_Status status; + + DBG_INIT (); + + DBG (DBG_debug, "xcam: main\n"); + DBG (DBG_error, "xcam (version: %s, package: %s) starting\n", VERSION, + PACKAGE); + + win.buf_backend_size = (32 * 1024); + + pref_xcam_restore (); + + prog_name = strrchr (argv[0], '/'); + if (prog_name) + ++prog_name; + else + prog_name = argv[0]; + + /* turn on by default as we don't support graphical geometry selection */ + preferences.advanced = 1; + + status = sane_init (0, 0); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "init: sane_main failed: %s\n", + sane_strstatus (status)); + exit (1); + } + + if (argc > 1) + { + + while ((ch = getopt_long (argc, argv, "hBV", long_options, 0)) != EOF) + { + switch (ch) + { + case 'V': + printf ("xcam (%s) %s\n", PACKAGE, VERSION); + exit (0); + + case 'B': + win.buf_backend_size = 1024 * 1024; + break; + case 'h': + default: + usage (); + exit (0); + } + } + } + + DBG (DBG_debug, "xcam.main: buf_backend_size 0x%x\n", win.buf_backend_size); + + win.buf = malloc (win.buf_backend_size); + + gdk_set_show_events (0); + gtk_init (&argc, &argv); + + atexit (xcam_exit); + + win.gdk_input_tag = -1; + win.shell = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (win.shell), (char *) prog_name); + gtk_signal_connect (GTK_OBJECT (win.shell), "delete_event", + GTK_SIGNAL_FUNC (xcam_win_delete), NULL); + + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_border_width (GTK_CONTAINER (vbox), 0); + gtk_container_add (GTK_CONTAINER (win.shell), vbox); + gtk_widget_show (vbox); + + menu_bar = gtk_menu_bar_new (); + + win.devices.menu = build_device_menu (); + + /* "Files" entry: */ + menu_bar_item = gtk_menu_item_new_with_label ("File"); + gtk_container_add (GTK_CONTAINER (menu_bar), menu_bar_item); + menu = build_files_menu (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_bar_item), menu); + gtk_widget_show (menu_bar_item); + + /* "Devices" entry: */ + win.devices.item = gtk_menu_item_new_with_label ("Devices"); + gtk_container_add (GTK_CONTAINER (menu_bar), win.devices.item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (win.devices.item), + win.devices.menu); + gtk_widget_show (win.devices.item); + + /* "Preferences" entry: */ + menu_bar_item = gtk_menu_item_new_with_label ("Preferences"); + gtk_container_add (GTK_CONTAINER (menu_bar), menu_bar_item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_bar_item), + build_preferences_menu (dialog)); + gtk_widget_show (menu_bar_item); + + gtk_box_pack_start (GTK_BOX (vbox), menu_bar, FALSE, FALSE, 0); + gtk_widget_show (menu_bar); + + /* add device info at top: */ + frame = gtk_frame_new (0); + gtk_container_border_width (GTK_CONTAINER (frame), 8); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + win.device_info_label = gtk_label_new (""); + gtk_widget_show (win.device_info_label); + gtk_container_add (GTK_CONTAINER (frame), win.device_info_label); + + hbox = gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_widget_show (hbox); + + /* create the device dialog box: */ + win.dialog_box = gtk_vbox_new (FALSE, 0); + gtk_widget_show (win.dialog_box); + + DBG (DBG_debug, "xcam main, preview vbox on the left hand side \n"); + /* the preview vbox on the left hand side: */ + preview_vbox = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), preview_vbox, TRUE, TRUE, 0); + + frame = gtk_frame_new ("Image view"); + gtk_container_border_width (GTK_CONTAINER (frame), 8); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); + gtk_container_add (GTK_CONTAINER (preview_vbox), frame); + + alignment = gtk_alignment_new (0, 0.5, 1.0, 1.0); + gtk_box_pack_start (GTK_BOX (preview_vbox), alignment, TRUE, TRUE, 0); + + win.canvas.preview = gtk_drawing_area_new (); + gtk_drawing_area_size (GTK_DRAWING_AREA (win.canvas.preview), 320, 200); + gtk_widget_set_events (win.canvas.preview, CANVAS_EVENT_MASK); + gtk_signal_connect (GTK_OBJECT (win.canvas.preview), "event", + (GtkSignalFunc) canvas_events, 0); + gtk_container_add (GTK_CONTAINER (frame), win.canvas.preview); + + gtk_widget_show (win.canvas.preview); + gtk_widget_show (alignment); + gtk_widget_show (frame); + gtk_widget_show (preview_vbox); + + win.canvas.graylevel_cmap = gdk_colormap_get_system (); + for (i = 0; i < NELEMS (win.canvas.graylevel); ++i) + { + GdkColor color; + color.red = color.green = color.blue = + i * 0xffff / (NELEMS (win.canvas.graylevel) - 1); + gdk_color_alloc (win.canvas.graylevel_cmap, &color); + win.canvas.graylevel[i] = color.pixel; + } + +#if 0 + { + win.canvas.cube_cmap + = gdk_colormap_new (win.canvas.preview->window->visual, 1); + for (i = 0; i < NELEMS (win.canvas.cube_colors); ++i) + { + win.canvas.cube_colors[i].pixel = i; + win.canvas.cube_colors[i].red = ((i / 30) % 5) * 0xffff / 4; + win.canvas.cube_colors[i].green = ((i / 5) % 6) * 0xffff / 5; + win.canvas.cube_colors[i].blue = ((i % 5)) * 0xffff / 4; + } + gdk_colors_store (win.canvas.cube_cmap, win.canvas.cube_colors, + NELEMS (win.canvas.cube_colors)); + gdk_window_set_colormap (win.shell->window, win.canvas.cube_cmap); + } +#endif + + DBG (DBG_debug, "xcam main, use a scrolled window \n"); + + /* use a scrolled window to show the device options, as in xscanimage */ + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_CORNER_TOP_RIGHT); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW + (scrolled_window), win.dialog_box); + gtk_container_add (GTK_CONTAINER (hbox), scrolled_window); + + gtk_widget_show (GTK_WIDGET (scrolled_window)); + + if (device[0]) + { + switch_device (device[0]); + load_defaults (1); + } + else + { + DBG (DBG_fatal, + " No vidcams were identified. If you were expecting something\n" + " different, check that the vidcam is plugged in, turned on and\n" + " detected by sane-find-scanner (if appropriate). Please read\n" + " the documentation which came with this software (README, FAQ,\n" + " manpages).\n"); + atexit (xcam_exit); + } + + if (dialog && gsg_dialog_get_device (dialog) + && (sane_get_parameters (gsg_dialog_get_device (dialog), &win.params) + == SANE_STATUS_GOOD)) + { + gtk_widget_set_usize (win.canvas.preview, + win.params.pixels_per_line, win.params.lines); + } + + /* The bottom row */ + + DBG (DBG_debug, "xcam main, button row: info\n"); + + /* The info row */ + hbox = gtk_hbox_new (FALSE, 5); + gtk_container_border_width (GTK_CONTAINER (hbox), 3); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show (hbox); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + hbox = gtk_hbox_new (FALSE, 5); + gtk_container_border_width (GTK_CONTAINER (hbox), 2); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + win.info_label = + gtk_label_new ("0 x 0 0 kByte \n0 f_count \n0 fps 0 fps_av"); + gtk_box_pack_start (GTK_BOX (hbox), win.info_label, FALSE, FALSE, 0); + gtk_widget_show (win.info_label); + + win.f_count = 0; + win.fps = 0; + win.fps_av = 0; + win.i_time = 0; + time (&win.time1); /* first time marker */ + update_param (dialog, 0); + + DBG (DBG_debug, "xcam main, bottom row: rgb-bgr button\n"); + + /* The TXT button */ + button = gtk_button_new_with_label (" TXT "); + win.txt_label = GTK_BIN (button)->child; + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) txt_button, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + DBG (DBG_debug, "xcam main, bottom row: txt button\n"); + + /* The RGB-BGR button */ + button = gtk_button_new_with_label ("RGB"); + win.rgb_bgr_label = GTK_BIN (button)->child; + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) rgb_bgr_button, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + DBG (DBG_debug, "xcam main, bottom row: play button\n"); + + /* The Play button */ + button = gtk_button_new_with_label (" Play "); + win.play_stop_label = GTK_BIN (button)->child; + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) play_stop_button, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + DBG (DBG_debug, "xcam main, bottom row: save frame button\n"); + + /* The Save Frame button */ + button = gtk_button_new_with_label ("Save\nFrame"); + win.save_frame_label = GTK_BIN (button)->child; + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) save_frame_button, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_widget_show (button); + + DBG (DBG_debug, "xcam main, bottom row: output filename part\n"); + + /* output filename part */ + frame = gtk_frame_new ("Output"); + gtk_container_border_width (GTK_CONTAINER (frame), 4); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); + + hbox = gtk_hbox_new (FALSE, 2); + gtk_container_border_width (GTK_CONTAINER (hbox), 2); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + label = gtk_label_new ("Filename"); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + + text = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (text), (char *) preferences.filename); + gtk_box_pack_start (GTK_BOX (hbox), text, TRUE, TRUE, 2); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) filename_changed_callback, 0); + + win.filename_entry = text; + + button = gtk_button_new_with_label ("Browse"); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 2); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) browse_filename_callback, 0); + + gtk_widget_show (button); + gtk_widget_show (label); + gtk_widget_show (text); + gtk_widget_show (hbox); + gtk_widget_show (frame); + + gtk_widget_show (win.shell); + gtk_main (); + + pref_xcam_save (); + + DBG (DBG_debug, "xcam main exit\n"); + return 0; +} diff --git a/src/xscanimage-gimp-1_0-compat.h b/src/xscanimage-gimp-1_0-compat.h new file mode 100644 index 0000000..1647962 --- /dev/null +++ b/src/xscanimage-gimp-1_0-compat.h @@ -0,0 +1,47 @@ +/* xscanimage-gimp-1_0-compat.h -- stay compatible with gimp 1.0 + + 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. + + Copied from xsane (written by Oliver Rauch) +*/ + +#ifndef XSCANIMAGE_GIMP_1_0_COMPAT_H +#define XSCANIMAGE_GIMP_1_0_COMPAT_H + +#define GimpPlugInInfo GPlugInInfo +#define GimpParam GParam +#define GimpParamDef GParamDef +#define GimpDrawable GDrawable +#define GimpPixelRgn GPixelRgn +#define GimpRunModeType GRunModeType +#define GimpImageType GImageType + +#define GIMP_PDB_INT32 PARAM_INT32 +#define GIMP_PDB_STATUS PARAM_STATUS +#define GIMP_PDB_CALLING_ERROR STATUS_CALLING_ERROR +#define GIMP_PDB_SUCCESS STATUS_SUCCESS +#define GIMP_RUN_INTERACTIVE RUN_INTERACTIVE +#define GIMP_RUN_NONINTERACTIVE RUN_NONINTERACTIVE +#define GIMP_RUN_WITH_LAST_VALS RUN_WITH_LAST_VALS +#define GIMP_EXTENSION PROC_EXTENSION +#define GIMP_RGB RGB +#define GIMP_RGB_IMAGE RGB_IMAGE +#define GIMP_GRAY GRAY +#define GIMP_GRAY_IMAGE GRAY_IMAGE +#define GIMP_RGBA_IMAGE RGBA_IMAGE +#define GIMP_NORMAL_MODE NORMAL_MODE + +#endif + diff --git a/src/xscanimage.c b/src/xscanimage.c new file mode 100644 index 0000000..a36324f --- /dev/null +++ b/src/xscanimage.c @@ -0,0 +1,2224 @@ +/* xscanimage -- a graphical scanner-oriented SANE frontend + + Authors: + Andreas Beck <becka@sunserver1.rz.uni-duesseldorf.de> + Tristan Tarrant <ttarrant@etnoteam.it> + David Mosberger-Tang <davidm@azstarnet.com> + + Copyright (C) 1997, 1998 Andreas Beck, Tristan Tarrant, and David + Mosberger + + 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. */ + +#ifdef _AIX +# include "../include/lalloca.h" /* MUST come first for AIX! */ +#endif + +#include "../include/sane/config.h" +#include "../include/lalloca.h" + +#include <errno.h> +#include <fcntl.h> +#include <getopt.h> +#include <gtkglue.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/stat.h> + +#include <sane/sane.h> +#include <sane/saneopts.h> +#include "../include/sane/sanei.h" + +#define BACKEND_NAME xscanimage +#include "../include/sane/sanei_debug.h" + +#include <progress.h> +#include <preferences.h> +#include <preview.h> + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +#define OUTFILENAME "out.pnm" + +#ifdef HAVE_LIBGIMP_GIMP_H + +#include <libgimp/gimp.h> + +# ifdef HAVE_LIBGIMP_GIMPFEATURES_H +# include <libgimp/gimpfeatures.h> +# elif defined(ENABLE_GIMP_1_2) +# define GIMP_CHECK_VERSION(major, minor, micro) 0 +# endif /* HAVE_LIBGIMP_GIMPFEATURES_H */ + +#ifndef ENABLE_GIMP_1_2 +# define GIMP_HAVE_RESOLUTION_INFO +#endif /* !ENABLE_GIMP_1_2 */ + +# ifdef GIMP_CHECK_VERSION +# if GIMP_CHECK_VERSION(1,1,25) +/* ok, we have the new gimp interface */ +# else +/* we have the old gimp interface and need the compatibility header file */ +# include "xscanimage-gimp-1_0-compat.h" +# endif +# else +# ifdef ENABLE_GIMP_1_2 +/* we have the old gimp interface and need the compatibility header file */ +# include "xscanimage-gimp-1_0-compat.h" +# endif /* ENABLE_GIMP_1_2 */ +# endif + +static void query (void); +#ifndef ENABLE_GIMP_1_2 +static void run (const gchar * name, gint nparams, const GimpParam * param, + gint * nreturn_vals, GimpParam ** return_vals); +#else +static void run (char *name, int nparams, GimpParam * param, + int *nreturn_vals, GimpParam ** return_vals); +#endif /* !ENABLE_GIMP_1_2 */ + +GimpPlugInInfo PLUG_IN_INFO = { + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + +#endif /* HAVE_LIBGIMP_GIMP_H */ + +#define DBG_fatal 0 +#define DBG_error 1 +#define DBG_warning 2 +#define DBG_info 3 +#define DBG_debug 4 + +enum +{ + STANDALONE, SANE_GIMP_EXTENSION +}; + +static struct +{ + GtkWidget *shell; + GtkWidget *menubar; + GtkWidget *hruler; + GtkWidget *vruler; + GtkWidget *info_label; + GtkWidget *preview_button; + GtkWidget *scan_button; + Preview *preview; + gint32 mode; + /* various scanning related state: */ + size_t num_bytes; + size_t bytes_read; + Progress_t *progress; + int input_tag; + SANE_Parameters param; + int x, y; + /* for standalone mode: */ + GtkWidget *filename_entry; + FILE *out; + long header_size; + gboolean have_odd_byte; + guint8 odd_byte; +#ifdef HAVE_LIBGIMP_GIMP_H + /* for GIMP mode: */ + gint32 image_ID; + GimpDrawable *drawable; + guchar *tile; + unsigned tile_offset; + GimpPixelRgn region; + int first_frame; /* used for RED/GREEN/BLUE frames */ +#endif +} +scan_win; + +static const char *prog_name; +static GtkWidget *choose_device_dialog; +static GSGDialog *dialog; +static const SANE_Device **devlist; +static gint seldev = -1; /* The selected device */ +static gint defdev = -1; /* The default device */ +static gint ndevs; /* The number of available devices */ +static gboolean little_endian; /* Is this computer little-endian ? */ +static struct option long_options[] = { + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, + {0, 0, 0, 0} +}; + + +static int gtk_quit_flag; /* Call gtk_main_quit() only if at least one device + device is found. */ + +/* forward declarations: */ + +int main (int argc, char **argv); +static void interface (int argc, char **argv); +static void scan_start (void); +static void scan_done (void); + +/* Test if this machine is little endian (from coolscan.c) */ +static gboolean +calc_little_endian (void) +{ + SANE_Int testvalue = 255; + u_int8_t *firstbyte = (u_int8_t *) & testvalue; + + if (*firstbyte == 255) + return TRUE; + return FALSE; +} + +#ifdef HAVE_LIBGIMP_GIMP_H + +static int +encode_devname (const char *devname, int n, char *buf) +{ + static const char hexdigit[] = "0123456789abcdef"; + char *dst, *limit; + const char *src; + char ch; + + DBG_INIT (); + + DBG (DBG_debug, "encode_devname\n"); + limit = buf + n; + for (src = devname, dst = buf; *src; ++src) + { + if (dst >= limit) + return -1; + + ch = *src; + /* don't use the ctype.h macros here since we don't want to + allow anything non-ASCII here... */ + if ((ch >= '0' && ch <= '9') + || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) + *dst++ = ch; + else + { + /* encode */ + + if (dst + 4 >= limit) + return -1; + + *dst++ = '-'; + if (ch == '-') + *dst++ = '-'; + else + { + *dst++ = hexdigit[(ch >> 4) & 0x0f]; + *dst++ = hexdigit[(ch >> 0) & 0x0f]; + *dst++ = '-'; + } + } + } + if (dst >= limit) + return -1; + *dst = '\0'; + DBG (DBG_debug, "encode_devname: %s --> %s\n", devname, buf); + + return 0; +} + +static int +decode_devname (const char *encoded_devname, int n, char *buf) +{ + char *dst, *limit; + const char *src; + char ch, val; + + DBG_INIT (); + + DBG (DBG_debug, "decode_devname\n"); + limit = buf + n; + for (src = encoded_devname, dst = buf; *src; ++dst) + { + if (dst >= limit) + return -1; + + ch = *src++; + /* don't use the ctype.h macros here since we don't want to + allow anything non-ASCII here... */ + if (ch != '-') + *dst = ch; + else + { + /* decode */ + + ch = *src++; + if (ch == '-') + *dst = ch; + else + { + if (ch >= 'a' && ch <= 'f') + val = (ch - 'a') + 10; + else + val = (ch - '0'); + val <<= 4; + + ch = *src++; + if (ch >= 'a' && ch <= 'f') + val |= (ch - 'a') + 10; + else + val |= (ch - '0'); + + *dst = val; + + ++src; /* simply skip terminating '-' for now... */ + } + } + } + if (dst >= limit) + return -1; + *dst = '\0'; + DBG (DBG_debug, "deccode_devname: %s -> %s\n", encoded_devname, buf); + return 0; +} + +static void +query (void) +{ + static GimpParamDef args[] = { + {GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive"}, + }; + static GimpParamDef *return_vals = NULL; + static int nargs = sizeof (args) / sizeof (args[0]); + static int nreturn_vals = 0; + char mpath[1024]; + char name[1024]; + size_t len; + int i, j; + SANE_Status status; + + DBG_INIT (); + + DBG (DBG_debug, "query\n"); + gimp_install_procedure ("xscanimage", + "Front-end to the SANE interface", + "This function provides access to scanners and other image acquisition " + "devices through the SANE (Scanner Access Now Easy) interface.", + "Andy Beck, Tristan Tarrant, and David Mosberger", + "Andy Beck, Tristan Tarrant, and David Mosberger", + "8th June 1997", + "<Toolbox>/File/Acquire/xscanimage/Device dialog...", + "RGB, GRAY", + GIMP_EXTENSION, + nargs, nreturn_vals, args, return_vals); + + status = sane_init (0, 0); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "query: sane_init failed: %s\n", + sane_strstatus (status)); + exit (1); + } + + status = sane_get_devices (&devlist, SANE_FALSE); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "query: sane_get_devices failed: %s\n", + sane_strstatus (status)); + exit (1); + } + + for (i = 0; devlist[i]; ++i) + { + strcpy (name, "xscanimage-"); + if (encode_devname (devlist[i]->name, sizeof (name) - 11, name + 11) < + 0) + continue; /* name too long... */ + + strncpy (mpath, "<Toolbox>/File/Acquire/xscanimage/", sizeof (mpath)); + len = strlen (mpath); + for (j = 0; devlist[i]->name[j]; ++j) + { + if (devlist[i]->name[j] == '/') + mpath[len++] = '\''; + else + mpath[len++] = devlist[i]->name[j]; + } + mpath[len++] = '\0'; + + gimp_install_procedure + (name, "Front-end to the SANE interface", + "This function provides access to scanners and other image " + "acquisition devices through the SANE (Scanner Access Now Easy) " + "interface.", + "Andy Beck, Tristan Tarrant, and David Mosberger", + "Andy Beck, Tristan Tarrant, and David Mosberger", + "8th June 1997", mpath, "RGB, GRAY", GIMP_EXTENSION, + nargs, nreturn_vals, args, return_vals); + } + sane_exit (); + DBG (DBG_debug, "query: finished\n"); +} + +#ifndef ENABLE_GIMP_1_2 +static void +run (const gchar * name, gint nparams, const GimpParam * param, + gint * nreturn_vals, GimpParam ** return_vals) +#else +static void +run (char *name, int nparams, GimpParam * param, + int *nreturn_vals, GimpParam ** return_vals) +#endif /* !ENABLE_GIMP_1_2 */ +{ + static GimpParam values[2]; +#ifndef ENABLE_GIMP_1_2 + GimpRunMode run_mode; +#else + GimpRunModeType run_mode; +#endif /* !ENABLE_GIMP_1_2 */ + char devname[1024]; + char *args[2]; + int nargs; + + DBG (DBG_debug, "run\n"); + run_mode = param[0].data.d_int32; + scan_win.mode = SANE_GIMP_EXTENSION; + + *nreturn_vals = 1; + *return_vals = values; + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + + nargs = 0; + args[nargs++] = "xscanimage"; + + seldev = -1; + if (strncmp (name, "xscanimage-", 11) == 0) + { + if (decode_devname (name + 11, sizeof (devname), devname) < 0) + return; /* name too long */ + args[nargs++] = devname; + } + + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: +#ifndef ENABLE_GIMP_1_2 + gimp_extension_ack (); +#endif /* !ENABLE_GIMP_1_2 */ + interface (nargs, args); + values[0].data.d_status = GIMP_PDB_SUCCESS; + break; + + case GIMP_RUN_NONINTERACTIVE: + /* Make sure all the arguments are there! */ + break; + + case GIMP_RUN_WITH_LAST_VALS: + /* Possibly retrieve data */ + break; + + default: + break; + } + DBG (DBG_debug, "run: finished\n"); +} + +static void +null_print_func (const gchar * msg) +{ +} + +#endif /* HAVE_LIBGIMP_GIMP_H */ + +static SANE_Word +get_resolution (SANE_Handle dev) +{ + SANE_Status status; + SANE_Word resolution; + SANE_Int num_options, i; + const SANE_Option_Descriptor *option_desc; + + DBG (DBG_debug, "get_resolution\n"); + status = + sane_control_option (dev, 0, SANE_ACTION_GET_VALUE, &num_options, 0); + if (status != SANE_STATUS_GOOD) + return 0; + + for (i = 1; i < num_options; i++) + { + option_desc = sane_get_option_descriptor (dev, i); + if (option_desc) + if (option_desc->name) + { + if (strncmp (option_desc->name, SANE_NAME_SCAN_RESOLUTION, + sizeof (SANE_NAME_SCAN_RESOLUTION)) == 0) + { + status = sane_control_option (dev, i, SANE_ACTION_GET_VALUE, + &resolution, 0); + if (status == SANE_STATUS_GOOD) + { + if (option_desc->type == SANE_TYPE_INT) + return resolution; + else if (option_desc->type == SANE_TYPE_FIXED) + return (SANE_Word) SANE_UNFIX (resolution); + } + return 0; + } + } + } + DBG (DBG_debug, "get_resolution: finished\n"); + return 0; +} + +static void +update_preview (GSGDialog * dialog, void *arg) +{ + if (scan_win.preview) + preview_update (scan_win.preview); +} + +/* Update the info line with the latest size information. */ +static void +update_param (GSGDialog * dialog, void *arg) +{ + SANE_Parameters params; + gchar buf[200]; + + DBG (DBG_debug, "update_param\n"); + if (!scan_win.info_label) + return; + + if (sane_get_parameters (gsg_dialog_get_device (dialog), ¶ms) + == SANE_STATUS_GOOD) + { + double size = (double) params.bytes_per_line * (double) params.lines; + const char *unit = "B"; + + if (params.lines == -1) + { + snprintf (buf, sizeof (buf), "%dxunknown: unknown size", + params.pixels_per_line); + } + else + { + if (params.format >= SANE_FRAME_RED + && params.format <= SANE_FRAME_BLUE) + size *= 3; + + if (size >= 1024 * 1024) + { + size /= 1024 * 1024; + unit = "MB"; + } + else if (size >= 1024) + { + size /= 1024; + unit = "KB"; + } + snprintf (buf, sizeof (buf), "%dx%d: %1.1f %s", + params.pixels_per_line, params.lines, size, unit); + } + } + else + snprintf (buf, sizeof (buf), "Invalid parameters."); + gtk_label_set (GTK_LABEL (scan_win.info_label), buf); + + if (scan_win.preview) + preview_update (scan_win.preview); + DBG (DBG_debug, "update_param: finished\n"); +} + +static void +pref_xscanimage_save (void) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "pref_xscanimage_save\n"); + /* first save xscanimage-specific preferences: */ + gsg_make_path (sizeof (filename), filename, "xscanimage", "xscanimage", + 0, ".rc"); + fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd < 0) + { + char buf[256]; + + snprintf (buf, sizeof (buf), "Failed to create file: %s.", + strerror (errno)); + gsg_error (buf); + return; + } + preferences_save (fd); + close (fd); + DBG (DBG_debug, "pref_xscanimage_save: finished\n"); +} + +static void +pref_xscanimage_restore (void) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "pref_xscanimage_restore\n"); + gsg_make_path (sizeof (filename), filename, "xscanimage", "xscanimage", + 0, ".rc"); + fd = open (filename, O_RDONLY); + if (fd >= 0) + { + preferences_restore (fd); + close (fd); + } + if (!preferences.filename) + preferences.filename = strdup (OUTFILENAME); + DBG (DBG_debug, "pref_xscanimage_restore: finished\n"); +} + +static void +quit_xscanimage (void) +{ + DBG (DBG_debug, "quit_xscanimage\n"); + if (scan_win.preview) + { + Preview *preview = scan_win.preview; + scan_win.preview = 0; + preview_destroy (preview); + } + while (gsg_message_dialog_active) + { + if (!gtk_events_pending ()) + usleep (100000); + gtk_main_iteration (); + } + pref_xscanimage_save (); + if (dialog && gsg_dialog_get_device (dialog)) + sane_close (gsg_dialog_get_device (dialog)); + sane_exit (); + if (gtk_quit_flag == 1) + gtk_main_quit (); +#ifdef HAVE_LIBGIMP_GIMP_H + if (scan_win.mode == SANE_GIMP_EXTENSION) + gimp_quit (); +#endif + DBG (DBG_debug, "quit_xscanimage: exiting\n"); + exit (0); +} + +/* Invoked when window manager's "delete" (or "close") function is + invoked. */ +static gint +scan_win_delete (GtkWidget * w, gpointer data) +{ + quit_xscanimage (); + return FALSE; +} + +static void +preview_window_destroyed (GtkWidget * widget, gpointer call_data) +{ + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (call_data), FALSE); +} + +/* Invoked when the preview button is pressed. */ + +static void +scan_preview (GtkWidget * widget, gpointer call_data) +{ + DBG (DBG_debug, "scan_preview\n"); + + if (GTK_TOGGLE_BUTTON (widget)->active) + { + if (!scan_win.preview) + { + scan_win.preview = preview_new (dialog); + if (scan_win.preview && scan_win.preview->top) + gtk_signal_connect (GTK_OBJECT (scan_win.preview->top), + "destroy", + GTK_SIGNAL_FUNC (preview_window_destroyed), + widget); + else + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (widget), FALSE); + if (scan_win.progress) + gtk_widget_set_sensitive (scan_win.preview->preview, FALSE); + } + } + else if (scan_win.preview) + { + preview_destroy (scan_win.preview); + scan_win.preview = 0; + } + DBG (DBG_debug, "scan_preview: finished\n"); +} + +#ifdef HAVE_LIBGIMP_GIMP_H +static void +advance (void) +{ + DBG (DBG_debug, "advance\n"); + + if (++scan_win.x >= scan_win.param.pixels_per_line) + { + int tile_height = gimp_tile_height (); + + scan_win.x = 0; + ++scan_win.y; + if (scan_win.y % tile_height == 0) + { + gimp_pixel_rgn_set_rect (&scan_win.region, scan_win.tile, + 0, scan_win.y - tile_height, + scan_win.param.pixels_per_line, + tile_height); + if (scan_win.param.format >= SANE_FRAME_RED + && scan_win.param.format <= SANE_FRAME_BLUE) + { + int height; + + scan_win.tile_offset %= 3; + if (!scan_win.first_frame) + { + /* get the data for the existing tile: */ + height = tile_height; + if (scan_win.y + height >= scan_win.param.lines) + height = scan_win.param.lines - scan_win.y; + gimp_pixel_rgn_get_rect (&scan_win.region, scan_win.tile, + 0, scan_win.y, + scan_win.param.pixels_per_line, + height); + } + } + else + scan_win.tile_offset = 0; + } + } + DBG (DBG_debug, "advance: finished\n"); +} + +#endif /* HAVE_LIBGIMP_GIMP_H */ + +static void +write_swapped_words (FILE * f, char *buf, guint len) +{ + char tmp_buf[2]; + char tmp; + unsigned int i; + + DBG (DBG_debug, "write_swapped_words\n"); + if (!len) + return; + if (scan_win.have_odd_byte) + { + tmp_buf[0] = *buf++; + tmp_buf[1] = scan_win.odd_byte; + fwrite (tmp_buf, 1, 2, f); + --len; + scan_win.have_odd_byte = FALSE; + } + if (len) + { + for (i = 1; i < len; i += 2) + { + tmp = buf[i]; + buf[i] = buf[i - 1]; + buf[i - 1] = tmp; + } + fwrite (buf, 1, len & ~1, f); + if (len & 1) + { + scan_win.have_odd_byte = TRUE; + scan_win.odd_byte = buf[len - 1]; + } + } + DBG (DBG_debug, "write_swapped_words: finished\n"); +} + +static void +input_available (gpointer data, gint source, GdkInputCondition cond) +{ + SANE_Handle dev = gsg_dialog_get_device (dialog); + static char buf[32768]; + SANE_Status status; + SANE_Int len; + int i; + + DBG (DBG_debug, "input_available\n"); + while (1) + { + status = sane_read (dev, (unsigned char *) buf, sizeof (buf), &len); + if (status != SANE_STATUS_GOOD) + { + if (status == SANE_STATUS_EOF) + { + if (!scan_win.param.last_frame) + { + if (scan_win.input_tag < 0) + { + while (gtk_events_pending ()) + gtk_main_iteration (); + } + else + { + gdk_input_remove (scan_win.input_tag); + scan_win.input_tag = -1; + } + scan_start (); + break; + } + } + else + { + snprintf (buf, sizeof (buf), "Error during read: %s.", + sane_strstatus (status)); + gsg_error (buf); + } + scan_done (); + return; + } + if (!len) /* out of data for now */ + { + if (scan_win.input_tag < 0) + { + while (gtk_events_pending ()) + gtk_main_iteration (); + continue; + } + else + break; + } + + scan_win.bytes_read += len; + progress_update (scan_win.progress, + scan_win.bytes_read / (gfloat) scan_win.num_bytes); + if (scan_win.input_tag < 0) + while (gtk_events_pending ()) + gtk_main_iteration (); + + switch (scan_win.param.format) + { + case SANE_FRAME_GRAY: + if (scan_win.mode == STANDALONE) + { + if (scan_win.param.depth > 8 && little_endian) + write_swapped_words (scan_win.out, buf, len); + else + fwrite (buf, 1, len, scan_win.out); + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + switch (scan_win.param.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf[i]; + for (j = 7; j >= 0; --j) + { + u_char gl = (mask & (1 << j)) ? 0x00 : 0xff; + scan_win.tile[scan_win.tile_offset++] = gl; + advance (); + if (scan_win.x == 0) + break; + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + scan_win.tile[scan_win.tile_offset++] = buf[i]; + advance (); + } + break; + + default: + goto bad_depth; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + + case SANE_FRAME_RGB: + if (scan_win.mode == STANDALONE) + { + if (scan_win.param.depth > 8 && little_endian) + write_swapped_words (scan_win.out, buf, len); + else + fwrite (buf, 1, len, scan_win.out); + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + switch (scan_win.param.depth) + { + case 1: + if (scan_win.param.format == SANE_FRAME_RGB) + goto bad_depth; + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf[i]; + for (j = 0; j < 8; ++j) + { + u_char gl = (mask & 1) ? 0xff : 0x00; + mask >>= 1; + scan_win.tile[scan_win.tile_offset++] = gl; + advance (); + if (scan_win.x == 0) + break; + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + scan_win.tile[scan_win.tile_offset++] = buf[i]; + if (scan_win.tile_offset % 3 == 0) + advance (); + } + break; + + default: + goto bad_depth; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + if (scan_win.mode == STANDALONE) + for (i = 0; i < len; ++i) + { + fwrite (buf + i, 1, 1, scan_win.out); + fseek (scan_win.out, 2, SEEK_CUR); + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + switch (scan_win.param.depth) + { + case 1: + for (i = 0; i < len; ++i) + { + u_char mask; + int j; + + mask = buf[i]; + for (j = 0; j < 8; ++j) + { + u_char gl = (mask & 1) ? 0xff : 0x00; + mask >>= 1; + scan_win.tile[scan_win.tile_offset] = gl; + scan_win.tile_offset += 3; + advance (); + if (scan_win.x == 0) + break; + } + } + break; + + case 8: + for (i = 0; i < len; ++i) + { + scan_win.tile[scan_win.tile_offset] = buf[i]; + scan_win.tile_offset += 3; + advance (); + } + break; + } + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + break; + + default: + fprintf (stderr, "%s.input_available: bad frame format %d\n", + prog_name, scan_win.param.format); + scan_done (); + return; + } + } + DBG (DBG_debug, "input_available: finished\n"); + return; + +#ifdef HAVE_LIBGIMP_GIMP_H +bad_depth: + snprintf (buf, sizeof (buf), "Cannot handle depth %d.", + scan_win.param.depth); + gsg_error (buf); + scan_done (); + return; +#endif +} + +static void +scan_done (void) +{ + DBG (DBG_debug, "scan_done\n"); + gsg_set_sensitivity (dialog, TRUE); + if (scan_win.preview) + gtk_widget_set_sensitive (scan_win.preview->preview, TRUE); + gtk_widget_set_sensitive (scan_win.scan_button, TRUE); + gtk_widget_set_sensitive (scan_win.menubar, TRUE); + + if (scan_win.input_tag >= 0) + { + gdk_input_remove (scan_win.input_tag); + scan_win.input_tag = -1; + } + + sane_cancel (gsg_dialog_get_device (dialog)); + + if (!scan_win.progress) + return; + + progress_free (scan_win.progress); + scan_win.progress = 0; + scan_win.header_size = 0; + + if (scan_win.mode == STANDALONE) + { + fclose (scan_win.out); + scan_win.out = 0; + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + int remaining; + + /* GIMP mode */ + if (scan_win.y > scan_win.param.lines) + scan_win.y = scan_win.param.lines; + + remaining = scan_win.y % gimp_tile_height (); + if (remaining) + gimp_pixel_rgn_set_rect (&scan_win.region, scan_win.tile, + 0, scan_win.y - remaining, + scan_win.param.pixels_per_line, remaining); + gimp_drawable_flush (scan_win.drawable); + gimp_display_new (scan_win.image_ID); + gimp_drawable_detach (scan_win.drawable); + g_free (scan_win.tile); + scan_win.tile = 0; + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + DBG (DBG_debug, "scan_done: finished\n"); +} + +static void +progress_cancel (void) +{ + DBG (DBG_debug, "progress_cancel\n"); + sane_cancel (gsg_dialog_get_device (dialog)); + DBG (DBG_debug, "progress_cancel: done\n"); +} + +static void +scan_start (void) +{ + SANE_Status status; + SANE_Handle dev = gsg_dialog_get_device (dialog); + +#ifdef HAVE_LIBGIMP_GIMP_H + SANE_Word resolution; +#endif /* HAVE_LIBGIMP_GIMP_H */ + + const char *frame_type = 0; + char buf[256]; + int fd; + + DBG (DBG_debug, "scan_start\n"); + + gsg_set_sensitivity (dialog, FALSE); + if (scan_win.preview) + gtk_widget_set_sensitive (scan_win.preview->preview, FALSE); + gtk_widget_set_sensitive (scan_win.scan_button, FALSE); + gtk_widget_set_sensitive (scan_win.menubar, FALSE); + +#ifdef HAVE_LIBGIMP_GIMP_H + if (scan_win.mode == SANE_GIMP_EXTENSION && scan_win.tile) + { + int height, remaining; + + /* write the last tile of the frame to the GIMP region: */ + + if (scan_win.y > scan_win.param.lines) /* sanity check */ + scan_win.y = scan_win.param.lines; + + remaining = scan_win.y % gimp_tile_height (); + if (remaining) + gimp_pixel_rgn_set_rect (&scan_win.region, scan_win.tile, + 0, scan_win.y - remaining, + scan_win.param.pixels_per_line, remaining); + + /* initialize the tile with the first tile of the GIMP region: */ + + height = gimp_tile_height (); + if (height >= scan_win.param.lines) + height = scan_win.param.lines; + gimp_pixel_rgn_get_rect (&scan_win.region, scan_win.tile, + 0, 0, scan_win.param.pixels_per_line, height); + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + +#ifdef GIMP_HAVE_RESOLUTION_INFO + resolution = get_resolution (dev); +#endif + + scan_win.x = scan_win.y = 0; + + while (gtk_events_pending ()) + gtk_main_iteration (); + status = sane_start (dev); + if (status != SANE_STATUS_GOOD) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), "Failed to start scanner: %s", + sane_strstatus (status)); + gsg_error (buf); + return; + } + + status = sane_get_parameters (dev, &scan_win.param); + if (status != SANE_STATUS_GOOD) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), "Failed to get parameters: %s", + sane_strstatus (status)); + gsg_error (buf); + scan_done (); + return; + } + + if (scan_win.param.lines == -1) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), "Hand-Scanner mode not supported"); + gsg_error (buf); + scan_done (); + return; + } + + scan_win.num_bytes = scan_win.param.lines * scan_win.param.bytes_per_line; + scan_win.bytes_read = 0; + scan_win.have_odd_byte = FALSE; + + switch (scan_win.param.format) + { + case SANE_FRAME_RGB: + frame_type = "RGB"; + break; + case SANE_FRAME_RED: + frame_type = "red"; + break; + case SANE_FRAME_GREEN: + frame_type = "green"; + break; + case SANE_FRAME_BLUE: + frame_type = "blue"; + break; + case SANE_FRAME_GRAY: + frame_type = "gray"; + break; + } + + if (scan_win.mode == STANDALONE) + { /* We are running in standalone mode */ + if (!scan_win.header_size) + { + switch (scan_win.param.format) + { + case SANE_FRAME_RED: + case SANE_FRAME_GREEN: + case SANE_FRAME_BLUE: + if (scan_win.param.depth > 8) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), + "Separate channel transfers are not supported " + "with %d bits/channel.", scan_win.param.depth); + gsg_error (buf); + scan_done (); + return; + } + /*FALLTHROUGH*/ case SANE_FRAME_RGB: + fprintf (scan_win.out, "P6\n# SANE data follows\n%d %d\n%d\n", + scan_win.param.pixels_per_line, scan_win.param.lines, + (scan_win.param.depth <= 8) ? 255 : 65535); + break; + + case SANE_FRAME_GRAY: + if (scan_win.param.depth == 1) + fprintf (scan_win.out, "P4\n# SANE data follows\n%d %d\n", + scan_win.param.pixels_per_line, + scan_win.param.lines); + else + fprintf (scan_win.out, "P5\n# SANE data follows\n%d %d\n%d\n", + scan_win.param.pixels_per_line, scan_win.param.lines, + (scan_win.param.depth <= 8) ? 255 : 65535); + break; + } + scan_win.header_size = ftell (scan_win.out); + } + if (scan_win.param.format >= SANE_FRAME_RED + && scan_win.param.format <= SANE_FRAME_BLUE) + fseek (scan_win.out, + scan_win.header_size + scan_win.param.format - SANE_FRAME_RED, + SEEK_SET); + snprintf (buf, sizeof (buf), "Receiving %s data for `%s'...", + frame_type, preferences.filename); + } +#ifdef HAVE_LIBGIMP_GIMP_H + else + { + size_t tile_size; + + /* We are running under the GIMP */ + /* Check whether the selected bit depth is supported by the Gimp */ + if (scan_win.param.depth > 8) + { + gsg_set_sensitivity (dialog, TRUE); + snprintf (buf, sizeof (buf), "The Gimp doesn't support images " + "with %d bits/channel.", scan_win.param.depth); + gsg_error (buf); + return; + } + + scan_win.tile_offset = 0; + tile_size = scan_win.param.pixels_per_line * gimp_tile_height (); + if (scan_win.param.format != SANE_FRAME_GRAY) + tile_size *= 3; /* 24 bits/pixel */ + if (scan_win.tile) + scan_win.first_frame = 0; + else + { + GimpImageType image_type = GIMP_RGB; + GimpImageType drawable_type = GIMP_RGB_IMAGE; + gint32 layer_ID; + + if (scan_win.param.format == SANE_FRAME_GRAY) + { + image_type = GIMP_GRAY; + drawable_type = GIMP_GRAY_IMAGE; + } + + scan_win.image_ID = gimp_image_new (scan_win.param.pixels_per_line, + scan_win.param.lines, + image_type); + +/* the following is supported since gimp-1.1.0 */ +#ifdef GIMP_HAVE_RESOLUTION_INFO + if (resolution > 0) + gimp_image_set_resolution (scan_win.image_ID, resolution, + resolution); +#endif + + layer_ID = gimp_layer_new (scan_win.image_ID, "Background", + scan_win.param.pixels_per_line, + scan_win.param.lines, + drawable_type, 100, GIMP_NORMAL_MODE); + gimp_image_add_layer (scan_win.image_ID, layer_ID, 0); + + scan_win.drawable = gimp_drawable_get (layer_ID); + gimp_pixel_rgn_init (&scan_win.region, scan_win.drawable, 0, 0, + scan_win.drawable->width, + scan_win.drawable->height, TRUE, FALSE); + scan_win.tile = g_new (guchar, tile_size); + scan_win.first_frame = 1; + } + if (scan_win.param.format >= SANE_FRAME_RED + && scan_win.param.format <= SANE_FRAME_BLUE) + scan_win.tile_offset = scan_win.param.format - SANE_FRAME_RED; + snprintf (buf, sizeof (buf), "Receiving %s data for GIMP...", + frame_type); + } +#endif /* HAVE_LIBGIMP_GIMP_H */ + if (scan_win.progress) + progress_free (scan_win.progress); + scan_win.progress = progress_new ("Scanning", buf, + (GtkSignalFunc) progress_cancel, 0); + + scan_win.input_tag = -1; + if (sane_set_io_mode (dev, SANE_TRUE) == SANE_STATUS_GOOD + && sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD) + scan_win.input_tag = + gdk_input_add (fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + input_available, 0); + else + { + while (gtk_events_pending ()) + gtk_main_iteration (); + input_available (0, -1, GDK_INPUT_READ); + } + DBG (DBG_debug, "scan_start: finished\n"); +} + +/* Invoked when the scan button is pressed */ +static void +scan_dialog (GtkWidget * widget, gpointer call_data) +{ + char buf[256]; + char testfilename[256]; + + DBG (DBG_debug, "scan_dialog\n"); + if (scan_win.mode == STANDALONE) + { /* We are running in standalone mode */ + /* test for pnm formats */ + strncpy (testfilename, preferences.filename, sizeof (testfilename)); + testfilename[sizeof (testfilename)] = 0; + g_strreverse (testfilename); + if (!((!strncmp (testfilename, "mnp.", 4)) || + (!strncmp (testfilename, "mgp.", 4)) || + (!strncmp (testfilename, "mbp.", 4)) || + (!strncmp (testfilename, "mpp.", 4)) || + (!strncmp (testfilename, "MNP.", 4)) || + (!strncmp (testfilename, "MGP.", 4)) || + (!strncmp (testfilename, "MBP.", 4)) || + (!strncmp (testfilename, "MPP.", 4)))) + { + snprintf (buf, sizeof (buf), + "Failed to scan, wrong file extension, use pnm, pgm, pbm or ppm `%s'", + preferences.filename); + gsg_error (buf); + return; + } + scan_win.out = fopen (preferences.filename, "w"); + if (!scan_win.out) + { + snprintf (buf, sizeof (buf), "Failed to open `%s': %s", + preferences.filename, strerror (errno)); + gsg_error (buf); + return; + } + } + gsg_sync (dialog); + scan_start (); + DBG (DBG_debug, "scan_dialog: finished\n"); +} + +#if 0 + +static void +zoom_in_preview (GtkWidget * widget, gpointer data) +{ + if (Selection.x1 >= Selection.x2 + || Selection.y1 >= Selection.y2 || !Selection.active) + return; + + Selection.active = FALSE; + draw_selection (TRUE); + + gtk_ruler_set_range (GTK_RULER (scan_win.hruler), Selection.x1, + Selection.x2, 0, 20); + gtk_ruler_set_range (GTK_RULER (scan_win.vruler), Selection.y1, + Selection.y2, 0, 20); +} + +static void +zoom_out_preview (GtkWidget * widget, gpointer data) +{ + gtk_ruler_set_range (GTK_RULER (scan_win.hruler), 0, + Preview.PhysWidth, 0, 20); + gtk_ruler_set_range (GTK_RULER (scan_win.vruler), 0, + Preview.PhysHeight, 0, 20); +} + +#endif /* 0 */ + +static void +files_exit_callback (GtkWidget * widget, gpointer data) +{ + quit_xscanimage (); +} + +static GtkWidget * +files_build_menu (void) +{ + GtkWidget *menu, *item; + + DBG (DBG_debug, "files_build_menu\n"); + menu = gtk_menu_new (); + + item = gtk_menu_item_new (); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Exit"); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) files_exit_callback, 0); + gtk_widget_show (item); + + DBG (DBG_debug, "files_build_menu: finished\n"); + return menu; +} + +static void +pref_set_unit_callback (GtkWidget * widget, gpointer data) +{ + const char *unit = data; + double unit_conversion_factor = 1.0; + + DBG (DBG_debug, "pref_set_unit_callback\n"); + + if (strcmp (unit, "cm") == 0) + unit_conversion_factor = 10.0; + else if (strcmp (unit, "in") == 0) + unit_conversion_factor = 25.4; + + preferences.length_unit = unit_conversion_factor; + + gsg_refresh_dialog (dialog); + if (scan_win.preview) + preview_update (scan_win.preview); + + pref_xscanimage_save (); + DBG (DBG_debug, "pref_set_unit_callback: finished\n"); +} + +static void +update_int_callback (GtkWidget * widget, gpointer data) +{ + int *valuep = data; + + *valuep = (GTK_TOGGLE_BUTTON (widget)->active != 0); +} + +static void +update_double_callback (GtkWidget * widget, gpointer data) +{ + double *valuep = data; + const char *start; + char *end; + double v; + + start = gtk_entry_get_text (GTK_ENTRY (widget)); + if (!start) + return; + + v = strtod (start, &end); + if (end > start) + *valuep = v; +} + +static void +preview_options_ok_callback (GtkWidget * widget, gpointer data) +{ + GtkWidget *dialog = data; + char buf[1024]; + + DBG (DBG_debug, "preview_options_ok_callback\n"); + + /* gamma min, max test */ + if (preferences.preview_gamma < 0.0 || preferences.preview_gamma > 255.0) + { + snprintf (buf, sizeof (buf), + "Gamma value %g is < 0 or > 255, please change!", + preferences.preview_gamma); + gsg_warning (buf); + return; + } + + + gtk_widget_destroy (dialog); + pref_xscanimage_save (); + + + snprintf (buf, sizeof (buf), + "It is necessary to restart %s for the changes to take effect.", + prog_name); + gsg_warning (buf); + DBG (DBG_debug, "preview_options_ok_callback: finished\n"); +} + +static void +preview_options_cancel_callback (GtkWidget * widget, gpointer data) +{ + GtkWidget *dialog = data; + + gtk_widget_destroy (dialog); +} + +static void +preview_options_dialog (GtkWidget * widget, gpointer data) +{ + GtkWidget *dialog, *vbox, *hbox, *button, *label, *text; + char buf[64]; + + DBG (DBG_debug, "preview_options_dialog\n"); + dialog = gtk_dialog_new (); + sprintf (buf, "%s preview options", prog_name); + gtk_window_set_title (GTK_WINDOW (dialog), buf); + + vbox = GTK_DIALOG (dialog)->vbox; + + /* preserve preview image: */ + + hbox = gtk_hbox_new ( /* homogeneous */ FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2); + button = gtk_check_button_new_with_label ("Preserve preview image"); + gtk_signal_connect (GTK_OBJECT (button), "toggled", + (GtkSignalFunc) update_int_callback, + &preferences.preserve_preview); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), + preferences.preserve_preview); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 2); + + gtk_widget_show (button); + gtk_widget_show (hbox); + + /* private colormap: */ + + hbox = gtk_hbox_new ( /* homogeneous */ FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2); + button = gtk_check_button_new_with_label ("Use private colormap"); + gtk_signal_connect (GTK_OBJECT (button), "toggled", + (GtkSignalFunc) update_int_callback, + &preferences.preview_own_cmap); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), + preferences.preview_own_cmap); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 2); + + gtk_widget_show (button); + gtk_widget_show (hbox); + + /* gamma correction value: */ + + hbox = gtk_hbox_new ( /* homogeneous */ FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2); + gtk_widget_show (hbox); + + label = gtk_label_new ("Gamma correction value"); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + gtk_widget_show (label); + + sprintf (buf, "%g", preferences.preview_gamma); + text = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (text), buf); + gtk_box_pack_start (GTK_BOX (hbox), text, TRUE, TRUE, 2); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) update_double_callback, + &preferences.preview_gamma); + gtk_widget_show (text); + + /* fill in action area: */ + hbox = GTK_DIALOG (dialog)->action_area; + + button = gtk_button_new_with_label ("OK"); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) preview_options_ok_callback, dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_grab_default (button); + gtk_widget_show (button); + + button = gtk_button_new_with_label ("Cancel"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) preview_options_cancel_callback, + dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_show (button); + + gtk_widget_show (dialog); + DBG (DBG_debug, "preview_options_dialog: finished\n"); +} + +static void +pref_device_save (GtkWidget * widget, gpointer data) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "pref_device_save\n"); + gsg_make_path (sizeof (filename), filename, + "xscanimage", 0, dialog->dev_name, ".rc"); + fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd < 0) + { + char buf[256]; + + snprintf (buf, sizeof (buf), "Failed to create file: %s.", + strerror (errno)); + gsg_error (buf); + return; + } + gsg_sync (dialog); + sanei_save_values (fd, dialog->dev); + close (fd); + DBG (DBG_debug, "pref_device_save: finished\n"); +} + +static void +pref_device_restore (void) +{ + char filename[PATH_MAX]; + int fd; + + DBG (DBG_debug, "pref_device_restore\n"); + gsg_make_path (sizeof (filename), filename, + "xscanimage", 0, dialog->dev_name, ".rc"); + fd = open (filename, O_RDONLY); + if (fd < 0) + return; + sanei_load_values (fd, dialog->dev); + close (fd); + + gsg_refresh_dialog (dialog); + DBG (DBG_debug, "pref_device_restore: finished\n"); +} + +static void +pref_toggle_advanced (GtkWidget * widget, gpointer data) +{ + preferences.advanced = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_advanced (dialog, preferences.advanced); + pref_xscanimage_save (); +} + +static void +pref_toggle_tooltips (GtkWidget * widget, gpointer data) +{ + preferences.tooltips_enabled = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_tooltips (dialog, preferences.tooltips_enabled); + pref_xscanimage_save (); +} + +static void +pref_toggle_twocolumn (GtkWidget * widget, gpointer data) +{ + preferences.twocolumn_enabled = (GTK_CHECK_MENU_ITEM (widget)->active != 0); + gsg_set_twocolumn (dialog, preferences.twocolumn_enabled); + pref_xscanimage_save (); +} + +static GtkWidget * +pref_build_menu (void) +{ + GtkWidget *menu, *item, *submenu; + GtkWidget *unit_mm, *unit_cm, *unit_in; + GSList *units_group = NULL; + double unit; + + DBG (DBG_debug, "pref_build_menu\n"); + menu = gtk_menu_new (); + + /* advanced user option: */ + item = gtk_check_menu_item_new_with_label ("Show advanced options"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.advanced); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_advanced, 0); + + /* tooltips submenu: */ + + item = gtk_check_menu_item_new_with_label ("Show tooltips"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.tooltips_enabled); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_tooltips, 0); + + /* two column submenu: */ + + item = gtk_check_menu_item_new_with_label ("Show two column display"); + gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), + preferences.twocolumn_enabled); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + gtk_signal_connect (GTK_OBJECT (item), "toggled", + (GtkSignalFunc) pref_toggle_twocolumn, 0); + + /* length unit submenu: */ + + item = gtk_menu_item_new_with_label ("Length unit"); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + + submenu = gtk_menu_new (); + + unit_mm = gtk_radio_menu_item_new_with_label (units_group, "millimeters"); + units_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (unit_mm)); + gtk_menu_append (GTK_MENU (submenu), unit_mm); + gtk_widget_show (unit_mm); + + unit_cm = gtk_radio_menu_item_new_with_label (units_group, "centimeters"); + units_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (unit_cm)); + gtk_menu_append (GTK_MENU (submenu), unit_cm); + gtk_widget_show (unit_cm); + + unit_in = gtk_radio_menu_item_new_with_label (units_group, "inches"); + gtk_menu_append (GTK_MENU (submenu), unit_in); + gtk_widget_show (unit_in); + + unit = preferences.length_unit; + if ((unit > 9.9) && (unit < 10.1)) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (unit_cm), TRUE); + else if ((unit > 25.3) && (unit < 25.5)) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (unit_in), TRUE); + else + { + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (unit_mm), TRUE); + preferences.length_unit = 1.0; + } + gtk_signal_connect (GTK_OBJECT (unit_mm), "toggled", + (GtkSignalFunc) pref_set_unit_callback, "mm"); + gtk_signal_connect (GTK_OBJECT (unit_cm), "toggled", + (GtkSignalFunc) pref_set_unit_callback, "cm"); + gtk_signal_connect (GTK_OBJECT (unit_in), "toggled", + (GtkSignalFunc) pref_set_unit_callback, "in"); + + gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); + + /* preview options: */ + + item = gtk_menu_item_new_with_label ("Preview options..."); + gtk_menu_append (GTK_MENU (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) preview_options_dialog, 0); + gtk_widget_show (item); + + /* insert separator: */ + item = gtk_menu_item_new (); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Save device settings"); + gtk_menu_append (GTK_MENU (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) pref_device_save, 0); + gtk_widget_show (item); + + item = gtk_menu_item_new_with_label ("Restore device settings"); + gtk_menu_append (GTK_MENU (menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate", + (GtkSignalFunc) pref_device_restore, 0); + gtk_widget_show (item); + + DBG (DBG_debug, "pref_build_menu: finished\n"); + return menu; +} + +static void +browse_filename_callback (GtkWidget * widget, gpointer data) +{ + char filename[1024]; + + DBG (DBG_debug, "browse_filename_callback\n"); + if (preferences.filename) + { + strncpy (filename, preferences.filename, sizeof (filename)); + filename[sizeof (filename) - 1] = '\0'; + } + else + strcpy (filename, OUTFILENAME); + gsg_get_filename ("Output Filename", filename, sizeof (filename), filename); + gtk_entry_set_text (GTK_ENTRY (scan_win.filename_entry), filename); + + if (preferences.filename) + free ((void *) preferences.filename); + preferences.filename = strdup (filename); + DBG (DBG_debug, "browse_filename_callback: finished\n"); +} + +static void +filename_changed_callback (GtkWidget * widget, gpointer data) +{ + if (preferences.filename) + free ((void *) preferences.filename); + preferences.filename = strdup (gtk_entry_get_text (GTK_ENTRY (widget))); +} + +/* Create the main dialog box. */ +static void +device_dialog (void) +{ + GtkWidget *vbox, *hbox, *button, *frame, *scrolled_window, *dialog_window, + *label, *text; + GtkWidget *menubar_item; + const gchar *devname; + + DBG (DBG_debug, "device_dialog\n"); + /* first, restore xscanimage preferences */ + pref_xscanimage_restore (); + + devname = devlist[seldev]->name; + + /* create the dialog box */ + scan_win.shell = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (scan_win.shell), (char *) devname); + gtk_window_set_policy (GTK_WINDOW (scan_win.shell), FALSE, TRUE, TRUE); + gtk_window_set_default_size (GTK_WINDOW (scan_win.shell), 400, 400); + gtk_signal_connect (GTK_OBJECT (scan_win.shell), "delete_event", + GTK_SIGNAL_FUNC (scan_win_delete), NULL); + + /* create the main vbox */ + vbox = GTK_DIALOG (scan_win.shell)->vbox; + + /* create the menubar */ + + scan_win.menubar = gtk_menu_bar_new (); + gtk_box_pack_start (GTK_BOX (vbox), scan_win.menubar, FALSE, FALSE, 0); + + /* "Files" submenu: */ + menubar_item = gtk_menu_item_new_with_label ("File"); + gtk_container_add (GTK_CONTAINER (scan_win.menubar), menubar_item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_item), + files_build_menu ()); + gtk_widget_show (menubar_item); + + /* "Preferences" submenu: */ + menubar_item = gtk_menu_item_new_with_label ("Preferences"); + gtk_container_add (GTK_CONTAINER (scan_win.menubar), menubar_item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_item), + pref_build_menu ()); + gtk_widget_show (menubar_item); + + gtk_widget_show (scan_win.menubar); + + /* if we're running in standalone mode, provide a output filename box: */ + if (scan_win.mode == STANDALONE) + { + frame = gtk_frame_new ("Output"); + gtk_container_border_width (GTK_CONTAINER (frame), 4); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); + + hbox = gtk_hbox_new (FALSE, 2); + gtk_container_border_width (GTK_CONTAINER (hbox), 2); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + label = gtk_label_new ("Filename"); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); + + text = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (text), (char *) preferences.filename); + gtk_box_pack_start (GTK_BOX (hbox), text, TRUE, TRUE, 2); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) filename_changed_callback, 0); + + scan_win.filename_entry = text; + + button = gtk_button_new_with_label ("Browse"); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 2); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) browse_filename_callback, 0); + + gtk_widget_show (button); + gtk_widget_show (label); + gtk_widget_show (text); + gtk_widget_show (hbox); + gtk_widget_show (frame); + } + + /* create a subwindow so the dialog keeps its position on rebuilds: */ + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_CORNER_TOP_RIGHT); + dialog_window = gtk_hbox_new ( /* homogeneous */ FALSE, 0); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW + (scrolled_window), dialog_window); + + gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0); + gtk_widget_show (scrolled_window); + gtk_widget_show (dialog_window); + + dialog = gsg_create_dialog (dialog_window, devname, + update_preview, 0, update_param, 0); + if (!dialog) + return; + + /* The info row */ + hbox = gtk_hbox_new (FALSE, 5); + gtk_container_border_width (GTK_CONTAINER (hbox), 3); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show (hbox); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + hbox = gtk_hbox_new (FALSE, 5); + gtk_container_border_width (GTK_CONTAINER (hbox), 2); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + scan_win.info_label = gtk_label_new ("0x0: 0KB"); + gtk_box_pack_start (GTK_BOX (hbox), scan_win.info_label, FALSE, FALSE, 0); + gtk_widget_show (scan_win.info_label); + + update_param (dialog, 0); + + /* The bottom row of buttons */ + hbox = GTK_DIALOG (scan_win.shell)->action_area; + + /* The Scan button */ + scan_win.scan_button = gtk_button_new_with_label ("Scan"); + gtk_signal_connect (GTK_OBJECT (scan_win.scan_button), "clicked", + (GtkSignalFunc) scan_dialog, NULL); + gtk_box_pack_start (GTK_BOX (hbox), scan_win.scan_button, TRUE, TRUE, 0); + gtk_widget_show (scan_win.scan_button); + + /* The Preview button */ + scan_win.preview_button = + gtk_toggle_button_new_with_label ("Preview Window"); + gtk_signal_connect (GTK_OBJECT (scan_win.preview_button), "clicked", + (GtkSignalFunc) scan_preview, NULL); + gtk_box_pack_start (GTK_BOX (hbox), scan_win.preview_button, TRUE, TRUE, 0); + gtk_widget_show (scan_win.preview_button); + +#if 0 + /* The Zoom in button */ + button = gtk_button_new_with_label ("Zoom"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) zoom_in_preview, NULL); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_show (button); + + /* The Zoom out button */ + button = gtk_button_new_with_label ("Zoom out"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) zoom_out_preview, NULL); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_show (button); +#endif + + pref_device_restore (); /* restore device-settings */ + gtk_widget_show (scan_win.shell); + DBG (DBG_debug, "device_dialog: finished\n"); +} + +static void +ok_choose_dialog_callback (void) +{ + gtk_widget_destroy (choose_device_dialog); + device_dialog (); +} + +static int +select_device_callback (GtkWidget * widget, GdkEventButton * event, + gpointer data) +{ + seldev = (long) data; + if (event->type == GDK_2BUTTON_PRESS && event->button == 1) + ok_choose_dialog_callback (); + + return 0; +} + +static gint32 +choose_device (void) +{ + GtkWidget *main_vbox, *vbox, *hbox, *button; + GSList *owner; + const SANE_Device *adev; + gint i; + + DBG (DBG_debug, "choose_device\n"); + choose_device_dialog = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (choose_device_dialog), "Select device"); + gtk_signal_connect (GTK_OBJECT (choose_device_dialog), "delete_event", + GTK_SIGNAL_FUNC (files_exit_callback), NULL); + + main_vbox = GTK_DIALOG (choose_device_dialog)->vbox; + + /* The list of drivers */ + vbox = gtk_vbox_new (FALSE, 5); + gtk_container_border_width (GTK_CONTAINER (vbox), 3); + gtk_box_pack_start (GTK_BOX (main_vbox), vbox, TRUE, TRUE, 0); + gtk_widget_show (vbox); + + /* The radio buttons */ + owner = NULL; + for (i = 0; i < ndevs; i++) + { + adev = devlist[i]; + + button = gtk_radio_button_new_with_label (owner, (char *) adev->name); + gtk_signal_connect (GTK_OBJECT (button), "button_press_event", + (GtkSignalFunc) select_device_callback, + (void *) (long) i); + gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); + gtk_widget_show (button); + owner = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + if (i == defdev) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + } + + /* The bottom row of buttons */ + hbox = GTK_DIALOG (choose_device_dialog)->action_area; + + /* The OK button */ + button = gtk_button_new_with_label ("OK"); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) ok_choose_dialog_callback, NULL); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_grab_default (button); + gtk_widget_show (button); + + /* The Cancel button */ + button = gtk_button_new_with_label ("Cancel"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + (GtkSignalFunc) files_exit_callback, NULL); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + gtk_widget_show (button); + + gtk_widget_show (choose_device_dialog); + DBG (DBG_debug, "choose_device: finished\n"); + return 0; +} + +static void +usage (void) +{ + printf ("Usage: %s [OPTION]... [DEVICE]\n\ +\n\ +Start up graphical user interface to access SANE (Scanner Access Now\n\ +Easy) devices.\n\ +\n\ +-h, --help display this help message and exit\n\ +-V, --version print version information\n", prog_name); +} + +static void +init (int argc, char **argv) +{ + char filename[PATH_MAX]; + struct stat st; + SANE_Status status; + + DBG_INIT (); + + DBG (DBG_debug, "init\n"); + gtk_init (&argc, &argv); +#ifdef HAVE_LIBGIMP_GIMP_H + gtk_rc_parse (gimp_gtkrc ()); + +# ifndef ENABLE_GIMP_1_2 + /* GIMP 2.0 defines gimp_use_xshm() as a macro always returning TRUE + * (in the compat header) */ + gdk_set_use_xshm (TRUE); +# else + gdk_set_use_xshm (gimp_use_xshm ()); +# endif /* !ENABLE_GIMP_1_2 */ +#endif + + gsg_make_path (sizeof (filename), filename, 0, "sane-style", 0, ".rc"); + if (stat (filename, &st) >= 0) + gtk_rc_parse (filename); + else + { + strncpy (filename, STRINGIFY (PATH_SANE_DATA_DIR) "/sane-style.rc", + sizeof (filename)); + filename[sizeof (filename) - 1] = '\0'; + if (stat (filename, &st) >= 0) + gtk_rc_parse (filename); + } + + status = sane_init (0, 0); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "init: sane_init failed: %s\n", + sane_strstatus (status)); + exit (1); + } + + if (argc > 1) + { + static SANE_Device dev; + static const SANE_Device *device_list[] = { &dev, 0 }; + int ch; + + while ((ch = getopt_long (argc, argv, "ghV", long_options, 0)) != EOF) + { + switch (ch) + { + case 'g': + printf ("%s: GIMP support missing.\n", argv[0]); + exit (0); + + case 'V': + printf ("xscanimage (%s) %s\n", PACKAGE, VERSION); + exit (0); + + case 'h': + default: + usage (); + exit (0); + } + } + + if (optind < argc) + { + memset (&dev, 0, sizeof (dev)); + dev.name = argv[argc - 1]; + dev.vendor = "Unknown"; + dev.type = "unknown"; + dev.model = "unknown"; + + devlist = device_list; + seldev = 0; + } + } + + if (seldev < 0) + { + char *defdevname; + + status = sane_get_devices (&devlist, SANE_FALSE); + if (status != SANE_STATUS_GOOD) + { + DBG (DBG_fatal, "init: sane_get_devices failed: %s\n", + sane_strstatus (status)); + exit (1); + } + + if ((defdevname = getenv ("SANE_DEFAULT_DEVICE")) != NULL) + { + int i; + + for (i = 0; devlist[i] != 0; i++) + { + if (strcmp (devlist[i]->name, defdevname) == 0) + { + defdev = i; + break; + } + } + if (defdev < 0) + DBG (DBG_error, "default device is `%s' wasn't found by " + "sane_get_devices() \n", defdevname); + else + DBG (DBG_info, "default device is `%s'\n", defdevname); + } + } + DBG (DBG_debug, "init: finished\n"); +} + +static void +interface (int argc, char **argv) +{ + scan_win.info_label = NULL; + + DBG (DBG_debug, "interface\n"); + init (argc, argv); + + for (ndevs = 0; devlist[ndevs]; ++ndevs); + + if (seldev >= 0) + { + if (seldev >= ndevs) + { + fprintf (stderr, "%s: device %d is unavailable.\n", + prog_name, seldev); + quit_xscanimage (); + } + device_dialog (); + if (!dialog) + quit_xscanimage (); + } + else + { + if (ndevs > 0) + { + seldev = 0; + if (ndevs == 1) + { + device_dialog (); + if (!dialog) + quit_xscanimage (); + } + else + choose_device (); + } + else + { + DBG (DBG_fatal, + "No scanners were identified. If you were expecting something\n" + " different, check that the scanner is plugged in, turned on and\n" + " detected by sane-find-scanner (if appropriate). Please read\n" + " the documentation which came with this software (README, FAQ,\n" + " manpages).\n"); + quit_xscanimage (); + } + } + gtk_quit_flag = 1; + DBG (DBG_debug, "interface: now running gtk_main ()\n"); + gtk_main (); + sane_exit (); + DBG (DBG_debug, "interface: finished\n"); +} + +int +main (int argc, char **argv) +{ + DBG_INIT (); + DBG (DBG_debug, "main\n"); + DBG (DBG_error, "xscanimage (version: %s, package: %s) starting\n", VERSION, + PACKAGE); + little_endian = calc_little_endian (); + scan_win.mode = STANDALONE; + gtk_quit_flag = 0; + prog_name = strrchr (argv[0], '/'); + if (prog_name) + ++prog_name; + else + prog_name = argv[0]; + +#ifdef HAVE_LIBGIMP_GIMP_H + { + GPrintFunc old_print_func; + GPrintFunc old_printerr_func; + int result; + + /* Temporarily install a print function that discards all output. + This is to avoid annoying "you must run this program under + gimp" messages when xscanimage gets invoked in stand-alone + mode. */ + old_print_func = g_set_print_handler (null_print_func); + old_printerr_func = g_set_printerr_handler (null_print_func); + /* gimp_main () returns 1 if xscanimage wasn't invoked by GIMP */ +# ifdef HAVE_OS2_H + set_gimp_PLUG_IN_INFO (&PLUG_IN_INFO); +# endif +# ifndef ENABLE_GIMP_1_2 + result = gimp_main (&PLUG_IN_INFO, argc, argv); +# else + result = gimp_main (argc, argv); +# endif /* !ENABLE_GIMP_1_2 */ + g_set_print_handler (old_print_func); + g_set_printerr_handler (old_printerr_func); + if (result) + interface (argc, argv); + } +#else + interface (argc, argv); +#endif /* HAVE_LIBGIMP_GIMP_H */ + DBG (DBG_debug, "main: finished\n"); + return 0; +} diff --git a/xscanimage-icon-48x48-2.png b/xscanimage-icon-48x48-2.png Binary files differnew file mode 100644 index 0000000..9db88be --- /dev/null +++ b/xscanimage-icon-48x48-2.png |