diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2018-04-12 14:17:51 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2018-04-12 14:17:51 +0800 |
commit | 3d1888960d61461991f0542413964bcf8df42c40 (patch) | |
tree | 8752a833ae13d6b1cc5af4032e41d45490d688fa | |
download | fbterm-3d1888960d61461991f0542413964bcf8df42c40.tar.gz fbterm-3d1888960d61461991f0542413964bcf8df42c40.zip |
Initial commit
From fbterm 1.7.0, at https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/fbterm/fbterm-1.7.0.tar.gz
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | COPYING | 341 | ||||
-rw-r--r-- | ChangeLog | 222 | ||||
-rw-r--r-- | INSTALL | 365 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 687 | ||||
-rw-r--r-- | NEWS | 0 | ||||
-rw-r--r-- | README | 30 | ||||
-rw-r--r-- | aclocal.m4 | 1109 | ||||
-rw-r--r-- | config.h.in | 180 | ||||
-rwxr-xr-x | configure | 7281 | ||||
-rw-r--r-- | configure.ac | 123 | ||||
-rwxr-xr-x | depcomp | 630 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/Makefile.in | 412 | ||||
-rw-r--r-- | doc/fbterm.1.in | 227 | ||||
-rw-r--r-- | im/256colors.png | bin | 0 -> 1583 bytes | |||
-rw-r--r-- | im/Makefile.am | 5 | ||||
-rw-r--r-- | im/Makefile.in | 426 | ||||
-rw-r--r-- | im/example.c | 128 | ||||
-rw-r--r-- | im/imapi.c | 279 | ||||
-rw-r--r-- | im/imapi.h | 147 | ||||
-rw-r--r-- | im/keycode.c | 293 | ||||
-rw-r--r-- | im/keycode.h | 42 | ||||
-rwxr-xr-x | install-sh | 520 | ||||
-rwxr-xr-x | missing | 376 | ||||
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/Makefile.in | 829 | ||||
-rw-r--r-- | src/fbconfig.cpp | 301 | ||||
-rw-r--r-- | src/fbconfig.h | 54 | ||||
-rw-r--r-- | src/fbdev.cpp | 208 | ||||
-rw-r--r-- | src/fbdev.h | 38 | ||||
-rw-r--r-- | src/fbio.cpp | 132 | ||||
-rw-r--r-- | src/fbio.h | 39 | ||||
-rw-r--r-- | src/fbshell.cpp | 773 | ||||
-rw-r--r-- | src/fbshell.h | 86 | ||||
-rw-r--r-- | src/fbshellman.cpp | 174 | ||||
-rw-r--r-- | src/fbshellman.h | 58 | ||||
-rw-r--r-- | src/fbterm.cpp | 302 | ||||
-rw-r--r-- | src/fbterm.h | 44 | ||||
-rw-r--r-- | src/font.cpp | 329 | ||||
-rw-r--r-- | src/font.h | 52 | ||||
-rw-r--r-- | src/immessage.h | 202 | ||||
-rw-r--r-- | src/improxy.cpp | 455 | ||||
-rw-r--r-- | src/improxy.h | 73 | ||||
-rw-r--r-- | src/input.cpp | 312 | ||||
-rw-r--r-- | src/input.h | 42 | ||||
-rw-r--r-- | src/input_key.h | 56 | ||||
-rw-r--r-- | src/lib/Makefile.am | 4 | ||||
-rw-r--r-- | src/lib/Makefile.in | 540 | ||||
-rw-r--r-- | src/lib/charsetmap.cpp | 171 | ||||
-rw-r--r-- | src/lib/instance.h | 63 | ||||
-rw-r--r-- | src/lib/io.cpp | 249 | ||||
-rw-r--r-- | src/lib/io.h | 64 | ||||
-rw-r--r-- | src/lib/shell.cpp | 430 | ||||
-rw-r--r-- | src/lib/shell.h | 100 | ||||
-rw-r--r-- | src/lib/type.h | 34 | ||||
-rw-r--r-- | src/lib/vterm.cpp | 834 | ||||
-rw-r--r-- | src/lib/vterm.h | 276 | ||||
-rw-r--r-- | src/lib/vterm_action.cpp | 702 | ||||
-rw-r--r-- | src/lib/vterm_states.cpp | 136 | ||||
-rw-r--r-- | src/lib/wcwidth.cpp | 318 | ||||
-rw-r--r-- | src/mouse.cpp | 175 | ||||
-rw-r--r-- | src/mouse.h | 37 | ||||
-rw-r--r-- | src/screen.cpp | 396 | ||||
-rw-r--r-- | src/screen.h | 105 | ||||
-rw-r--r-- | src/screen_render.cpp | 242 | ||||
-rw-r--r-- | src/signalfd.h | 58 | ||||
-rw-r--r-- | src/vbe.h | 134 | ||||
-rw-r--r-- | src/vesadev.cpp | 383 | ||||
-rw-r--r-- | src/vesadev.h | 42 | ||||
-rw-r--r-- | terminfo/Makefile.am | 4 | ||||
-rw-r--r-- | terminfo/Makefile.in | 330 | ||||
-rw-r--r-- | terminfo/fbterm | 33 |
74 files changed, 24257 insertions, 0 deletions
@@ -0,0 +1 @@ +dragchan <zgchan317@gmail.com> @@ -0,0 +1,341 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..8c1f77c --- /dev/null +++ b/ChangeLog @@ -0,0 +1,222 @@ +2010-10-5 version 1.7 + * vterm.cpp charsetmap.cpp: + improved escape sequences support, now curses h/v lines should be drawed correctly + + * fbshell.cpp: + added redirecting /dev/tty0 output to FbTerm's sub-window + + * improxy.cpp input.cpp: + added shortcut CTRL_ALT_K to kill the frozen IM server + + * vterm.cpp wcwidth.cpp fbconfig.cpp: + added option "ambiguous-wide" to treat ambiguous CJK characters as wide width + + * font.cpp fbcofnig.cpp: + added option "font-height" to force font height + + * vterm.cpp: + do_normal_char(): fixed logical error in insert mode + + * shell.cpp: + autoTextSelect(): fixed logical error + + * improxy.cpp: + improved screen redrawing performance when im is active + +2009-11-14 version 1.6 + * screen.cpp screen.h screen_render.cpp: + reorganized class Screen API for VESA support + + * screen_clip.cpp: + removed this file because similar function has been recoded in improxy.cpp + + * vesa.cpp vesa.h vbe.h: + added general VESA video card support + + * fbdev.cpp fbdev.h: + moved frame buffer device support from class Screen to new class FbDev + + * immessage.h improxy.cpp: + added IM rendering message for IM server development + + * input.cpp: + moved tty initialing code from ttyInput() to switchVc() + Ctrl+Space won't be a shortcut if user run FbTerm without input-method option + + * mouse.cpp: + fixed a bug where FbTerm isn't compiled with gpm mouse support but run with gpm server enabled + + * fbconfig.cpp: + added options for VESA support + fixed some spelling errors in FbTerm's help message + + * doc/inputmethod.txt: + removed content of this file to be comments of im/immessage.h and im/imapi.h + + * doc/fbterm.1.in: + added description for VESA support + fixed several spelling errors + + * imapi.c: + fixed a IM dead loop bug triggered by FbTerm's crash + fixed a bug where IM maybe doesn't process pending messages until a new message arrives + +2009-04-26 version 1.5 + * fbconfig.cpp fbshell.cpp shell.cpp: + added command line arguments to customize command executed in sub-window, which is user's login shell by default + + * improxy.cpp input.cpp fbshell.cpp fbshellman.cpp: + added Alt-Fn and all FbTerm's shortcuts support when input method is actived + + * screen_render.cpp: + added support for text rendering with background image + + * fbconfig.cpp fbshell.cpp input.cpp font.cpp screen.cpp: + showInfo(): added option "-v/--verbose" to show extra system information + + * lib/shell.cpp: + createShellProcess(): changed shell program selection algorithm + + * screen.cpp: + createInstance(): changed frame buffer device selection behavior + + * font.cpp: + createInstance(): removed duplicate fonts with same family from ordered font list + + * lib/io.cpp: + localCodec(): fixed UTF-8 characters not showed correctly when locale is C/POSIX + + * lib/vterm.h: + fixed a bug with character color for underline/halfbright attribute in version 1.4 + + * fbterm.cpp: + fixed a clearing screen issue on startup even in inactive tty + + * fbconfig.cpp: + Config(): fixed a bug when user try to execute FbTerm in initscripts and variable HOME is not defined + + * input.cpp: + fixed a bug that ctrl/space release keycodes are sent to im server when user enable it by pressing ctrl+space + +2009-03-14 version 1.4 + * screen_render.cpp: + improved text rendering performance + + * lib/vterm_state.cpp lib/vterm_action.cpp fbshell.cpp: + added private escape sequences for 256 color support + + * font.cpp fbconfig.cpp: + added a option to adjust font width + + * fbterm.cpp fbio.cpp: + added using select() for old 2.2/2.4 kernel + + * font.cpp: + fixed a crash bug where font's width/height returns zero for bitmap fonts + + * font.cpp screen.cpp: + removed codes for non fixed width font + + * configure: + fixed a failure with cross-compiling environment + +2008-12-20 version 1.3 + * fbconfig.cpp: + added command line arguments to change option values + + * fbterm.cpp fbshellman.cpp fbshell.cpp improxy.cpp improxy.h input.cpp im/*: + added client-server based input method framework + + * screen.cpp screen_clip.cpp: + added screen clip support for IM + + * screen.cpp font.cpp: + added screen rotation support + + * screen.cpp: + drawGlyph(): fixed a spelling error of '=' as '-', which even appears in version 1.0 + move(): fixed a duplicate repaint bug while fast scrolling type is ypan + moved paint code to a separate source file screen_render.cpp + + * screen_render.cpp: + setupSysPalette(): added support visual FB_VISUAL_DIRECTCOLOR + + * mouse.cpp lib/shell.cpp lib/shell.h: + added mouse wheel support + + * lib/vterm.h lib/vterm.cpp: + decreased memory usage of every vterm instance by changing struct CharAttr size from 4 to 2 bytes + + * font.cpp: + replaced hash table based glyph cache with direct array index, removed dependence of hash.h/hash.cpp + + * input.cpp: + readyRead(): fixed a unicode input character processing error + + * lib/shell.cpp lib/vterm.cpp: + fixed a bug of not inverse color for selected text when switch back to the shell + moved mouse pointer drawing code to class FbShell + + * fbshell.cpp: + fixed a bug of maybe not restore original console state after FbTerm exited + moved class FbShellManager to separate source files fbshellman.h and fbshellman.cpp + + * fbshellman.cpp: + switchShell(): fixed a duplicate repaint bug while switch to same window + + * configure src/Makefile.in fbterm.cpp fbshell.cpp input.cpp: + added using filesystem capability attributes offered by kernel 2.6.27, instead of setting set-user-ID bit on FbTerm + +2008-10-12 version 1.2 + * lib/term.h lib/term.cpp lib/term_states.cpp lib/term_action.cpp: + improved escape and control sequences compatibility with linux console + + * fbshell.cpp: + added support linux console sequences for changing the color palette and cursor shape + moved shell management code to a separate class FbShellManager + + * fbconfig.cpp fbshell.cpp: + added option to adjust default cursor shape and flash interval + added option to modify chars considered as part of a word while auto-selecting text + + * fbterm.cpp: + added handle signal SIGHUP, FbTerm will exit normally while shutdown system directly in it + + * mouse.cpp: + Mouse(): fixed a freeze issue caused by changing console winsize under kernel 2.6.26 + + * screen.cpp: + createInstance(): fixed a crash bug while font size is greater than screen size + + * lib/shell.cpp: + cleaned text selection code and fixed a crash bug + + * fbshell.cpp: + fixed not repainting screen when switch back to virtual console which FbTerm running on, but FbTerm not have active window + + * lib/term_action.cpp: + next_param(): fixed a buffer overflow issue which may cause denial of service via application crash + +2008-08-23 version 1.1 + * fbshell.h fbshell.cpp fbterm.cpp input_key.h: + added configurable additional text encoding support and switch between them with hot keys + + * lib/term.h lib/term.cpp fbshell.cpp: + added a option in configure file to let user adjust max scroll-back history lines of every window + + * lib/term.cpp: + expose(): fixed a bug of NOT redraw whole changed area + a example is cursor drawing error while shell command line containing double width characters + + * hash.cpp: + find(): fixed a bug to get a little better hash search performance + + * fbterm.cpp: + pollSingal(): fixed a variable name spelling error in source for older kernel support + SignalIo::readyRead(): fixed a compile failure while kernel headers version less than 2.6.24 + + * screen.cpp: + createInstance(): fixed a compile failure under certain systems + +2008-07-05 version 1.0 + first release @@ -0,0 +1,365 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..10814b6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src im terminfo doc diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..2ff15c9 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + depcomp install-sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src im terminfo doc +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ + distclean distclean-generic distclean-hdr distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: @@ -0,0 +1,30 @@ +FbTerm - a fast FrameBuffer based TERMinal emulator for linux + + +DESCRIPTION + + FbTerm is a fast terminal emulator for linux with frame buffer device or VESA video card. Features include: + + * mostly as fast as terminal of linux kernel while accelerated scrolling is enabled + * select font with fontconfig and draw text with freetype2, same as Qt/Gtk+ based GUI apps + * dynamicly create/destroy up to 10 windows initially running default shell + * record scrollback history for every window + * auto-detect current locale and convert text encoding, support double width scripts like Chinese, Japanese etc + * switch between configurable additional text encodings with hot keys on the fly + * copy/past selected text between windows with mouse when gpm server is running + * change the orientation of screen display, a.k.a. screen rotation + * lightweight input method framework with client-server architecture + * background image for eye candy + + + read man page doc/fbterm.1 for usage help. + + +INPUT METHOD + + Instead of adding input method directly in FbTerm, a client-server based input method framework is designed to do +this work. FbTerm acts as a client, standalone IM program as a server, and they run in seperated processes. + + As a normal IM user, please visit FbTerm's homepage (http://code.google.com/p/fbterm/) to check current available IM +programs. If you want to develope a new IM program for FbTerm, there is a IM example in im/ directory, which help you to +understand IM architecture and provide some base sources to simplify the development. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..8fc1df9 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1109 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, +[m4_warning([this file was generated for autoconf 2.65. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..730799b --- /dev/null +++ b/config.h.in @@ -0,0 +1,180 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* */ +#undef ENABLE_GPM + +/* */ +#undef ENABLE_VESA + +/* */ +#undef HAVE_EPOLL + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the <gpm.h> header file. */ +#undef HAVE_GPM_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <langinfo.h> header file. */ +#undef HAVE_LANGINFO_H + +/* Define to 1 if you have the `util' library (-lutil). */ +#undef HAVE_LIBUTIL + +/* Define to 1 if you have the <libx86.h> header file. */ +#undef HAVE_LIBX86_H + +/* Define to 1 if you have the <linux/fb.h> header file. */ +#undef HAVE_LINUX_FB_H + +/* Define to 1 if you have the <linux/input.h> header file. */ +#undef HAVE_LINUX_INPUT_H + +/* Define to 1 if you have the <linux/kd.h> header file. */ +#undef HAVE_LINUX_KD_H + +/* Define to 1 if you have the <linux/keyboard.h> header file. */ +#undef HAVE_LINUX_KEYBOARD_H + +/* Define to 1 if you have the <locale.h> header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the `nl_langinfo' function. */ +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* */ +#undef HAVE_SIGNALFD + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the <stddef.h> header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* 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 `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/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 <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the <termios.h> header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your <sys/time.h> declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const diff --git a/configure b/configure new file mode 100755 index 0000000..d416407 --- /dev/null +++ b/configure @@ -0,0 +1,7281 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.65 for FbTerm 1.7. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='FbTerm' +PACKAGE_TARNAME='fbterm' +PACKAGE_VERSION='1.7' +PACKAGE_STRING='FbTerm 1.7' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="src/fbterm.cpp" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_header_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +X86_LIBS +VESA_FALSE +VESA_TRUE +LIBOBJS +EGREP +GREP +CPP +FC_LIBS +FC_CFLAGS +FT2_LIBS +FT2_CFLAGS +PKG_CONFIG +RANLIB +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +ac_ct_CC +CFLAGS +CC +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CXX +CPPFLAGS +LDFLAGS +CXXFLAGS +CXX +RELEASE_DATE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_gpm +enable_vesa +enable_epoll +enable_signalfd +' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS +PKG_CONFIG +FT2_CFLAGS +FT2_LIBS +FC_CFLAGS +FC_LIBS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures FbTerm 1.7 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/fbterm] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of FbTerm 1.7:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-gpm disable gpm mouse support [[default=auto]] + --disable-vesa disable VESA video card support [[default=auto]] + --disable-epoll do not use epoll system call [[default=auto]] + --disable-signalfd do not use signalfd system call [[default=auto]] + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CC C compiler command + CFLAGS C compiler flags + PKG_CONFIG path to pkg-config utility + FT2_CFLAGS C compiler flags for FT2, overriding pkg-config + FT2_LIBS linker flags for FT2, overriding pkg-config + FC_CFLAGS C compiler flags for FC, overriding pkg-config + FC_LIBS linker flags for FC, overriding pkg-config + 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. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +FbTerm configure 1.7 +generated by GNU Autoconf 2.65 + +Copyright (C) 2009 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by FbTerm $as_me 1.7, which was +generated by GNU Autoconf 2.65. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_list " stdlib.h" +as_fn_append ac_header_list " unistd.h" +as_fn_append ac_header_list " sys/param.h" +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version='1.11' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + for ac_t in install-sh install.sh shtool; do + if test -f "$ac_dir/$ac_t"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/$ac_t -c" + break 2 + fi + done +done +if test -z "$ac_aux_dir"; then + as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='fbterm' + VERSION='1.7' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +ac_config_headers="$ac_config_headers config.h" + + +RELEASE_DATE="October 2010" + + +# Checks for programs. +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +$as_echo_n "checking whether the C++ compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "C++ compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +$as_echo_n "checking for C++ compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C++ compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi + +# Check whether --enable-gpm was given. +if test "${enable_gpm+set}" = set; then : + enableval=$enable_gpm; GPM="$enableval" +else + GPM=auto +fi + + +# Check whether --enable-vesa was given. +if test "${enable_vesa+set}" = set; then : + enableval=$enable_vesa; VESA="$enableval" +else + VESA=auto +fi + + +# Check whether --enable-epoll was given. +if test "${enable_epoll+set}" = set; then : + enableval=$enable_epoll; EPOLL="$enableval" +else + EPOLL=auto +fi + + +# Check whether --enable-signalfd was given. +if test "${enable_signalfd+set}" = set; then : + enableval=$enable_signalfd; SIGNALFD="$enableval" +else + SIGNALFD=auto +fi + + + +# Checks for libraries. + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 +$as_echo_n "checking for forkpty in -lutil... " >&6; } +if test "${ac_cv_lib_util_forkpty+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char forkpty (); +int +main () +{ +return forkpty (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_util_forkpty=yes +else + ac_cv_lib_util_forkpty=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 +$as_echo "$ac_cv_lib_util_forkpty" >&6; } +if test "x$ac_cv_lib_util_forkpty" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUTIL 1 +_ACEOF + + LIBS="-lutil $LIBS" + +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT2" >&5 +$as_echo_n "checking for FT2... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$FT2_CFLAGS"; then + pkg_cv_FT2_CFLAGS="$FT2_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FT2_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$FT2_LIBS"; then + pkg_cv_FT2_LIBS="$FT2_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FT2_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + FT2_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "freetype2"` + else + FT2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$FT2_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (freetype2) were not met: + +$FT2_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables FT2_CFLAGS +and FT2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables FT2_CFLAGS +and FT2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details." "$LINENO" 5; } +else + FT2_CFLAGS=$pkg_cv_FT2_CFLAGS + FT2_LIBS=$pkg_cv_FT2_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FC" >&5 +$as_echo_n "checking for FC... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$FC_CFLAGS"; then + pkg_cv_FC_CFLAGS="$FC_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FC_CFLAGS=`$PKG_CONFIG --cflags "fontconfig" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$FC_LIBS"; then + pkg_cv_FC_LIBS="$FC_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FC_LIBS=`$PKG_CONFIG --libs "fontconfig" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + FC_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig"` + else + FC_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig"` + fi + # Put the nasty error message in config.log where it belongs + echo "$FC_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (fontconfig) were not met: + +$FC_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables FC_CFLAGS +and FC_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables FC_CFLAGS +and FC_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details." "$LINENO" 5; } +else + FC_CFLAGS=$pkg_cv_FC_CFLAGS + FC_LIBS=$pkg_cv_FC_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + +# Checks for header files. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test "${ac_cv_header_sys_wait_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_sys_wait_h=yes +else + ac_cv_header_sys_wait_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } +if test $ac_cv_header_sys_wait_h = yes; then + +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in fcntl.h langinfo.h locale.h stddef.h stdlib.h string.h termios.h unistd.h \ + sys/ioctl.h sys/socket.h sys/time.h linux/fb.h linux/kd.h linux/keyboard.h linux/input.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error "required header file is missing!" "$LINENO" 5 +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if test "${ac_cv_header_stdbool_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <stdbool.h> +#ifndef bool + "error: bool is not defined" +#endif +#ifndef false + "error: false is not defined" +#endif +#if false + "error: false is not 0" +#endif +#ifndef true + "error: true is not defined" +#endif +#if true != 1 + "error: true is not 1" +#endif +#ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" +#endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +# if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a runtime + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +# endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + +int +main () +{ + + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } +ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + +if test $ac_cv_header_stdbool_h = yes; then + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* 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"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 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; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 +$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } +if test "${ac_cv_struct_tm+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> +#include <time.h> + +int +main () +{ +struct tm tm; + int *p = &tm.tm_sec; + return !p; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_struct_tm=time.h +else + ac_cv_struct_tm=sys/time.h +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 +$as_echo "$ac_cv_struct_tm" >&6; } +if test $ac_cv_struct_tm = sys/time.h; then + +$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h + +fi + + +# Checks for library functions. +if test $ac_cv_c_compiler_gnu = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if test "${ac_cv_prog_gcc_traditional+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + + + + for ac_header in $ac_header_list +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + +for ac_func in getpagesize +do : + ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" +if test "x$ac_cv_func_getpagesize" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETPAGESIZE 1 +_ACEOF + +fi +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 +$as_echo_n "checking for working mmap... " >&6; } +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_mmap_fixed_mapped=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 !defined STDC_HEADERS && !defined HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef 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; + const char *cdata2; + int i, pagesize; + int fd, fd2; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 2; + if (write (fd, data, pagesize) != pagesize) + return 3; + close (fd); + + /* Next, check that the tail of a page is zero-filled. File must have + non-zero length, otherwise we risk SIGBUS for entire page. */ + fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); + if (fd2 < 0) + return 4; + cdata2 = ""; + if (write (fd2, cdata2, 1) != 1) + return 5; + data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + if (data2 == MAP_FAILED) + return 6; + for (i = 0; i < pagesize; ++i) + if (*(data2 + i)) + return 7; + close (fd2); + if (munmap (data2, pagesize)) + return 8; + + /* 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) + return 9; + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 10; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 11; + + /* 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) + return 12; + if (read (fd, data3, pagesize) != pagesize) + return 13; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 14; + close (fd); + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_mmap_fixed_mapped=yes +else + ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 +$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +$as_echo "#define HAVE_MMAP 1" >>confdefs.h + +fi +rm -f conftest.mmap conftest.txt + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if test "${ac_cv_type_signal+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> +#include <signal.h> + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 +$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + if test "$cross_compiling" = yes; then : + ac_cv_func_lstat_dereferences_slashed_symlink=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + /* Linux will dereference the symlink and fail, as required by POSIX. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_lstat_dereferences_slashed_symlink=yes +else + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + +if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then + case " $LIBOBJS " in + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" + ;; +esac + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 +$as_echo_n "checking whether stat accepts an empty string... " >&6; } +if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_stat_empty_string_bug=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + return stat ("", &sbuf) == 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_stat_empty_string_bug=no +else + ac_cv_func_stat_empty_string_bug=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 +$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } +if test $ac_cv_func_stat_empty_string_bug = yes; then + case " $LIBOBJS " in + *" stat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS stat.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define HAVE_STAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + +for ac_func in memset memmove munmap nl_langinfo setenv setlocale socket strcasecmp strchr strstr strtol +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error "required lib function is missing!" "$LINENO" 5 +fi +done + + +GPM_WARN= +if test x"$GPM" != xno; then + for ac_header in gpm.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "gpm.h" "ac_cv_header_gpm_h" "$ac_includes_default" +if test "x$ac_cv_header_gpm_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GPM_H 1 +_ACEOF + +fi + +done + + if test x"$GPM" = xauto; then + GPM="$ac_cv_header_gpm_h" + [ "$GPM" = "no" ] && GPM_WARN=yes + elif test x"$ac_cv_header_gpm_h" != xyes; then + as_fn_error "can't find gpm.h required by gpm mouse support!" "$LINENO" 5 + fi +fi + +VESA_WARN= +if test x"$VESA" != xno; then + for ac_header in libx86.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libx86.h" "ac_cv_header_libx86_h" "$ac_includes_default" +if test "x$ac_cv_header_libx86_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBX86_H 1 +_ACEOF + +fi + +done + + if test x"$VESA" = xauto; then + VESA="$ac_cv_header_libx86_h" + [ "$VESA" = "no" ] && VESA_WARN=yes + elif test x"$ac_cv_header_libx86_h" != xyes; then + as_fn_error "can't find libx86.h required by VESA video card support!" "$LINENO" 5 + fi +fi + +if test x"$EPOLL" = xauto -a x"$cross_compiling" = xno; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/epoll.h> +int +main () +{ +if (epoll_create(10) >= 0) return 0; return 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + EPOLL=yes + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi + +if test x"$SIGNALFD" = xauto -a x"$cross_compiling" = xno; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/signalfd.h> +int +main () +{ +sigset_t mask; if (signalfd(-1, &mask, 0) >= 0) return 0; return 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + SIGNALFD=yes + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi + + if test x"$VESA" = xyes; then + VESA_TRUE= + VESA_FALSE='#' +else + VESA_TRUE='#' + VESA_FALSE= +fi + + +x86_LIBS= +[ "$VESA" = "yes" ] && x86_LIBS="-lx86" +X86_LIBS="$x86_LIBS" + + + + + + + +[ "$GPM" = "yes" ] && $as_echo "#define ENABLE_GPM 1" >>confdefs.h + +[ "$VESA" = "yes" ] && $as_echo "#define ENABLE_VESA 1" >>confdefs.h + +[ "$EPOLL" = "yes" ] && $as_echo "#define HAVE_EPOLL 1" >>confdefs.h + +[ "$SIGNALFD" = "yes" ] && $as_echo "#define HAVE_SIGNALFD 1" >>confdefs.h + + +ac_config_files="$ac_config_files Makefile src/Makefile src/lib/Makefile im/Makefile terminfo/Makefile doc/Makefile doc/fbterm.1" + +ac_config_links="$ac_config_links im/input_key.h:src/input_key.h im/immessage.h:src/immessage.h" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${VESA_TRUE}" && test -z "${VESA_FALSE}"; then + as_fn_error "conditional \"VESA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by FbTerm $as_me 1.7, which was +generated by GNU Autoconf 2.65. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_links="$ac_config_links" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration links: +$config_links + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +FbTerm config.status 1.7 +configured by $0, generated by GNU Autoconf 2.65, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2009 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; + "im/Makefile") CONFIG_FILES="$CONFIG_FILES im/Makefile" ;; + "terminfo/Makefile") CONFIG_FILES="$CONFIG_FILES terminfo/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/fbterm.1") CONFIG_FILES="$CONFIG_FILES doc/fbterm.1" ;; + "im/input_key.h") CONFIG_LINKS="$CONFIG_LINKS im/input_key.h:src/input_key.h" ;; + "im/immessage.h") CONFIG_LINKS="$CONFIG_LINKS im/immessage.h:src/immessage.h" ;; + + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' <confdefs.h | sed ' +s/'"$ac_delim"'/"\\\ +"/g' >>$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + :L) + # + # CONFIG_LINK + # + + if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then + : + else + # Prefer the file from the source tree if names are identical. + if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then + ac_source=$srcdir/$ac_source + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + + if test ! -r "$ac_source"; then + as_fn_error "$ac_source: file not found" "$LINENO" 5 + fi + rm -f "$ac_file" + + # Try a relative symlink, then a hard link, then a copy. + case $srcdir in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$ac_source ;; + esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$ac_source" "$ac_file" 2>/dev/null || + cp -p "$ac_source" "$ac_file" || + as_fn_error "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + fi + ;; + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit $? +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +[ "$GPM_WARN" = "yes" ] && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gpm.h doesn't exist! gpm mouse support will be disabled!" >&5 +$as_echo "$as_me: WARNING: gpm.h doesn't exist! gpm mouse support will be disabled!" >&2;} +[ "$VESA_WARN" = "yes" ] && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libx86.h doesn't exist! VESA support will be disabled!" >&5 +$as_echo "$as_me: WARNING: libx86.h doesn't exist! VESA support will be disabled!" >&2;} || exit 0 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4c04455 --- /dev/null +++ b/configure.ac @@ -0,0 +1,123 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.61]) +AC_INIT([FbTerm], [1.7]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src/fbterm.cpp]) +AC_CONFIG_HEADERS([config.h]) + +AC_SUBST([RELEASE_DATE], "October 2010") + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_RANLIB +PKG_PROG_PKG_CONFIG + +AC_ARG_ENABLE(gpm, + AC_HELP_STRING([--disable-gpm], [disable gpm mouse support [[default=auto]]]), + [GPM="$enableval"], + [GPM=auto]) + +AC_ARG_ENABLE(vesa, + AC_HELP_STRING([--disable-vesa], [disable VESA video card support [[default=auto]]]), + [VESA="$enableval"], + [VESA=auto]) + +AC_ARG_ENABLE(epoll, + AC_HELP_STRING([--disable-epoll], [do not use epoll system call [[default=auto]]]), + [EPOLL="$enableval"], + [EPOLL=auto]) + +AC_ARG_ENABLE(signalfd, + AC_HELP_STRING([--disable-signalfd], [do not use signalfd system call [[default=auto]]]), + [SIGNALFD="$enableval"], + [SIGNALFD=auto]) + + +# Checks for libraries. +AC_CHECK_LIB([util], [forkpty]) +PKG_CHECK_MODULES([FT2], [freetype2]) +PKG_CHECK_MODULES([FC], [fontconfig]) + +# Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stddef.h stdlib.h string.h termios.h unistd.h \ + sys/ioctl.h sys/socket.h sys/time.h linux/fb.h linux/kd.h linux/keyboard.h linux/input.h], + [], [AC_MSG_ERROR(required header file is missing!)]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_STRUCT_TM + +# Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MMAP +AC_TYPE_SIGNAL +AC_FUNC_STAT +AC_CHECK_FUNCS([memset memmove munmap nl_langinfo setenv setlocale socket strcasecmp strchr strstr strtol], + [], [AC_MSG_ERROR(required lib function is missing!)]) + +GPM_WARN= +if test x"$GPM" != xno; then + AC_CHECK_HEADERS([gpm.h]) + if test x"$GPM" = xauto; then + GPM="$ac_cv_header_gpm_h" + [[ "$GPM" = "no" ]] && GPM_WARN=yes + elif test x"$ac_cv_header_gpm_h" != xyes; then + AC_MSG_ERROR(can't find gpm.h required by gpm mouse support!) + fi +fi + +VESA_WARN= +if test x"$VESA" != xno; then + AC_CHECK_HEADERS([libx86.h]) + if test x"$VESA" = xauto; then + VESA="$ac_cv_header_libx86_h" + [[ "$VESA" = "no" ]] && VESA_WARN=yes + elif test x"$ac_cv_header_libx86_h" != xyes; then + AC_MSG_ERROR(can't find libx86.h required by VESA video card support!) + fi +fi + +if test x"$EPOLL" = xauto -a x"$cross_compiling" = xno; then + AC_RUN_IFELSE( + AC_LANG_PROGRAM([[#include <sys/epoll.h>]], + [[if (epoll_create(10) >= 0) return 0; return 1;]]), + [EPOLL=yes] + ) +fi + +if test x"$SIGNALFD" = xauto -a x"$cross_compiling" = xno; then + AC_RUN_IFELSE( + AC_LANG_PROGRAM([[#include <sys/signalfd.h>]], + [[sigset_t mask; if (signalfd(-1, &mask, 0) >= 0) return 0; return 1;]]), + [SIGNALFD=yes] + ) +fi + +AM_CONDITIONAL(VESA, test x"$VESA" = xyes) + +x86_LIBS= +[[ "$VESA" = "yes" ]] && x86_LIBS="-lx86" +AC_SUBST([X86_LIBS], ["$x86_LIBS"]) + +AH_TEMPLATE([ENABLE_GPM]) +AH_TEMPLATE([ENABLE_VESA]) +AH_TEMPLATE([HAVE_EPOLL]) +AH_TEMPLATE([HAVE_SIGNALFD]) + +[[ "$GPM" = "yes" ]] && AC_DEFINE([ENABLE_GPM]) +[[ "$VESA" = "yes" ]] && AC_DEFINE([ENABLE_VESA]) +[[ "$EPOLL" = "yes" ]] && AC_DEFINE([HAVE_EPOLL]) +[[ "$SIGNALFD" = "yes" ]] && AC_DEFINE([HAVE_SIGNALFD]) + +AC_CONFIG_FILES([Makefile src/Makefile src/lib/Makefile im/Makefile terminfo/Makefile doc/Makefile doc/fbterm.1]) +AC_CONFIG_LINKS([im/input_key.h:src/input_key.h im/immessage.h:src/immessage.h]) +AC_OUTPUT + +[[ "$GPM_WARN" = "yes" ]] && AC_MSG_WARN([gpm.h doesn't exist! gpm mouse support will be disabled!]) +[[ "$VESA_WARN" = "yes" ]] && AC_MSG_WARN([libx86.h doesn't exist! VESA support will be disabled!]) || exit 0 @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..a79de5c --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = fbterm.1 +EXTRA_DIST = fbterm.1.in diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..675ebda --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,412 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/fbterm.1.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fbterm.1 +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +man_MANS = fbterm.1 +EXTRA_DIST = fbterm.1.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fbterm.1: $(top_builddir)/config.status $(srcdir)/fbterm.1.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list=''; test -n "$(man1dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-man uninstall-man1 + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/fbterm.1.in b/doc/fbterm.1.in new file mode 100644 index 0000000..1885fa6 --- /dev/null +++ b/doc/fbterm.1.in @@ -0,0 +1,227 @@ +.TH "FbTerm" "1" "@RELEASE_DATE@" "FbTerm @VERSION@" "FbTerm User Manual" +.SH "NAME" +FbTerm - a fast Frame Buffer based TERMinal emulator for linux +.SH "SYNOPSIS" +\fBfbterm\fR [\fIoptions\fR] [--] [\fIcommand\fR [\fIarguments\fR]] +.SH "DESCRIPTION" +FbTerm is a fast terminal emulator for linux with frame buffer device or VESA video card. Features include: + + * mostly as fast as terminal of linux kernel while accelerated scrolling is enabled + * select font with fontconfig and draw text with freetype2, same as Qt/Gtk+ based GUI apps + * dynamically create/destroy up to 10 windows initially running default shell + * record scroll-back history for every window + * auto-detect current locale and convert text encoding, support double width scripts like Chinese, Japanese etc + * switch between configurable additional text encodings with hot keys on the fly + * copy/past selected text between windows with mouse when gpm server is running + * change the orientation of screen display, a.k.a. screen rotation + * lightweight input method framework with client-server architecture + * background image for eye candy +.SH "OPTIONS" +\fIcommand\fR [\fIarguments\fR] may be given to override the built-in choice of shell program. Normally FbTerm +checks the \fISHELL\fR variable. If that is not set, it tries to use the user's login shell program specified in the password +file. If that is not set, /bin/sh will be used. You should use the \fI--\fR argument to separate FbTerm's options from +the arguments supplied to the \fIcommand\fR. + +FbTerm first uses option value specified in command line arguments, then in the configure file \fI$HOME/.fbtermrc\fR. +If that file doesn't exist, FbTerm will create it with default options on startup. +.TP +\fB-h, --help\fR +display the help and exit +.TP +\fB-V, --version\fR +display FbTerm version and exit +.TP +\fB-v, --verbose\fR +display extra FbTerm's information +.TP +\fB-n, --font-names=\fR\fItext\fR +specify font family names +.TP +\fB-s, --font-size=\fR\fInum\fR +specify font pixel size +.TP +\fB--font-width=\fR\fInum\fR +force font width +.TP +\fB--font-height=\fR\fInum\fR +force font height +.TP +\fB-f, --color-foreground=\fR\fInum\fR +specify foreground color +.TP +\fB-b, --color-background=\fR\fInum\fR +specify background color +.TP +\fB-e, --text-encodings=\fR\fItext\fR +specify additional text encodings +.TP +\fB-a, --ambiguous-wide +treat ambiguous width characters as wide +.TP +\fB-r, --screen-rotate=\fR\fInum\fR +specify the orientation of screen display +.TP +\fB-i, --input-method=\fR\fItext\fR +specify input method program +.TP +\fB--cursor-shape=\fR\fInum\fR +specify default cursor shape +.TP +\fB--cursor-interval=\fR\fInum\fR +specify cursor flash interval +.TP +\fB--vesa-mode=\fR\fInum\fR +specify VESA video mode +.TP +\fB--vesa-mode=list\fR +display available VESA video modes + +.TP +see comments in \fI$HOME/.fbtermrc\fR for details of these options. +.SH "SHORTCUT SUMMARY" +keyboard: + CTRL_ALT_E: exit from FbTerm + CTRL_ALT_C: create a new window + CTRL_ALT_D: destroy current window + CTRL_ALT_1: switch to window 1 + CTRL_ALT_2: switch to window 2 + CTRL_ALT_3: switch to window 3 + CTRL_ALT_4: switch to window 4 + CTRL_ALT_5: switch to window 5 + CTRL_ALT_6: switch to window 6 + CTRL_ALT_7: switch to window 7 + CTRL_ALT_8: switch to window 8 + CTRL_ALT_9: switch to window 9 + CTRL_ALT_0: switch to window 10 + SHIFT_LEFT: switch to previous window + SHIFT_RIGHT: switch to next window + SHIFT_PAGEUP: history scroll up + SHIFT_PAGEDOWN: history scroll down + CTRL_ALT_F1: switch to encoding of current locale + CTRL_ALT_F2 to CTRL_ALT_F6: switch to additional encodings + CTRL_SPACE: toggle input method + CTRL_ALT_K: kill input method server + +mouse: + move when left button down: select text + double click with left button: auto select text + click with right button: paste selected text + +Sometimes above actions will not work, please try to redo them with shift key holding down. +.SH "FRAME BUFFER DEVICE" +Before executing FbTerm, make sure there is a frame buffer device in your system, and you have read/write access right +with it. Normally FbTerm tries to open /dev/fb0 and /dev/fb/0, environment variable "\fIFRAMEBUFFER\fR" may be used to override this +built-in behavior. +.SH "VESA VIDEO DEVICE" +From version 1.6, FbTerm adds VESA video card support. By default, FbTerm tries frame buffer device first, if failure, +then tries to use VESA device with highest resolution and color depth. option "\fIvesa-mode\fR" may be given to force only open +VESA device with the specified video mode. To see available video modes for your VESA card, execute "\fBfbterm --vesa-mode=list\fR". + +Attention: 1) VESA support requires root privilege to work; 2) do not force to use VESA device on the system with frame buffer device +enabled, they maybe conflict with each other. +.SH "FONT" +FbTerm invokes fontconfig to get a font list, if the first font doesn't contain the glyph for the rendering character, +it will try second font, then the third, ... and so on, user can see this ordered font list with "\fBfbterm -v\fR". + +If you don't like the fonts selected by FbTerm, execute "fc-list" to get available fonts, choose favorites as +the value of option "\fIfont-names\fR". You may also modify the configure file of fontconfig, which will +change the behavior of all programs based on fontconfig! +.SH "TEXT ENCODING" +By using iconv, FbTerm converts other encodings to internal encoding UTF-8. On startup, FbTerm checks variable +\fILC_CTYPE\fR to determine the default text encoding, which is binded to shortcut CTRL_ALT_F1. +User can specify up to 5 additional encodings with option "\fItext-encodings\fR", for example, as a Chinese user, +you set "text-encodings=gbk,big5", shortcut CTRL_ALT_F2 will bind to gbk, and CTRL_ALT_F3 bind to big5. + +In a number of CJK encodings there are ambiguous width characters which have a width of either narrow or wide +depending on the context of their use. By default, FbTerm treats them as narrow width characters, +option "\fIambiguous-wide\fR" may be used to change the behavior. +.SH "BACKGROUND IMAGE" +FbTerm doesn't load and parse any image file with various formats directly, instead it takes a screen shot of +frame buffer device on startup if variable \fIFBTERM_BACKGROUND_IMAGE\fR is defined, then uses this screen shot as +the background for text rendering. In order to enable background image support, user should first +put a image to frame buffer device with a image viewer. A wrapper script using fbv is listed below: +\fB +.br + + #!/bin/bash + + # fbterm-bi: a wrapper script to enable background image with fbterm + # usage: fbterm-bi /path/to/image fbterm-options + + echo -ne "\\e[?25l" # hide cursor + + fbv -ciuker "$1" << EOF + q + EOF + + shift + export FBTERM_BACKGROUND_IMAGE=1 + exec fbterm "$@" +\fR +Attention: 1) do not enable background image on frame buffer device with 8bpp depth, because FbTerm changes color map +table for correct text rendering; 2) if the screen shot is different from the original image, try to use a fast scrolling +disabled frame buffer device. +.SH "256 COLOR EXTENSION" +FbTerm supports xterm's 256 color mode extension. The first 16 colors are the default terminal colors. Additionally, there's +a 6x6x6 color cube, and 24 grayscale tones. But xterm's 256 color escape sequences conflict with the linux sequences implemented by FbTerm, +so private escape sequences were introduced to support this feature: +\fB +.br + + ESC [ 1 ; n } set foreground color to n (0 - 255) + ESC [ 2 ; n } set background color to n (0 - 255) + ESC [ 3 ; n ; r ; g ; b } set color n to (r, g, b) , n, r, g, b all in (0 - 255) +\fR + +A new terminfo database entry named "fbterm" was added to use these private sequences, all program based on terminfo should work with it. +By default, FbTerm sets environment variable "TERM" to value "linux", user need run "TERM=fbterm /path/to/program" to enable 256 color mode. +.SH "INPUT METHOD" +Instead of adding input method directly in FbTerm, a client-server based input method framework is designed to do +this work. FbTerm acts as a client, standalone IM program as a server, and they run in separated processes. + +As a normal IM user, you should install a IM program written for FbTerm, and specify it as the value of option "\fIinput-method\fR". +CTRL_SPACE is the shortcut to activate/deactivate input method. And CTRL_ALT_K may be used to kill the IM program when it has freezed. + +.SH "SECURITY NOTES" +FbTerm tries to change linux kernel key map table to setup shortcuts, which requires \fISYS_TTY_CONFIG\fR capability since kernel +version 2.6.15. It means FbTerm should be a setuid 0 program to allow non-root users to use shortcuts. FbTerm only +switches to root privilege temporarily when changing key map table, we believe it's pretty much free from security problems. +If you really don't like this and have a linux kernel with file system capabilities enabled, which allow user to give +binaries a subset of root's powers without using setuid 0 (official kernel 2.6.27 includes it), you can run command +"\fBsudo setcap 'cap_sys_tty_config+ep' /path/to/fbterm\fR". + +FbTerm redirects /dev/tty0 output to the pseudo terminal of current sub-window. In linux before version 2.6.10, anybody can do this +as long as the output was not redirected yet; since version 2.6.10, only root or a process with the \fICAP_SYS_ADMIN\fR capability may do this. +You should do similar work with above ones for FbTerm to enable this feature for non-root users. + +.SH "PERFORMANCE" +According test result, FbTerm spends more than 95% time on painting screen. Speedup painting will significantly +increase performance. Here are some suggestions for frame buffer device: + + * Enable fast scrolling on frame buffer device. The visible screen will be just a window of the video memory, +when scrolling, FbTerm only change the start of window, no need to repaint the whole screen. + + * On Intel P6 family processors the Memory Type Range Registers (MTRRs) may be used to control processor access to +memory ranges. If you have video card on a PCI or AGP bus, enabling write-combining allows bus write transfers +to be combined into a larger transfer before bursting over the PCI/AGP bus. This can increase performance of +FbTerm's paint operations. + +Maybe you need to enable them manually for your video card. For example, by default fast scrolling and write-combining +are all disabled on general VESA frame buffer device, GRUB/LILO configure file should be modified to enable them. +A GRUB example is showed below: + +title Ubuntu + root (hd0,0) + kernel /boot/vmlinuz ro root=LABEL=UBUNTU splash vga=0x317 \fBvideo=vesafb:ywrap,mtrr:3\fR + initrd /boot/initrd.img + +You may check fast scrolling status with "\fBfbterm -v\fR", a message with "scrolling: redraw" means fast scrolling +is disabled, otherwise enabled. +.SH "AUTHOR" +Written by dragchan. +.SH "REPORTING BUGS" +Please submit bug reports to <\fBhttp://code.google.com/p/fbterm/issues\fR>. +.SH "COPYRIGHT" +Copyright \(co 2008-2010 dragchan. License GPLv2: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. +.br +This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. diff --git a/im/256colors.png b/im/256colors.png Binary files differnew file mode 100644 index 0000000..ff98632 --- /dev/null +++ b/im/256colors.png diff --git a/im/Makefile.am b/im/Makefile.am new file mode 100644 index 0000000..b7411fe --- /dev/null +++ b/im/Makefile.am @@ -0,0 +1,5 @@ +check_PROGRAMS = imexample + +imexample_SOURCES = imapi.h imapi.c keycode.h keycode.c example.c + +EXTRA_DIST = 256colors.png diff --git a/im/Makefile.in b/im/Makefile.in new file mode 100644 index 0000000..bfc097a --- /dev/null +++ b/im/Makefile.in @@ -0,0 +1,426 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +check_PROGRAMS = imexample$(EXEEXT) +subdir = im +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = input_key.h immessage.h +CONFIG_CLEAN_VPATH_FILES = +am_imexample_OBJECTS = imapi.$(OBJEXT) keycode.$(OBJEXT) \ + example.$(OBJEXT) +imexample_OBJECTS = $(am_imexample_OBJECTS) +imexample_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(imexample_SOURCES) +DIST_SOURCES = $(imexample_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +imexample_SOURCES = imapi.h imapi.c keycode.h keycode.c example.c +EXTRA_DIST = 256colors.png +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu im/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu im/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +imexample$(EXEEXT): $(imexample_OBJECTS) $(imexample_DEPENDENCIES) + @rm -f imexample$(EXEEXT) + $(LINK) $(imexample_OBJECTS) $(imexample_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imapi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keycode.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/im/example.c b/im/example.c new file mode 100644 index 0000000..60818ce --- /dev/null +++ b/im/example.c @@ -0,0 +1,128 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "imapi.h" +#include "keycode.h" + +static char raw_mode = 1; +static unsigned cursorx, cursory; + +static void im_active() +{ + if (raw_mode) { + init_keycode_state(); + } +} + +static void im_deactive() +{ + Rectangle rect = { 0, 0, 0, 0 }; + set_im_window(0, rect); + set_im_window(1, rect); +} + +static void process_raw_key(char *buf, unsigned len) +{ + unsigned i; + for (i = 0; i < len; i++) { + char down = !(buf[i] & 0x80); + short code = buf[i] & 0x7f; + + if (!code) { + if (i + 2 >= len) break; + + code = (buf[++i] & 0x7f) << 7; + code |= buf[++i] & 0x7f; + if (!(buf[i] & 0x80) || !(buf[i - 1] & 0x80)) continue; + } + + unsigned short keysym = keycode_to_keysym(code, down); + char *str = keysym_to_term_string(keysym, down); + + put_im_text(str, strlen(str)); + } +} + +static void process_key(char *keys, unsigned len) +{ + if (raw_mode) { + process_raw_key(keys, len); + } else { + put_im_text(keys, len); + } +} + +static void im_show(unsigned winid) +{ + static const char str[] = "a IM example"; + + Rectangle rect; + rect.x = cursorx + 10, rect.y = cursory + 10; + rect.w = 40, rect.h = 20; + + set_im_window(0, rect); + fill_rect(rect, Gray); + + rect.y += rect.h + 10; + rect.w = 180; + rect.h = 30; + + set_im_window(1, rect); + fill_rect(rect, Gray); + draw_text(rect.x + 5, rect.y + 5, Black, Gray, str, sizeof(str) - 1); +} + +static void im_hide() +{ +} + +static void cursor_pos_changed(unsigned x, unsigned y) +{ + cursorx = x; + cursory = y; + im_show(-1); +} + +static void update_fbterm_info(Info *info) +{ +} + +static ImCallbacks cbs = { + im_active, // .active + im_deactive, // .deactive + im_show, // .show_ui + im_hide, // .hide_ui + process_key, // .send_key + cursor_pos_changed, // .cursor_position + update_fbterm_info, // .fbterm_info + update_term_mode // .term_mode +}; + +int main() +{ + register_im_callbacks(cbs); + connect_fbterm(raw_mode); + while (check_im_message()) ; + + return 0; +} diff --git a/im/imapi.c b/im/imapi.c new file mode 100644 index 0000000..0bbb127 --- /dev/null +++ b/im/imapi.c @@ -0,0 +1,279 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdint.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "imapi.h" + +#define OFFSET(TYPE, MEMBER) ((size_t)(&(((TYPE *)0)->MEMBER))) +#define MSG(a) ((Message *)(a)) + +static int imfd = -1; +static ImCallbacks cbs; +static char pending_msg_buf[10240]; +static unsigned pending_msg_buf_len = 0; +static int im_active = 0; + +static void wait_message(MessageType type); + +void register_im_callbacks(ImCallbacks callbacks) +{ + cbs = callbacks; +} + +int get_im_socket() +{ + static char init = 0; + if (!init) { + init = 1; + + char *val = getenv("FBTERM_IM_SOCKET"); + if (val) { + char *tail; + int fd = strtol(val, &tail, 0); + if (!*tail) imfd = fd; + } + } + + return imfd; +} + +void connect_fbterm(char raw) +{ + get_im_socket(); + if (imfd == -1) return; + + Message msg; + msg.type = Connect; + msg.len = sizeof(msg); + msg.raw = (raw ? 1 : 0); + int ret = write(imfd, (char *)&msg, sizeof(msg)); +} + +void put_im_text(const char *text, unsigned len) +{ + if (imfd == -1 || !im_active || !text || !len || (OFFSET(Message, texts) + len > UINT16_MAX)) return; + + char buf[OFFSET(Message, texts) + len]; + + MSG(buf)->type = PutText; + MSG(buf)->len = sizeof(buf); + memcpy(MSG(buf)->texts, text, len); + + int ret = write(imfd, buf, MSG(buf)->len); +} + +void set_im_window(unsigned id, Rectangle rect) +{ + if (imfd == -1 || !im_active || id >= NR_IM_WINS) return; + + Message msg; + msg.type = SetWin; + msg.len = sizeof(msg); + msg.win.winid = id; + msg.win.rect = rect; + + int ret = write(imfd, (char *)&msg, sizeof(msg)); + wait_message(AckWin); +} + +void fill_rect(Rectangle rect, unsigned char color) +{ + Message msg; + msg.type = FillRect; + msg.len = sizeof(msg); + + msg.fillRect.rect = rect; + msg.fillRect.color = color; + + int ret = write(imfd, (char *)&msg, sizeof(msg)); +} + +void draw_text(unsigned x, unsigned y, unsigned char fc, unsigned char bc, const char *text, unsigned len) +{ + if (!text || !len) return; + + char buf[OFFSET(Message, drawText.texts) + len]; + + MSG(buf)->type = DrawText; + MSG(buf)->len = sizeof(buf); + + MSG(buf)->drawText.x = x; + MSG(buf)->drawText.y = y; + MSG(buf)->drawText.fc = fc; + MSG(buf)->drawText.bc = bc; + memcpy(MSG(buf)->drawText.texts, text, len); + + int ret = write(imfd, buf, MSG(buf)->len); +} + +static int process_message(Message *msg) +{ + int exit = 0; + + switch (msg->type) { + case Disconnect: + close(imfd); + imfd = -1; + exit = 1; + break; + + case FbTermInfo: + if (cbs.fbterm_info) { + cbs.fbterm_info(&msg->info); + } + break; + + case Active: + im_active = 1; + if (cbs.active) { + cbs.active(); + } + break; + + case Deactive: + if (cbs.deactive) { + cbs.deactive(); + } + im_active = 0; + break; + + case ShowUI: + if (im_active && cbs.show_ui) { + cbs.show_ui(msg->winid); + } + break; + + case HideUI: { + if (im_active && cbs.hide_ui) { + cbs.hide_ui(); + } + + Message msg; + msg.type = AckHideUI; + msg.len = sizeof(msg); + int ret = write(imfd, (char *)&msg, sizeof(msg)); + break; + } + + case SendKey: + if (im_active && cbs.send_key) { + cbs.send_key(msg->keys, msg->len - OFFSET(Message, keys)); + } + break; + + case CursorPosition: + if (im_active && cbs.cursor_position) { + cbs.cursor_position(msg->cursor.x, msg->cursor.y); + } + break; + + case TermMode: + if (im_active && cbs.term_mode) { + cbs.term_mode(msg->term.crWithLf, msg->term.applicKeypad, msg->term.cursorEscO); + } + break; + + default: + break; + } + + return exit; +} + +static int process_messages(char *buf, int len) +{ + char *cur = buf, *end = cur + len; + int exit = 0; + + for (; cur < end && MSG(cur)->len <= (end - cur); cur += MSG(cur)->len) { + exit |= process_message(MSG(cur)); + } + + return exit; +} + +static void wait_message(MessageType type) +{ + int ack = 0; + while (!ack) { + char *cur = pending_msg_buf + pending_msg_buf_len; + int len = read(imfd, cur, sizeof(pending_msg_buf) - pending_msg_buf_len); + + if (len == -1 && (errno == EAGAIN || errno == EINTR)) continue; + else if (len <= 0) { + close(imfd); + imfd = -1; + return; + } + + pending_msg_buf_len += len; + + char *end = cur + len; + for (; cur < end && MSG(cur)->len <= (end - cur); cur += MSG(cur)->len) { + if (MSG(cur)->type == type) { + memcpy(cur, cur + MSG(cur)->len, end - cur - MSG(cur)->len); + pending_msg_buf_len -= MSG(cur)->len; + + ack = 1; + break; + } + } + } + + if (pending_msg_buf_len) { + Message msg; + msg.type = Ping; + msg.len = sizeof(msg); + int ret = write(imfd, (char *)&msg, sizeof(msg)); + } +} + +int check_im_message() +{ + if (imfd == -1) return 0; + + char buf[sizeof(pending_msg_buf)]; + int len, exit = 0; + + if (pending_msg_buf_len) { + len = pending_msg_buf_len; + pending_msg_buf_len = 0; + + memcpy(buf, pending_msg_buf, len); + exit |= process_messages(buf, len); + } + + len = read(imfd, buf, sizeof(buf)); + + if (len == -1 && (errno == EAGAIN || errno == EINTR)) return 1; + else if (len <= 0) { + close(imfd); + imfd = -1; + return 0; + } + + exit |= process_messages(buf, len); + + return !exit; +} diff --git a/im/imapi.h b/im/imapi.h new file mode 100644 index 0000000..e363241 --- /dev/null +++ b/im/imapi.h @@ -0,0 +1,147 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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. + * + */ + +/** + * FbTerm provides a set of wrapped API to simply the IM server development. The API encapsulates input method message sending, + * receiving and processing. + */ + +#ifndef IM_API_H +#define IM_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "immessage.h" + +typedef void (*ActiveFun)(); +typedef void (*DeactiveFun)(); + +/// @param winid indicates which window should be redrawn, -1 means redraw all UI window. @see set_im_window() +typedef void (*ShowUIFun)(unsigned winid); +typedef void (*HideUIFun)(); +typedef void (*SendKeyFun)(char *keys, unsigned len); +typedef void (*CursorPositionFun)(unsigned x, unsigned y); +typedef void (*FbTermInfoFun)(Info *info); +typedef void (*TermModeFun)(char crlf, char appkey, char curo); + +typedef struct { + ActiveFun active; ///< called when receiving a Active message + DeactiveFun deactive; ///< called when receiving a Deactive message + ShowUIFun show_ui; ///< called when receiving a ShowUI message + HideUIFun hide_ui; ///< called when receiving a HideUI message + SendKeyFun send_key; ///< called when receiving a SendKey message + CursorPositionFun cursor_position; ///< called when receiving a CursorPosition message + FbTermInfoFun fbterm_info; ///< called when receiving a FbTermInfo message + TermModeFun term_mode; ///< called when receiving a TermMode message +} ImCallbacks; + +/** + * @brief register message call-back functions: + * @param callbacks + */ +extern void register_im_callbacks(ImCallbacks callbacks); + +/** + * @brief send message Connect to FbTerm + * @param mode keyboard input mode + * + * FbTerm provides two kinds of keyboard input modes, IM server can choose a favorite one with parameter mode of + * connect_fbterm(). + * + * If mode equals zero, IM server will receive characters translated by kernel with current keymap in SendKey messages. + * There are some disadvantages in this mode, for example, shortcuts composed with only modifiers are impossible. + * ( shortcuts composed with modifiers and normal keys can create a map if they are not mapped in current kernel keymap, + * maybe we need add new messages like RequestKeyMap and AckKeyMap used by IM server to ask FbTerm to do this work. ) + + * If mode is non-zero, FbTerm sets keyboard mode to K_MEDIUMRAW after Active Message, IM server will receive raw keycode + * from kernel and have full control for keyboard, except FbTerm's shortcuts, e.g. Ctrl + Space. + * Under this mode, IM server should translate keycodes to keysyms according current kernel keymap, change keyboard led + * state and translate keysyms to characters if it want to send user input back to FbTerm. Because some translation of + * keysyms to characters are not fixed (e.g. cursor movement keysym K_LEFT can be 'ESC [ D' or 'ESC O D'), message TermMode + * sent by FbTerm is used to help IM server do this translation. + * + * keycode.c/keycode.h provides some functions to translate keycode to keysym and keysym to characters. + */ +extern void connect_fbterm(char mode); + +/** + * @brief get the file descriptor of the unix socket used to transfer IM messages. + * @return file id of the socket connected to FbTerm + * + * Because check_im_message() blocks until a message arrives, IM server can use select/poll to monitor other file + * descriptors among with the one from get_im_socket(). + */ +extern int get_im_socket(); + +/** + * @brief receive IM messages from FbTerm and dispatch them to functions registered with register_im_callbacks() + * @return zero if DisconnectIM messages has been received, otherwise non-zero + */ +extern int check_im_message(); + +/** + * @brief send message PutText to FbTerm + * @param text translated text from user keyboard input, must be encoded with utf8 + * @param len text's length + */ +extern void put_im_text(const char *text, unsigned len); + +/** + * @brief send message SetWin to FbTerm and wait until AckWin has arrived + * @param winid the window id, must less than NR_IM_WINS + * @param rect the rectangle of this window area + * + * every UI window (e.g. status bar, candidate table, etc) should have a unique win id. + */ +extern void set_im_window(unsigned winid, Rectangle rect); + +/** + * The colors of xterm's 256 color mode supported by FbTerm can be used in fill_rect() and draw_text(). + * ColorType defines the first 16 colors with standard linux console. + * view 256colors.png for all colors. + */ +typedef enum { Black = 0, DarkRed, DarkGreen, DarkYellow, DarkBlue, DarkMagenta, DarkCyan, Gray, + DarkGray, Red, Green, Yellow, Blue, Magenta, Cyan, White } ColorType; + +/** + * @brief send message FillRect to FbTerm + * @param rect the rectangle to be filled + * @param color + */ +extern void fill_rect(Rectangle rect, unsigned char color); + +/** + * @breif send message DrawText to FbTerm + * @param x x axes of top left point + * @param y y axes of top left point + * @param fc foreground color + * @param bc background color + * @param text text to be drawn, must be encoding with utf8 + * @param len text's length + */ +extern void draw_text(unsigned x, unsigned y, unsigned char fc, unsigned char bc, const char *text, unsigned len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/im/keycode.c b/im/keycode.c new file mode 100644 index 0000000..d0c3b6d --- /dev/null +++ b/im/keycode.c @@ -0,0 +1,293 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <string.h> +#include <stdio.h> +#include <sys/ioctl.h> +#include <linux/kd.h> +#include <linux/keyboard.h> +#include <linux/input.h> +#include "input_key.h" + +static char key_down[NR_KEYS]; +static unsigned char shift_down[NR_SHIFT]; +static short shift_state; +static char lock_state; +static char cr_with_lf, applic_keypad, cursor_esco; +static int npadch; + +void init_keycode_state() +{ + npadch = -1; + shift_state = 0; + memset(key_down, 0, sizeof(char) * NR_KEYS); + memset(shift_down, 0, sizeof(char) * NR_SHIFT); + ioctl(STDIN_FILENO, KDGKBLED, &lock_state); +} + +void update_term_mode(char crlf, char appkey, char curo) +{ + cr_with_lf = crlf; + applic_keypad = appkey; + cursor_esco = curo; +} + +unsigned short keycode_to_keysym(unsigned short keycode, char down) +{ + if (keycode >= NR_KEYS) return K_HOLE; + + char rep = (down && key_down[keycode]); + key_down[keycode] = down; + + struct kbentry ke; + ke.kb_table = shift_state; + ke.kb_index = keycode; + + if (ioctl(STDIN_FILENO, KDGKBENT, &ke) == -1) return K_HOLE; + + if (KTYP(ke.kb_value) == KT_LETTER && (lock_state & K_CAPSLOCK)) { + ke.kb_table = shift_state ^ (1 << KG_SHIFT); + if (ioctl(STDIN_FILENO, KDGKBENT, &ke) == -1) return K_HOLE; + } + + if (ke.kb_value == K_HOLE || ke.kb_value == K_NOSUCHMAP) return K_HOLE; + + unsigned value = KVAL(ke.kb_value); + + switch (KTYP(ke.kb_value)) { + case KT_SPEC: + switch (ke.kb_value) { + case K_NUM: + if (applic_keypad) break; + case K_BARENUMLOCK: + case K_CAPS: + case K_CAPSON: + if (down && !rep) { + if (value == KVAL(K_NUM) || value == KVAL(K_BARENUMLOCK)) lock_state ^= K_NUMLOCK; + else if (value == KVAL(K_CAPS)) lock_state ^= K_CAPSLOCK; + else if (value == KVAL(K_CAPSON)) lock_state |= K_CAPSLOCK; + + ioctl(STDIN_FILENO, KDSKBLED, lock_state); + } + break; + + default: + break; + } + break; + + case KT_SHIFT: + if (value >= NR_SHIFT || rep) break; + + if (value == KVAL(K_CAPSSHIFT)) { + value = KVAL(K_SHIFT); + + if (down && (lock_state & K_CAPSLOCK)) { + lock_state &= ~K_CAPSLOCK; + ioctl(STDIN_FILENO, KDSKBLED, lock_state); + } + } + + if (down) shift_down[value]++; + else if (shift_down[value]) shift_down[value]--; + + if (shift_down[value]) shift_state |= (1 << value); + else shift_state &= ~(1 << value); + + break; + + case KT_LATIN: + case KT_LETTER: + case KT_FN: + case KT_PAD: + case KT_CONS: + case KT_CUR: + case KT_META: + case KT_ASCII: + break; + + default: + printf("not support!\n"); + break; + } + + return ke.kb_value; +} + +unsigned short keypad_keysym_redirect(unsigned short keysym) +{ + if (applic_keypad || KTYP(keysym) != KT_PAD || KVAL(keysym) >= NR_PAD) return keysym; + + #define KL(val) K(KT_LATIN, val) + static const unsigned short num_map[] = { + KL('0'), KL('1'), KL('2'), KL('3'), KL('4'), + KL('5'), KL('6'), KL('7'), KL('8'), KL('9'), + KL('+'), KL('-'), KL('*'), KL('/'), K_ENTER, + KL(','), KL('.'), KL('?'), KL('('), KL(')'), + KL('#') + }; + + static const unsigned short fn_map[] = { + K_INSERT, K_SELECT, K_DOWN, K_PGDN, K_LEFT, + K_P5, K_RIGHT, K_FIND, K_UP, K_PGUP, + KL('+'), KL('-'), KL('*'), KL('/'), K_ENTER, + K_REMOVE, K_REMOVE, KL('?'), KL('('), KL(')'), + KL('#') + }; + + if (lock_state & K_NUMLOCK) return num_map[keysym - K_P0]; + return fn_map[keysym - K_P0]; +} + + +static unsigned to_utf8(unsigned c, char *buf) +{ + unsigned index = 0; + + if (c < 0x80) + buf[index++] = c; + else if (c < 0x800) { + // 110***** 10****** + buf[index++] = 0xc0 | (c >> 6); + buf[index++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + if (c >= 0xD800 && c < 0xE000) + return index; + if (c == 0xFFFF) + return index; + // 1110**** 10****** 10****** + buf[index++] = 0xe0 | (c >> 12); + buf[index++] = 0x80 | ((c >> 6) & 0x3f); + buf[index++] = 0x80 | (c & 0x3f); + } else if (c < 0x200000) { + // 11110*** 10****** 10****** 10****** + buf[index++] = 0xf0 | (c >> 18); + buf[index++] = 0x80 | ((c >> 12) & 0x3f); + buf[index++] = 0x80 | ((c >> 6) & 0x3f); + buf[index++] = 0x80 | (c & 0x3f); + } + + return index; +} + + +char *keysym_to_term_string(unsigned short keysym, char down) +{ + static struct kbsentry kse; + char *buf = (char *)kse.kb_string; + *buf = 0; + + if (KTYP(keysym) != KT_SHIFT && !down) return buf; + + keysym = keypad_keysym_redirect(keysym); + unsigned index = 0, value = KVAL(keysym); + + + switch (KTYP(keysym)) { + case KT_LATIN: + case KT_LETTER: + if (value < KVAL(AC_START) || value > KVAL(AC_END)) index = to_utf8(value, buf); + break; + + case KT_FN: + kse.kb_func = value; + ioctl(STDIN_FILENO, KDGKBSENT, &kse); + index = strlen(buf); + break; + + case KT_SPEC: + if (keysym == K_ENTER) { + buf[index++] = '\r'; + if (cr_with_lf) buf[index++] = '\n'; + } else if (keysym == K_NUM && applic_keypad) { + buf[index++] = '\e'; + buf[index++] = 'O'; + buf[index++] = 'P'; + } + break; + + case KT_PAD: + if (applic_keypad && !shift_down[KG_SHIFT]) { + if (value < NR_PAD) { + static const char app_map[] = "pqrstuvwxylSRQMnnmPQS"; + + buf[index++] = '\e'; + buf[index++] = 'O'; + buf[index++] = app_map[value]; + } + } else if (keysym == K_P5 && !(lock_state & K_NUMLOCK)) { + buf[index++] = '\e'; + buf[index++] = (applic_keypad ? 'O' : '['); + buf[index++] = 'G'; + } + break; + + case KT_CUR: + if (value < 4) { + static const char cur_chars[] = "BDCA"; + + buf[index++] = '\e'; + buf[index++] = (cursor_esco ? 'O' : '['); + buf[index++] = cur_chars[value]; + } + break; + + case KT_META: { + long flag; + ioctl(STDIN_FILENO, KDGKBMETA, &flag); + + if (flag == K_METABIT) { + buf[index++] = 0x80 | value; + } else { + buf[index++] = '\e'; + buf[index++] = value; + } + break; + } + + case KT_SHIFT: + if (!down && npadch != -1) { + index = to_utf8(npadch, buf); + npadch = -1; + } + break; + + case KT_ASCII: + if (value < NR_ASCII) { + int base = 10; + + if (value >= KVAL(K_HEX0)) { + base = 16; + value -= KVAL(K_HEX0); + } + + if (npadch == -1) npadch = value; + else npadch = npadch * base + value; + } + break; + + default: + break; + } + + buf[index] = 0; + return buf; +} diff --git a/im/keycode.h b/im/keycode.h new file mode 100644 index 0000000..a324037 --- /dev/null +++ b/im/keycode.h @@ -0,0 +1,42 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 KEYCODE_H +#define KEYCODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +void init_keycode_state(); + +void update_term_mode(char crlf, char appkey, char curo); + +unsigned short keycode_to_keysym(unsigned short keycode, char down); + +unsigned short keypad_keysym_redirect(unsigned short keysym); + +char *keysym_to_term_string(unsigned short keysym, char down); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..6781b98 --- /dev/null +++ b/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..040fbdd --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,11 @@ +SUBDIRS = lib + +bin_PROGRAMS = fbterm + +fbterm_SOURCES = fbconfig.cpp fbconfig.h fbio.cpp fbio.h fbshell.cpp fbshell.h fbshellman.cpp fbshellman.h fbterm.cpp \ + fbterm.h font.cpp font.h input.cpp input.h input_key.h mouse.cpp mouse.h screen.cpp screen.h improxy.cpp improxy.h \ + screen_render.cpp fbdev.cpp fbdev.h vesadev.cpp vesadev.h vbe.h +EXTRA_fbterm_SOURCES = signalfd.h + +fbterm_CXXFLAGS = -fno-exceptions -fno-rtti -Ilib @FT2_CFLAGS@ @FC_CFLAGS@ +fbterm_LDADD = lib/libshell.a @FT2_LIBS@ @FC_LIBS@ @X86_LIBS@ -lutil diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..443972b --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,829 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = fbterm$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/immessage.h $(srcdir)/input_key.h +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_fbterm_OBJECTS = fbterm-fbconfig.$(OBJEXT) fbterm-fbio.$(OBJEXT) \ + fbterm-fbshell.$(OBJEXT) fbterm-fbshellman.$(OBJEXT) \ + fbterm-fbterm.$(OBJEXT) fbterm-font.$(OBJEXT) \ + fbterm-input.$(OBJEXT) fbterm-mouse.$(OBJEXT) \ + fbterm-screen.$(OBJEXT) fbterm-improxy.$(OBJEXT) \ + fbterm-screen_render.$(OBJEXT) fbterm-fbdev.$(OBJEXT) \ + fbterm-vesadev.$(OBJEXT) +fbterm_OBJECTS = $(am_fbterm_OBJECTS) +fbterm_DEPENDENCIES = lib/libshell.a +fbterm_LINK = $(CXXLD) $(fbterm_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(fbterm_SOURCES) $(EXTRA_fbterm_SOURCES) +DIST_SOURCES = $(fbterm_SOURCES) $(EXTRA_fbterm_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = lib +fbterm_SOURCES = fbconfig.cpp fbconfig.h fbio.cpp fbio.h fbshell.cpp fbshell.h fbshellman.cpp fbshellman.h fbterm.cpp \ + fbterm.h font.cpp font.h input.cpp input.h input_key.h mouse.cpp mouse.h screen.cpp screen.h improxy.cpp improxy.h \ + screen_render.cpp fbdev.cpp fbdev.h vesadev.cpp vesadev.h vbe.h + +EXTRA_fbterm_SOURCES = signalfd.h +fbterm_CXXFLAGS = -fno-exceptions -fno-rtti -Ilib @FT2_CFLAGS@ @FC_CFLAGS@ +fbterm_LDADD = lib/libshell.a @FT2_LIBS@ @FC_LIBS@ @X86_LIBS@ -lutil +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +fbterm$(EXEEXT): $(fbterm_OBJECTS) $(fbterm_DEPENDENCIES) + @rm -f fbterm$(EXEEXT) + $(fbterm_LINK) $(fbterm_OBJECTS) $(fbterm_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbconfig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbdev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbshell.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbshellman.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-fbterm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-font.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-improxy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-mouse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-screen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-screen_render.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbterm-vesadev.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +fbterm-fbconfig.o: fbconfig.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbconfig.o -MD -MP -MF $(DEPDIR)/fbterm-fbconfig.Tpo -c -o fbterm-fbconfig.o `test -f 'fbconfig.cpp' || echo '$(srcdir)/'`fbconfig.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbconfig.Tpo $(DEPDIR)/fbterm-fbconfig.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbconfig.cpp' object='fbterm-fbconfig.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbconfig.o `test -f 'fbconfig.cpp' || echo '$(srcdir)/'`fbconfig.cpp + +fbterm-fbconfig.obj: fbconfig.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbconfig.obj -MD -MP -MF $(DEPDIR)/fbterm-fbconfig.Tpo -c -o fbterm-fbconfig.obj `if test -f 'fbconfig.cpp'; then $(CYGPATH_W) 'fbconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/fbconfig.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbconfig.Tpo $(DEPDIR)/fbterm-fbconfig.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbconfig.cpp' object='fbterm-fbconfig.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbconfig.obj `if test -f 'fbconfig.cpp'; then $(CYGPATH_W) 'fbconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/fbconfig.cpp'; fi` + +fbterm-fbio.o: fbio.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbio.o -MD -MP -MF $(DEPDIR)/fbterm-fbio.Tpo -c -o fbterm-fbio.o `test -f 'fbio.cpp' || echo '$(srcdir)/'`fbio.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbio.Tpo $(DEPDIR)/fbterm-fbio.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbio.cpp' object='fbterm-fbio.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbio.o `test -f 'fbio.cpp' || echo '$(srcdir)/'`fbio.cpp + +fbterm-fbio.obj: fbio.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbio.obj -MD -MP -MF $(DEPDIR)/fbterm-fbio.Tpo -c -o fbterm-fbio.obj `if test -f 'fbio.cpp'; then $(CYGPATH_W) 'fbio.cpp'; else $(CYGPATH_W) '$(srcdir)/fbio.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbio.Tpo $(DEPDIR)/fbterm-fbio.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbio.cpp' object='fbterm-fbio.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbio.obj `if test -f 'fbio.cpp'; then $(CYGPATH_W) 'fbio.cpp'; else $(CYGPATH_W) '$(srcdir)/fbio.cpp'; fi` + +fbterm-fbshell.o: fbshell.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbshell.o -MD -MP -MF $(DEPDIR)/fbterm-fbshell.Tpo -c -o fbterm-fbshell.o `test -f 'fbshell.cpp' || echo '$(srcdir)/'`fbshell.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbshell.Tpo $(DEPDIR)/fbterm-fbshell.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbshell.cpp' object='fbterm-fbshell.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbshell.o `test -f 'fbshell.cpp' || echo '$(srcdir)/'`fbshell.cpp + +fbterm-fbshell.obj: fbshell.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbshell.obj -MD -MP -MF $(DEPDIR)/fbterm-fbshell.Tpo -c -o fbterm-fbshell.obj `if test -f 'fbshell.cpp'; then $(CYGPATH_W) 'fbshell.cpp'; else $(CYGPATH_W) '$(srcdir)/fbshell.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbshell.Tpo $(DEPDIR)/fbterm-fbshell.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbshell.cpp' object='fbterm-fbshell.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbshell.obj `if test -f 'fbshell.cpp'; then $(CYGPATH_W) 'fbshell.cpp'; else $(CYGPATH_W) '$(srcdir)/fbshell.cpp'; fi` + +fbterm-fbshellman.o: fbshellman.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbshellman.o -MD -MP -MF $(DEPDIR)/fbterm-fbshellman.Tpo -c -o fbterm-fbshellman.o `test -f 'fbshellman.cpp' || echo '$(srcdir)/'`fbshellman.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbshellman.Tpo $(DEPDIR)/fbterm-fbshellman.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbshellman.cpp' object='fbterm-fbshellman.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbshellman.o `test -f 'fbshellman.cpp' || echo '$(srcdir)/'`fbshellman.cpp + +fbterm-fbshellman.obj: fbshellman.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbshellman.obj -MD -MP -MF $(DEPDIR)/fbterm-fbshellman.Tpo -c -o fbterm-fbshellman.obj `if test -f 'fbshellman.cpp'; then $(CYGPATH_W) 'fbshellman.cpp'; else $(CYGPATH_W) '$(srcdir)/fbshellman.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbshellman.Tpo $(DEPDIR)/fbterm-fbshellman.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbshellman.cpp' object='fbterm-fbshellman.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbshellman.obj `if test -f 'fbshellman.cpp'; then $(CYGPATH_W) 'fbshellman.cpp'; else $(CYGPATH_W) '$(srcdir)/fbshellman.cpp'; fi` + +fbterm-fbterm.o: fbterm.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbterm.o -MD -MP -MF $(DEPDIR)/fbterm-fbterm.Tpo -c -o fbterm-fbterm.o `test -f 'fbterm.cpp' || echo '$(srcdir)/'`fbterm.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbterm.Tpo $(DEPDIR)/fbterm-fbterm.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbterm.cpp' object='fbterm-fbterm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbterm.o `test -f 'fbterm.cpp' || echo '$(srcdir)/'`fbterm.cpp + +fbterm-fbterm.obj: fbterm.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbterm.obj -MD -MP -MF $(DEPDIR)/fbterm-fbterm.Tpo -c -o fbterm-fbterm.obj `if test -f 'fbterm.cpp'; then $(CYGPATH_W) 'fbterm.cpp'; else $(CYGPATH_W) '$(srcdir)/fbterm.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbterm.Tpo $(DEPDIR)/fbterm-fbterm.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbterm.cpp' object='fbterm-fbterm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbterm.obj `if test -f 'fbterm.cpp'; then $(CYGPATH_W) 'fbterm.cpp'; else $(CYGPATH_W) '$(srcdir)/fbterm.cpp'; fi` + +fbterm-font.o: font.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-font.o -MD -MP -MF $(DEPDIR)/fbterm-font.Tpo -c -o fbterm-font.o `test -f 'font.cpp' || echo '$(srcdir)/'`font.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-font.Tpo $(DEPDIR)/fbterm-font.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='font.cpp' object='fbterm-font.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-font.o `test -f 'font.cpp' || echo '$(srcdir)/'`font.cpp + +fbterm-font.obj: font.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-font.obj -MD -MP -MF $(DEPDIR)/fbterm-font.Tpo -c -o fbterm-font.obj `if test -f 'font.cpp'; then $(CYGPATH_W) 'font.cpp'; else $(CYGPATH_W) '$(srcdir)/font.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-font.Tpo $(DEPDIR)/fbterm-font.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='font.cpp' object='fbterm-font.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-font.obj `if test -f 'font.cpp'; then $(CYGPATH_W) 'font.cpp'; else $(CYGPATH_W) '$(srcdir)/font.cpp'; fi` + +fbterm-input.o: input.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-input.o -MD -MP -MF $(DEPDIR)/fbterm-input.Tpo -c -o fbterm-input.o `test -f 'input.cpp' || echo '$(srcdir)/'`input.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-input.Tpo $(DEPDIR)/fbterm-input.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='input.cpp' object='fbterm-input.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-input.o `test -f 'input.cpp' || echo '$(srcdir)/'`input.cpp + +fbterm-input.obj: input.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-input.obj -MD -MP -MF $(DEPDIR)/fbterm-input.Tpo -c -o fbterm-input.obj `if test -f 'input.cpp'; then $(CYGPATH_W) 'input.cpp'; else $(CYGPATH_W) '$(srcdir)/input.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-input.Tpo $(DEPDIR)/fbterm-input.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='input.cpp' object='fbterm-input.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-input.obj `if test -f 'input.cpp'; then $(CYGPATH_W) 'input.cpp'; else $(CYGPATH_W) '$(srcdir)/input.cpp'; fi` + +fbterm-mouse.o: mouse.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-mouse.o -MD -MP -MF $(DEPDIR)/fbterm-mouse.Tpo -c -o fbterm-mouse.o `test -f 'mouse.cpp' || echo '$(srcdir)/'`mouse.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-mouse.Tpo $(DEPDIR)/fbterm-mouse.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mouse.cpp' object='fbterm-mouse.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-mouse.o `test -f 'mouse.cpp' || echo '$(srcdir)/'`mouse.cpp + +fbterm-mouse.obj: mouse.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-mouse.obj -MD -MP -MF $(DEPDIR)/fbterm-mouse.Tpo -c -o fbterm-mouse.obj `if test -f 'mouse.cpp'; then $(CYGPATH_W) 'mouse.cpp'; else $(CYGPATH_W) '$(srcdir)/mouse.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-mouse.Tpo $(DEPDIR)/fbterm-mouse.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mouse.cpp' object='fbterm-mouse.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-mouse.obj `if test -f 'mouse.cpp'; then $(CYGPATH_W) 'mouse.cpp'; else $(CYGPATH_W) '$(srcdir)/mouse.cpp'; fi` + +fbterm-screen.o: screen.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-screen.o -MD -MP -MF $(DEPDIR)/fbterm-screen.Tpo -c -o fbterm-screen.o `test -f 'screen.cpp' || echo '$(srcdir)/'`screen.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-screen.Tpo $(DEPDIR)/fbterm-screen.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screen.cpp' object='fbterm-screen.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-screen.o `test -f 'screen.cpp' || echo '$(srcdir)/'`screen.cpp + +fbterm-screen.obj: screen.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-screen.obj -MD -MP -MF $(DEPDIR)/fbterm-screen.Tpo -c -o fbterm-screen.obj `if test -f 'screen.cpp'; then $(CYGPATH_W) 'screen.cpp'; else $(CYGPATH_W) '$(srcdir)/screen.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-screen.Tpo $(DEPDIR)/fbterm-screen.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screen.cpp' object='fbterm-screen.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-screen.obj `if test -f 'screen.cpp'; then $(CYGPATH_W) 'screen.cpp'; else $(CYGPATH_W) '$(srcdir)/screen.cpp'; fi` + +fbterm-improxy.o: improxy.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-improxy.o -MD -MP -MF $(DEPDIR)/fbterm-improxy.Tpo -c -o fbterm-improxy.o `test -f 'improxy.cpp' || echo '$(srcdir)/'`improxy.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-improxy.Tpo $(DEPDIR)/fbterm-improxy.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='improxy.cpp' object='fbterm-improxy.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-improxy.o `test -f 'improxy.cpp' || echo '$(srcdir)/'`improxy.cpp + +fbterm-improxy.obj: improxy.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-improxy.obj -MD -MP -MF $(DEPDIR)/fbterm-improxy.Tpo -c -o fbterm-improxy.obj `if test -f 'improxy.cpp'; then $(CYGPATH_W) 'improxy.cpp'; else $(CYGPATH_W) '$(srcdir)/improxy.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-improxy.Tpo $(DEPDIR)/fbterm-improxy.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='improxy.cpp' object='fbterm-improxy.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-improxy.obj `if test -f 'improxy.cpp'; then $(CYGPATH_W) 'improxy.cpp'; else $(CYGPATH_W) '$(srcdir)/improxy.cpp'; fi` + +fbterm-screen_render.o: screen_render.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-screen_render.o -MD -MP -MF $(DEPDIR)/fbterm-screen_render.Tpo -c -o fbterm-screen_render.o `test -f 'screen_render.cpp' || echo '$(srcdir)/'`screen_render.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-screen_render.Tpo $(DEPDIR)/fbterm-screen_render.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screen_render.cpp' object='fbterm-screen_render.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-screen_render.o `test -f 'screen_render.cpp' || echo '$(srcdir)/'`screen_render.cpp + +fbterm-screen_render.obj: screen_render.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-screen_render.obj -MD -MP -MF $(DEPDIR)/fbterm-screen_render.Tpo -c -o fbterm-screen_render.obj `if test -f 'screen_render.cpp'; then $(CYGPATH_W) 'screen_render.cpp'; else $(CYGPATH_W) '$(srcdir)/screen_render.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-screen_render.Tpo $(DEPDIR)/fbterm-screen_render.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screen_render.cpp' object='fbterm-screen_render.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-screen_render.obj `if test -f 'screen_render.cpp'; then $(CYGPATH_W) 'screen_render.cpp'; else $(CYGPATH_W) '$(srcdir)/screen_render.cpp'; fi` + +fbterm-fbdev.o: fbdev.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbdev.o -MD -MP -MF $(DEPDIR)/fbterm-fbdev.Tpo -c -o fbterm-fbdev.o `test -f 'fbdev.cpp' || echo '$(srcdir)/'`fbdev.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbdev.Tpo $(DEPDIR)/fbterm-fbdev.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbdev.cpp' object='fbterm-fbdev.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbdev.o `test -f 'fbdev.cpp' || echo '$(srcdir)/'`fbdev.cpp + +fbterm-fbdev.obj: fbdev.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-fbdev.obj -MD -MP -MF $(DEPDIR)/fbterm-fbdev.Tpo -c -o fbterm-fbdev.obj `if test -f 'fbdev.cpp'; then $(CYGPATH_W) 'fbdev.cpp'; else $(CYGPATH_W) '$(srcdir)/fbdev.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-fbdev.Tpo $(DEPDIR)/fbterm-fbdev.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fbdev.cpp' object='fbterm-fbdev.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-fbdev.obj `if test -f 'fbdev.cpp'; then $(CYGPATH_W) 'fbdev.cpp'; else $(CYGPATH_W) '$(srcdir)/fbdev.cpp'; fi` + +fbterm-vesadev.o: vesadev.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-vesadev.o -MD -MP -MF $(DEPDIR)/fbterm-vesadev.Tpo -c -o fbterm-vesadev.o `test -f 'vesadev.cpp' || echo '$(srcdir)/'`vesadev.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-vesadev.Tpo $(DEPDIR)/fbterm-vesadev.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vesadev.cpp' object='fbterm-vesadev.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-vesadev.o `test -f 'vesadev.cpp' || echo '$(srcdir)/'`vesadev.cpp + +fbterm-vesadev.obj: vesadev.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -MT fbterm-vesadev.obj -MD -MP -MF $(DEPDIR)/fbterm-vesadev.Tpo -c -o fbterm-vesadev.obj `if test -f 'vesadev.cpp'; then $(CYGPATH_W) 'vesadev.cpp'; else $(CYGPATH_W) '$(srcdir)/vesadev.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/fbterm-vesadev.Tpo $(DEPDIR)/fbterm-vesadev.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vesadev.cpp' object='fbterm-vesadev.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fbterm_CXXFLAGS) $(CXXFLAGS) -c -o fbterm-vesadev.obj `if test -f 'vesadev.cpp'; then $(CYGPATH_W) 'vesadev.cpp'; else $(CYGPATH_W) '$(srcdir)/vesadev.cpp'; fi` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/fbconfig.cpp b/src/fbconfig.cpp new file mode 100644 index 0000000..14240b6 --- /dev/null +++ b/src/fbconfig.cpp @@ -0,0 +1,301 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <getopt.h> +#include <sys/stat.h> +#include "config.h" +#include "fbconfig.h" + +#define MAX_CONFIG_FILE_SIZE 10240 + +DEFINE_INSTANCE_DEFAULT(Config) + +Config::Config() +{ + mShellCommand = 0; + mConfigBuf = 0; + mConfigEntrys = 0; + + const s8 *home = getenv("HOME"); + if (!home) { + if (getuid()) return; + home = "/root"; + } + + s8 name[64]; + snprintf(name, sizeof(name), "%s/%s", home, ".fbtermrc"); + + checkConfigFile(name); + + struct stat cstat; + if (stat(name, &cstat) == -1) return; + if (cstat.st_size > MAX_CONFIG_FILE_SIZE) return; + + s32 fd = open(name, O_RDONLY); + if (fd == -1) return; + + mConfigBuf = new char[cstat.st_size + 1]; + mConfigBuf[cstat.st_size] = 0; + + s32 ret = read(fd, mConfigBuf, cstat.st_size); + close(fd); + + s8 *end, *start = mConfigBuf; + do { + end = strchr(start, '\n'); + if (end) *end = 0; + parseOption(start); + if (end) start = end + 1; + } while (end && *start); +} + +Config::~Config() +{ + if (mConfigBuf) delete[] mConfigBuf; + + OptionEntry *next, *cur = mConfigEntrys; + while (cur) { + next = cur->next; + delete cur; + cur = next; + } +} + +void Config::getOption(const s8 *key, s8 *val, u32 len) +{ + if (!val) return; + *val = 0; + + OptionEntry *entry = getEntry(key); + if (!entry || !entry->val) return; + + u32 val_len = strlen(entry->val); + if (--len > val_len) len = val_len; + memcpy(val, entry->val, len); + val[len] = 0; +} + +void Config::getOption(const s8 *key, u32 &val) +{ + OptionEntry *entry = getEntry(key); + if (!entry || !entry->val) return; + + s8 *tail; + s32 a = strtol(entry->val, &tail, 10); + + if (!*tail) val = a; +} + +void Config::getOption(const s8 *key, bool &val) +{ + OptionEntry *entry = getEntry(key); + if (!entry || !entry->val) return; + + if (!strcmp(entry->val, "yes")) val = true; + else if (!strcmp(entry->val, "no")) val = false; +} + +Config::OptionEntry *Config::getEntry(const s8 *key) +{ + if (!key) return 0; + + OptionEntry *entry = mConfigEntrys; + while (entry) { + if (!strcmp(key, entry->key)) break; + entry = entry->next; + } + + return entry; +} + +void Config::addEntry(const s8 *key, const s8 *val) +{ + OptionEntry *entry = new OptionEntry; + entry->key = key; + entry->val = val; + entry->next = mConfigEntrys; + mConfigEntrys = entry; +} + +void Config::parseOption(s8 *str) +{ + s8 *cur = str, *end = str + strlen(str) - 1; + while (*cur == ' ') cur++; + + if (!*cur || *cur == '#') return; + + s8 *key = cur; + while (*cur && *cur != '=') cur++; + if (!*cur) return; + *cur = 0; + + s8 *val = ++cur; + cur = end; + while (*cur == ' ') cur--; + if (cur < val) return; + *(cur + 1) = 0; + + addEntry(key, val); +} + +void Config::checkConfigFile(const s8 *name) +{ + static const s8 defaultConfig[] = + "# Configuration for FbTerm\n" + "\n" + "# Lines starting with '#' are ignored.\n" + "# Note that end-of-line comments are NOT supported, comments must be on a line of their own.\n" + "\n\n" + "# font family names/pixelsize used by fbterm, multiple font family names must be seperated by ','\n" + "# and using a fixed width font as the first is strongly recommended\n" + "font-names=mono\n" + "font-size=12\n" + "\n" + "# force font width (and/or height), usually for non-fixed width fonts\n" + "# legal value format: n (fw_new = n), +n (fw_new = fw_old + n), -n (fw_new = fw_old - n)\n" + "#font-width=\n" + "#font-height=\n" + "\n" + "# default color of foreground/background text\n" + "# available colors: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white\n" + "color-foreground=7\n" + "color-background=0\n" + "\n" + "# max scroll-back history lines of every window, value must be [0 - 65535], 0 means disable it\n" + "history-lines=1000\n" + "\n" + "# up to 5 additional text encodings, multiple encodings must be seperated by ','\n" + "# run 'iconv --list' to get available encodings.\n" + "text-encodings=\n" + "\n" + "# cursor shape: 0 = underline, 1 = block\n" + "# cursor flash interval in milliseconds, 0 means disable flashing\n" + "cursor-shape=0\n" + "cursor-interval=500\n" + "\n" + "# additional ascii chars considered as part of a word while auto-selecting text, except ' ', 0-9, a-z, A-Z\n" + "word-chars=._-\n" + "\n" + "# change the clockwise orientation angle of screen display\n" + "# available values: 0 = 0 degree, 1 = 90 degrees, 2 = 180 degrees, 3 = 270 degrees\n" + "screen-rotate=0\n" + "\n" + "# specify the favorite input method program to run\n" + "input-method=\n" + "\n" + "# treat ambiguous width characters as wide\n" + "#ambiguous-wide=yes\n" + ; + + struct stat cstat; + if (stat(name, &cstat) != -1) return; + + s32 fd = open(name, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if (fd == -1) return; + + s32 ret = write(fd, defaultConfig, sizeof(defaultConfig) - 1); + close(fd); +} + +bool Config::parseArgs(s32 argc, s8 **argv) +{ + static const option options[] = { + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'V' }, + { "verbose", no_argument, 0, 'v' }, + { "font-names", required_argument, 0, 'n' }, + { "font-size", required_argument, 0, 's' }, + { "color-foreground", required_argument, 0, 'f' }, + { "color-background", required_argument, 0, 'b' }, + { "text-encodings", required_argument, 0, 'e' }, + { "screen-rotate", required_argument, 0, 'r' }, + { "input-method", required_argument, 0, 'i' }, + { "cursor-shape", required_argument, 0, 0 }, + { "cursor-interval", required_argument, 0, 1 }, + { "font-width", required_argument, 0, 2 }, + { "font-height", required_argument, 0, 4 }, + { "ambiguous-wide", no_argument, 0, 'a' }, +#ifdef ENABLE_VESA + { "vesa-mode", required_argument, 0, 3 }, +#endif + { 0, 0, 0, 0 } + }; + + s32 index; + while ((index = getopt_long(argc, argv, "Vvhn:s:f:b:e:r:i:a", options, 0)) != -1) { + switch (index) { + case 'V': + printf("FbTerm version " VERSION "\n"); + return false; + + case 'h': + case '?': + printf( + "Usage: fbterm [options] [--] [command [arguments]]\n" + "A fast framebuffer/vesa based terminal emulator for linux\n" + "\n" + " -h, --help display this help and exit\n" + " -V, --version display FbTerm version and exit\n" + " -v, --verbose display extra information\n" + " -n, --font-names=TEXT specify font family names\n" + " -s, --font-size=NUM specify font pixel size\n" + " --font-width=NUM force font width\n" + " --font-height=NUM force font height\n" + " -f, --color-foreground=NUM specify foreground color\n" + " -b, --color-background=NUM specify background color\n" + " -e, --text-encodings=TEXT specify additional text encodings\n" + " -r, --screen-rotate=NUM specify orientation of screen display\n" + " -a, --ambiguous-wide treat ambiguous width characters as wide\n" + " -i, --input-method=TEXT specify input method program\n" + " --cursor-shape=NUM specify default cursor shape\n" + " --cursor-interval=NUM specify cursor flash interval\n" +#ifdef ENABLE_VESA + " --vesa-mode=NUM force VESA video mode\n" + " list display available VESA video modes\n" +#endif + "\n" + "See comments in ~/.fbtermrc for details of these options.\n" + ); + return false; + + default: + for (const option *opt = options; opt->name; opt++) { + if (opt->val != index) continue; + + const s8 *val = (opt->has_arg ? optarg : "yes"); + OptionEntry *entry = getEntry(opt->name); + + if (entry) entry->val = val; + else addEntry(opt->name, val); + + break; + } + break; + } + } + + if (argv[optind]) mShellCommand = argv + optind; + return true; +} diff --git a/src/fbconfig.h b/src/fbconfig.h new file mode 100644 index 0000000..6051002 --- /dev/null +++ b/src/fbconfig.h @@ -0,0 +1,54 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 CONFIG_H +#define CONFIG_H + +#include "type.h" +#include "instance.h" + +class Config { + DECLARE_INSTANCE(Config) +public: + void getOption(const s8 *key, s8 *val, u32 len); + void getOption(const s8 *key, u32 &val); + void getOption(const s8 *key, bool &val); + bool parseArgs(s32 argc, s8 **argv); + s8** getShellCommand() { return mShellCommand; } + +private: + void checkConfigFile(const s8 *name); + void parseOption(s8 *str); + void addEntry(const s8 *key, const s8 *val); + + struct OptionEntry { + const s8 *key; + const s8 *val; + OptionEntry *next; + }; + + OptionEntry *getEntry(const s8 *key); + + s8 *mConfigBuf; + OptionEntry *mConfigEntrys; + s8 **mShellCommand; +}; + +#endif diff --git a/src/fbdev.cpp b/src/fbdev.cpp new file mode 100644 index 0000000..a9b6b90 --- /dev/null +++ b/src/fbdev.cpp @@ -0,0 +1,208 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include <linux/kd.h> +#include <linux/fb.h> +#include "fbdev.h" +#include "font.h" + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +static fb_fix_screeninfo finfo; +static fb_var_screeninfo vinfo; + +static s32 fbdev_fd; + +FbDev *FbDev::initFbDev() +{ + s8 *fbdev = getenv("FRAMEBUFFER"); + + if (fbdev) { + fbdev_fd = open(fbdev, O_RDWR); + } else { + fbdev_fd = open("/dev/fb0", O_RDWR); + if (fbdev_fd < 0) fbdev_fd = open("/dev/fb/0", O_RDWR); + } + + if (fbdev_fd < 0) { + fprintf(stderr, "can't open frame buffer device!\n"); + return 0; + } + + fcntl(fbdev_fd, F_SETFD, fcntl(fbdev_fd, F_GETFD) | FD_CLOEXEC); + ioctl(fbdev_fd, FBIOGET_FSCREENINFO, &finfo); + ioctl(fbdev_fd, FBIOGET_VSCREENINFO, &vinfo); + + if (finfo.type != FB_TYPE_PACKED_PIXELS) { + fprintf(stderr, "unsupported frame buffer device!\n"); + return 0; + } + + switch (vinfo.bits_per_pixel) { + case 8: + if (finfo.visual != FB_VISUAL_PSEUDOCOLOR) { + fprintf(stderr, "only support pseudo-color visual with 8bpp depth!\n"); + return 0; + } + break; + + case 15: + case 16: + case 32: + if (finfo.visual != FB_VISUAL_TRUECOLOR && finfo.visual != FB_VISUAL_DIRECTCOLOR) { + fprintf(stderr, "only support true-color/direct-color visual with 15/16/32bpp depth!\n"); + return 0; + } + break; + + default: + fprintf(stderr, "only support frame buffer device with 8/15/16/32 color depth!\n"); + return 0; + } + + return new FbDev(); +} + +FbDev::FbDev() +{ + mWidth = vinfo.xres; + mHeight = vinfo.yres; + mBitsPerPixel = vinfo.bits_per_pixel; + mBytesPerLine = finfo.line_length; + mVMemBase = (u8 *)mmap(0, finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbdev_fd, 0); + + + if (mRotateType == Rotate0 || mRotateType == Rotate180) { + bool ypan = (vinfo.yres_virtual > vinfo.yres && finfo.ypanstep && !(FH(1) % finfo.ypanstep)); + bool ywrap = (finfo.ywrapstep && !(FH(1) % finfo.ywrapstep)); + if (ywrap && !(vinfo.vmode & FB_VMODE_YWRAP)) { + vinfo.vmode |= FB_VMODE_YWRAP; + ioctl(fbdev_fd, FBIOPUT_VSCREENINFO, &vinfo); + ywrap = (vinfo.vmode & FB_VMODE_YWRAP); + } + + if ((ypan || ywrap) && !ioctl(fbdev_fd, FBIOPAN_DISPLAY, &vinfo)) { + if (ywrap) { + mScrollType = YWrap; + mOffsetMax = vinfo.yres_virtual - 1; + } else { + mScrollType = YPan; + mOffsetMax = vinfo.yres_virtual - vinfo.yres; + } + } + } +} + +FbDev::~FbDev() +{ + munmap(mVMemBase, finfo.smem_len); + close(fbdev_fd); + + if (mScrollType != Redraw) { + ioctl(STDIN_FILENO, KDSETMODE, KD_GRAPHICS); + ioctl(STDIN_FILENO, KDSETMODE, KD_TEXT); + } +} + +const s8 *FbDev::drvId() +{ + return finfo.id; +} + +void FbDev::setupOffset() +{ + vinfo.yoffset = mOffsetCur; + ioctl(fbdev_fd, FBIOPAN_DISPLAY, &vinfo); +} + +void FbDev::setupPalette(bool restore) +{ + if (finfo.visual == FB_VISUAL_TRUECOLOR || (!restore && !mPalette)) return; + + static bool palette_saved = false; + static u16 saved_red[256], saved_green[256], saved_blue[256]; + u32 cols, rcols, gcols, bcols; + fb_cmap cmap; + + #define INIT_CMAP(_red, _green, _blue) \ + do { \ + cmap.start = 0; \ + cmap.len = cols; \ + cmap.red = _red; \ + cmap.green = _green; \ + cmap.blue = _blue; \ + cmap.transp = 0; \ + } while (0) + + if (finfo.visual == FB_VISUAL_PSEUDOCOLOR) cols = NR_COLORS; + else { + rcols = 1 << vinfo.red.length; + gcols = 1 << vinfo.green.length; + bcols = 1 << vinfo.blue.length; + + cols = MAX(rcols, MAX(gcols, bcols)); + } + + if (restore) { + if (!palette_saved) return; + + INIT_CMAP(saved_red, saved_green, saved_blue); + ioctl(fbdev_fd, FBIOPUTCMAP, &cmap); + } else { + if (!palette_saved) { + palette_saved = true; + + INIT_CMAP(saved_red, saved_green, saved_blue); + ioctl(fbdev_fd, FBIOGETCMAP, &cmap); + } + + u16 red[cols], green[cols], blue[cols]; + + if (finfo.visual == FB_VISUAL_PSEUDOCOLOR) { + for (u32 i = 0; i < NR_COLORS; i++) { + red[i] = (mPalette[i].red << 8) | mPalette[i].red; + green[i] = (mPalette[i].green << 8) | mPalette[i].green; + blue[i] = (mPalette[i].blue << 8) | mPalette[i].blue; + } + } else { + for (u32 i = 0; i < rcols; i++) { + red[i] = (65535 / (rcols - 1)) * i; + } + + for (u32 i = 0; i < gcols; i++) { + green[i] = (65535 / (gcols - 1)) * i; + } + + for (u32 i = 0; i < bcols; i++) { + blue[i] = (65535 / (bcols - 1)) * i; + } + } + + INIT_CMAP(red, green, blue); + ioctl(fbdev_fd, FBIOPUTCMAP, &cmap); + } +} diff --git a/src/fbdev.h b/src/fbdev.h new file mode 100644 index 0000000..df7536d --- /dev/null +++ b/src/fbdev.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FBDEV_H +#define FBDEV_H + +#include "screen.h" + +class FbDev : public Screen { +private: + friend class Screen; + static FbDev *initFbDev(); + + FbDev(); + ~FbDev(); + + virtual void setupOffset(); + virtual void setupPalette(bool restore); + virtual const s8 *drvId(); +}; +#endif diff --git a/src/fbio.cpp b/src/fbio.cpp new file mode 100644 index 0000000..e5afc44 --- /dev/null +++ b/src/fbio.cpp @@ -0,0 +1,132 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <fcntl.h> +#include "config.h" +#include "fbio.h" + +#define NR_FDS 32 + +#ifdef HAVE_EPOLL +#include <sys/epoll.h> +#define NR_EPOLL_FDS 10 +s32 epollFd; +#else +static fd_set fds; +static u32 maxfd = 0; +#endif + +static IoPipe *ioPipeMap[NR_FDS]; + +IoDispatcher *IoDispatcher::createInstance() +{ + return new FbIoDispatcher(); +} + +FbIoDispatcher::FbIoDispatcher() +{ +#ifdef HAVE_EPOLL + epollFd = epoll_create(NR_EPOLL_FDS); + fcntl(epollFd, F_SETFD, fcntl(epollFd, F_GETFD) | FD_CLOEXEC); +#else + FD_ZERO(&fds); +#endif +} + +FbIoDispatcher::~FbIoDispatcher() +{ + for (u32 i = NR_FDS; i--;) { + if (ioPipeMap[i]) delete ioPipeMap[i]; + } + +#ifdef HAVE_EPOLL + close(epollFd); +#endif +} + +void FbIoDispatcher::addIoSource(IoPipe *src, bool isread) +{ + if (src->fd() >= NR_FDS) return; + ioPipeMap[src->fd()] = src; + +#ifdef HAVE_EPOLL + epoll_event ev; + ev.data.fd = src->fd(); + ev.events = (isread ? EPOLLIN : EPOLLOUT); + epoll_ctl(epollFd, EPOLL_CTL_ADD, src->fd(), &ev); +#else + FD_SET(src->fd(), &fds); + if (src->fd() > maxfd) maxfd = src->fd(); +#endif +} + +void FbIoDispatcher::removeIoSource(IoPipe *src, bool isread) +{ + if (src->fd() >= NR_FDS) return; + ioPipeMap[src->fd()] = 0; + +#ifdef HAVE_EPOLL + epoll_event ev; + ev.data.fd = src->fd(); + ev.events = (isread ? EPOLLIN : EPOLLOUT); + epoll_ctl(epollFd, EPOLL_CTL_DEL, src->fd(), &ev); +#else + FD_CLR(src->fd(), &fds); +#endif +} + +void FbIoDispatcher::poll() +{ +#ifdef HAVE_EPOLL + epoll_event evs[NR_EPOLL_FDS]; + s32 nfds = epoll_wait(epollFd, evs, NR_EPOLL_FDS, -1); + + for (s32 i = 0; i < nfds; i++) { + IoPipe *src = ioPipeMap[evs[i].data.fd]; + if (!src) continue; + + if (evs[i].events & EPOLLIN) { + src->ready(true); + } + + if (evs[i].events & EPOLLOUT) { + src->ready(false); + } + + if (evs[i].events & EPOLLHUP) { + delete src; + } + } +#else + fd_set rfds = fds; + s32 num = select(maxfd + 1, &rfds, 0, 0, 0); + if (num <= 0) return; + + for (u32 i = 0; i <= maxfd; i++) { + if (FD_ISSET(i, &rfds)) { + if (ioPipeMap[i]) { + ioPipeMap[i]->ready(true); + } + if (!--num) break; + } + } +#endif +} diff --git a/src/fbio.h b/src/fbio.h new file mode 100644 index 0000000..e962ba5 --- /dev/null +++ b/src/fbio.h @@ -0,0 +1,39 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FBIO_H +#define FBIO_H + +#include "io.h" + +class FbIoDispatcher : public IoDispatcher { +public: + void poll(); + +private: + friend class IoDispatcher; + FbIoDispatcher(); + ~FbIoDispatcher(); + + virtual void addIoSource(IoPipe *src, bool isread); + virtual void removeIoSource(IoPipe *src, bool isread); +}; + +#endif diff --git a/src/fbshell.cpp b/src/fbshell.cpp new file mode 100644 index 0000000..bce28c7 --- /dev/null +++ b/src/fbshell.cpp @@ -0,0 +1,773 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <signal.h> +#include <termios.h> +#include <fcntl.h> +#include <sys/time.h> +#include <sys/ioctl.h> +#include "fbshell.h" +#include "fbshellman.h" +#include "fbconfig.h" +#include "screen.h" +#include "improxy.h" +#include "fbterm.h" +#include "font.h" +#include "input.h" + +#define screen (Screen::instance()) +#define manager (FbShellManager::instance()) + +static const Color defaultPalette[NR_COLORS] = { + {0x00, 0x00, 0x00}, /* 0 */ + {0xaa, 0x00, 0x00}, /* 1 */ + {0x00, 0xaa, 0x00}, /* 2 */ + {0xaa, 0x55, 0x00}, /* 3 */ + {0x00, 0x00, 0xaa}, /* 4 */ + {0xaa, 0x00, 0xaa}, /* 5 */ + {0x00, 0xaa, 0xaa}, /* 6 */ + {0xaa, 0xaa, 0xaa}, /* 7 */ + {0x55, 0x55, 0x55}, /* 8 */ + {0xff, 0x55, 0x55}, /* 9 */ + {0x55, 0xff, 0x55}, /* 10 */ + {0xff, 0xff, 0x55}, /* 11 */ + {0x55, 0x55, 0xff}, /* 12 */ + {0xff, 0x55, 0xff}, /* 13 */ + {0x55, 0xff, 0xff}, /* 14 */ + {0xff, 0xff, 0xff}, /* 15 */ + + {0x00, 0x00, 0x00}, /* 16 */ + {0x00, 0x00, 0x5f}, /* 17 */ + {0x00, 0x00, 0x87}, /* 18 */ + {0x00, 0x00, 0xaf}, /* 19 */ + {0x00, 0x00, 0xd7}, /* 20 */ + {0x00, 0x00, 0xff}, /* 21 */ + {0x00, 0x5f, 0x00}, /* 22 */ + {0x00, 0x5f, 0x5f}, /* 23 */ + {0x00, 0x5f, 0x87}, /* 24 */ + {0x00, 0x5f, 0xaf}, /* 25 */ + {0x00, 0x5f, 0xd7}, /* 26 */ + {0x00, 0x5f, 0xff}, /* 27 */ + {0x00, 0x87, 0x00}, /* 28 */ + {0x00, 0x87, 0x5f}, /* 29 */ + {0x00, 0x87, 0x87}, /* 30 */ + {0x00, 0x87, 0xaf}, /* 31 */ + {0x00, 0x87, 0xd7}, /* 32 */ + {0x00, 0x87, 0xff}, /* 33 */ + {0x00, 0xaf, 0x00}, /* 34 */ + {0x00, 0xaf, 0x5f}, /* 35 */ + {0x00, 0xaf, 0x87}, /* 36 */ + {0x00, 0xaf, 0xaf}, /* 37 */ + {0x00, 0xaf, 0xd7}, /* 38 */ + {0x00, 0xaf, 0xff}, /* 39 */ + {0x00, 0xd7, 0x00}, /* 40 */ + {0x00, 0xd7, 0x5f}, /* 41 */ + {0x00, 0xd7, 0x87}, /* 42 */ + {0x00, 0xd7, 0xaf}, /* 43 */ + {0x00, 0xd7, 0xd7}, /* 44 */ + {0x00, 0xd7, 0xff}, /* 45 */ + {0x00, 0xff, 0x00}, /* 46 */ + {0x00, 0xff, 0x5f}, /* 47 */ + {0x00, 0xff, 0x87}, /* 48 */ + {0x00, 0xff, 0xaf}, /* 49 */ + {0x00, 0xff, 0xd7}, /* 50 */ + {0x00, 0xff, 0xff}, /* 51 */ + + {0x5f, 0x00, 0x00}, /* 52 */ + {0x5f, 0x00, 0x5f}, /* 53 */ + {0x5f, 0x00, 0x87}, /* 54 */ + {0x5f, 0x00, 0xaf}, /* 55 */ + {0x5f, 0x00, 0xd7}, /* 56 */ + {0x5f, 0x00, 0xff}, /* 57 */ + {0x5f, 0x5f, 0x00}, /* 58 */ + {0x5f, 0x5f, 0x5f}, /* 59 */ + {0x5f, 0x5f, 0x87}, /* 60 */ + {0x5f, 0x5f, 0xaf}, /* 61 */ + {0x5f, 0x5f, 0xd7}, /* 62 */ + {0x5f, 0x5f, 0xff}, /* 63 */ + {0x5f, 0x87, 0x00}, /* 64 */ + {0x5f, 0x87, 0x5f}, /* 65 */ + {0x5f, 0x87, 0x87}, /* 66 */ + {0x5f, 0x87, 0xaf}, /* 67 */ + {0x5f, 0x87, 0xd7}, /* 68 */ + {0x5f, 0x87, 0xff}, /* 69 */ + {0x5f, 0xaf, 0x00}, /* 70 */ + {0x5f, 0xaf, 0x5f}, /* 71 */ + {0x5f, 0xaf, 0x87}, /* 72 */ + {0x5f, 0xaf, 0xaf}, /* 73 */ + {0x5f, 0xaf, 0xd7}, /* 74 */ + {0x5f, 0xaf, 0xff}, /* 75 */ + {0x5f, 0xd7, 0x00}, /* 76 */ + {0x5f, 0xd7, 0x5f}, /* 77 */ + {0x5f, 0xd7, 0x87}, /* 78 */ + {0x5f, 0xd7, 0xaf}, /* 79 */ + {0x5f, 0xd7, 0xd7}, /* 80 */ + {0x5f, 0xd7, 0xff}, /* 81 */ + {0x5f, 0xff, 0x00}, /* 82 */ + {0x5f, 0xff, 0x5f}, /* 83 */ + {0x5f, 0xff, 0x87}, /* 84 */ + {0x5f, 0xff, 0xaf}, /* 85 */ + {0x5f, 0xff, 0xd7}, /* 86 */ + {0x5f, 0xff, 0xff}, /* 87 */ + + {0x87, 0x00, 0x00}, /* 88 */ + {0x87, 0x00, 0x5f}, /* 89 */ + {0x87, 0x00, 0x87}, /* 90 */ + {0x87, 0x00, 0xaf}, /* 91 */ + {0x87, 0x00, 0xd7}, /* 92 */ + {0x87, 0x00, 0xff}, /* 93 */ + {0x87, 0x5f, 0x00}, /* 94 */ + {0x87, 0x5f, 0x5f}, /* 95 */ + {0x87, 0x5f, 0x87}, /* 96 */ + {0x87, 0x5f, 0xaf}, /* 97 */ + {0x87, 0x5f, 0xd7}, /* 98 */ + {0x87, 0x5f, 0xff}, /* 99 */ + {0x87, 0x87, 0x00}, /* 100 */ + {0x87, 0x87, 0x5f}, /* 101 */ + {0x87, 0x87, 0x87}, /* 102 */ + {0x87, 0x87, 0xaf}, /* 103 */ + {0x87, 0x87, 0xd7}, /* 104 */ + {0x87, 0x87, 0xff}, /* 105 */ + {0x87, 0xaf, 0x00}, /* 106 */ + {0x87, 0xaf, 0x5f}, /* 107 */ + {0x87, 0xaf, 0x87}, /* 108 */ + {0x87, 0xaf, 0xaf}, /* 109 */ + {0x87, 0xaf, 0xd7}, /* 110 */ + {0x87, 0xaf, 0xff}, /* 111 */ + {0x87, 0xd7, 0x00}, /* 112 */ + {0x87, 0xd7, 0x5f}, /* 113 */ + {0x87, 0xd7, 0x87}, /* 114 */ + {0x87, 0xd7, 0xaf}, /* 115 */ + {0x87, 0xd7, 0xd7}, /* 116 */ + {0x87, 0xd7, 0xff}, /* 117 */ + {0x87, 0xff, 0x00}, /* 118 */ + {0x87, 0xff, 0x5f}, /* 119 */ + {0x87, 0xff, 0x87}, /* 120 */ + {0x87, 0xff, 0xaf}, /* 121 */ + {0x87, 0xff, 0xd7}, /* 122 */ + {0x87, 0xff, 0xff}, /* 123 */ + + {0xaf, 0x00, 0x00}, /* 124 */ + {0xaf, 0x00, 0x5f}, /* 125 */ + {0xaf, 0x00, 0x87}, /* 126 */ + {0xaf, 0x00, 0xaf}, /* 127 */ + {0xaf, 0x00, 0xd7}, /* 128 */ + {0xaf, 0x00, 0xff}, /* 129 */ + {0xaf, 0x5f, 0x00}, /* 130 */ + {0xaf, 0x5f, 0x5f}, /* 131 */ + {0xaf, 0x5f, 0x87}, /* 132 */ + {0xaf, 0x5f, 0xaf}, /* 133 */ + {0xaf, 0x5f, 0xd7}, /* 134 */ + {0xaf, 0x5f, 0xff}, /* 135 */ + {0xaf, 0x87, 0x00}, /* 136 */ + {0xaf, 0x87, 0x5f}, /* 137 */ + {0xaf, 0x87, 0x87}, /* 138 */ + {0xaf, 0x87, 0xaf}, /* 139 */ + {0xaf, 0x87, 0xd7}, /* 140 */ + {0xaf, 0x87, 0xff}, /* 141 */ + {0xaf, 0xaf, 0x00}, /* 142 */ + {0xaf, 0xaf, 0x5f}, /* 143 */ + {0xaf, 0xaf, 0x87}, /* 144 */ + {0xaf, 0xaf, 0xaf}, /* 145 */ + {0xaf, 0xaf, 0xd7}, /* 146 */ + {0xaf, 0xaf, 0xff}, /* 147 */ + {0xaf, 0xd7, 0x00}, /* 148 */ + {0xaf, 0xd7, 0x5f}, /* 149 */ + {0xaf, 0xd7, 0x87}, /* 150 */ + {0xaf, 0xd7, 0xaf}, /* 151 */ + {0xaf, 0xd7, 0xd7}, /* 152 */ + {0xaf, 0xd7, 0xff}, /* 153 */ + {0xaf, 0xff, 0x00}, /* 154 */ + {0xaf, 0xff, 0x5f}, /* 155 */ + {0xaf, 0xff, 0x87}, /* 156 */ + {0xaf, 0xff, 0xaf}, /* 157 */ + {0xaf, 0xff, 0xd7}, /* 158 */ + {0xaf, 0xff, 0xff}, /* 159 */ + + {0xd7, 0x00, 0x00}, /* 160 */ + {0xd7, 0x00, 0x5f}, /* 161 */ + {0xd7, 0x00, 0x87}, /* 162 */ + {0xd7, 0x00, 0xaf}, /* 163 */ + {0xd7, 0x00, 0xd7}, /* 164 */ + {0xd7, 0x00, 0xff}, /* 165 */ + {0xd7, 0x5f, 0x00}, /* 166 */ + {0xd7, 0x5f, 0x5f}, /* 167 */ + {0xd7, 0x5f, 0x87}, /* 168 */ + {0xd7, 0x5f, 0xaf}, /* 169 */ + {0xd7, 0x5f, 0xd7}, /* 170 */ + {0xd7, 0x5f, 0xff}, /* 171 */ + {0xd7, 0x87, 0x00}, /* 172 */ + {0xd7, 0x87, 0x5f}, /* 173 */ + {0xd7, 0x87, 0x87}, /* 174 */ + {0xd7, 0x87, 0xaf}, /* 175 */ + {0xd7, 0x87, 0xd7}, /* 176 */ + {0xd7, 0x87, 0xff}, /* 177 */ + {0xd7, 0xaf, 0x00}, /* 178 */ + {0xd7, 0xaf, 0x5f}, /* 179 */ + {0xd7, 0xaf, 0x87}, /* 180 */ + {0xd7, 0xaf, 0xaf}, /* 181 */ + {0xd7, 0xaf, 0xd7}, /* 182 */ + {0xd7, 0xaf, 0xff}, /* 183 */ + {0xd7, 0xd7, 0x00}, /* 184 */ + {0xd7, 0xd7, 0x5f}, /* 185 */ + {0xd7, 0xd7, 0x87}, /* 186 */ + {0xd7, 0xd7, 0xaf}, /* 187 */ + {0xd7, 0xd7, 0xd7}, /* 188 */ + {0xd7, 0xd7, 0xff}, /* 189 */ + {0xd7, 0xff, 0x00}, /* 190 */ + {0xd7, 0xff, 0x5f}, /* 191 */ + {0xd7, 0xff, 0x87}, /* 192 */ + {0xd7, 0xff, 0xaf}, /* 193 */ + {0xd7, 0xff, 0xd7}, /* 194 */ + {0xd7, 0xff, 0xff}, /* 195 */ + + {0xff, 0x00, 0x00}, /* 196 */ + {0xff, 0x00, 0x5f}, /* 197 */ + {0xff, 0x00, 0x87}, /* 198 */ + {0xff, 0x00, 0xaf}, /* 199 */ + {0xff, 0x00, 0xd7}, /* 200 */ + {0xff, 0x00, 0xff}, /* 201 */ + {0xff, 0x5f, 0x00}, /* 202 */ + {0xff, 0x5f, 0x5f}, /* 203 */ + {0xff, 0x5f, 0x87}, /* 204 */ + {0xff, 0x5f, 0xaf}, /* 205 */ + {0xff, 0x5f, 0xd7}, /* 206 */ + {0xff, 0x5f, 0xff}, /* 207 */ + {0xff, 0x87, 0x00}, /* 208 */ + {0xff, 0x87, 0x5f}, /* 209 */ + {0xff, 0x87, 0x87}, /* 210 */ + {0xff, 0x87, 0xaf}, /* 211 */ + {0xff, 0x87, 0xd7}, /* 212 */ + {0xff, 0x87, 0xff}, /* 213 */ + {0xff, 0xaf, 0x00}, /* 214 */ + {0xff, 0xaf, 0x5f}, /* 215 */ + {0xff, 0xaf, 0x87}, /* 216 */ + {0xff, 0xaf, 0xaf}, /* 217 */ + {0xff, 0xaf, 0xd7}, /* 218 */ + {0xff, 0xaf, 0xff}, /* 219 */ + {0xff, 0xd7, 0x00}, /* 220 */ + {0xff, 0xd7, 0x5f}, /* 221 */ + {0xff, 0xd7, 0x87}, /* 222 */ + {0xff, 0xd7, 0xaf}, /* 223 */ + {0xff, 0xd7, 0xd7}, /* 224 */ + {0xff, 0xd7, 0xff}, /* 225 */ + {0xff, 0xff, 0x00}, /* 226 */ + {0xff, 0xff, 0x5f}, /* 227 */ + {0xff, 0xff, 0x87}, /* 228 */ + {0xff, 0xff, 0xaf}, /* 229 */ + {0xff, 0xff, 0xd7}, /* 230 */ + {0xff, 0xff, 0xff}, /* 231 */ + + {0x08, 0x08, 0x08}, /* 232 */ + {0x12, 0x12, 0x12}, /* 233 */ + {0x1c, 0x1c, 0x1c}, /* 234 */ + {0x26, 0x26, 0x26}, /* 235 */ + {0x30, 0x30, 0x30}, /* 236 */ + {0x3a, 0x3a, 0x3a}, /* 237 */ + {0x44, 0x44, 0x44}, /* 238 */ + {0x4e, 0x4e, 0x4e}, /* 239 */ + {0x58, 0x58, 0x58}, /* 240 */ + {0x62, 0x62, 0x62}, /* 241 */ + {0x6c, 0x6c, 0x6c}, /* 242 */ + {0x76, 0x76, 0x76}, /* 243 */ + {0x80, 0x80, 0x80}, /* 244 */ + {0x8a, 0x8a, 0x8a}, /* 245 */ + {0x94, 0x94, 0x94}, /* 246 */ + {0x9e, 0x9e, 0x9e}, /* 247 */ + {0xa8, 0xa8, 0xa8}, /* 248 */ + {0xb2, 0xb2, 0xb2}, /* 249 */ + {0xbc, 0xbc, 0xbc}, /* 250 */ + {0xc6, 0xc6, 0xc6}, /* 251 */ + {0xd0, 0xd0, 0xd0}, /* 252 */ + {0xda, 0xda, 0xda}, /* 253 */ + {0xe4, 0xe4, 0xe4}, /* 254 */ + {0xee, 0xee, 0xee}, /* 255 */ +}; + +static bool firstShell = true; + +u16 VTerm::init_history_lines() +{ + u32 val = 1000; + Config::instance()->getOption("history-lines", val); + if (val > 65535) val = 65535; + return val; +} + +u8 VTerm::init_default_color(bool foreground) +{ + u32 color; + + if (foreground) { + color = 7; + Config::instance()->getOption("color-foreground", color); + if (color > 7) color = 7; + } else { + color = 0; + Config::instance()->getOption("color-background", color); + if (color > 7) color = 0; + } + + return color; +} + +bool VTerm::init_ambiguous_wide() +{ + bool val = false; + Config::instance()->getOption("ambiguous-wide", val); + return val; +} + +void Shell::initWordChars(s8 *buf, u32 len) +{ + Config::instance()->getOption("word-chars", buf, len); +} + +FbShell::FbShell() +{ + mImProxy = 0; + mPaletteChanged = false; + mPalette = 0; + createShellProcess(Config::instance()->getShellCommand()); + resize(screen->cols(), screen->rows()); + + firstShell = false; +} + +FbShell::~FbShell() +{ + if (mImProxy) delete mImProxy; + + manager->shellExited(this); + if (mPalette) delete[] mPalette; +} + +void FbShell::drawChars(CharAttr attr, u16 x, u16 y, u16 w, u16 num, u16 *chars, bool *dws) +{ + if (manager->activeShell() != this) return; + + adjustCharAttr(attr); + screen->drawText(FW(x), FH(y), attr.fcolor, attr.bcolor, num, chars, dws); + + if (mImProxy) { + Rectangle rect = { FW(x), FH(y), FW(w), FH(1) }; + mImProxy->redrawImWin(rect); + } +} + +bool FbShell::moveChars(u16 sx, u16 sy, u16 dx, u16 dy, u16 w, u16 h) +{ + if (manager->activeShell() != this) return true; + return screen->move(sx, sy, dx, dy, w, h); +} + +void FbShell::drawCursor(CharAttr attr, u16 x, u16 y, u16 c) +{ + u16 oldX = mCursor.x, oldY = mCursor.y; + + adjustCharAttr(attr); + mCursor.attr = attr; + mCursor.x = x; + mCursor.y = y; + mCursor.code = c; + mCursor.showed = false; + + updateCursor(); + + if (manager->activeShell() == this && (oldX != x || oldY != y)) { + reportCursor(); + } +} + +void FbShell::updateCursor() +{ + if (manager->activeShell() != this || mCursor.x >= w() || mCursor.y >= h()) return; + mCursor.showed ^= true; + + u16 shape = mode(CursorShape); + if (shape == CurDefault) { + static bool inited = false; + static u32 default_shape = 0; + if (!inited) { + inited = true; + Config::instance()->getOption("cursor-shape", default_shape); + + if (!default_shape) default_shape = CurUnderline; + else default_shape = CurBlock; + } + + shape = default_shape; + } + + switch (shape) { + case CurNone: + break; + + case CurUnderline: + screen->fillRect(FW(mCursor.x), FH(mCursor.y + 1) - 1, FW(1), 1, mCursor.showed ? mCursor.attr.fcolor : mCursor.attr.bcolor); + if (mImProxy) { + Rectangle rect = { FW(mCursor.x), FH(mCursor.y + 1) - 1, FW(1), 1 }; + mImProxy->redrawImWin(rect); + } + break; + + default: { + bool dw = (mCursor.attr.type != CharAttr::Single); + + u16 x = mCursor.x; + if (mCursor.attr.type == CharAttr::DoubleRight) x--; + + CharAttr attr = mCursor.attr; + if (mCursor.showed) { + u8 temp = attr.fcolor; + attr.fcolor = attr.bcolor; + attr.bcolor = temp; + } + + drawChars(attr, x, mCursor.y, dw ? FW(2) : FW(1), 1, &mCursor.code, &dw); + break; + } + } +} + +void FbShell::enableCursor(bool enable) +{ + static u32 interval = 500; + static bool inited = false; + if (!inited) { + inited = true; + Config::instance()->getOption("cursor-interval", interval); + } + + if (!interval) return; + + static bool enabled = false; + if (enabled == enable) return; + enabled = enable; + + u32 val = (enable ? interval : 0); + u32 sec = val / 1000, usec = (val % 1000) * 1000; + + struct itimerval timer; + timer.it_interval.tv_usec = usec; + timer.it_interval.tv_sec = sec; + timer.it_value.tv_usec = usec; + timer.it_value.tv_sec = sec; + + setitimer(ITIMER_REAL, &timer, NULL); +} + +void FbShell::modeChanged(ModeType type) +{ + if (manager->activeShell() != this) return; + + if (type & (CursorVisible | CursorShape)) { + enableCursor(mode(CursorVisible) && mode(CursorShape) != CurNone); + } + + if (type & CursorKeyEscO) { + changeMode(CursorKeyEscO, mode(CursorKeyEscO)); + } + + if (type & AutoRepeatKey) { + changeMode(AutoRepeatKey, mode(AutoRepeatKey)); + } + + if (type & ApplicKeypad) { + changeMode(ApplicKeypad, mode(ApplicKeypad)); + } + + if (type & CRWithLF) { + changeMode(CRWithLF, mode(CRWithLF)); + } + + if (type & (CursorKeyEscO | ApplicKeypad | CRWithLF)) { + reportMode(); + } +} + +void FbShell::request(RequestType type, u32 val) +{ + bool active = (manager->activeShell() == this); + + switch (type) { + case PaletteSet: + if ((val >> 24) >= NR_COLORS) break; + + if (!mPaletteChanged) { + mPaletteChanged = true; + + if (!mPalette) mPalette = new Color[NR_COLORS]; + memcpy(mPalette, defaultPalette, sizeof(defaultPalette)); + } + + mPalette[val >> 24].red = (val >> 16) & 0xff; + mPalette[val >> 24].green = (val >> 8) & 0xff; + mPalette[val >> 24].blue = val & 0xff; + + if (active) { + screen->setPalette(mPalette); + } + break; + + case PaletteClear: + if (!mPaletteChanged) break; + mPaletteChanged = false; + + if (active) { + screen->setPalette(defaultPalette); + } + break; + + case VcSwitch: + break; + + default: + break; + } +} + +static s32 tty0_fd = -1; + +void FbShell::switchVt(bool enter, FbShell *peer) +{ + if (tty0_fd == -1) tty0_fd = open("/dev/tty0", O_RDWR); + if (tty0_fd != -1) { + seteuid(0); + ioctl(tty0_fd, TIOCCONS, 0); + if (enter) { + s32 slavefd = open(ptsname(fd()), O_RDWR); + ioctl(slavefd, TIOCCONS, 0); + close(slavefd); + } + seteuid(getuid()); + } + + if (mImProxy) { + mImProxy->switchVt(enter, peer ? peer->mImProxy : 0); + } + + if (enter) { + screen->setPalette(mPaletteChanged ? mPalette : defaultPalette); + modeChanged(AllModes); + reportCursor(); + } else if (!peer) { + changeMode(CursorKeyEscO, false); + changeMode(ApplicKeypad, false); + changeMode(CRWithLF, false); + changeMode(AutoRepeatKey, true); + + enableCursor(false); + screen->setPalette(defaultPalette); + } +} + +void FbShell::initShellProcess() +{ + if (tty0_fd != -1) close(tty0_fd); + FbTerm::instance()->initChildProcess(); + + if (!firstShell) return; + + bool verbose = false; + Config::instance()->getOption("verbose", verbose); + + TtyInput::instance()->showInfo(verbose); + Screen::instance()->showInfo(verbose); + Font::instance()->showInfo(verbose); + + if (verbose) { + printf("[term] size: %dx%d, default codec: %s\n", screen->cols(), screen->rows(), localCodec()); + } +} + +void FbShell::switchCodec(u8 index) +{ + if (!index) { + setCodec("UTF-8", localCodec()); + return; + } + + #define NR_CODECS 5 + if (index > NR_CODECS) return; + + static s8 buf[128], *codecs[NR_CODECS]; + static bool inited = false; + if (!inited) { + inited = true; + Config::instance()->getOption("text-encodings", buf, sizeof(buf)); + if (!*buf) return; + + s8 *cur = buf, *next; + u8 i = 0; + while (1) { + next = strchr(cur, ','); + codecs[i++] = cur; + + if (!next) break; + *next = 0; + + if (i == NR_CODECS) break; + + cur = next + 1; + } + } + + if (codecs[index - 1]) { + setCodec("UTF-8", codecs[index - 1]); + } +} + +void FbShell::keyInput(s8 *buf, u32 len) +{ + if (mImProxy && mImProxy->actived()) { + mImProxy->sendKey(buf, len); + } else { + imInput(buf, len); + } +} + +void FbShell::mouseInput(u16 x, u16 y, s32 type, s32 buttons) +{ + if (type == Move) { + clearMousePointer(); + + CharAttr attr = charAttr(x, y); + adjustCharAttr(attr); + + bool dw = (attr.type != CharAttr::Single); + u16 code = charCode(x, y); + + if (attr.type == CharAttr::DoubleRight) x--; + screen->drawText(FW(x), FH(y), attr.bcolor, attr.fcolor, 1, &code, &dw); + + mMousePointer.x = x; + mMousePointer.y = y; + mMousePointer.drawed = true; + } + + Shell::mouseInput(x, y, type, buttons); +} + +void FbShell::readyRead(s8 *buf, u32 len) +{ + clearMousePointer(); + Shell::readyRead(buf, len); +} + +void FbShell::clearMousePointer() +{ + if (mMousePointer.drawed) { + mMousePointer.drawed = false; + expose(mMousePointer.x, mMousePointer.y, 1, 1); + } +} + +void FbShell::expose(u16 x, u16 y, u16 w, u16 h) +{ + VTerm::expose(x, y, w, h); + + if (mode(CursorVisible) && mCursor.y >= y && mCursor.y < (y + h) && mCursor.x >= x && mCursor.x < (x + w)) { + mCursor.showed = false; + updateCursor(); + } +} + +void FbShell::adjustCharAttr(CharAttr &attr) +{ + if (attr.italic) attr.fcolor = 2; // green + else if (attr.underline) attr.fcolor = 6; // cyan + else if (attr.intensity == 0) attr.fcolor = 8; // gray + + if (attr.blink && attr.bcolor < 8) attr.bcolor ^= 8; + if (attr.intensity == 2 && attr.fcolor < 8) attr.fcolor ^= 8; + + if (attr.reverse) { + u16 temp = attr.bcolor; + attr.bcolor = attr.fcolor; + attr.fcolor = temp; + + if (attr.bcolor > 8 && attr.bcolor < 16) attr.bcolor -= 8; + } +} + +void FbShell::changeMode(ModeType type, u16 val) +{ + const s8 *str = 0; + + if (type == CursorKeyEscO) str = (val ? "\e[?1h" : "\e[?1l"); + else if (type == AutoRepeatKey) str = (val ? "\e[?8h" : "\e[?8l"); + else if (type == ApplicKeypad) str = (val ? "\e=" : "\e>"); + else if (type == CRWithLF) str = (val ? "\e[20h" : "\e[20l"); + + if (str) { + s32 ret = ::write(STDIN_FILENO, str, strlen(str)); + } +} + +void FbShell::reportCursor() +{ + if (mImProxy) mImProxy->changeCursorPos(mCursor.x, mCursor.y); +} + +void FbShell::reportMode() +{ + if (mImProxy) mImProxy->changeTermMode(mode(CRWithLF), mode(ApplicKeypad), mode(CursorKeyEscO)); +} + +void FbShell::killIm() +{ + if (mImProxy) delete mImProxy; +} +void FbShell::toggleIm() +{ + if (!mImProxy) mImProxy = new ImProxy(this); + + if (mImProxy) { + mImProxy->toggleActive(); + reportCursor(); + reportMode(); + } +} + +void FbShell::imInput(s8 *buf, u32 len) +{ + clearMousePointer(); + Shell::keyInput(buf, len); +} + +bool FbShell::childProcessExited(s32 pid) +{ + if (mImProxy && pid == mImProxy->imProcessId()) { + delete mImProxy; + return true; + } + + if (pid == shellProcessId()) { + delete this; + return true; + } + + return false; +} diff --git a/src/fbshell.h b/src/fbshell.h new file mode 100644 index 0000000..983ce1d --- /dev/null +++ b/src/fbshell.h @@ -0,0 +1,86 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FBSHELL_H +#define FBSHELL_H + +#include "shell.h" + +class FbShell : public Shell { +public: + void keyInput(s8 *buf, u32 len); + void mouseInput(u16 x, u16 y, s32 type, s32 buttons); + void switchCodec(u8 index); + void expose(u16 x, u16 y, u16 w, u16 h); + void toggleIm(); + void killIm(); + void imInput(s8 *buf, u32 len); + void ImExited() { mImProxy = 0; } + bool childProcessExited(s32 pid); + +private: + friend class FbShellManager; + FbShell(); + ~FbShell(); + + virtual void drawChars(CharAttr attr, u16 x, u16 y, u16 w, u16 num, u16 *chars, bool *dws); + virtual bool moveChars(u16 sx, u16 sy, u16 dx, u16 dy, u16 w, u16 h); + virtual void drawCursor(CharAttr attr, u16 x, u16 y, u16 c); + virtual void modeChanged(ModeType type); + virtual void request(RequestType type, u32 val = 0); + + virtual void initShellProcess(); + virtual void readyRead(s8 *buf, u32 len); + + void switchVt(bool enter, FbShell *peer); + void adjustCharAttr(CharAttr &attr); + void enableCursor(bool enable); + void updateCursor(); + void clearMousePointer(); + + void changeMode(ModeType type, u16 val); + void reportCursor(); + void reportMode(); + + struct Cursor { + Cursor() { + x = y = (u16)-1; + showed = false; + } + bool showed; + u16 x, y; + u16 code; + CharAttr attr; + } mCursor; + + struct MousePointer { + MousePointer() { + drawed = false; + } + u16 x, y; + bool drawed; + } mMousePointer; + + bool mPaletteChanged; + struct Color *mPalette; + class ImProxy *mImProxy; +}; + +#endif diff --git a/src/fbshellman.cpp b/src/fbshellman.cpp new file mode 100644 index 0000000..6629234 --- /dev/null +++ b/src/fbshellman.cpp @@ -0,0 +1,174 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <string.h> +#include "fbshellman.h" +#include "fbshell.h" +#include "fbterm.h" +#include "screen.h" +#include "improxy.h" +#include "font.h" + +#define screen (Screen::instance()) +#define SHELL_ANY ((FbShell *)-1) + +DEFINE_INSTANCE_DEFAULT(FbShellManager) + +FbShellManager::FbShellManager() +{ + mVcCurrent = false; + mShellCount = 0; + mCurShell = 0; + mActiveShell = 0; + memset(mShellList, 0, sizeof(mShellList)); +} + +FbShellManager::~FbShellManager() +{ +} + +void FbShellManager::createShell() +{ + if (mShellCount == NR_SHELLS) return; + mShellCount++; + + u32 index = getIndex(0, true, false); + mShellList[index] = new FbShell(); + switchShell(index); +} + +void FbShellManager::deleteShell() +{ + if (mShellList[mCurShell]) delete mShellList[mCurShell]; +} + +void FbShellManager::nextShell() +{ + switchShell(getIndex(SHELL_ANY, true, true)); +} + +void FbShellManager::prevShell() +{ + switchShell(getIndex(SHELL_ANY, false, true)); +} + +void FbShellManager::switchShell(u32 num) +{ + if (num >= NR_SHELLS) return; + + mCurShell = num; + if (mVcCurrent && setActive(mShellList[mCurShell])) { + redraw(0, 0, screen->cols(), screen->rows()); + } +} + +void FbShellManager::drawCursor() +{ + if (mActiveShell) { + mActiveShell->updateCursor(); + } +} + +void FbShellManager::historyScroll(bool down) +{ + if (mActiveShell) { + mActiveShell->historyDisplay(false, down ? mActiveShell->h() : -mActiveShell->h()); + } +} + +void FbShellManager::switchVc(bool enter) +{ + mVcCurrent = enter; + setActive(enter ? mShellList[mCurShell] : 0); + + if (enter) { + redraw(0, 0, screen->cols(), screen->rows()); + } +} + +void FbShellManager::shellExited(FbShell *shell) +{ + if (!shell) return; + + u8 index = getIndex(shell, true, false); + mShellList[index] = 0; + + if (index == mCurShell) { + prevShell(); + } + + if (!--mShellCount) { + FbTerm::instance()->exit(); + } +} + +u32 FbShellManager::getIndex(FbShell *shell, bool forward, bool stepfirst) +{ + u32 index, temp = mCurShell + NR_SHELLS; + + #define STEP() do { \ + if (forward) temp++; \ + else temp--; \ + } while (0) + + if (stepfirst) STEP(); + + for (u32 i = NR_SHELLS; i--;) { + index = temp % NR_SHELLS; + if ((shell == SHELL_ANY && mShellList[index]) || shell == mShellList[index]) break; + STEP(); + } + + return index; +} + +bool FbShellManager::setActive(FbShell *shell) +{ + if (mActiveShell == shell) return false; + + if (mActiveShell) { + mActiveShell->switchVt(false, shell); + } + + FbShell *oldActiveShell = mActiveShell; + mActiveShell = shell; + + if (mActiveShell) { + mActiveShell->switchVt(true, oldActiveShell); + } + + return true; +} + +void FbShellManager::redraw(u16 x, u16 y, u16 w, u16 h) +{ + if (mActiveShell) { + mActiveShell->expose(x, y, w, h); + } else { + screen->fillRect(FW(x), FH(y), FW(w), FH(h), 0); + } +} + +void FbShellManager::childProcessExited(s32 pid) +{ + for (u32 i = 0; i < NR_SHELLS; i++) { + if (mShellList[i] && mShellList[i]->childProcessExited(pid)) break; + } +} diff --git a/src/fbshellman.h b/src/fbshellman.h new file mode 100644 index 0000000..5f047a6 --- /dev/null +++ b/src/fbshellman.h @@ -0,0 +1,58 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FBSHELL_MANAGER_H +#define FBSHELL_MANAGER_H + +#include "type.h" +#include "instance.h" + +class FbShell; + +class FbShellManager { + DECLARE_INSTANCE(FbShellManager) +public: + FbShell *activeShell() { + return mActiveShell; + } + void createShell(); + void deleteShell(); + void shellExited(FbShell *shell); + void switchShell(u32 num); + void nextShell(); + void prevShell(); + + void drawCursor(); + void historyScroll(bool down); + void redraw(u16 x, u16 y, u16 w, u16 h); + void switchVc(bool enter); + void childProcessExited(s32 pid); + +private: + u32 getIndex(FbShell *shell, bool forward, bool stepfirst); + bool setActive(FbShell *shell); + + #define NR_SHELLS 10 + FbShell *mShellList[NR_SHELLS], *mActiveShell; + u32 mShellCount, mCurShell; + bool mVcCurrent; +}; + +#endif diff --git a/src/fbterm.cpp b/src/fbterm.cpp new file mode 100644 index 0000000..38d4014 --- /dev/null +++ b/src/fbterm.cpp @@ -0,0 +1,302 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <stdio.h> +#include <signal.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <linux/vt.h> +#include <linux/kdev_t.h> +#include "config.h" +#include "fbterm.h" +#include "fbshell.h" +#include "fbshellman.h" +#include "fbconfig.h" +#include "fbio.h" +#include "screen.h" +#include "input.h" +#include "input_key.h" +#include "mouse.h" + +#ifdef HAVE_SIGNALFD +// <sys/signalfd.h> offered by some systems has bug with g++ +#include "signalfd.h" + +static sigset_t oldSigmask; + +class SignalIo : public IoPipe { +public: + SignalIo(sigset_t &sigmask); + +private: + virtual void readyRead(s8 *buf, u32 len); +}; + +SignalIo::SignalIo(sigset_t &sigmask) +{ + int fd = signalfd(-1, &sigmask, 0); + setFd(fd); +} + +void SignalIo::readyRead(s8 *buf, u32 len) +{ + signalfd_siginfo *si = (signalfd_siginfo*)buf; + for (len /= sizeof(*si); len--; si++) { + FbTerm::instance()->processSignal(si->ssi_signo); + } +} +#else + +static volatile sig_atomic_t pendsigs = 0; + +static void signalHandler(s32 signo) +{ + pendsigs |= 1 << signo; +} + +static void pollSignal() +{ + if (!pendsigs) return; + + sig_atomic_t sigs = pendsigs; + pendsigs = 0; + + for (u32 i = 0; i < sizeof(sigs); i++) { + u8 sig8 = (sigs >> (i * 8)) & 0xff; + if (!sig8) continue; + + for (u32 j = 0; j < 8; j++) { + if (sig8 & (1 << j)) { + FbTerm::instance()->processSignal(i * 8 + j); + } + } + } +} +#endif + +DEFINE_INSTANCE_DEFAULT(FbTerm) + +FbTerm::FbTerm() +{ + mInit = false; + init(); +} + +FbTerm::~FbTerm() +{ + IoDispatcher::uninstance(); + FbShellManager::uninstance(); + Screen::uninstance(); +} + +void FbTerm::init() +{ + if (!TtyInput::instance() || !Screen::instance()) return; + + struct vt_mode vtm; + vtm.mode = VT_PROCESS; + vtm.waitv = 0; + vtm.relsig = SIGUSR1; + vtm.acqsig = SIGUSR2; + vtm.frsig = 0; + ioctl(STDIN_FILENO, VT_SETMODE, &vtm); + +#ifdef HAVE_SIGNALFD + sigset_t sigmask; + sigemptyset(&sigmask); + + sigaddset(&sigmask, SIGCHLD); + sigaddset(&sigmask, SIGUSR1); + sigaddset(&sigmask, SIGUSR2); + sigaddset(&sigmask, SIGALRM); + sigaddset(&sigmask, SIGTERM); + sigaddset(&sigmask, SIGHUP); + + sigprocmask(SIG_BLOCK, &sigmask, &oldSigmask); + new SignalIo(sigmask); +#else + sighandler_t sh = signalHandler; + + signal(SIGCHLD, sh); + signal(SIGUSR1, sh); + signal(SIGUSR2, sh); + signal(SIGALRM, sh); + signal(SIGTERM, sh); + signal(SIGHUP, sh); +#endif + signal(SIGPIPE, SIG_IGN); + + Mouse::instance(); + mInit = true; +} + +static bool isActiveTerm() +{ + struct vt_stat vtstat; + ioctl(STDIN_FILENO, VT_GETSTATE, &vtstat); + + struct stat ttystat; + fstat(STDIN_FILENO, &ttystat); + + return vtstat.v_active == MINOR(ttystat.st_rdev); +} + +void FbTerm::run() +{ + if (!mInit) return; + + if (isActiveTerm()) processSignal(SIGUSR2); + + FbShellManager::instance()->createShell(); + + mRun = true; + FbIoDispatcher *io = (FbIoDispatcher*)IoDispatcher::instance(); + while (mRun) { + io->poll(); +#ifndef HAVE_SIGNALFD + pollSignal(); +#endif + } + + if (isActiveTerm()) processSignal(SIGUSR1); +} + +void FbTerm::processSignal(u32 signo) +{ + switch (signo) { + case SIGTERM: + case SIGHUP: + exit(); + break; + + case SIGALRM: + FbShellManager::instance()->drawCursor(); + break; + + case SIGUSR1: + FbShellManager::instance()->switchVc(false); + Screen::instance()->switchVc(false); + TtyInput::instance()->switchVc(false); + Mouse::instance()->switchVc(false); + ioctl(STDIN_FILENO, VT_RELDISP, 1); + break; + + case SIGUSR2: + Mouse::instance()->switchVc(true); + TtyInput::instance()->switchVc(true); + Screen::instance()->switchVc(true); + FbShellManager::instance()->switchVc(true); + break; + + case SIGCHLD: + if (mRun) { + s32 pid = waitpid(WAIT_ANY, 0, WNOHANG); + if (pid > 0) { + FbShellManager::instance()->childProcessExited(pid); + } + } + break; + + default: + break; + } +} + +void FbTerm::processSysKey(u32 key) +{ + FbShellManager *manager = FbShellManager::instance(); + + switch (key) { + case CTRL_ALT_E: + exit(); + break; + + case SHIFT_PAGEDOWN: + case SHIFT_PAGEUP: + manager->historyScroll(key == SHIFT_PAGEDOWN); + break; + + case CTRL_ALT_C: + manager->createShell(); + break; + + case CTRL_ALT_D: + manager->deleteShell(); + break; + + case CTRL_ALT_1 ... CTRL_ALT_0: + manager->switchShell(key - CTRL_ALT_1); + break; + + case SHIFT_LEFT: + manager->prevShell(); + break; + + case SHIFT_RIGHT: + manager->nextShell(); + break; + + case CTRL_ALT_F1 ... CTRL_ALT_F6: + if (manager->activeShell()) { + manager->activeShell()->switchCodec(key - CTRL_ALT_F1); + } + break; + + case CTRL_SPACE: + if (manager->activeShell()) { + manager->activeShell()->toggleIm(); + } + break; + + case CTRL_ALT_K: + if (manager->activeShell()) { + manager->activeShell()->killIm(); + } + + default: + break; + } +} + +void FbTerm::initChildProcess() +{ + setuid(getuid()); + +#ifdef HAVE_SIGNALFD + sigprocmask(SIG_SETMASK, &oldSigmask, 0); +#endif + + signal(SIGPIPE, SIG_DFL); +} + +int main(int argc, char **argv) +{ + seteuid(getuid()); + + if (Config::instance()->parseArgs(argc, argv)) { + FbTerm::instance()->run(); + FbTerm::uninstance(); + } + + Config::uninstance(); + return 0; +} diff --git a/src/fbterm.h b/src/fbterm.h new file mode 100644 index 0000000..c9dfcda --- /dev/null +++ b/src/fbterm.h @@ -0,0 +1,44 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FBTERM_H +#define FBTERM_H + +#include "type.h" +#include "instance.h" + +class FbTerm { + DECLARE_INSTANCE(FbTerm) +public: + void run(); + void exit() { + mRun = false; + } + void processSysKey(u32 key); + void processSignal(u32 signo); + void initChildProcess(); + +private: + void init(); + + bool mInit, mRun; +}; + +#endif diff --git a/src/font.cpp b/src/font.cpp new file mode 100644 index 0000000..14b922f --- /dev/null +++ b/src/font.cpp @@ -0,0 +1,329 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <fontconfig/fontconfig.h> +#include <ft2build.h> +#include FT_GLYPH_H +#include "font.h" +#include "screen.h" +#include "fbconfig.h" + +#define OFFSET(TYPE, MEMBER) ((size_t)(&(((TYPE *)0)->MEMBER))) +#define SUBS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +static FcCharSet *unicodeMap; +static FcFontSet *fontList; + +static FT_Library ftlib; +static FT_Face *fontFaces; +static u32 *fontFlags; + +static Font::Glyph **glyphCache; +static bool *glyphCacheInited; + +static void openFont(u32 index); + +DEFINE_INSTANCE(Font) + +Font *Font::createInstance() +{ + FcInit(); + + s8 buf[64]; + Config::instance()->getOption("font-names", buf, sizeof(buf)); + + FcPattern *pat = FcNameParse((FcChar8 *)(*buf ? buf : "mono")); + + u32 pixel_size = 12; + Config::instance()->getOption("font-size", pixel_size); + FcPatternAddDouble(pat, FC_PIXEL_SIZE, (double)pixel_size); + + FcPatternAddString(pat, FC_LANG, (FcChar8 *)"en"); + + FcConfigSubstitute(NULL, pat, FcMatchPattern); + FcDefaultSubstitute(pat); + + FcResult result; + FcFontSet *fs = FcFontSort(NULL, pat, FcTrue, &unicodeMap, &result); + + if (fs) { + fontList = FcFontSetCreate(); + + FcObjectSet *family = FcObjectSetCreate(); + FcObjectSetAdd(family, FC_FAMILY); + + for (u32 i = 0; i < fs->nfont; i++) { + FcPattern *font = FcFontRenderPrepare(NULL, pat, fs->fonts[i]); + if (!font) continue; + + bool same = false; + for (u32 j = 0; j < fontList->nfont; j++) { + if (FcPatternEqualSubset(fontList->fonts[j], font, family)) { + same = true; + break; + } + } + + if (same) { + FcPatternDestroy(font); + } else { + FcFontSetAdd(fontList, font); + } + } + + FcObjectSetDestroy(family); + } + + FcPatternDestroy(pat); + if (fs) FcFontSetDestroy(fs); + + if (fontList && fontList->nfont) return new Font(); + + if (unicodeMap) FcCharSetDestroy(unicodeMap); + if (fontList) FcFontSetDestroy(fontList); + FcFini(); + return 0; +} + +Font::Font() +{ + mHeight = mWidth = 0; + + fontFaces = new FT_Face[fontList->nfont]; + fontFlags = new u32[fontList->nfont]; + memset(fontFaces, 0, sizeof(FT_Face) * fontList->nfont); + + glyphCache = new Glyph *[256 * 256]; + glyphCacheInited = new bool[256]; + memset(glyphCacheInited, 0, sizeof(bool) * 256); + + FT_Init_FreeType(&ftlib); + openFont(0); + + FT_Face face = fontFaces[0]; + if (face == (FT_Face)-1) return; + + if (face->face_flags & FT_FACE_FLAG_SCALABLE) { + mHeight = face->size->metrics.height >> 6; + mWidth = face->size->metrics.max_advance >> 6; + } else if (face->num_fixed_sizes) { + double dsize; + FcPatternGetDouble(fontList->fonts[0], FC_PIXEL_SIZE, 0, &dsize); + + FT_Bitmap_Size *sizes = face->available_sizes; + u32 index = 0, diffmin = (u32)-1; + for (u32 i = 0; i < face->num_fixed_sizes; i++) { + u32 diff = SUBS(sizes[i].size >> 6, (u32)dsize); + if (diff < diffmin ) { + index = i; + diffmin = diff; + } + } + + mHeight = sizes[index].height; + mWidth = sizes[index].width; + } + + if (!(face->face_flags & FT_FACE_FLAG_FIXED_WIDTH)) mWidth = MIN(mWidth, (mHeight + 1) / 2); + + u32 width = 0; + Config::instance()->getOption("font-width", width); + + if (width) { + s8 buf[64]; + Config::instance()->getOption("font-width", buf, sizeof(buf)); + + if (buf[0] == '+' || buf[0] == '-') mWidth += (s32)width; + else mWidth = width; + } + + u32 height = 0; + Config::instance()->getOption("font-height", height); + + if (height) { + s8 buf[64]; + Config::instance()->getOption("font-height", buf, sizeof(buf)); + + if (buf[0] == '+' || buf[0] == '-') mHeight += (s32)height; + else mHeight = height; + } +} + +Font::~Font() +{ + for (u32 i = 0; i < 256; i++) { + if (!glyphCacheInited[i]) continue; + + for (u32 j = 0; j < 256; j++) { + if (glyphCache[i * 256 + j]) { + delete[] (u8 *)glyphCache[i * 256 + j]; + } + } + } + + delete[] glyphCache; + delete[] glyphCacheInited; + + for (u32 i = 0; i < fontList->nfont; i++) { + if (fontFaces[i] && fontFaces[i] != (FT_Face)-1) { + FT_Done_Face(fontFaces[i]); + } + } + + delete[] fontFaces; + delete[] fontFlags; + + FT_Done_FreeType(ftlib); + FcCharSetDestroy(unicodeMap); + FcFontSetDestroy(fontList); + FcFini(); +} + +void Font::showInfo(bool verbose) +{ + if (!verbose) return; + + printf("[font] width: %dpx, height: %dpx, ordered list: ", mWidth, mHeight); + + u32 index; + FcChar8 *family; + for (index = 0; index < fontList->nfont - 1; index++) { + FcPatternGetString(fontList->fonts[index], FC_FAMILY, 0, &family); + printf("%s, ", family); + } + + FcPatternGetString(fontList->fonts[index], FC_FAMILY, 0, &family); + printf("%s\n", family); +} + +static void openFont(u32 index) +{ + if (index >= fontList->nfont) return; + + FcPattern *pattern = fontList->fonts[index]; + + FcChar8 *name = (FcChar8 *)""; + FcPatternGetString(pattern, FC_FILE, 0, &name); + + int id = 0; + FcPatternGetInteger (pattern, FC_INDEX, 0, &id); + + FT_Face face; + if (FT_New_Face(ftlib, (const char *)name, id, &face)) { + fontFaces[index] = (FT_Face)-1; + return; + } + + double ysize; + FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &ysize); + FT_Set_Pixel_Sizes(face, 0, (FT_UInt)ysize); + + int load_flags = FT_LOAD_DEFAULT; + + FcBool scalable, antialias; + FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable); + FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &antialias); + + if (scalable && antialias) load_flags |= FT_LOAD_NO_BITMAP; + + if (antialias) { + FcBool hinting; + int hint_style; + FcPatternGetBool(pattern, FC_HINTING, 0, &hinting); + FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &hint_style); + + if (!hinting || hint_style == FC_HINT_NONE) { + load_flags |= FT_LOAD_NO_HINTING; + } else { + load_flags |= FT_LOAD_TARGET_LIGHT; + } + } else { + load_flags |= FT_LOAD_TARGET_MONO; + } + + fontFaces[index] = face; + fontFlags[index] = load_flags; +} + +static int fontIndex(u32 unicode) +{ + if (!FcCharSetHasChar(unicodeMap, unicode)) return -1; + + FcCharSet *charset; + for (u32 i = 0; i < fontList->nfont; i++) { + FcPatternGetCharSet(fontList->fonts[i], FC_CHARSET, 0, &charset); + if (FcCharSetHasChar(charset, unicode)) return i; + } + + return -1; +} + +Font::Glyph *Font::getGlyph(u32 unicode) +{ + if (unicode >= 256 * 256) return 0; + + if (!glyphCacheInited[unicode >> 8]) { + glyphCacheInited[unicode >> 8] = true; + memset(&glyphCache[unicode & 0xff00], 0, sizeof(Glyph *) * 256); + } + + if (glyphCache[unicode]) return glyphCache[unicode]; + + int i = fontIndex(unicode); + if (i == -1) return 0; + + if (!fontFaces[i]) openFont(i); + if (fontFaces[i] == (FT_Face)-1) return 0; + + FT_Face face = fontFaces[i]; + FT_UInt index = FT_Get_Char_Index(face, (FT_ULong)unicode); + if (!index) return 0; + + FT_Load_Glyph(face, index, FT_LOAD_RENDER | fontFlags[i]); + FT_Bitmap &bitmap = face->glyph->bitmap; + + u32 x, y, w, h, nx, ny, nw, nh; + x = y = 0; + w = nw = bitmap.width; + h = nh = bitmap.rows; + Screen::instance()->rotateRect(x, y, nw, nh); + + Glyph *glyph = (Glyph *)new u8[OFFSET(Glyph, pixmap) + nw * nh]; + glyph->left = face->glyph->metrics.horiBearingX >> 6; + glyph->top = mHeight - 1 + (face->size->metrics.descender >> 6) - (face->glyph->metrics.horiBearingY >> 6); + glyph->width = face->glyph->metrics.width >> 6; + glyph->height = face->glyph->metrics.height >> 6; + glyph->pitch = nw; + + u8 *buf = bitmap.buffer; + for (y = 0; y < h; y++, buf += bitmap.pitch) { + for (x = 0; x < w; x++) { + nx = x, ny = y; + Screen::instance()->rotatePoint(w, h, nx, ny); + + glyph->pixmap[ny * nw + nx] = + (bitmap.pixel_mode == FT_PIXEL_MODE_MONO) ? ((buf[(x >> 3)] & (0x80 >> (x & 7))) ? 0xff : 0) : buf[x]; + } + } + + glyphCache[unicode] = glyph; + return glyph; +} diff --git a/src/font.h b/src/font.h new file mode 100644 index 0000000..5158987 --- /dev/null +++ b/src/font.h @@ -0,0 +1,52 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 FONT_H +#define FONT_H + +#include "type.h" +#include "instance.h" + +#define FW(cols) (Font::instance()->width() * (cols)) +#define FH(rows) (Font::instance()->height() * (rows)) + +class Font { + DECLARE_INSTANCE(Font) +public: + struct Glyph { + s16 pitch, width, height; + s16 left, top; + u8 pixmap[0]; + }; + + Glyph *getGlyph(u32 unicode); + u32 width() { + return mWidth; + } + u32 height() { + return mHeight; + } + void showInfo(bool verbose); + +private: + u32 mWidth, mHeight; +}; + +#endif diff --git a/src/immessage.h b/src/immessage.h new file mode 100644 index 0000000..fd6cbd1 --- /dev/null +++ b/src/immessage.h @@ -0,0 +1,202 @@ +/* + * Copyright ? 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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. + * + */ + +/** + * +FbTerm implements a lightweight client-server input method architecture. Instead of processing user input and +drawing input method UI itself, FbTerm acts as a client and requests the input method server to do all these works. + + +Input Method Messages + +On startup, FbTerm forks a child process and executes the input method server program in it. FbTerm and the input +method server will communicate each other with a unix socket pair created by FbTerm. When IM server startup, it sends +a Connect message to FbTerm, indicates that the server has got ready. FbTerm response a FbTermInfo message, tell +IM server things like current screen size, font size, rotation etc, help IM server draw it's UI. Of course, +IM server may ignore these hints. + +When FbTerm exit, it sends a Disconnect to IM server, indicates it to exit. + + +------+ +------+ +------+ +------+ + |FbTerm| | IM | |FbTerm| | IM | + +--.---+ +---.--+ +--.---+ +---.--+ + | | | | + | |<init> <exit>| | + | Connect | | Disconnect | + |<------------------| |------------------>| + | | | | + | FbTermInfo | | |<exit> + |------------------>| | | + | | | | + | | | | + + +If user presses the input method state switch shortcut (e.g. Ctrl + Space), FbTerm sends a Active message to +IM server, and a CursorPosition message with current cursor position. After receiving the Active message, +IM server may want to draw it's UI, e.g. a IM status bar, on frame buffer screen. In order to avoid FbTerm corrupting +it's UI, IM server first sends a SetWin message, tell FbTerm the screen areas occupied by its status bar, and waits FbTerm +to response a AckWin message. Now IM server can begin to draw the status bar. + +While user pressing Ctrl + Space again, FbTerm sends a Deactive message to IM server. IM server should response a +SetWin message with a empty screen area to hide its status bar and ask FbTerm to redraw screen. + + +------+ +------+ +------+ +------+ + |FbTerm| | IM | |FbTerm| | IM | + +--.---+ +---.--+ +--.---+ +---.--+ + | | | | + | | | | + | Active | | Deactive | + |------------------>| |------------------>| + | | | | + | CursorPosition | | SetWin | + |------------------>| |<------------------| + | | | | + | SetWin | | AckWin | + |<------------------| |------------------>| + | | | | + | AckWin | | | + |------------------>| | | + | |<draw UI> | | + | | | | + + +When IM state is on, FbTerm doesn't process any keyboard input except its shortcuts and Alt-Fn, it redirects them +to IM server with SendKey messages. After receiving SendKey message, IM server may draw it's preedit and candidate UI. +As described above, it should first send SetWin messages to tell FbTerm the areas occupied by preedit and candidate UI +and wait for responsed AckWin messages before drawing UI. + +IM server sends the converted texts in a PutText message back to FbTerm, and FbTerm will write them to the running +program. In the common case, the running program will change cursor position, FbTerm notifies it to IM server with a +CursorPosition message. If IM server provides a XIM "over the spot" style UI, it may response SetWin messages to move +and redraw it's UI. + + +------+ +------+ +------+ +------+ + |FbTerm| | IM | |FbTerm| | IM | + +--.---+ +---.--+ +--.---+ +---.--+ + | | | | + | | | | + | SendKey | | PutText | + |------------------>| |<------------------| + | | | | + | SetWin | | CursorPosition | + |<------------------| |------------------>| + | | | | + | AckWin | | SetWin | + |------------------>| |<------------------| + | | | | + | |<draw UI> | AckWin | + | | |------------------>| + | | | | + | | | |<draw UI> + + +When IM state is on, user presses shortcuts for switching to other sub-window or Alt-Fn for other virtual console, FbTerm +sends a HideUI message to IM server, then waits for a AckHideUI message responsed from IM server before switching. Maybe +IM server is busy with the previous SendKey message when HideUI message is arrived, it continues it's work, then processes +this HideUI message, sends back a AckHideUI message to FbTerm. + +When switching back, FbTerm sends a ShowUI message to IM server, indicates IM server to redraw it's UI. + + +------+ +------+ +------+ +------+ + |FbTerm| | IM | |FbTerm| | IM | + +--.---+ +---.--+ +--.---+ +---.--+ + | | | | + | | | | + | HideUI | | ShowUI | + |------------------>| |------------------>| + | | | | + | AckHideUI | | SetWin | + |<------------------| |<------------------| + | | | | + |<do switching> | | AckWin | + | | |------------------>| + | | | | + | | | |<draw UI> + | | | | + | | | | + | | | | + */ + +#ifndef IM_MESSAGE_H +#define IM_MESSAGE_H + +typedef enum { + Connect = 0, Disconnect, + Active, Deactive, + SendKey, PutText, + SetWin, AckWin, + CursorPosition, FbTermInfo, TermMode, + ShowUI, HideUI, AckHideUI, + FillRect, DrawText, + Ping, AckPing +} MessageType; + +typedef struct { + unsigned fontHeight, fontWidth; + unsigned screenHeight, screenWidth; +} Info; + +#define NR_IM_WINS 10 + +typedef struct { + unsigned x, y; + unsigned w, h; +} Rectangle; + +typedef struct { + unsigned short type; ///< message's type, @see MessageType + unsigned short len; ///< message's length, including head and body + + union { + char keys[0]; ///< included in message SendKey + char texts[0]; ///< included in message PutText + char raw; ///< included in message Connect + unsigned winid; ///< included in message ShowUI + Info info; ///< included in message FbTermInfo + + struct { + Rectangle rect; + unsigned winid; + } win; ///< included in message SetWin + + struct { + char crWithLf; + char applicKeypad; + char cursorEscO; + } term; ///< included in message TermMode; + + struct { + unsigned x, y; + } cursor; ///< included in message CursorPosition + + struct { + Rectangle rect; + unsigned char color; + } fillRect; ///< included in message FillRect + + struct { + unsigned x, y; + unsigned char fc, bc; + char texts[0]; + } drawText; ///< included in message DrawText + }; +} Message; + +#endif diff --git a/src/improxy.cpp b/src/improxy.cpp new file mode 100644 index 0000000..3d03e66 --- /dev/null +++ b/src/improxy.cpp @@ -0,0 +1,455 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/socket.h> +#include "improxy.h" +#include "immessage.h" +#include "fbconfig.h" +#include "fbshell.h" +#include "fbshellman.h" +#include "font.h" +#include "screen.h" +#include "input.h" +#include "fbterm.h" +#include <time.h> + +#define NR_WIN_MSGS 512 +#define MSG_DRAWTEXT_MAX_LEN 10240 + +#define sw FW(Screen::instance()->cols()) +#define sh FH(Screen::instance()->rows()) + +#define OFFSET(TYPE, MEMBER) ((size_t)(&(((TYPE *)0)->MEMBER))) +#define MSG(a) ((Message *)(a)) + +ImProxy::ImProxy(FbShell *shell) +{ + mShell = shell; + mPid = -1; + mConnected = false; + mActive = false; + mMsgWaitState = NoMessageToWait; + + mValidWinNum = 0; + memset(&mWins, 0, sizeof(mWins)); + + createImProcess(); +} + +ImProxy::~ImProxy() +{ + mShell->ImExited(); + if (!mConnected) return; + + if (FbShellManager::instance()->activeShell() == mShell) { + TtyInput::instance()->setRawMode(false); + } + + sendDisconnect(); + setFd(-1); + + extern void waitChildProcessExit(s32 pid); + waitChildProcessExit(mPid); + + Rectangle rect = { 0, 0, 0, 0 }; + for (u32 i = 0; i < NR_IM_WINS; i++) { + if (mWins[i].w) setImWin(i, rect); + } +} + +void ImProxy::createImProcess() +{ + s8 app[128]; + Config::instance()->getOption("input-method", app, sizeof(app)); + if (!app[0]) return; + + int fds[2]; + if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) == -1) return; + + mPid = fork(); + + switch (mPid) { + case -1: + close(fds[0]); + close(fds[1]); + break; + + case 0: { + FbTerm::instance()->initChildProcess(); + close(fds[0]); + + s8 buf[16]; + snprintf(buf, sizeof(buf), "%d", fds[1]); + setenv("FBTERM_IM_SOCKET", buf, 1); + + execlp(app, app, NULL); + fprintf(stderr, "can't execute IM program %s!\n", app); + exit(1); + break; + } + + default: + close(fds[1]); + setFd(fds[0]); + waitImMessage(Connect); + break; + } +} + +bool ImProxy::actived() +{ + return mActive; +} + +void ImProxy::toggleActive() +{ + if (!mConnected) return; + + mActive ^= true; + TtyInput::instance()->setRawMode(mRawInput && mActive); + + Message msg; + msg.type = (mActive ? Active : Deactive); + msg.len = sizeof(msg); + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::changeCursorPos(u16 col, u16 row) +{ + if (!mConnected || !mActive) return; + + Message msg; + msg.type = CursorPosition; + msg.len = sizeof(msg); + msg.cursor.x = FW(col); + msg.cursor.y = FH(row + 1); + + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::changeTermMode(bool crlf, bool appkey, bool curo) +{ + if (!mConnected || !mActive) return; + + Message msg; + msg.type = TermMode; + msg.len = sizeof(msg); + msg.term.crWithLf = crlf; + msg.term.applicKeypad = appkey; + msg.term.cursorEscO = curo; + + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::switchVt(bool enter, ImProxy *peer) +{ + if (!mConnected || !mActive) return; + + TtyInput::instance()->setRawMode(enter && mRawInput); + + Message msg; + msg.type = (enter ? ShowUI : HideUI); + msg.len = sizeof(msg); + if (enter) msg.winid = (unsigned)-1; + + write((s8 *)&msg, sizeof(msg)); + + if (!enter) { + waitImMessage(AckHideUI); + Screen::instance()->enableScroll(true); + } +} + +void ImProxy::sendKey(s8 *keys, u32 len) +{ + if (!mConnected || !mActive || !keys || !len) return; + + s8 buf[OFFSET(Message, keys) + len]; + + MSG(buf)->type = SendKey; + MSG(buf)->len = sizeof(buf); + memcpy(MSG(buf)->keys, keys, len); + + write(buf, MSG(buf)->len); +} + +void ImProxy::sendInfo() +{ + Message msg; + msg.type = FbTermInfo; + msg.len = sizeof(msg); + msg.info.fontHeight = FH(1); + msg.info.fontWidth = FW(1); + msg.info.screenHeight = sh; + msg.info.screenWidth = sw; + + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::sendAckWin() +{ + Message msg; + msg.type = AckWin; + msg.len = sizeof(msg); + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::sendAckPing() +{ + Message msg; + msg.type = AckPing; + msg.len = sizeof(msg); + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::sendDisconnect() +{ + if (!mConnected) return; + + Message msg; + msg.type = Disconnect; + msg.len = sizeof(msg); + write((s8 *)&msg, sizeof(msg)); +} + +void ImProxy::readyRead(s8 *buf, u32 len) +{ + for (s8 *end = buf + len; buf < end && MSG(buf)->len && MSG(buf)->len <= (end - buf); buf += MSG(buf)->len) { + if (mMsgWaitState == WaitingMessage && mMsgWaitType == MSG(buf)->type) mMsgWaitState = GotMessage; + if (!mConnected && MSG(buf)->type != Connect) continue; + + switch (MSG(buf)->type) { + case Connect: + mConnected = true; + mRawInput = MSG(buf)->raw; + + sendInfo(); + break; + + case PutText: + if (MSG(buf)->len > OFFSET(Message, texts)) { + mShell->imInput(MSG(buf)->texts, MSG(buf)->len - OFFSET(Message, texts)); + } + break; + + case SetWin: + if (MSG(buf)->len == sizeof(Message)) { // keep compatibility with v1.5 + setImWin(MSG(buf)->win.winid, MSG(buf)->win.rect); + } + sendAckWin(); + break; + + case FillRect: + if (addWinMsg(MSG(buf)) && FbShellManager::instance()->activeShell() == mShell) { + doFillRect(MSG(buf)); + } + break; + + case DrawText: + if (addWinMsg(MSG(buf)) && FbShellManager::instance()->activeShell() == mShell) { + doDrawText(MSG(buf)); + } + break; + + case Ping: + sendAckPing(); + break; + + default: + break; + } + } +} + +typedef enum { Intersect, Inside, Outside } IntersectState; + +static IntersectState intersectRectangles(const Rectangle &r1, const Rectangle &r2) +{ + if (!r1.w || !r1.h) return Inside; + if (!r2.w || !r2.h) return Outside; + if (r1.x >= (r2.x + r2.w) || r1.y >= (r2.y + r2.h) || (r1.x + r1.w) <= r2.x || (r1.y + r1.h) <= r2.y) return Outside; + if (r1.x >= r2.x && r1.y >= r2.y && (r1.x + r1.w) <= (r2.x + r2.w) && (r1.y + r1.h) <= (r2.y + r2.h)) return Inside; + return Intersect; +} + +void ImProxy::redrawImWin(const Rectangle &rect) +{ + for (u32 num = mValidWinNum, i = 0; num && i < NR_IM_WINS; i++) { + if (!mWins[i].w || !mWins[i].h) continue; + num--; + + IntersectState state = intersectRectangles(rect, mWins[i]); + if (state == Outside) continue; + + for (MsgList::iterator it = mWinMsgs[i].begin(); it != mWinMsgs[i].end(); it++) { + Message *m = *it; + + if (m->type == FillRect) doFillRect(m); + else if (m->type == DrawText) doDrawText(m); + } + } +} + +void ImProxy::setImWin(u32 id, Rectangle &rect) +{ + if (id >= NR_IM_WINS) return; + + if (!rect.w || !rect.h || rect.x >= sw || rect.y >= sh) + memset(&rect, 0, sizeof(rect)); + + if (rect.x + rect.w >= sw) rect.w = sw - rect.x; + if (rect.y + rect.h >= sh) rect.h = sh - rect.y; + + bool active = (FbShellManager::instance()->activeShell() == mShell); + + if (active && intersectRectangles(mWins[id], rect) != Inside) { + Rectangle oldrect = mWins[id]; + + memset(&mWins[id], 0, sizeof(rect)); + mValidWinNum--; + + u32 endx = oldrect.x + oldrect.w, endy = oldrect.y + oldrect.h; + u16 col = oldrect.x / FW(1); + u16 row = oldrect.y / FH(1); + u16 endcol = endx / FW(1); + u16 endrow = endy / FH(1); + + mShell->expose(col, row, endcol - col + 1, endrow - row + 1); + } + + if (!mWins[id].w && rect.w) mValidWinNum++; + mWins[id] = rect; + + if (active) { + Screen::instance()->enableScroll(!mValidWinNum); + } + + for (MsgList::iterator it = mWinMsgs[id].begin(); it != mWinMsgs[id].end(); it++) { + delete[] (s8 *)(*it); + } + + mWinMsgs[id].clear(); +} + +bool ImProxy::addWinMsg(Message *m) +{ + Rectangle rect = { 0, 0, 1, 1 }; + if (m->type == FillRect) rect = m->fillRect.rect; + else { + if (m->len > MSG_DRAWTEXT_MAX_LEN) return false; + + rect.x = m->drawText.x; + rect.y = m->drawText.y; + } + + for (u32 num = mValidWinNum, i = 0; num && i < NR_IM_WINS; i++) { + if (!mWins[i].w || !mWins[i].h) continue; + num--; + + IntersectState state = intersectRectangles(rect, mWins[i]); + if (state != Inside) continue; + + if (mWinMsgs[i].size() >= NR_WIN_MSGS) return false; + + s8 *buf = new s8[m->len]; + memcpy(buf, m, m->len); + + mWinMsgs[i].push_back((Message *)buf); + break; + } + + return true; +} + +void ImProxy::doFillRect(Message *m) +{ + Rectangle &rect = m->fillRect.rect; + Screen::instance()->fillRect(rect.x, rect.y, rect.w, rect.h, m->fillRect.color); +} + +static void utf8_to_utf16(u8 *utf8, u16 *utf16, u16 &len) +{ + u8 *end = utf8 + len; + len = 0; + + for (; utf8 < end;) { + if ((*utf8 & 0x80) == 0) { + utf16[len++] = *utf8; + utf8++; + } else if ((*utf8 & 0xe0) == 0xc0) { + utf16[len++] = ((*utf8 & 0x1f) << 6) | (utf8[1] & 0x3f); + utf8 += 2; + } else if ((*utf8 & 0xf0) == 0xe0) { + utf16[len++] = ((*utf8 & 0xf) << 12) | ((utf8[1] & 0x3f) << 6) | (utf8[2] & 0x3f); + utf8 += 3; + } else utf8++; + } +} + +void ImProxy::doDrawText(Message *m) +{ + if (m->len <= OFFSET(Message, drawText.texts)) return; + + u16 len = m->len - OFFSET(Message, drawText.texts); + u8 *utf8 = (u8 *)(m->drawText.texts); + + u16 utf16[len]; + utf8_to_utf16(utf8, utf16, len); + + if (!len) return; + + bool dws[len]; + for (u16 i = 0; i < len; i++) { + dws[i] = (VTerm::charWidth(utf16[i]) == 2); + } + + Screen::instance()->drawText(m->drawText.x, m->drawText.y, m->drawText.fc, m->drawText.bc, len, utf16, dws); +} + +void ImProxy::waitImMessage(u32 type) +{ + mMsgWaitState = WaitingMessage; + mMsgWaitType = type; + + timeval tv = {2, 0}; + + while (1) { + fd_set fds; + FD_ZERO(&fds); + FD_SET(fd(), &fds); + + s32 ret = select(fd() + 1, &fds, 0, 0, &tv); + + if (ret > 0 && FD_ISSET(fd(), &fds)) ready(true); + if ((ret == -1 && errno != EINTR) || !ret || mMsgWaitState == GotMessage) break; + }; + + mMsgWaitState = NoMessageToWait; +} + +void ImProxy::ioError(bool read, s32 err) +{ + if (read && mMsgWaitState == WaitingMessage) mMsgWaitState = GotMessage; +} diff --git a/src/improxy.h b/src/improxy.h new file mode 100644 index 0000000..bdc5234 --- /dev/null +++ b/src/improxy.h @@ -0,0 +1,73 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 IM_PROXY_H +#define IM_PROXY_H + +#include <list> +#include "io.h" +#include "immessage.h" + +class FbShell; + +class ImProxy: public IoPipe { +public: + ImProxy(FbShell *shell); + ~ImProxy(); + + s32 imProcessId() { return mPid; } + bool actived(); + void toggleActive(); + void sendKey(s8 *buf, u32 len); + void changeCursorPos(u16 col, u16 row); + void changeTermMode(bool crlf, bool appkey, bool curo); + void switchVt(bool enter, ImProxy *peer); + void redrawImWin(const Rectangle &rect); + +private: + virtual void readyRead(s8 *buf, u32 len); + virtual void ioError(bool read, s32 err); + + void createImProcess(); + void waitImMessage(u32 type); + void sendInfo(); + void sendAckWin(); + void sendAckPing(); + void sendDisconnect(); + void setImWin(u32 winid, Rectangle &rect); + bool addWinMsg(Message *m); + void doFillRect(Message *m); + void doDrawText(Message *m); + + FbShell *mShell; + s32 mPid; + bool mConnected; + bool mActive; + bool mRawInput; + enum {NoMessageToWait, WaitingMessage, GotMessage} mMsgWaitState; + u32 mMsgWaitType; + + u32 mValidWinNum; + typedef std::list<Message *> MsgList; + MsgList mWinMsgs[NR_IM_WINS]; + Rectangle mWins[NR_IM_WINS]; +}; + +#endif diff --git a/src/input.cpp b/src/input.cpp new file mode 100644 index 0000000..f6ab87b --- /dev/null +++ b/src/input.cpp @@ -0,0 +1,312 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <unistd.h> +#include <stdio.h> +#include <string.h> +#include <termios.h> +#include <sys/ioctl.h> +#include <sys/vt.h> +#include <linux/kd.h> +#include <linux/input.h> +#include "input.h" +#include "input_key.h" +#include "fbshell.h" +#include "fbshellman.h" +#include "fbterm.h" +#include "improxy.h" +#include "fbconfig.h" + +static termios oldTm; +static long oldKbMode; +static bool keymapFailure = false; +static bool inited = false; + +DEFINE_INSTANCE(TtyInput) + +TtyInput *TtyInput::createInstance() +{ + s8 buf[64]; + if (ttyname_r(STDIN_FILENO, buf, sizeof(buf))) { + fprintf(stderr, "stdin isn't a tty!\n"); + return 0; + } + + if (!strstr(buf, "/dev/tty") && !strstr(buf, "/dev/vc")) { + fprintf(stderr, "stdin isn't a interactive tty!\n"); + return 0; + } + + return new TtyInput(); +} + +TtyInput::TtyInput() +{ + setFd(dup(STDIN_FILENO)); +} + +TtyInput::~TtyInput() +{ + if (!inited) return; + + setupSysKey(true); + ioctl(STDIN_FILENO, KDSKBMODE, oldKbMode); + tcsetattr(STDIN_FILENO, TCSAFLUSH, &oldTm); +} + +void TtyInput::showInfo(bool verbose) +{ + if (keymapFailure) { + printf("[input] can't change kernel keymap table, all shortcuts will NOT work! see SECURITY NOTES section of man page for solution.\n"); + } +} + +void TtyInput::switchVc(bool enter) +{ + setupSysKey(!enter); + + if (!enter || inited) return; + inited = true; + + tcgetattr(STDIN_FILENO, &oldTm); + + ioctl(STDIN_FILENO, KDGKBMODE, &oldKbMode); + setRawMode(false, true); + + termios tm = oldTm; + cfmakeraw(&tm); + tm.c_cc[VMIN] = 1; + tm.c_cc[VTIME] = 0; + tcsetattr(STDIN_FILENO, TCSAFLUSH, &tm); +} + +void TtyInput::setupSysKey(bool restore) +{ + #define T_SHIFT (1 << KG_SHIFT) + #define T_CTRL (1 << KG_CTRL) + #define T_CTRL_ALT ((1 << KG_CTRL) + (1 << KG_ALT)) + + static bool syskey_saved = false; + static struct KeyEntry { + u8 table; + u8 keycode; + u16 new_val; + u16 old_val; + } sysKeyTable[] = { + {T_SHIFT, KEY_PAGEUP, SHIFT_PAGEUP}, + {T_SHIFT, KEY_PAGEDOWN, SHIFT_PAGEDOWN}, + {T_SHIFT, KEY_LEFT, SHIFT_LEFT}, + {T_SHIFT, KEY_RIGHT, SHIFT_RIGHT}, + {T_CTRL, KEY_SPACE, CTRL_SPACE}, + {T_CTRL_ALT, KEY_1, CTRL_ALT_1}, + {T_CTRL_ALT, KEY_2, CTRL_ALT_2}, + {T_CTRL_ALT, KEY_3, CTRL_ALT_3}, + {T_CTRL_ALT, KEY_4, CTRL_ALT_4}, + {T_CTRL_ALT, KEY_5, CTRL_ALT_5}, + {T_CTRL_ALT, KEY_6, CTRL_ALT_6}, + {T_CTRL_ALT, KEY_7, CTRL_ALT_7}, + {T_CTRL_ALT, KEY_8, CTRL_ALT_8}, + {T_CTRL_ALT, KEY_9, CTRL_ALT_9}, + {T_CTRL_ALT, KEY_0, CTRL_ALT_0}, + {T_CTRL_ALT, KEY_C, CTRL_ALT_C}, + {T_CTRL_ALT, KEY_D, CTRL_ALT_D}, + {T_CTRL_ALT, KEY_E, CTRL_ALT_E}, + {T_CTRL_ALT, KEY_F1, CTRL_ALT_F1}, + {T_CTRL_ALT, KEY_F2, CTRL_ALT_F2}, + {T_CTRL_ALT, KEY_F3, CTRL_ALT_F3}, + {T_CTRL_ALT, KEY_F4, CTRL_ALT_F4}, + {T_CTRL_ALT, KEY_F5, CTRL_ALT_F5}, + {T_CTRL_ALT, KEY_F6, CTRL_ALT_F6}, + {T_CTRL_ALT, KEY_K, CTRL_ALT_K}, + }; + + if (!syskey_saved && restore) return; + + seteuid(0); + + s8 imapp[128]; + Config::instance()->getOption("input-method", imapp, sizeof(imapp)); + + for (u32 i = 0; i < sizeof(sysKeyTable) / sizeof(KeyEntry); i++) { + if (!imapp[0] + && (sysKeyTable[i].new_val == CTRL_SPACE + || sysKeyTable[i].new_val == CTRL_ALT_K)) continue; + + kbentry entry; + entry.kb_table = sysKeyTable[i].table; + entry.kb_index = sysKeyTable[i].keycode; + + if (!syskey_saved) { + ioctl(STDIN_FILENO, KDGKBENT, &entry); + sysKeyTable[i].old_val = entry.kb_value; + } + + entry.kb_value = (restore ? sysKeyTable[i].old_val : sysKeyTable[i].new_val); + s32 ret = ioctl(STDIN_FILENO, KDSKBENT, &entry); //should have perm CAP_SYS_TTY_CONFIG + if (!keymapFailure && ret == -1) keymapFailure = true; + } + + if (!syskey_saved && !restore) syskey_saved = true; + + seteuid(getuid()); +} + +void TtyInput::readyRead(s8 *buf, u32 len) +{ + if (mRawMode) { + processRawKeys(buf, len); + return; + } + + FbShell *shell = FbShellManager::instance()->activeShell(); + + u32 start = 0; + for (u32 i = 0; i < len; i++) { + u32 orig = i; + u16 c = (u8)buf[i]; + + if ((c >> 5) == 0x6 && i < (len - 1) && (((u8)buf[++i]) >> 6) == 0x2) { + c = ((c & 0x1f) << 6) | (buf[i] & 0x3f); + if (c < AC_START || c > AC_END) continue; + + if (shell && orig > start) shell->keyInput(buf + start, orig - start); + start = i + 1; + + FbTerm::instance()->processSysKey(c); + } + } + + if (shell && len > start) shell->keyInput(buf + start, len - start); +} + +static u16 down_num; +static bool key_down[NR_KEYS]; +static u8 shift_down[NR_SHIFT]; +static u16 shift_state; + +void TtyInput::setRawMode(bool raw, bool force) +{ + if (!force && raw == mRawMode) return; + + mRawMode = raw; + ioctl(STDIN_FILENO, KDSKBMODE, mRawMode ? K_MEDIUMRAW : K_UNICODE); + + if (mRawMode) { + down_num = 0; + shift_state = 0; + memset(key_down, 0, sizeof(bool) * NR_KEYS); + memset(shift_down, 0, sizeof(char) * NR_SHIFT); + } else { + if (!down_num) return; + + FbShell *shell = FbShellManager::instance()->activeShell(); + if (!shell) return; + + u32 num = down_num; + for (u32 i = 0; i < NR_KEYS; i++) { + if (!key_down[i]) continue; + + s8 code = i | 0x80; + shell->keyInput(&code, 1); + + if (!--num) break; + } + } +} + +void TtyInput::processRawKeys(s8 *buf, u32 len) +{ + FbShell *shell = FbShellManager::instance()->activeShell(); + u32 start = 0; + + for (u32 i = 0; i < len; i++) { + bool down = !(buf[i] & 0x80); + u16 code = buf[i] & 0x7f; + u32 orig = i; + + if (!code) { + if (i + 2 >= len) break; + + code = (buf[++i] & 0x7f) << 7; + code |= buf[++i] & 0x7f; + if (!(buf[i] & 0x80) || !(buf[i - 1] & 0x80)) continue; + } + + if (code >= NR_KEYS) continue; + + if (down ^ key_down[code]) { + if (down) down_num++; + else down_num--; + } else if (!down) { + if (shell && orig > start) shell->keyInput(buf + start, orig - start); + start = i + 1; + } + + bool rep = (down && key_down[code]); + key_down[code] = down; + + struct kbentry ke; + ke.kb_table = shift_state; + ke.kb_index = code; + + if (ioctl(STDIN_FILENO, KDGKBENT, &ke) == -1) continue; + + u16 value = KVAL(ke.kb_value); + u16 syskey = 0, switchvc = 0; + + switch (KTYP(ke.kb_value)) { + case KT_LATIN: + if (value >= AC_START && value <= AC_END) syskey = value; + break; + + case KT_CONS: + switchvc = value + 1; + break; + + case KT_SHIFT: + if (rep || value >= NR_SHIFT) break; + if (value == KVAL(K_CAPSSHIFT)) value = KVAL(K_SHIFT); + + if (down) shift_down[value]++; + else if (shift_down[value]) shift_down[value]--; + + if (shift_down[value]) shift_state |= (1 << value); + else shift_state &= ~(1 << value); + + break; + + default: + break; + } + + if (down && (syskey || switchvc)) { + if (shell && i >= start) shell->keyInput(buf + start, i - start + 1); + start = i + 1; + + if (syskey) { + FbTerm::instance()->processSysKey(syskey); + } else { + ioctl(STDIN_FILENO, VT_ACTIVATE, switchvc); + } + } + } + + if (shell && len > start) shell->keyInput(buf + start, len - start); +} diff --git a/src/input.h b/src/input.h new file mode 100644 index 0000000..de47ea6 --- /dev/null +++ b/src/input.h @@ -0,0 +1,42 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 INPUT_H +#define INPUT_H + +#include "io.h" +#include "instance.h" + +class TtyInput : public IoPipe { + DECLARE_INSTANCE(TtyInput) +public: + void switchVc(bool enter); + void setRawMode(bool raw, bool force = false); + void showInfo(bool verbose); + +private: + virtual void readyRead(s8 *buf, u32 len); + void setupSysKey(bool restore); + void processRawKeys(s8* buf, u32 len); + + bool mRawMode; +}; + +#endif diff --git a/src/input_key.h b/src/input_key.h new file mode 100644 index 0000000..5ab5215 --- /dev/null +++ b/src/input_key.h @@ -0,0 +1,56 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 INPUT_KEY_H +#define INPUT_KEY_H + +#include <linux/keyboard.h> + +enum Keys { + AC_START = K(KT_LATIN, 0x80), + SHIFT_PAGEUP = AC_START, + SHIFT_PAGEDOWN, + SHIFT_LEFT, + SHIFT_RIGHT, + CTRL_SPACE, + CTRL_ALT_1, + CTRL_ALT_2, + CTRL_ALT_3, + CTRL_ALT_4, + CTRL_ALT_5, + CTRL_ALT_6, + CTRL_ALT_7, + CTRL_ALT_8, + CTRL_ALT_9, + CTRL_ALT_0, + CTRL_ALT_C, + CTRL_ALT_D, + CTRL_ALT_E, + CTRL_ALT_F1, + CTRL_ALT_F2, + CTRL_ALT_F3, + CTRL_ALT_F4, + CTRL_ALT_F5, + CTRL_ALT_F6, + CTRL_ALT_K, + AC_END = CTRL_ALT_K +}; + +#endif diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am new file mode 100644 index 0000000..935f08f --- /dev/null +++ b/src/lib/Makefile.am @@ -0,0 +1,4 @@ +noinst_LIBRARIES = libshell.a + +libshell_a_SOURCES = io.cpp io.h shell.cpp shell.h vterm_action.cpp vterm.cpp vterm_states.cpp vterm.h type.h instance.h wcwidth.cpp charsetmap.cpp +libshell_a_CXXFLAGS = -fno-exceptions -fno-rtti diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in new file mode 100644 index 0000000..2898d0c --- /dev/null +++ b/src/lib/Makefile.in @@ -0,0 +1,540 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = src/lib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libshell_a_AR = $(AR) $(ARFLAGS) +libshell_a_LIBADD = +am_libshell_a_OBJECTS = libshell_a-io.$(OBJEXT) \ + libshell_a-shell.$(OBJEXT) libshell_a-vterm_action.$(OBJEXT) \ + libshell_a-vterm.$(OBJEXT) libshell_a-vterm_states.$(OBJEXT) \ + libshell_a-wcwidth.$(OBJEXT) libshell_a-charsetmap.$(OBJEXT) +libshell_a_OBJECTS = $(am_libshell_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libshell_a_SOURCES) +DIST_SOURCES = $(libshell_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libshell.a +libshell_a_SOURCES = io.cpp io.h shell.cpp shell.h vterm_action.cpp vterm.cpp vterm_states.cpp vterm.h type.h instance.h wcwidth.cpp charsetmap.cpp +libshell_a_CXXFLAGS = -fno-exceptions -fno-rtti +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libshell.a: $(libshell_a_OBJECTS) $(libshell_a_DEPENDENCIES) + -rm -f libshell.a + $(libshell_a_AR) libshell.a $(libshell_a_OBJECTS) $(libshell_a_LIBADD) + $(RANLIB) libshell.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-charsetmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-shell.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-vterm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-vterm_action.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-vterm_states.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshell_a-wcwidth.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libshell_a-io.o: io.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-io.o -MD -MP -MF $(DEPDIR)/libshell_a-io.Tpo -c -o libshell_a-io.o `test -f 'io.cpp' || echo '$(srcdir)/'`io.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-io.Tpo $(DEPDIR)/libshell_a-io.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='io.cpp' object='libshell_a-io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-io.o `test -f 'io.cpp' || echo '$(srcdir)/'`io.cpp + +libshell_a-io.obj: io.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-io.obj -MD -MP -MF $(DEPDIR)/libshell_a-io.Tpo -c -o libshell_a-io.obj `if test -f 'io.cpp'; then $(CYGPATH_W) 'io.cpp'; else $(CYGPATH_W) '$(srcdir)/io.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-io.Tpo $(DEPDIR)/libshell_a-io.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='io.cpp' object='libshell_a-io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-io.obj `if test -f 'io.cpp'; then $(CYGPATH_W) 'io.cpp'; else $(CYGPATH_W) '$(srcdir)/io.cpp'; fi` + +libshell_a-shell.o: shell.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-shell.o -MD -MP -MF $(DEPDIR)/libshell_a-shell.Tpo -c -o libshell_a-shell.o `test -f 'shell.cpp' || echo '$(srcdir)/'`shell.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-shell.Tpo $(DEPDIR)/libshell_a-shell.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shell.cpp' object='libshell_a-shell.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-shell.o `test -f 'shell.cpp' || echo '$(srcdir)/'`shell.cpp + +libshell_a-shell.obj: shell.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-shell.obj -MD -MP -MF $(DEPDIR)/libshell_a-shell.Tpo -c -o libshell_a-shell.obj `if test -f 'shell.cpp'; then $(CYGPATH_W) 'shell.cpp'; else $(CYGPATH_W) '$(srcdir)/shell.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-shell.Tpo $(DEPDIR)/libshell_a-shell.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shell.cpp' object='libshell_a-shell.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-shell.obj `if test -f 'shell.cpp'; then $(CYGPATH_W) 'shell.cpp'; else $(CYGPATH_W) '$(srcdir)/shell.cpp'; fi` + +libshell_a-vterm_action.o: vterm_action.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm_action.o -MD -MP -MF $(DEPDIR)/libshell_a-vterm_action.Tpo -c -o libshell_a-vterm_action.o `test -f 'vterm_action.cpp' || echo '$(srcdir)/'`vterm_action.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm_action.Tpo $(DEPDIR)/libshell_a-vterm_action.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm_action.cpp' object='libshell_a-vterm_action.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm_action.o `test -f 'vterm_action.cpp' || echo '$(srcdir)/'`vterm_action.cpp + +libshell_a-vterm_action.obj: vterm_action.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm_action.obj -MD -MP -MF $(DEPDIR)/libshell_a-vterm_action.Tpo -c -o libshell_a-vterm_action.obj `if test -f 'vterm_action.cpp'; then $(CYGPATH_W) 'vterm_action.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm_action.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm_action.Tpo $(DEPDIR)/libshell_a-vterm_action.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm_action.cpp' object='libshell_a-vterm_action.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm_action.obj `if test -f 'vterm_action.cpp'; then $(CYGPATH_W) 'vterm_action.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm_action.cpp'; fi` + +libshell_a-vterm.o: vterm.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm.o -MD -MP -MF $(DEPDIR)/libshell_a-vterm.Tpo -c -o libshell_a-vterm.o `test -f 'vterm.cpp' || echo '$(srcdir)/'`vterm.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm.Tpo $(DEPDIR)/libshell_a-vterm.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm.cpp' object='libshell_a-vterm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm.o `test -f 'vterm.cpp' || echo '$(srcdir)/'`vterm.cpp + +libshell_a-vterm.obj: vterm.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm.obj -MD -MP -MF $(DEPDIR)/libshell_a-vterm.Tpo -c -o libshell_a-vterm.obj `if test -f 'vterm.cpp'; then $(CYGPATH_W) 'vterm.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm.Tpo $(DEPDIR)/libshell_a-vterm.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm.cpp' object='libshell_a-vterm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm.obj `if test -f 'vterm.cpp'; then $(CYGPATH_W) 'vterm.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm.cpp'; fi` + +libshell_a-vterm_states.o: vterm_states.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm_states.o -MD -MP -MF $(DEPDIR)/libshell_a-vterm_states.Tpo -c -o libshell_a-vterm_states.o `test -f 'vterm_states.cpp' || echo '$(srcdir)/'`vterm_states.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm_states.Tpo $(DEPDIR)/libshell_a-vterm_states.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm_states.cpp' object='libshell_a-vterm_states.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm_states.o `test -f 'vterm_states.cpp' || echo '$(srcdir)/'`vterm_states.cpp + +libshell_a-vterm_states.obj: vterm_states.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-vterm_states.obj -MD -MP -MF $(DEPDIR)/libshell_a-vterm_states.Tpo -c -o libshell_a-vterm_states.obj `if test -f 'vterm_states.cpp'; then $(CYGPATH_W) 'vterm_states.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm_states.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-vterm_states.Tpo $(DEPDIR)/libshell_a-vterm_states.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vterm_states.cpp' object='libshell_a-vterm_states.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-vterm_states.obj `if test -f 'vterm_states.cpp'; then $(CYGPATH_W) 'vterm_states.cpp'; else $(CYGPATH_W) '$(srcdir)/vterm_states.cpp'; fi` + +libshell_a-wcwidth.o: wcwidth.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-wcwidth.o -MD -MP -MF $(DEPDIR)/libshell_a-wcwidth.Tpo -c -o libshell_a-wcwidth.o `test -f 'wcwidth.cpp' || echo '$(srcdir)/'`wcwidth.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-wcwidth.Tpo $(DEPDIR)/libshell_a-wcwidth.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='wcwidth.cpp' object='libshell_a-wcwidth.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-wcwidth.o `test -f 'wcwidth.cpp' || echo '$(srcdir)/'`wcwidth.cpp + +libshell_a-wcwidth.obj: wcwidth.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-wcwidth.obj -MD -MP -MF $(DEPDIR)/libshell_a-wcwidth.Tpo -c -o libshell_a-wcwidth.obj `if test -f 'wcwidth.cpp'; then $(CYGPATH_W) 'wcwidth.cpp'; else $(CYGPATH_W) '$(srcdir)/wcwidth.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-wcwidth.Tpo $(DEPDIR)/libshell_a-wcwidth.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='wcwidth.cpp' object='libshell_a-wcwidth.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-wcwidth.obj `if test -f 'wcwidth.cpp'; then $(CYGPATH_W) 'wcwidth.cpp'; else $(CYGPATH_W) '$(srcdir)/wcwidth.cpp'; fi` + +libshell_a-charsetmap.o: charsetmap.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-charsetmap.o -MD -MP -MF $(DEPDIR)/libshell_a-charsetmap.Tpo -c -o libshell_a-charsetmap.o `test -f 'charsetmap.cpp' || echo '$(srcdir)/'`charsetmap.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-charsetmap.Tpo $(DEPDIR)/libshell_a-charsetmap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='charsetmap.cpp' object='libshell_a-charsetmap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-charsetmap.o `test -f 'charsetmap.cpp' || echo '$(srcdir)/'`charsetmap.cpp + +libshell_a-charsetmap.obj: charsetmap.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -MT libshell_a-charsetmap.obj -MD -MP -MF $(DEPDIR)/libshell_a-charsetmap.Tpo -c -o libshell_a-charsetmap.obj `if test -f 'charsetmap.cpp'; then $(CYGPATH_W) 'charsetmap.cpp'; else $(CYGPATH_W) '$(srcdir)/charsetmap.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libshell_a-charsetmap.Tpo $(DEPDIR)/libshell_a-charsetmap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='charsetmap.cpp' object='libshell_a-charsetmap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshell_a_CXXFLAGS) $(CXXFLAGS) -c -o libshell_a-charsetmap.obj `if test -f 'charsetmap.cpp'; then $(CYGPATH_W) 'charsetmap.cpp'; else $(CYGPATH_W) '$(srcdir)/charsetmap.cpp'; fi` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/lib/charsetmap.cpp b/src/lib/charsetmap.cpp new file mode 100644 index 0000000..2914088 --- /dev/null +++ b/src/lib/charsetmap.cpp @@ -0,0 +1,171 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * based on GTerm by Timothy Miller <tim@techsource.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "vterm.h" + +static u16 translations[][256] = { + /* 8-bit Latin-1 mapped to Unicode -- trivial mapping */ + { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff + }, + /* VT100 graphics mapped to Unicode */ + { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x2192, 0x2190, 0x2191, 0x2193, 0x002f, + 0x2588, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x00a0, + 0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1, + 0x2591, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba, + 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534, 0x252c, + 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, 0x007f, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff + }, + /* IBM Codepage 437 mapped to Unicode */ + { + 0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, + 0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c, + 0x25b6, 0x25c0, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8, + 0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302, + 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, + 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, + 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, + 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, + 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, + 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, + 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, + 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, + 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 + }, + /* User mapping -- default to codes for direct font mapping */ + { + 0xf000, 0xf001, 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007, + 0xf008, 0xf009, 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f, + 0xf010, 0xf011, 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017, + 0xf018, 0xf019, 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, + 0xf020, 0xf021, 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027, + 0xf028, 0xf029, 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f, + 0xf030, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, + 0xf038, 0xf039, 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f, + 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047, + 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f, + 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057, + 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f, + 0xf060, 0xf061, 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067, + 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f, + 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077, + 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f, + 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087, + 0xf088, 0xf089, 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, 0xf08f, + 0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, 0xf097, + 0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, 0xf09f, + 0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, 0xf0a7, + 0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, 0xf0af, + 0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, 0xf0b7, + 0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, 0xf0bf, + 0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, 0xf0c7, + 0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, 0xf0cf, + 0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d7, + 0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, 0xf0df, + 0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, 0xf0e7, + 0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, 0xf0ef, + 0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, 0xf0f7, + 0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, 0xf0ff + } +}; + +u32 VTerm::translate_char(u32 c) +{ + if (c >= 256) return c; + return translations[charset][c]; +} diff --git a/src/lib/instance.h b/src/lib/instance.h new file mode 100644 index 0000000..740e139 --- /dev/null +++ b/src/lib/instance.h @@ -0,0 +1,63 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 INSTANCE_H +#define INSTANCE_H + +#define DECLARE_INSTANCE(classname) \ +public: \ + static classname *instance(); \ + static void uninstance(); \ +protected: \ + classname(); \ + virtual ~classname(); \ +private: \ + static classname *createInstance(); \ + static classname *mp##classname; + +#define DEFINE_INSTANCE(classname) \ +classname *classname::mp##classname = 0; \ + \ +classname *classname::instance() \ +{ \ + if (!mp##classname) { \ + mp##classname = createInstance(); \ + } \ + \ + return mp##classname; \ +} \ + \ +void classname::uninstance() \ +{ \ + if (mp##classname) { \ + delete mp##classname; \ + mp##classname = 0; \ + } \ +} + +#define DEFINE_INSTANCE_DEFAULT(classname) \ +DEFINE_INSTANCE(classname) \ + \ +classname *classname::createInstance() \ +{ \ + return new classname(); \ +} + +#endif diff --git a/src/lib/io.cpp b/src/lib/io.cpp new file mode 100644 index 0000000..e9a20b7 --- /dev/null +++ b/src/lib/io.cpp @@ -0,0 +1,249 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <string.h> +#include <locale.h> +#include <langinfo.h> +#include <iconv.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <time.h> +#include "io.h" + +DEFINE_INSTANCE(IoDispatcher) + +IoDispatcher::IoDispatcher() +{ +} + +IoDispatcher::~IoDispatcher() +{ +} + +const s8 *IoPipe::localCodec() +{ + static s8 local_codec[32]; + if (!local_codec[0]) { + // The output character set of gettext is, by default, the value of nl_langinfo(CODESET), + // which depends on the LC_CTYPE part of the current locale. + setlocale(LC_CTYPE, ""); + + s8 *locale = setlocale(LC_CTYPE, ""); + if (!locale || !strcmp(locale, "C")) { + strcpy(local_codec, "UTF-8"); + } else { + strncpy(local_codec, nl_langinfo(CODESET), sizeof(local_codec) - 1); + } + } + + return local_codec; +} + +IoPipe::IoPipe() +{ + mFd = -1; + mCodecRead = 0; + mCodecWrite = 0; + mBufLenRead = 0; + mBufLenWrite = 0; +} + +IoPipe::~IoPipe() +{ + if (mFd != -1) { + IoDispatcher::instance()->removeIoSource(this, true); + close(mFd); + } + + if (mCodecRead) { + iconv_close((iconv_t)mCodecRead); + } + + if (mCodecWrite) { + iconv_close((iconv_t)mCodecWrite); + } +} + +void IoPipe::setFd(s32 fd) +{ + if (fd == mFd) return; + + if (mFd != -1) { + IoDispatcher::instance()->removeIoSource(this, true); + close(mFd); + } + + mFd = fd; + + if (mFd != -1) { + fcntl(mFd, F_SETFD, fcntl(mFd, F_GETFD) | FD_CLOEXEC); + fcntl(mFd, F_SETFL, fcntl(mFd, F_GETFL) | O_NONBLOCK); + + IoDispatcher::instance()->addIoSource(this, true); + } +} + + +void IoPipe::setCodec(const s8 *up, const s8 *down) +{ + if (!up || !down) return; + + if (mCodecRead) { + iconv_close((iconv_t)mCodecRead); + mCodecRead = 0; + } + + if (mCodecWrite) { + iconv_close((iconv_t)mCodecWrite); + mCodecWrite = 0; + } + + if (!strcasecmp(up, down)) return; + + mCodecRead = iconv_open(up, down); + if (mCodecRead == (void*)-1) mCodecRead = 0; + + mCodecWrite = iconv_open(down, up); + if (mCodecWrite == (void*)-1) mCodecWrite = 0; +} + +#define BUF_SIZE 10240 + +void IoPipe::ready(bool isread) +{ + if (!isread) return; + + s8 buf[BUF_SIZE]; + s32 len = read(mFd, buf + mBufLenRead, sizeof(buf) - mBufLenRead); + + if (!len) { + ioError(true, 0); // end of file + } else if (len == -1) { + if (errno != EAGAIN && errno != EINTR) { + ioError(true, errno); + } + } else if (len > 0) { + if (mBufLenRead) { + memcpy(buf, mBufRead, mBufLenRead); + len += mBufLenRead; + mBufLenRead = 0; + } + + translate(true, buf, len); + } +} + +void IoPipe::write(s8 *buf, u32 len) +{ + translate(false, buf, len); +} + +void IoPipe::translate(bool isread, s8 *buf, u32 len) +{ + if (!buf || !len) return; + + s8 *bufleft; + u32 *buflen; + iconv_t codec; + + if (isread) { + bufleft = mBufRead; + buflen = &mBufLenRead; + codec = (iconv_t)mCodecRead; + } else { + bufleft = mBufWrite; + buflen = &mBufLenWrite; + codec = (iconv_t)mCodecWrite; + } + + if (!codec) { + if (isread) { + readyRead(buf, len); + } else { + writeIo(buf, len); + } + + return; + } + + u32 outlen = BUF_SIZE; + s8 outbuf[outlen]; + + size_t nconv, left, total = len; + s8 *outptr, *inptr = buf; + + while (total) { + outptr = outbuf; + left = outlen; + + nconv = iconv(codec, &inptr, &total, &outptr, &left); + if (left < outlen) { + if (isread) { + readyRead(outbuf, outlen - left); + } else { + writeIo(outbuf, outlen - left); + } + } + + if ((ssize_t)nconv == -1) { + if (errno == EILSEQ) { + s8 c = '?'; + if (isread) { + readyRead(&c, 1); + } else { + writeIo(&c, 1); + } + + inptr++; + total--; + } else if (errno == EINVAL) { + memcpy(bufleft, inptr, total); + *buflen = total; + total = 0; + } + } + } +} + +void IoPipe::writeIo(s8 *buf, u32 len) +{ + u32 num = 5; + + while (len) { + s32 ret = ::write(mFd, buf, len); + if (ret == -1) { + if (errno == EAGAIN) { + if (num--) { + timespec tm = { 0, 200 * 1000000UL }; + nanosleep(&tm, 0); + } else break; + } else { + if (errno != EINTR) { + ioError(false, errno); + } + break; + } + } else if (ret > 0) { + buf += ret; + len -= ret; + } + } +} diff --git a/src/lib/io.h b/src/lib/io.h new file mode 100644 index 0000000..bb5ca99 --- /dev/null +++ b/src/lib/io.h @@ -0,0 +1,64 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 IO_H +#define IO_H + +#include "type.h" +#include "instance.h" + +class IoPipe { +public: + IoPipe(); + virtual ~IoPipe(); + + s32 fd() { return mFd; } + void ready(bool isread); + + static const s8 *localCodec(); + +protected: + void setFd(s32 fd); + void setCodec(const s8 *up, const s8 *down); + void write(s8 *buf, u32 len); + + virtual void readyRead(s8 *buf, u32 len) = 0; + virtual void ioError(bool read, s32 err) {} + +private: + void translate(bool isread, s8 *buf, u32 len); + void writeIo(s8 *buf, u32 len); + + s32 mFd; + void *mCodecRead, *mCodecWrite; + s8 mBufRead[16], mBufWrite[16]; + u32 mBufLenRead, mBufLenWrite; +}; + +class IoDispatcher { + DECLARE_INSTANCE(IoDispatcher) +private: + virtual void addIoSource(IoPipe *src, bool isread) = 0; + virtual void removeIoSource(IoPipe *src, bool isread) = 0; + + friend class IoPipe; +}; + +#endif diff --git a/src/lib/shell.cpp b/src/lib/shell.cpp new file mode 100644 index 0000000..657c4a4 --- /dev/null +++ b/src/lib/shell.cpp @@ -0,0 +1,430 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <errno.h> +#include <pty.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> +#include <termios.h> +#include <sched.h> +#include <sys/ioctl.h> +#include <sys/wait.h> +#include "shell.h" + +void waitChildProcessExit(s32 pid) +{ + if (pid < 0) return; + + kill(pid, SIGTERM); + sched_yield(); + + s32 ret = waitpid(pid, 0, WNOHANG); + if (ret > 0 || (ret == -1 && errno == ECHILD)) return; + + for (u32 i = 5; i--;) { + usleep(100 * 1000); + + ret = waitpid(pid, 0, WNOHANG); + if (ret > 0) break; + } + + if (ret <= 0) { + kill(pid, SIGKILL); + waitpid(pid, 0, 0); + } +} + +Shell::SelectedText Shell::mSelText; + +Shell::Shell() +{ + mPid = -1; +} + +Shell::~Shell() +{ + setFd(-1); + waitChildProcessExit(mPid); +} + +void Shell::createShellProcess(s8 **command) +{ + s32 fd; + mPid = forkpty(&fd, NULL, NULL, NULL); + + switch (mPid) { + case -1: + break; + + case 0: // child process + initShellProcess(); + setenv("TERM", "linux", 1); + + if (command) { + execvp(command[0], command); + } else { + s8 *shell = getenv("SHELL"); + if (shell) execlp(shell, shell, NULL); + + struct passwd *userpd = getpwuid(getuid()); + execlp(userpd->pw_shell, userpd->pw_shell, NULL); + + execlp("/bin/sh", "/bin/sh", NULL); + } + + exit(1); + break; + + default: + setFd(fd); + setCodec("UTF-8", localCodec()); + resize(w(), h()); + break; + } +} + +void Shell::readyRead(s8 *buf, u32 len) +{ + resetTextSelect(); + input((const u8 *)buf, len); +} + +void Shell::sendBack(const s8 *data) +{ + write((s8*)data, strlen(data)); +} + +void Shell::resize(u16 w, u16 h) +{ + if (!w || !h) return; + + resetTextSelect(); + VTerm::resize(w, h); + + struct winsize size; + size.ws_xpixel = 0; + size.ws_ypixel = 0; + size.ws_col = w; + size.ws_row = h; + ioctl(fd(), TIOCSWINSZ, &size); +} + +void Shell::keyInput(s8 *buf, u32 len) +{ + resetTextSelect(); + write(buf, len); +} + +void Shell::mouseInput(u16 x, u16 y, s32 type, s32 buttons) +{ + if (x >= w()) x = w() - 1; + if (y >= h()) y = h() - 1; + + s32 btn = buttons & MouseButtonMask; + s32 modifies = buttons & ModifyButtonMask; + u16 rtype = mode(MouseReport); + + if (btn && rtype != Wheel && (rtype == MouseNone || (modifies & ShiftButton))) { + textSelect(x, y, type, btn); + return; + } + + if (rtype == MouseNone) return; + + s32 val = -1; + + switch (type) { + case Press: + case DblClick: + if (btn & LeftButton) val = 0; + else if (btn & MidButton) val = 1; + else if (btn & RightButton) val = 2; + break; + case Release: + if (rtype == MouseX11) val = 3; + break; + case Wheel: + if (rtype == MouseX11) { + val = 64; + if (btn & WheelDown) val |= 1; + } + break; + default: + break; + } + + if (rtype == MouseX11 && val != -1) { + if (modifies & ShiftButton) val |= 4; + if (modifies & AltButton) val |= 8; + if (modifies & ControlButton) val |= 16; + } + + if (val != -1) { + s8 buf[8]; + snprintf(buf, sizeof(buf), "\e[M%c%c%c", ' ' + val, ' ' + x + 1, ' ' + y + 1); + sendBack(buf); + } +} + +void Shell::textSelect(u16 x, u16 y, s32 type, s32 btn) +{ + if (btn == LeftButton) { + switch (type) { + case Press: + resetTextSelect(); + mSelState.selecting = true; + startTextSelect(x, y); + break; + case Move: + if (mSelState.selecting) { + middleTextSelect(x, y); + } else { + resetTextSelect(); + mSelState.selecting = true; + startTextSelect(x, y); + } + break; + case Release: + mSelState.selecting = false; + endTextSelect(); + break; + case DblClick: + resetTextSelect(); + autoTextSelect(x, y); + break; + default: + break; + } + } else if (btn == RightButton) { + if (type == Press || type == DblClick) { + resetTextSelect(); + putSelectedText(); + } + } +} + +void Shell::startTextSelect(u16 x, u16 y) +{ + mSelState.start = mSelState.end = y * w() + x; + + inverseTextColor(mSelState.start, mSelState.end); + mSelState.color_inversed = true; +} + +void Shell::middleTextSelect(u16 x, u16 y) +{ + u32 start = mSelState.start, end = mSelState.end; + u32 new_end = y * w() + x; + + bool dir_sel = (end >= start); + bool dir_new_sel = (new_end >= start); + + mSelState.end = new_end; + + if (dir_sel == dir_new_sel) { + bool dir_change = (new_end > end); + + u32 &pos = (dir_sel == dir_change) ? end : new_end; + CharAttr attr = charAttr(pos % w(), pos / w()); + + if (dir_sel) { + if (attr.type == CharAttr::DoubleLeft) pos++; + pos++; + } else { + if (attr.type == CharAttr::DoubleRight) pos--; + pos--; + } + + bool dir_new_change = (new_end == end) ? dir_change : (new_end > end); + + if (dir_change == dir_new_change) { + inverseTextColor(end, new_end); + } + } else { + inverseTextColor(start, end); + inverseTextColor(start, new_end); + } +} + +static void utf16_to_utf8(u16 *buf16, u32 num, s8 *buf8) +{ + u16 code; + u32 index = 0; + for (; num--; buf16++) { + code = *buf16; + if (code >> 11) { + buf8[index++] = 0xe0 | (code >> 12); + buf8[index++] = 0x80 | ((code >> 6) & 0x3f); + buf8[index++] = 0x80 | (code & 0x3f); + } else if (code >> 7) { + buf8[index++] = 0xc0 | ((code >> 6) & 0x1f); + buf8[index++] = 0x80 | (code & 0x3f); + } else { + buf8[index++] = code; + } + } + + buf8[index] = 0; +} + +#define SWAP(a, b) do { \ + if (a > b) { \ + u32 tmp = a; \ + a = b; \ + b = tmp; \ + } \ +} while (0) + +void Shell::endTextSelect() +{ + u32 start = mSelState.start, end = mSelState.end; + SWAP(start, end); + + u32 len = end - start + 1; + u16 buf[len]; + s8 *text = new s8[len * 3]; + + u16 sx, sy, ex, ey; + sx = start % w(), sy = start / w(); + ex = end % w(), ey = end / w(); + + u32 index = 0; + for (u16 y = sy; y <= ey; y++) { + u16 x = (y == sy ? sx : 0); + u16 end = (y == ey ? ex : (w() -1)); + for (; x <= end; x++) { + buf[index++] = charCode(x, y); + if (charAttr(x, y).type == CharAttr::DoubleLeft) x++; + } + } + + utf16_to_utf8(buf, index, text); + mSelText.setText(text); +} + +void Shell::resetTextSelect() +{ + mSelState.selecting = false; + if (mSelState.color_inversed) { + mSelState.color_inversed = false; + inverseTextColor(mSelState.start, mSelState.end); + } +} + +void Shell::autoTextSelect(u16 x, u16 y) +{ + static u32 inwordLut[8] = { + 0x00000000, + 0x03FF0000, /* digits */ + 0x07FFFFFE, /* uppercase */ + 0x07FFFFFE, /* lowercase */ + 0x00000000, + 0x00000000, + 0xFF7FFFFF, /* latin-1 accented letters, not multiplication sign */ + 0xFF7FFFFF /* latin-1 accented letters, not division sign */ + }; + + static bool inited = false; + if (!inited) { + inited = true; + + u8 chrs[32]; + initWordChars((s8*)chrs, sizeof(chrs)); + + for (u32 i = 0; chrs[i]; i++) { + if (chrs[i] > 0x7f || chrs[i] <= ' ') continue; + inwordLut[chrs[i] >> 5] |= 1 << (chrs[i] & 0x1f); + } + } + + #define inword(c) ((c) > 0xff || (( inwordLut[(c) >> 5] >> ((c) & 0x1f) ) & 1)) + + u16 code = charCode(x, y); + bool inw = inword(code); + bool found = false; + + u16 sx = x; + while (sx) { + if (inw ^ inword(code)) { + found = true; + break; + } + + code = charCode(--sx, y); + } + + if (found) sx++; + + code = charCode(x, y); + inw = inword(code); + found = false; + + u16 ex = x; + while (ex != w() -1) { + if (inw ^ inword(code)) { + found = true; + break; + } + + code = charCode(++ex, y); + } + + if (found) ex--; + + mSelState.start = y * w() + sx; + mSelState.end = y * w() + ex; + inverseTextColor(mSelState.start, mSelState.end); + mSelState.color_inversed = true; +} + +void Shell::putSelectedText() +{ + if (mSelText.text) { + sendBack(mSelText.text); + } +} + +void Shell::inverseTextColor(u32 start, u32 end) +{ + SWAP(start, end); + + u16 sx, sy, ex, ey; + sx = start % w(), sy = start / w(); + ex = end % w(), ey = end / w(); + + inverse(sx, sy, ex, ey); + + if (charAttr(sx, sy).type == CharAttr::DoubleRight) sx--; + if (charAttr(ex, ey).type == CharAttr::DoubleLeft) ex++; + + requestUpdate(sx, sy, (sy == ey ? (ex + 1) : w()) - sx, 1); + + if (ey > sy + 1) { + requestUpdate(0, sy + 1, w(), ey - sy - 1); + } + + if (ey > sy) { + requestUpdate(0, ey, ex + 1, 1); + } +} diff --git a/src/lib/shell.h b/src/lib/shell.h new file mode 100644 index 0000000..4cacf8e --- /dev/null +++ b/src/lib/shell.h @@ -0,0 +1,100 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 SHELL_H +#define SHELL_H + +#include "io.h" +#include "vterm.h" + +enum MouseType { Press = 0, Release, DblClick, Move, Wheel }; + +enum ButtonState { + NoButton = 0x0000, + LeftButton = 0x0001, + RightButton = 0x0002, + MidButton = 0x0004, + WheelDown = 0x0008, + WheelUp = 0x0010, + MouseButtonMask = 0x00ff, + + ShiftButton = 0x0100, + ControlButton = 0x0200, + AltButton = 0x0400, + ModifyButtonMask = 0x0700 +}; + +class Shell : public IoPipe, public VTerm { +public: + void keyInput(s8 *buf, u32 len); + void mouseInput(u16 x, u16 y, s32 type, s32 buttons); + +protected: + Shell(); + ~Shell(); + + void resize(u16 w, u16 h); + void createShellProcess(s8 **command); + s32 shellProcessId() { return mPid; } + + virtual void initShellProcess() {} + virtual void readyRead(s8 *buf, u32 len); + +private: + static void initWordChars(s8 *buf, u32 len); + virtual void sendBack(const s8 *data); + + void textSelect(u16 x, u16 y, s32 type, s32 buttons); + void startTextSelect(u16 x, u16 y); + void middleTextSelect(u16 x, u16 y); + void endTextSelect(); + void resetTextSelect(); + void autoTextSelect(u16 x, u16 y); + void putSelectedText(); + void inverseTextColor(u32 start, u32 end); + + s32 mPid; + + static struct SelectedText { + SelectedText() { + text = 0; + } + ~SelectedText() { + if (text) delete[] text; + } + void setText(s8 *_text) { + if (text) delete[] text; + text = _text; + } + + s8 *text; + } mSelText; + + struct TextSelection { + TextSelection() { + selecting = color_inversed = false; + } + u32 start, end; + bool selecting; + bool color_inversed; + } mSelState; +}; + +#endif diff --git a/src/lib/type.h b/src/lib/type.h new file mode 100644 index 0000000..5d24687 --- /dev/null +++ b/src/lib/type.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 TYPE_H +#define TYPE_H + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef unsigned long long u64; + +#endif diff --git a/src/lib/vterm.cpp b/src/lib/vterm.cpp new file mode 100644 index 0000000..3a5dcc7 --- /dev/null +++ b/src/lib/vterm.cpp @@ -0,0 +1,834 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * based on GTerm by Timothy Miller <tim@techsource.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <string.h> +#include "vterm.h" + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +VTerm::CharAttr VTerm::default_char_attr = { 0, 0, 1, 0, 0, 0, 0, VTerm::CharAttr::Single }; + +VTerm::CharAttr VTerm::normal_char_attr() +{ + CharAttr a(char_attr); + + if (a.underline && cur_underline_color != -1) { + a.underline = false; + a.fcolor = cur_underline_color; + } + + if (a.intensity == 0 && cur_halfbright_color != -1) { + a.intensity = 1; + a.fcolor = cur_halfbright_color; + } + + return a; +} + +VTerm::CharAttr VTerm::erase_char_attr() +{ + CharAttr a(default_char_attr); + + a.fcolor = char_attr.fcolor; + a.bcolor = char_attr.bcolor; + a.blink = char_attr.blink; + + return a; +} + +VTerm::ModeFlag::ModeFlag() +{ + memset(this, 0, sizeof(ModeFlag)); + auto_wrap = true; + cursor_visible = true; + autorepeat_key = true; +} + +u16 VTerm::history_lines; +u8 VTerm::control_map[MAX_CONTROL_CODE], VTerm::escape_map[NR_STATES][MAX_ESCAPE_CODE]; + +void VTerm::init_state() +{ + for (u8 i = 1; control_sequences[i].code != (u16)-1; i++) { + control_map[control_sequences[i].code] = i; + } + + u8 state = ESnormal; + for (u8 i = 1; ; i++) { + if (escape_sequences[i].code == (u16)-1) { + state++; + if (state == NR_STATES) break; + } else { + u8 start = escape_sequences[i].code & 0xff; + for (u8 j = 0; j <= escape_sequences[i].code >> 8; j++) { + escape_map[state][start + j] = i; + } + } + } +} + +VTerm::VTerm(u16 w, u16 h) +{ + static bool inited = false; + if (!inited) { + inited = true; + init_state(); + history_lines = init_history_lines(); + default_char_attr.fcolor = init_default_color(true); + default_char_attr.bcolor = init_default_color(false); + ambiguous_wide = init_ambiguous_wide(); + } + + text = 0; + attrs = 0; + tab_stops = 0; + linenumbers = 0; + dirty_startx = 0; + dirty_endx = 0; + + width = height = 0; + max_width = max_height = 0; + + history_full = false; + history_save_line = 0; + visual_start_line = 0; + + reset(); + resize(w, h); +} + +VTerm::~VTerm() +{ + if (!text) return; + + delete[] text; + delete[] attrs; + delete[] tab_stops; + delete[] linenumbers; + delete[] dirty_startx; + delete[] dirty_endx; +} + +void VTerm::reset() +{ + utf8 = true; + utf8_count = 0; + g0_is_active = true; + g0_charset = Lat1Map; + g1_charset = GrafMap; + charset = g0_charset; + + esc_state = ESnormal; + + pending_scroll = 0; + scroll_top = 0; + scroll_bot = height ? (height - 1) : 0; + cursor_x = cursor_y = 0; + s_cursor_x = s_cursor_y = 0; + + mode_flags = ModeFlag(); + char_attr = s_char_attr = default_char_attr; + cur_fcolor = default_char_attr.fcolor; + cur_bcolor = default_char_attr.bcolor; + cur_underline_color = -1; + cur_halfbright_color = -1; + + if (text) { + memset(tab_stops, 0, max_width / 8 + 1); + clear_area(0, 0, width - 1, height - 1); + } + + modeChanged(AllModes); +} + +void VTerm::resize(u16 w, u16 h) +{ + if (!w || !h || (w == width && h == height)) return; + + u16 new_max_width = (w > max_width) ? w : max_width; + u16 new_max_height = (h > max_height) ? h : max_height; + u16 minw = MIN(width, w), minh = MIN(height, h); + + if (new_max_width > max_width) { + s8 *new_tab_stops = new s8[new_max_width / 8 + 1]; + memset(new_tab_stops, 0, new_max_width / 8 + 1); + + if (tab_stops) { + memcpy(new_tab_stops, tab_stops, max_width / 8 + 1); + delete[] tab_stops; + } + tab_stops = new_tab_stops; + } else if (w > width) { + + } + + if (new_max_height > max_height) { + u16 *new_linenumbers = new u16[new_max_height]; + u16 *new_dirty_startx = new u16[new_max_height]; + u16 *new_dirty_endx = new u16[new_max_height]; + + for (u16 i = 0; i < new_max_height; i++) { + bool orig = (linenumbers && i < height); + new_linenumbers[i] = orig ? linenumbers[i] : (history_lines + i); + new_dirty_startx[i] = orig ? dirty_startx[i] : w; + new_dirty_endx[i] = orig ? dirty_endx[i] : 0; + } + + if (linenumbers) { + delete[] linenumbers; + delete[] dirty_startx; + delete[] dirty_endx; + } + + linenumbers = new_linenumbers; + dirty_startx = new_dirty_startx; + dirty_endx = new_dirty_endx; + } + + if (new_max_width > max_width || new_max_height > max_height) { + u16 *new_text = new u16[new_max_width * (history_lines + new_max_height)]; + CharAttr *new_attrs = new CharAttr[new_max_width * (history_lines + new_max_height)]; + + if (text) { + u32 start, new_start; + u16 history_copy_lines = (history_full ? history_lines : history_save_line); + for (u16 i = 0; i < history_copy_lines; i++) { + start = i * max_width; + new_start = i * new_max_width; + memcpy(&new_text[new_start], &text[start], sizeof(*text) * max_width); + memcpy(&new_attrs[new_start], &attrs[start], sizeof(*attrs) * max_width); + + for (u16 j = max_width; j < new_max_width; j++) { + new_text[new_start + j] = ' '; + new_attrs[new_start + j] = default_char_attr; + } + } + + for (u16 i = 0; i < max_height; i++) { + start = (history_lines + i) * max_width; + new_start = (history_lines + i) * new_max_width; + memcpy(&new_text[new_start], &text[start], sizeof(*text) * max_width); + memcpy(&new_attrs[new_start], &attrs[start], sizeof(*attrs) * max_width); + } + + delete[] text; + delete[] attrs; + } + + text = new_text; + attrs = new_attrs; + max_width = new_max_width; + max_height = new_max_height; + } + + bool h_changed = false; + + if (h != height) { + h_changed = true; + + if (h < height) { + if (h <= cursor_y) { + scroll_region(0, height - 1, cursor_y - h + 1); + move_cursor(cursor_x, h - 1); + } + } + } + + if (w <= cursor_x) { + move_cursor(w - 1, cursor_y); + } + + width = w; + height = h; + + if (h_changed) { + historyChanged(visual_start_line, total_history_lines()); + } + + scroll_bot = height - 1; + if (scroll_top >= height) scroll_top = 0; + + if (minw < w) { + clear_area(minw, 0, w - 1, h - 1); + } + + if (minh < h) { + clear_area(0, minh, minw, h - 1); + } + +} + +void VTerm::input(const u8 *buf, u32 count) +{ + if (!width) return; + + if (visual_start_line != total_history_lines()) { + historyDisplay(true, total_history_lines()); + historyChanged(visual_start_line, total_history_lines()); + } + + if (mode(CursorVisible)) { + changed_line(cursor_y, cursor_x, cursor_x); + } + + u32 c, tc; + bool rescan; + + while (count > 0) { + u32 orig = *buf; + c = orig; + buf++; + count--; + rescan = 0; + + /* Do no translation at all in control states */ + if (esc_state != ESnormal) { + tc = c; + } else if (utf8 && (!mode_flags.display_ctrl || c < 0x20)) { + rescan_last_byte: + if ((c & 0xc0) == 0x80) { + /* Continuation byte received */ + static const u32 utf8_length_changes[] = { 0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff}; + if (utf8_count) { + cur_char = (cur_char << 6) | (c & 0x3f); + npar++; + if (--utf8_count) { + /* Still need some bytes */ + continue; + } + /* Got a whole character */ + c = cur_char; + /* Reject overlong sequences */ + if (c <= utf8_length_changes[npar - 1] || + c > utf8_length_changes[npar]) + c = 0xfffd; + } else { + /* Unexpected continuation byte */ + utf8_count = 0; + c = 0xfffd; + } + } else { + /* Single ASCII byte or first byte of a sequence received */ + if (utf8_count) { + /* Continuation byte expected */ + rescan = 1; + utf8_count = 0; + c = 0xfffd; + } else if (c > 0x7f) { + /* First byte of a multibyte sequence received */ + npar = 0; + if ((c & 0xe0) == 0xc0) { + utf8_count = 1; + cur_char = (c & 0x1f); + } else if ((c & 0xf0) == 0xe0) { + utf8_count = 2; + cur_char = (c & 0x0f); + } else if ((c & 0xf8) == 0xf0) { + utf8_count = 3; + cur_char = (c & 0x07); + } else if ((c & 0xfc) == 0xf8) { + utf8_count = 4; + cur_char = (c & 0x03); + } else if ((c & 0xfe) == 0xfc) { + utf8_count = 5; + cur_char = (c & 0x01); + } else { + /* 254 and 255 are invalid */ + c = 0xfffd; + } + if (utf8_count) { + /* Still need some bytes */ + continue; + } + } + /* Nothing to do if an ASCII byte was received */ + } + /* End of UTF-8 decoding. */ + /* c is the received character, or U+FFFD for invalid sequences. */ + /* Replace invalid Unicode code points with U+FFFD too */ + if ((c >= 0xd800 && c <= 0xdfff) || c == 0xfffe || c == 0xffff) + c = 0xfffd; + tc = c; + } else { /* no utf or alternate charset mode */ + tc = translate_char(mode_flags.toggle_meta ? (c | 0x80) : c); + } + + cur_char = tc; + + /* A bitmap for codes <32. A bit of 1 indicates that the code + * corresponding to that bit number invokes some special action + * (such as cursor movement) and should not be displayed as a + * glyph unless the disp_ctrl mode is explicitly enabled. + */ +#define CTRL_ACTION 0x0d00ff81 +#define CTRL_ALWAYS 0x0800f501 /* Cannot be overridden by disp_ctrl */ + + /* If the original code was a control character we + * only allow a glyph to be displayed if the code is + * not normally used (such as for cursor movement) or + * if the disp_ctrl mode has been explicitly enabled. + * Certain characters (as given by the CTRL_ALWAYS + * bitmap) are always displayed as control characters, + * as the console would be pretty useless without + * them; to display an arbitrary font position use the + * direct-to-font zone in UTF-8 mode. + */ + bool ok = tc && (c >= 32 || !(mode_flags.display_ctrl ? ((CTRL_ALWAYS >> c) & 1) : (utf8 || ((CTRL_ACTION >> c) & 1)))) + && (c != 127 || mode_flags.display_ctrl) + && (c != 128+27); + + if ((esc_state == ESnormal) && ok) { + do_normal_char(); + + if (rescan) { + rescan = 0; + c = orig; + goto rescan_last_byte; + } + continue; + } + + do_control_char(); + } + + update(); + draw_cursor(); +} + +void VTerm::do_normal_char() +{ + if (cur_char > 0xffff) cur_char = 0xfffd; + + s32 cw = charWidth(cur_char); + if (cw <= 0) return; + + bool dw = (cw == 2); + + u32 yp = linenumbers[cursor_y] * max_width; + if ((!dw && cursor_x >= width) || (dw && (cursor_x >= width - 1))) { + if (mode_flags.auto_wrap) { + if (dw && cursor_x == width - 1) { + text[yp + cursor_x] = ' '; + attrs[yp + cursor_x] = erase_char_attr(); + } + next_line(); + yp = linenumbers[cursor_y] * max_width; + } else { + if (!dw) { + cursor_x = width - 1; + } else { + return; + } + } + } + + if (mode_flags.insert_mode) { + changed_line(cursor_y, cursor_x, width - 1); + + u16 step = dw ? 2 : 1; + for (u16 i = width - step - 1; i >= cursor_x; i--) { + text[yp + i + step] = text[yp + i]; + attrs[yp + i + step] = attrs[yp + i]; + } + } else { + changed_line(cursor_y, cursor_x, cursor_x + (dw ? 1 : 0)); + } + + text[yp + cursor_x] = cur_char; + attrs[yp + cursor_x] = normal_char_attr(); + + if (dw) { + attrs[yp + cursor_x++].type = CharAttr::DoubleLeft; + + text[yp + cursor_x] = cur_char; + attrs[yp + cursor_x] = normal_char_attr(); + attrs[yp + cursor_x++].type = CharAttr::DoubleRight; + } else { + attrs[yp + cursor_x++].type = CharAttr::Single; + } +} + +void VTerm::do_control_char() +{ + u8 index = (cur_char < MAX_CONTROL_CODE ? control_map[cur_char] : 0); + const Sequence *seq = control_sequences + index; + + if (!index && esc_state != ESnormal && cur_char) { + seq = escape_sequences + (cur_char < MAX_ESCAPE_CODE ? escape_map[esc_state][cur_char] : 0); + } + + if (seq->action) (this->*(seq->action))(); + if (seq->next != ESkeep) esc_state = seq->next; +} + +void VTerm::update() +{ + if (!width) return; + + // first perform scroll-copy + s32 mx = scroll_bot - scroll_top + 1; + if (pending_scroll && pending_scroll< mx && -pending_scroll < mx) { + u16 sy, dy, h; + if (pending_scroll < 0) { + sy = scroll_top; + dy = scroll_top - pending_scroll; + h = scroll_bot - scroll_top + pending_scroll + 1; + } else { + sy = scroll_top + pending_scroll; + dy = scroll_top; + h = scroll_bot - scroll_top - pending_scroll + 1; + } + + if (!moveChars(0, sy, 0, dy, width, h)) { + for (; h--; dy++) { + if (dy >= height) break; + dirty_startx[dy] = 0; + dirty_endx[dy] = width - 1; + } + } + } + pending_scroll = 0; + + for (u16 i = 0; i < height; i++) { + if (dirty_endx[i] >= dirty_startx[i]) { + requestUpdate(dirty_startx[i], i, dirty_endx[i] - dirty_startx[i] + 1, 1); + dirty_startx[i] = width; + dirty_endx[i] = 0; + } + } +} + +void VTerm::draw_cursor() +{ + if (!mode(CursorVisible)) return; + + u32 yp = linenumbers[cursor_y] * max_width + cursor_x; + + CharAttr attr = attrs[yp]; + attr.reverse ^= mode_flags.inverse_screen; + + drawCursor(attr, cursor_x, cursor_y, text[yp]); +} + +void VTerm::requestUpdate(u16 x, u16 y, u16 w, u16 h) +{ + expose(x, y, w, h); +} + +void VTerm::expose(u16 x, u16 y, u16 w, u16 h) +{ + if (!width || !w || !h || x >= width || y >= height) return; + + if (x + w > width) w = width - x; + if (y + h > height) h = height - y; + + for (; h--; y++) { + u32 yp = get_line(y) * max_width; + + u16 startx = x; + u16 endx = x + w - 1; + + if (attrs[yp + startx].type == CharAttr::DoubleRight) startx--; + if (attrs[yp + endx].type == CharAttr::DoubleLeft) endx++; + + CharAttr attr = attrs[yp + startx]; + bool dws[width]; + u16 codes[width], num = 0; + u16 cur, start = startx; + + for (cur = startx; cur <= endx; cur++) { + if (attrs[yp + cur].type == CharAttr::DoubleRight) continue; + + if (attrs[yp + cur] != attr) { + attr.reverse ^= mode_flags.inverse_screen; + drawChars(attr, start, y, cur - start, num, codes, dws); + + num = 0; + start = cur; + attr = attrs[yp + cur]; + } + + dws[num] = (attrs[yp + cur].type != CharAttr::Single); + codes[num++] = text[yp + cur]; + } + + attr.reverse ^= mode_flags.inverse_screen; + drawChars(attr, start, y, cur - start, num, codes, dws); + } +} + +void VTerm::inverse(u16 sx, u16 sy, u16 ex, u16 ey) +{ + if (sy > ey) return; + if (charAttr(sx, sy).type == CharAttr::DoubleRight) sx--; + if (charAttr(ex, ey).type == CharAttr::DoubleLeft) ex++; + if (sy == ey && sx > ex) return; + + for (u16 y = sy; y <= ey; y++) { + u32 yp = get_line(y) * max_width; + u16 start = (y == sy) ? sx : 0; + u16 end = (y == ey) ? ex : (w() - 1); + + for (u16 x = start; x <= end; x++) { + attrs[yp + x].reverse ^= 1; + } + } +} + +void VTerm::scroll_region(u16 start_y, u16 end_y, s16 num) +{ + s32 y, takey, fast_scroll, mx, clr; + u16 temp[height]; + u16 temp_sx[height], temp_ex[height]; + + if (!num) return; + if (end_y >= height) end_y = height - 1; + if (start_y > end_y) return; + + mx = end_y-start_y+1; + if (num > mx) num = mx; + if (-num > mx) num = -mx; + + if (start_y == 0 && num > 0) { + history_scroll(num); + } + + fast_scroll = (start_y == scroll_top && end_y == scroll_bot); + + if (fast_scroll) pending_scroll += num; + + memcpy(temp, linenumbers, sizeof(temp)); + if (fast_scroll) { + memcpy(temp_sx, dirty_startx, sizeof(temp_sx)); + memcpy(temp_ex, dirty_endx, sizeof(temp_ex)); + } + + // move the lines by renumbering where they point to + if (num<mx && -num<mx) { + for (y=start_y; y<=end_y; y++) { + takey = y+num; + clr = (takey<start_y) || (takey>end_y); + if (takey<start_y) takey = end_y+1-(start_y-takey); + if (takey>end_y) takey = start_y-1+(takey-end_y); + + linenumbers[y] = temp[takey]; + + if (!fast_scroll || clr) { + dirty_startx[y] = 0; + dirty_endx[y] = width-1; + } else { + dirty_startx[y] = temp_sx[takey]; + dirty_endx[y] = temp_ex[takey]; + } + + if (clr) { + clear_area(0, y, width - 1, y); + } + } + } +} + +void VTerm::shift_text(u16 y, u16 start_x, u16 end_x, s16 num) +{ + if (!num) return; + + u32 yp = linenumbers[y]*max_width; + + u16 mx = end_x-start_x+1; + if (num>mx) num = mx; + if (-num>mx) num = -mx; + + if (num<mx && -num<mx) { + if (num<0) { + memmove(text+yp+start_x, text+yp+start_x-num, sizeof(*text) * (mx+num)); + memmove(attrs+yp+start_x, attrs+yp+start_x-num, sizeof(*attrs) * (mx+num)); + } else { + memmove(text+yp+start_x+num, text+yp+start_x, sizeof(*text) * (mx-num)); + memmove(attrs+yp+start_x+num, attrs+yp+start_x, sizeof(*attrs) * (mx-num)); + } + } + + u16 x = (num < 0) ? (num + end_x + 1) : start_x; + if (num < 0) num = -num; + for (; num--; x++) { + text[yp + x] = ' '; + attrs[yp + x] = erase_char_attr(); + } + + changed_line(y, start_x, end_x); +} + +void VTerm::clear_area(u16 start_x, u16 start_y, u16 end_x, u16 end_y) +{ + if (start_x >= width || start_y >= height) return; + if (end_x >= width) end_x = width - 1; + if (end_y >= height) end_y = height - 1; + if (start_x > end_x || start_y > end_y) return; + + u16 x, y; + u32 yp; + for (y=start_y; y<=end_y; y++) { + yp = linenumbers[y]*max_width; + for (x=start_x; x<=end_x; x++) { + text[yp+x]= ' '; + attrs[yp+x] = erase_char_attr(); + } + changed_line(y, start_x, end_x); + } +} + +void VTerm::changed_line(u16 y, u16 start_x, u16 end_x) +{ + if (y >= height) return; + + if (start_x >= width) start_x = width - 1; + if (end_x >= width) end_x = width - 1; + + if (dirty_startx[y] > start_x) dirty_startx[y] = start_x; + if (dirty_endx[y] < end_x) dirty_endx[y] = end_x; +} + +void VTerm::move_cursor(u16 x, u16 y) +{ + if (x>=width) x = width-1; + if (y>=height) y = height-1; + cursor_x = x; + cursor_y = y; +} + +u16 VTerm::mode(ModeType type) +{ + u16 ret = false; + switch (type) { + case AutoRepeatKey: + ret = mode_flags.autorepeat_key; + break; + case ApplicKeypad: + ret = mode_flags.applic_keypad; + break; + case MouseReport: + ret = mode_flags.mouse_report; + break; + case CursorShape: + ret = mode_flags.cursor_shape; + break; + case CursorKeyEscO: + ret = mode_flags.cursorkey_esco; + break; + case CRWithLF: + ret = mode_flags.crlf; + break; + case CursorVisible: + ret = mode_flags.cursor_visible && (visual_start_line == total_history_lines()); + break; + default: + break; + } + + return ret; +} + +void VTerm::history_scroll(u16 num) +{ + if (!history_lines) return; + + u32 yp, yp_history; + for (u16 i = 0; i < num; i++) { + yp = linenumbers[i] * max_width; + yp_history = history_save_line * max_width; + memcpy(&text[yp_history], &text[yp], sizeof(*text) * width); + memcpy(&attrs[yp_history], &attrs[yp], sizeof(*attrs) * width); + + if (width < max_width) { + for (u16 i = width; i < max_width; i++) { + text[yp_history + i] = ' '; + attrs[yp_history + i] = default_char_attr; + } + } + + history_save_line++; + if (history_save_line == history_lines) { + history_save_line = 0; + if (!history_full) history_full = true; + } + } + + visual_start_line = total_history_lines(); + historyChanged(visual_start_line, total_history_lines()); +} + +void VTerm::historyDisplay(bool absolute, s32 num) +{ + if (!history_lines || (absolute && num == (s32)visual_start_line) || (!absolute && !num)) return; + + u32 bak_line = visual_start_line; + + if (absolute) { + visual_start_line = num; + } else { + if ((s32)visual_start_line < -num) visual_start_line = 0; + else visual_start_line += num; + } + + if (visual_start_line > total_history_lines()) visual_start_line = total_history_lines(); + if (visual_start_line == bak_line) return; + + modeChanged(CursorVisible); + + bool accel_scroll = false; + + u32 scroll_lines = (visual_start_line > bak_line) ? (visual_start_line - bak_line) : (bak_line - visual_start_line); + if (scroll_lines < height) { + u16 sy, dy, updatey; + + if (visual_start_line > bak_line) { + sy = scroll_lines; + dy = 0; + updatey = height - scroll_lines; + } else { + sy = 0; + dy = scroll_lines; + updatey = 0; + } + + accel_scroll = moveChars(0, sy, 0, dy, width, height - scroll_lines); + if (accel_scroll) { + requestUpdate(0, updatey, width, scroll_lines); + } + } + + if (!accel_scroll) { + requestUpdate(0, 0, width, height); + } + + draw_cursor(); +} + +u16 VTerm::get_line(u16 y) +{ + if (y > height) y = height; + u16 line = visual_start_line + y; + + if (line >= total_history_lines()) return linenumbers[line - total_history_lines()]; + + return ((history_full ? history_save_line : 0) + line) % history_lines; +} diff --git a/src/lib/vterm.h b/src/lib/vterm.h new file mode 100644 index 0000000..32ffd2a --- /dev/null +++ b/src/lib/vterm.h @@ -0,0 +1,276 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * based on GTerm by Timothy Miller <tim@techsource.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#ifndef VTERM_H +#define VTERM_H + +#include "type.h" + +class VTerm { +public: + struct CharAttr { + typedef enum { Single = 0, DoubleLeft, DoubleRight } CharType; + + bool operator != (const CharAttr a) { + return fcolor != a.fcolor || bcolor != a.bcolor || intensity != a.intensity + || italic != a.italic || underline != a.underline || blink != a.blink || reverse != a.reverse; + } + + u16 fcolor : 8; + u16 bcolor : 8; + u16 intensity : 2; // 0 = half-bright, 1 = normal, 2 = bold + u16 italic : 1; + u16 underline : 1; + u16 blink : 1; + u16 reverse : 1; + u16 type : 2; + }; + + typedef enum { + MouseNone, MouseX11, MouseX10, + } MouseReportType; + + typedef enum { + CurDefault, CurNone, CurUnderline, CurLowerThird, CurLowerHalf, CurTwoThirds, CurBlock, + } CursorType; + + typedef enum { + CursorVisible = 1, + CursorShape = 2, + MouseReport = 4, + CursorKeyEscO = 8, + AutoRepeatKey = 16, + ApplicKeypad = 32, + CRWithLF = 64, + AllModes = 0xff, + } ModeType; + + typedef enum { + Bell, BellFrequencySet, BellDurationSet, + PaletteSet, PaletteClear, + Blank, Unblank, + LedSet, LedClear, + VcSwitch, VesaPowerIntervalSet, + } RequestType; + + VTerm(u16 w = 0, u16 h = 0); + virtual ~VTerm(); + + u16 w() { return width; } + u16 h() { return height; } + void historyDisplay(bool absolute, s32 num); + u16 mode(ModeType type); + void resize(u16 w, u16 h); + void input(const u8 *buf, u32 count); + void expose(u16 x, u16 y, u16 w, u16 h); + void inverse(u16 sx, u16 sy, u16 ex, u16 ey); + + u16 charCode(u16 x, u16 y) { return text[get_line(y) * max_width + x]; } + CharAttr charAttr(u16 x, u16 y) { return attrs[get_line(y) * max_width + x]; } + + static s32 charWidth(u32 ucs); + +protected: + virtual void drawChars(CharAttr attr, u16 x, u16 y, u16 w, u16 num, u16 *chars, bool *dws) = 0; + virtual bool moveChars(u16 sx, u16 sy, u16 dx, u16 dy, u16 w, u16 h) { return false; } + virtual void drawCursor(CharAttr attr, u16 x, u16 y, u16 c) {} + virtual void sendBack(const s8 *data) {} + virtual void modeChanged(ModeType type) {} + virtual void historyChanged(u32 cur, u32 total) {} + virtual void request(RequestType type, u32 val = 0) {} + virtual void requestUpdate(u16 x, u16 y, u16 w, u16 h); + +private: + // utility functions + void do_normal_char(); + void do_control_char(); + void scroll_region(u16 start_y, u16 end_y, s16 num); // does clear + void shift_text(u16 y, u16 start_x, u16 end_x, s16 num); // ditto + void clear_area(u16 start_x, u16 start_y, u16 end_x, u16 end_y); + void changed_line(u16 y, u16 start_x, u16 end_x); + void move_cursor(u16 x, u16 y); + void update(); + void draw_cursor(); + u16 get_line(u16 y); + u16 total_history_lines() { return history_full ? history_lines : history_save_line; } + + // terminal actions + void set_q_mode(); + void clear_param(); + void param_digit(); + void next_param(); + + // non-printing characters + void cr(), lf(), bell(), tab(), bs(); + + // escape sequence actions + void reset(); + void keypad_numeric(); + void keypad_application(); + void save_cursor(); + void restore_cursor(); + void set_tab(); + void clear_tab(); + void index_down(); + void index_up(); + void next_line(); + void cursor_left(); + void cursor_right(); + void cursor_up(); + void cursor_down(); + void cursor_up_cr(); + void cursor_down_cr(); + void cursor_position(); + void cursor_position_col(); + void cursor_position_row(); + void insert_char(); + void delete_char(); + void erase_char(); + void insert_line(); + void delete_line(); + void erase_line(); + void erase_display(); + void screen_align(); + void set_margins(); + void respond_id(); + void status_report(); + void set_mode(); + void clear_mode(); + void enable_mode(bool); + void set_display_attr(); + void set_utf8(); + void clear_utf8(); + void active_g0(); + void active_g1(); + void current_is_g0(); + void current_is_g1(); + void set_charset(); + u32 translate_char(u32); + void set_cursor_type(); + void linux_specific(); + void begin_set_palette(); + void set_palette(); + void reset_palette(); + void set_led(); + void fbterm_specific(); + + CharAttr normal_char_attr(); + CharAttr erase_char_attr(); + + //history + void history_scroll(u16 num); + + static void init_state(); + static u16 init_history_lines(); + static u8 init_default_color(bool foreground); + static bool init_ambiguous_wide(); + + typedef enum { + ESnormal = 0, ESesc, ESsquare, ESnonstd, ESpercent, EScharset, EShash, ESfunckey, ESkeep + } EscapeState; + + EscapeState esc_state; + + typedef void (VTerm::*ActionFunc)(); + struct Sequence { + u16 code; + ActionFunc action; + EscapeState next; + }; + + static const Sequence control_sequences[], escape_sequences[]; + + #define NR_STATES ESkeep + #define MAX_CONTROL_CODE 256 + #define MAX_ESCAPE_CODE 128 + + static u8 control_map[MAX_CONTROL_CODE], escape_map[NR_STATES][MAX_ESCAPE_CODE]; + + //utf8 parse + u16 utf8_count; + u32 cur_char; + + //treat cjk ambiguous width characters as wide + static bool ambiguous_wide; + + //charset + + typedef enum { Lat1Map = 0, GrafMap, IbmpcMap, UserMap } CharsetMap; + + bool utf8; + bool g0_is_current; + bool g0_is_active, s_g0_is_active; + CharsetMap charset; + CharsetMap g0_charset, g1_charset; + CharsetMap s_g0_charset, s_g1_charset; + + // terminal info + u16 *text; + CharAttr *attrs; + s8 *tab_stops; + u16 *linenumbers; + u16 *dirty_startx, *dirty_endx; + u16 width, height, max_width, max_height; + u16 scroll_top, scroll_bot; + s32 pending_scroll; // >0 means scroll up + + // terminal state + struct ModeFlag { + ModeFlag(); + + u16 toggle_meta : 1; + u16 inverse_screen : 1; + + u16 display_ctrl : 1; + u16 crlf : 1; + u16 auto_wrap : 1; + u16 insert_mode : 1; + u16 cursor_visible : 1; + u16 cursor_relative : 1; + u16 col_132 : 1; + + u16 applic_keypad : 1; + u16 autorepeat_key : 1; + u16 cursorkey_esco : 1; + u16 mouse_report : 2; + u16 cursor_shape : 3; + } mode_flags; + + u16 cursor_x, cursor_y, s_cursor_x, s_cursor_y; + CharAttr char_attr, s_char_attr; + + static CharAttr default_char_attr; + u8 cur_fcolor, cur_bcolor; + s8 cur_underline_color, cur_halfbright_color; + + // action parameters + #define NPAR 16 + u16 npar, param[NPAR]; + bool q_mode, palette_mode; + + //history + static u16 history_lines; + bool history_full; + u32 history_save_line, visual_start_line; +}; + +#endif diff --git a/src/lib/vterm_action.cpp b/src/lib/vterm_action.cpp new file mode 100644 index 0000000..c1cbe05 --- /dev/null +++ b/src/lib/vterm_action.cpp @@ -0,0 +1,702 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * based on GTerm by Timothy Miller <tim@techsource.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <string.h> +#include <stdio.h> +#include "vterm.h" + +void VTerm::cr() +{ + move_cursor(0, cursor_y); +} + +void VTerm::lf() +{ + if (cursor_y < scroll_bot) move_cursor(cursor_x, cursor_y + 1); + else scroll_region(scroll_top, scroll_bot, 1); + + if (mode_flags.crlf) cr(); +} + +void VTerm::bs() +{ + if (cursor_x) move_cursor(cursor_x - 1, cursor_y); +} + +void VTerm::bell() +{ + request(Bell); +} + +void VTerm::tab() +{ + u16 x = 0; + + for (u16 i=cursor_x + 1; i < width; i++) { + s8 a = tab_stops[i/8]; + if (a && (a & (1 << (i % 8)))) { + x = i; + break; + } + } + + if (!x) x = (cursor_x + 8) & -8; + + if (x < width) move_cursor(x, cursor_y); + else move_cursor(width - 1, cursor_y); +} + +void VTerm::set_tab() +{ + tab_stops[cursor_x / 8] |= (1 << (cursor_x % 8)); +} + +void VTerm::clear_tab() +{ + if (param[0] == 3) { + memset(tab_stops, 0, max_width / 8 + 1); + } else if (param[0] == 0) { + tab_stops[cursor_x / 8] &= ~(1 << (cursor_x % 8)); + } +} + +void VTerm::param_digit() +{ + param[npar] = param[npar] * 10 + cur_char - '0'; +} + +void VTerm::next_param() +{ + if (npar < NPAR - 1) npar++; +} + +void VTerm::clear_param() +{ + q_mode = 0; + palette_mode = 0; + npar = 0; + memset(param, 0, sizeof(param)); +} + +void VTerm::save_cursor() +{ + s_g0_charset = g0_charset; + s_g1_charset = g1_charset; + s_g0_is_active = g0_is_active; + + s_cursor_x = cursor_x; + s_cursor_y = cursor_y; + s_char_attr = char_attr; +} + +void VTerm::restore_cursor() +{ + g0_charset = s_g0_charset; + g1_charset = s_g1_charset; + g0_is_active = s_g0_is_active; + charset = (g0_is_active ? g0_charset : g1_charset); + + char_attr = s_char_attr; + move_cursor(s_cursor_x, s_cursor_y); +} + +void VTerm::next_line() +{ + lf(); + cr(); +} + +void VTerm::index_down() +{ + lf(); +} + +void VTerm::index_up() +{ + if (cursor_y > scroll_top) move_cursor(cursor_x, cursor_y - 1); + else scroll_region(scroll_top, scroll_bot, -1); +} + +void VTerm::cursor_left() +{ + u16 n, x; + + n = param[0]; + if (n < 1) n = 1; + + if (cursor_x < n) x = 0; + else x = cursor_x - n; + + move_cursor(x, cursor_y); +} + +void VTerm::cursor_right() +{ + u16 n, x; + + n = param[0]; + if (n < 1) n = 1; + + x = cursor_x + n; + if (x >= width) x = width - 1; + + move_cursor(x, cursor_y); +} + +void VTerm::cursor_up() +{ + u16 n, y; + + n = param[0]; + if (n < 1) n = 1; + + if (cursor_y < n) y = 0; + else y = cursor_y - n; + + move_cursor(cursor_x, y); +} + +void VTerm::cursor_down() +{ + u16 n, y; + + n = param[0]; + if (n < 1) n = 1; + + y = cursor_y + n; + if (y >= height) y = height - 1; + + move_cursor(cursor_x, y); +} + +void VTerm::cursor_up_cr() +{ + u16 n, y; + + n = param[0]; + if (n < 1) n = 1; + + if (cursor_y < n) y = 0; + else y = cursor_y - n; + + move_cursor(0, y); +} + +void VTerm::cursor_down_cr() +{ + u16 n, y; + + n = param[0]; + if (n < 1) n = 1; + + y = cursor_y + n; + if (y >= height) y = height - 1; + + move_cursor(0, y); +} + +void VTerm::cursor_position() +{ + u16 x, y; + + x = param[1]; + if (x < 1) x = 1; + + y = param[0]; + if (y < 1) y = 1; + + move_cursor(x - 1, y - 1 + (mode_flags.cursor_relative ? scroll_top : 0)); +} + +void VTerm::cursor_position_col() +{ + u16 x = param[0]; + if (x < 1) x = 1; + + move_cursor(x-1, cursor_y); +} + +void VTerm::cursor_position_row() +{ + u16 y = param[0]; + if (y < 1) y = 1; + + move_cursor(cursor_x, y-1); +} + +void VTerm::insert_char() +{ + u16 n, mx; + + n = param[0]; + if (n < 1) n = 1; + + mx = width - cursor_x; + + if (n >= mx) clear_area(cursor_x, cursor_y, width - 1, cursor_y); + else shift_text(cursor_y, cursor_x, width - 1, n); +} + +void VTerm::delete_char() +{ + u16 n, mx; + n = param[0]; + if (n < 1) n = 1; + + mx = width - cursor_x; + + if (n >= mx) clear_area(cursor_x, cursor_y, width - 1, cursor_y); + else shift_text(cursor_y, cursor_x, width - 1, -n); +} + +void VTerm::erase_char() +{ + u16 n, mx; + + n = param[0]; + if (n < 1) n = 1; + + mx = width - cursor_x; + if (n > mx) n = mx; + + clear_area(cursor_x, cursor_y, cursor_x + n - 1, cursor_y); +} + +void VTerm::insert_line() +{ + u16 n, mx; + + n = param[0]; + if (n < 1) n = 1; + + mx = scroll_bot - cursor_y + 1; + + if (n >= mx) clear_area(0, cursor_y, width - 1, scroll_bot); + else scroll_region(cursor_y, scroll_bot, -n); +} + +void VTerm::delete_line() +{ + u16 n, mx; + + n = param[0]; + if (n < 1) n = 1; + + mx = scroll_bot - cursor_y + 1; + + if (n >= mx) clear_area(0, cursor_y, width - 1, scroll_bot); + else scroll_region(cursor_y, scroll_bot, n); +} + +void VTerm::erase_line() +{ + switch (param[0]) { + case 0: + clear_area(cursor_x, cursor_y, width - 1, cursor_y); + break; + case 1: + clear_area(0, cursor_y, cursor_x, cursor_y); + break; + case 2: + clear_area(0, cursor_y, width - 1, cursor_y); + break; + } +} + +void VTerm::erase_display() +{ + switch (param[0]) { + case 0: + clear_area(cursor_x, cursor_y, width - 1, cursor_y); + if (cursor_y < height - 1) clear_area(0, cursor_y + 1, width - 1, height - 1); + break; + case 1: + clear_area(0, cursor_y, cursor_x, cursor_y); + if (cursor_y > 0) clear_area(0, 0, width - 1, cursor_y - 1); + break; + case 2: + clear_area(0, 0, width - 1, height - 1); + break; + } +} + +void VTerm::screen_align() +{ + for (u16 y = 0; y < height; y++) { + u32 yp = linenumbers[y] * max_width; + changed_line(y, 0, width - 1); + + for (u16 x = 0; x < width; x++) { + text[yp + x] = 'E'; + attrs[yp + x] = normal_char_attr(); + } + } +} + +void VTerm::set_margins() +{ + u16 t, b; + + t = param[0]; + if (t < 1) t = 1; + + b = param[1]; + if (b < 1 || b > height) b = height; + + if (pending_scroll) update(); + + scroll_top = t - 1; + scroll_bot = b - 1; + if (cursor_y < scroll_top) move_cursor(cursor_x, scroll_top); + if (cursor_y > scroll_bot) move_cursor(cursor_x, scroll_bot); +} + +void VTerm::respond_id() +{ + sendBack("\e[?6c"); // response 'I'm a VT102' +} + +void VTerm::status_report() +{ + if (param[0] == 5) { // device status report + sendBack("\e[0n"); // response 'Terminal OK' + } else if (param[0] == 6) { // cursor position report + s8 str[32]; + snprintf(str, sizeof(str), "\e[%d;%dR", cursor_y + 1, cursor_x + 1); + sendBack(str); + } +} + +void VTerm::keypad_numeric() +{ + mode_flags.applic_keypad = false; + modeChanged(ApplicKeypad); +} + +void VTerm::keypad_application() +{ + mode_flags.applic_keypad = true; + modeChanged(ApplicKeypad); +} + +void VTerm::enable_mode(bool enable) +{ + switch (param[0] + 1000 * q_mode) { + case 3: + mode_flags.display_ctrl = enable; + break; + case 4: + mode_flags.insert_mode = enable; + break; + case 20: // auto echo cr with lf + mode_flags.crlf = enable; + modeChanged(CRWithLF); + break; + case 1001 : + mode_flags.cursorkey_esco = enable; + modeChanged(CursorKeyEscO); + break; + case 1003 : + mode_flags.col_132 = enable; + break; + case 1005 : + mode_flags.inverse_screen = enable; + for (u16 i = 0; i < height; i++) { + changed_line(i, 0, width - 1); + } + break; + case 1006 : + mode_flags.cursor_relative = enable; + break; + case 1007 : + mode_flags.auto_wrap = enable; + break; + case 1008 : + mode_flags.autorepeat_key = enable; + modeChanged(AutoRepeatKey); + break; + case 1009 : + mode_flags.mouse_report = (enable ? MouseX10 : MouseNone); + modeChanged(MouseReport); + break; + case 1025 : + mode_flags.cursor_visible = enable; + modeChanged(CursorVisible); + break; + case 2000 : + mode_flags.mouse_report = (enable ? MouseX11 : MouseNone); + modeChanged(MouseReport); + break; + default: + break; + } +} + +void VTerm::set_mode() +{ + enable_mode(true); +} + +void VTerm::clear_mode() +{ + enable_mode(false); +} + +void VTerm::set_display_attr() +{ + for (u16 n = 0; n <= npar; n++) { + switch (param[n]) { + case 0: + char_attr = default_char_attr; + break; + case 1: + char_attr.intensity = 2; + break; + case 2: + char_attr.intensity = 0; + break; + case 3: + char_attr.italic = true; + break; + case 4: + char_attr.underline = true; + break; + case 5: + char_attr.blink = true; + break; + case 7: + char_attr.reverse = true; + break; + case 10: + charset = (g0_is_active ? g0_charset : g1_charset); + mode_flags.display_ctrl = false; + mode_flags.toggle_meta = false; + break; + case 11: + charset = IbmpcMap; + mode_flags.display_ctrl = true; + mode_flags.toggle_meta = false; + break; + case 12: + charset = IbmpcMap; + mode_flags.display_ctrl = true; + mode_flags.toggle_meta = true; + break; + case 21: + case 22: + char_attr.intensity = 1; + break; + case 23: + char_attr.italic = false; + break; + case 24: + char_attr.underline = false; + break; + case 25: + char_attr.blink = false; + break; + case 27: + char_attr.reverse = false; + break; + case 30 ... 37: + char_attr.fcolor = param[n] % 10; + break; + case 38: + char_attr.fcolor = cur_fcolor; + char_attr.underline = true; + break; + case 39: + char_attr.fcolor = cur_fcolor; + char_attr.underline = false; + break; + case 40 ... 47: + char_attr.bcolor = param[n] % 10; + break; + case 49: + char_attr.bcolor = cur_bcolor; + break; + default : + break; + } + } +} + +void VTerm::set_q_mode() +{ + q_mode = 1; +} + +void VTerm::set_cursor_type() +{ + if (q_mode) { + mode_flags.cursor_shape = param[0]; + modeChanged(CursorShape); + } else if (!param[0]) { + respond_id(); + } +} + +void VTerm::set_utf8() +{ + utf8 = true; +} + +void VTerm::clear_utf8() +{ + utf8 = false; +} + +void VTerm::set_charset() +{ + CharsetMap &m = (g0_is_current ? g0_charset : g1_charset); + + switch (cur_char) { + case '0': + m = Lat1Map; + break; + case 'B': + m = GrafMap; + break; + case 'U': + m = IbmpcMap; + break; + case 'K': + m = UserMap; + break; + default: + break; + } +} + +void VTerm::active_g0() +{ + charset = g0_charset; + g0_is_active = true; + mode_flags.display_ctrl = false; +} + +void VTerm::active_g1() +{ + charset = g1_charset; + g0_is_active = false; + mode_flags.display_ctrl = true; +} + +void VTerm::current_is_g0() +{ + g0_is_current = true; +} + +void VTerm::current_is_g1() +{ + g0_is_current = false; +} + +void VTerm::linux_specific() +{ + switch (param[0]) { + case 1: + if (param[1] < 8) cur_underline_color = param[1]; + break; + case 2: + if (param[1] < 8) cur_halfbright_color = param[1]; + break; + case 8: + cur_fcolor = char_attr.fcolor; + cur_bcolor = char_attr.bcolor; + break; + case 9: + request(Blank, param[1]); + break; + case 10: + request(BellFrequencySet, param[1]); + break; + case 11: + request(BellDurationSet, param[1]); + break; + case 12: + request(VcSwitch, param[1]); + break; + case 13: + request(Unblank); + break; + case 14: + request(VesaPowerIntervalSet, param[1]); + break; + default: + break; + } +} + +void VTerm::begin_set_palette() +{ + if (palette_mode || npar) esc_state = ESnormal; + else palette_mode = true; +} + +void VTerm::set_palette() +{ + if (palette_mode) { + param[npar++] = (cur_char >= 'a' ? (cur_char - 'a' + 10) : (cur_char >= 'A' ? (cur_char - 'A' + 10) : (cur_char - '0'))); + + if (npar != 7) return; + + u32 val = 0; + for (u32 i = 0; i < 7; i++) { + val <<= 4; + val |= param[i]; + } + + request(PaletteSet, val); + } + + esc_state = ESnormal; +} + +void VTerm::reset_palette() +{ + request(PaletteClear); +} + +void VTerm::set_led() +{ + request(param[0] ? LedSet : LedClear, param[0]); +} + +void VTerm::fbterm_specific() +{ + switch (param[0]) { + case 1: + if (npar == 1) char_attr.fcolor = param[1]; + break; + + case 2: + if (npar == 1) char_attr.bcolor = param[1]; + break; + + case 3: + if (npar == 4) request(PaletteSet, ((param[1] & 0xff) << 24) | ((param[2] & 0xff) << 16) | ((param[3] & 0xff) << 8) | (param[4] & 0xff)); + break; + + default: + break; + } +} diff --git a/src/lib/vterm_states.cpp b/src/lib/vterm_states.cpp new file mode 100644 index 0000000..49e7588 --- /dev/null +++ b/src/lib/vterm_states.cpp @@ -0,0 +1,136 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * based on GTerm by Timothy Miller <tim@techsource.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "vterm.h" + +#define ADDSAME(len) ((len) << 8) + +const VTerm::Sequence VTerm::control_sequences[] = { + { 0, 0, ESkeep }, + { 7, &VTerm::bell, ESkeep }, + { 8, &VTerm::bs, ESkeep }, + { 9, &VTerm::tab, ESkeep }, + { 0xA, &VTerm::lf, ESkeep }, + { 0xB, &VTerm::lf, ESkeep }, + { 0xC, &VTerm::lf, ESkeep }, + { 0xD, &VTerm::cr, ESkeep }, + { 0xE, &VTerm::active_g1, ESkeep }, + { 0xF, &VTerm::active_g0, ESkeep }, + { 0x18, 0, ESnormal }, + { 0x1A, 0, ESnormal }, + { 0x1B, 0, ESesc }, + { 0x7F, 0, ESkeep }, + { 0x9B, 0, ESsquare }, + { -1} +}; + +const VTerm::Sequence VTerm::escape_sequences[] = { + { 0, 0, ESnormal }, + + // ESnormal + { -1 }, + + // ESesc + { '[', &VTerm::clear_param, ESsquare }, + { ']', &VTerm::clear_param, ESnonstd }, + { '%', 0, ESpercent }, + { '#', 0, EShash }, + { '(', &VTerm::current_is_g0, EScharset }, + { ')', &VTerm::current_is_g1, EScharset }, + { 'c', &VTerm::reset, ESnormal }, + { 'D', &VTerm::index_down, ESnormal }, + { 'E', &VTerm::next_line, ESnormal }, + { 'H', &VTerm::set_tab, ESnormal }, + { 'M', &VTerm::index_up, ESnormal }, + { 'Z', &VTerm::respond_id, ESnormal }, + { '7', &VTerm::save_cursor, ESnormal }, + { '8', &VTerm::restore_cursor, ESnormal }, + { '>', &VTerm::keypad_numeric, ESnormal }, + { '=', &VTerm::keypad_application, ESnormal }, + { -1 }, + + // ESsquare + { '[', 0, ESfunckey }, + { '?', &VTerm::set_q_mode, ESkeep }, + { '0' | ADDSAME(9), &VTerm::param_digit, ESkeep }, + { ';', &VTerm::next_param, ESkeep }, + { '@', &VTerm::insert_char, ESnormal }, + { 'A', &VTerm::cursor_up, ESnormal }, + { 'B', &VTerm::cursor_down, ESnormal }, + { 'C', &VTerm::cursor_right,ESnormal }, + { 'D', &VTerm::cursor_left, ESnormal }, + { 'E', &VTerm::cursor_down_cr, ESnormal }, + { 'F', &VTerm::cursor_up_cr, ESnormal }, + { 'G', &VTerm::cursor_position_col, ESnormal }, + { 'H', &VTerm::cursor_position, ESnormal }, + { 'J', &VTerm::erase_display, ESnormal }, + { 'K', &VTerm::erase_line, ESnormal }, + { 'L', &VTerm::insert_line, ESnormal }, + { 'M', &VTerm::delete_line, ESnormal }, + { 'P', &VTerm::delete_char, ESnormal }, + { 'X', &VTerm::erase_char, ESnormal }, + { 'a', &VTerm::cursor_right,ESnormal }, + { 'c', &VTerm::set_cursor_type, ESnormal }, + { 'd', &VTerm::cursor_position_row, ESnormal }, + { 'e', &VTerm::cursor_down, ESnormal }, + { 'f', &VTerm::cursor_position, ESnormal }, + { 'g', &VTerm::clear_tab, ESnormal }, + { 'h', &VTerm::set_mode, ESnormal }, + { 'l', &VTerm::clear_mode, ESnormal }, + { 'm', &VTerm::set_display_attr, ESnormal }, + { 'n', &VTerm::status_report, ESnormal }, + { 'q', &VTerm::set_led, ESnormal }, + { 'r', &VTerm::set_margins, ESnormal }, + { 's', &VTerm::save_cursor, ESnormal }, + { 'u', &VTerm::restore_cursor, ESnormal }, + { '`', &VTerm::cursor_position_col, ESnormal }, + { ']', &VTerm::linux_specific, ESnormal }, + { '}', &VTerm::fbterm_specific, ESnormal }, + { -1 }, + + // ESnonstd + { '0' | ADDSAME(9), &VTerm::set_palette, ESkeep }, + { 'A' | ADDSAME(5), &VTerm::set_palette, ESkeep }, + { 'a' | ADDSAME(5), &VTerm::set_palette, ESkeep }, + { 'P', &VTerm::begin_set_palette, ESkeep }, + { 'R', &VTerm::reset_palette, ESnormal }, + { -1 }, + + // ESpercent + { '@', &VTerm::clear_utf8, ESnormal }, + { 'G', &VTerm::set_utf8, ESnormal }, + { '8', &VTerm::set_utf8, ESnormal }, + { -1 }, + + // EScharset + { '0', &VTerm::set_charset, ESnormal }, + { 'B', &VTerm::set_charset, ESnormal }, + { 'U', &VTerm::set_charset, ESnormal }, + { 'K', &VTerm::set_charset, ESnormal }, + { -1 }, + + // EShash + { '8', &VTerm::screen_align, ESnormal }, + { -1 }, + + // ESfunckey + { -1 }, +}; diff --git a/src/lib/wcwidth.cpp b/src/lib/wcwidth.cpp new file mode 100644 index 0000000..235ac00 --- /dev/null +++ b/src/lib/wcwidth.cpp @@ -0,0 +1,318 @@ +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +#include <wchar.h> + +struct interval { + int first; + int last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(wchar_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that wchar_t characters are encoded + * in ISO 10646. + */ + +int mk_wcwidth(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ + static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } + }; + + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + (ucs >= 0x20000 && ucs <= 0x2fffd) || + (ucs >= 0x30000 && ucs <= 0x3fffd))); +} + + +int mk_wcswidth(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +int mk_wcwidth_cjk(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + + +int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + +#include "vterm.h" + +bool VTerm::ambiguous_wide = false; + +s32 VTerm::charWidth(u32 ucs) +{ + return ambiguous_wide ? mk_wcwidth_cjk(ucs) : mk_wcwidth(ucs); +} diff --git a/src/mouse.cpp b/src/mouse.cpp new file mode 100644 index 0000000..0435dd9 --- /dev/null +++ b/src/mouse.cpp @@ -0,0 +1,175 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 "mouse.h" +DEFINE_INSTANCE(Mouse) + +#include "config.h" +#ifdef ENABLE_GPM + +#include <stddef.h> +#include <unistd.h> +#include <stdlib.h> +#include <gpm.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <linux/keyboard.h> +#include "fbshellman.h" +#include "fbshell.h" +#include "screen.h" + +static s32 open_gpm(Gpm_Connect *conn) +{ + s8 buf[64]; + s32 ret = ttyname_r(STDIN_FILENO, buf, sizeof(buf)); + + u32 index = strlen(buf) - 1; + while (buf[index] >= '0' && buf[index] <= '9') index--; + + s8 *tail; + conn->vc = strtol(buf + index + 1, &tail, 10); + if (*tail) return -1; + + conn->pid = getpid(); + + s32 gpm_fd = socket(PF_UNIX, SOCK_STREAM, 0); + if (gpm_fd == -1) return -1; + + struct sockaddr_un addr; + memset((s8 *)&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, GPM_NODE_CTL, sizeof(addr.sun_path) - 1); + + #define OFFSET(TYPE, MEMBER) ((size_t)(&(((TYPE *)0)->MEMBER))) + u32 len = OFFSET(sockaddr_un, sun_path) + sizeof(GPM_NODE_CTL) - 1; + if (len > sizeof(addr)) len = sizeof(addr); + + if(connect(gpm_fd, (struct sockaddr *)(&addr), len) < 0 || + write(gpm_fd, conn, sizeof(*conn)) != sizeof(*conn)) { + close(gpm_fd); + return -1; + } + + return gpm_fd; +} + +Mouse *Mouse::createInstance() +{ + Gpm_Connect conn; + conn.eventMask = ~0; + conn.defaultMask = ~GPM_HARD; + conn.maxMod = ~0; + conn.minMod = 0; + + s32 fd = open_gpm(&conn); + if (fd == -1) return 0; + + Mouse *mouse = new Mouse(); + mouse->setFd(fd); + + return mouse; +} + +Mouse::Mouse() +{ + x = y = 0; +} + +Mouse::~Mouse() +{ +} + +void Mouse::readyRead(s8 *buf, u32 len) +{ + if (len % sizeof(Gpm_Event)) return; + + FbShell *shell = FbShellManager::instance()->activeShell(); + if (!shell) return; + + u16 maxx = Screen::instance()->cols(), maxy = Screen::instance()->rows(); + + len /= sizeof(Gpm_Event); + Gpm_Event *ev = (Gpm_Event *)buf; + + for (; len--; ev++) { + s32 type = -1, buttons = 0; + + if (ev->wdy) type = Wheel; + else if ((ev->type & GPM_MOVE) || (ev->type & GPM_DRAG)) type = Move; + else if (ev->type & GPM_DOWN) type = (ev->type & GPM_DOUBLE) ? DblClick : Press; + else if (ev->type & GPM_UP) type = Release; + if (type == -1) continue; + + if (ev->buttons & GPM_B_LEFT) buttons |= LeftButton; + if (ev->buttons & GPM_B_MIDDLE) buttons |= MidButton; + if (ev->buttons & GPM_B_RIGHT) buttons |= RightButton; + if (type == Wheel) buttons |= ((ev->wdy < 0) ? WheelDown : WheelUp); + + if (ev->modifiers & (1 << KG_SHIFT)) buttons |= ShiftButton; + if (ev->modifiers & (1 << KG_CTRL)) buttons |= ControlButton; + if (ev->modifiers & ((1 << KG_ALT) | (1 << KG_ALTGR))) buttons |= AltButton; + + s16 newx = (s16)x + ev->dx, newy =(s16)y + ev->dy; + if (newx < 0) newx = 0; + if (newy < 0) newy = 0; + if (newx >= maxx) newx = maxx - 1; + if (newy >= maxy) newy = maxy - 1; + if (newx == x && newy == y && !(buttons & MouseButtonMask)) continue; + + shell->mouseInput(newx, newy, type, buttons); + x = newx; + y = newy; + } +} + +void Mouse::switchVc(bool enter) +{ +} + +#else + +#include <unistd.h> +#include <sys/ioctl.h> +#include <linux/kd.h> + +Mouse *Mouse::createInstance() +{ + return new Mouse(); +} + +Mouse::Mouse() +{ +} + +Mouse::~Mouse() +{ +} + +void Mouse::switchVc(bool enter) +{ + ioctl(STDIN_FILENO, KDSETMODE, enter ? KD_GRAPHICS : KD_TEXT); +} + +void Mouse::readyRead(s8 *buf, u32 len) +{ +} +#endif diff --git a/src/mouse.h b/src/mouse.h new file mode 100644 index 0000000..7cd805b --- /dev/null +++ b/src/mouse.h @@ -0,0 +1,37 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 MOUSE_H +#define MOUSE_H + +#include "io.h" +#include "instance.h" + +class Mouse : public IoPipe { + DECLARE_INSTANCE(Mouse) +public: + void switchVc(bool enter); +private: + virtual void readyRead(s8 *buf, u32 len); + + u16 x, y; +}; + +#endif diff --git a/src/screen.cpp b/src/screen.cpp new file mode 100644 index 0000000..4da2453 --- /dev/null +++ b/src/screen.cpp @@ -0,0 +1,396 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdio.h> +#include <unistd.h> +#include <string.h> +#include "screen.h" +#include "font.h" +#include "fbshellman.h" +#include "fbconfig.h" +#include "fbdev.h" +#include "config.h" +#ifdef ENABLE_VESA +#include "vesadev.h" +#endif + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define redraw(args...) (FbShellManager::instance()->redraw(args)) + +static const s8 show_cursor[] = "\e[?25h"; +static const s8 hide_cursor[] = "\e[?25l"; +static const s8 disable_blank[] = "\e[9;0]"; +static const s8 enable_blank[] = "\e[9;10]"; +static const s8 clear_screen[] = "\e[2J\e[H"; + +DEFINE_INSTANCE(Screen) + +Screen *Screen::createInstance() +{ + if (!Font::instance() || !FW(1) || !FH(1)) { + fprintf(stderr, "init font error!\n"); + return 0; + } + + Screen *pScreen = 0; + +#ifdef ENABLE_VESA + s8 buf[16]; + Config::instance()->getOption("vesa-mode", buf, sizeof(buf)); + if (!strcmp(buf, "list")) { + VesaDev::printModes(); + return 0; + } + + u32 mode = 0; + Config::instance()->getOption("vesa-mode", mode); + + if (!mode) pScreen = FbDev::initFbDev(); + if (!pScreen) pScreen = VesaDev::initVesaDev(mode); +#else + pScreen = FbDev::initFbDev(); +#endif + + if (!pScreen) return 0; + + if (pScreen->mRotateType == Rotate90 || pScreen->mRotateType == Rotate270) { + u32 tmp = pScreen->mWidth; + pScreen->mWidth = pScreen->mHeight; + pScreen->mHeight = tmp; + } + + if (!pScreen->mCols) pScreen->mCols = pScreen->mWidth / FW(1); + if (!pScreen->mRows) pScreen->mRows = pScreen->mHeight / FH(1); + + if (!pScreen->mCols || !pScreen->mRows) { + fprintf(stderr, "font size is too huge!\n"); + delete pScreen; + return 0; + } + + pScreen->initFillDraw(); + return pScreen; +} + +Screen::Screen() +{ + mWidth = mHeight = 0; + mCols = mRows = 0; + mBitsPerPixel = mBytesPerLine = 0; + + mScrollEnable = true; + mScrollType = Redraw; + mOffsetMax = 0; + mOffsetCur = 0; + + mVMemBase = 0; + mPalette = 0; + + u32 type = Rotate0; + Config::instance()->getOption("screen-rotate", type); + if (type > Rotate270) type = Rotate0; + mRotateType = (RotateType)type; + + s32 ret = write(STDIN_FILENO, hide_cursor, sizeof(hide_cursor) - 1); + ret = write(STDIN_FILENO, disable_blank, sizeof(disable_blank) - 1); +} + +Screen::~Screen() +{ + Font::uninstance(); + endFillDraw(); + + s32 ret = write(STDIN_FILENO, show_cursor, sizeof(show_cursor) - 1); + ret = write(STDIN_FILENO, enable_blank, sizeof(enable_blank) - 1); + ret = write(STDIN_FILENO, clear_screen, sizeof(clear_screen) - 1); +} + +void Screen::showInfo(bool verbose) +{ + if (!verbose) return; + + static const s8* const scrollstr[4] = { + "redraw", "ypan", "ywrap", "xpan" + }; + printf("[screen] driver: %s, mode: %dx%d-%dbpp, scrolling: %s\n", + drvId(), mWidth, mHeight, mBitsPerPixel, scrollstr[mScrollType]); +} + +void Screen::switchVc(bool enter) +{ + mOffsetCur = 0; + setupOffset(); + + setupPalette(!enter); + if (enter && mPalette) eraseMargin(true, mRows); +} + +bool Screen::move(u16 scol, u16 srow, u16 dcol, u16 drow, u16 w, u16 h) +{ + if (!mScrollEnable || mScrollType == Redraw || scol != dcol) return false; + + u16 top = MIN(srow, drow), bot = MAX(srow, drow) + h; + u16 left = scol, right = scol + w; + + u32 noaccel_redraw_area = w * (bot - top - 1); + u32 accel_redraw_area = mCols * mRows - w * h; + + if (noaccel_redraw_area <= accel_redraw_area) return false; + + if (mRotateType == Rotate0 || mRotateType == Rotate270) mOffsetCur += FH((s32)srow - drow); + else mOffsetCur -= FH((s32)srow - drow); + + bool redraw_all = false; + if (mScrollType == YPan || mScrollType == XPan) { + redraw_all = true; + + if (mOffsetCur < 0) mOffsetCur = mOffsetMax; + else if ((u32)mOffsetCur > mOffsetMax) mOffsetCur = 0; + else redraw_all = false; + } else { + if (mOffsetCur < 0) mOffsetCur += mOffsetMax + 1; + else if ((u32)mOffsetCur > mOffsetMax) mOffsetCur -= mOffsetMax + 1; + } + + setupOffset(); + + if (top) redraw(0, 0, mCols, top); + if (bot < mRows) redraw(0, bot, mCols, mRows - bot); + if (left > 0) redraw(0, top, left, bot - top - 1); + if (right < mCols) redraw(right, top, mCols - right, bot - top - 1); + + if (redraw_all) { + eraseMargin(true, mRows); + } else { + eraseMargin(drow > srow, drow > srow ? (drow - srow) : (srow - drow)); + } + + return !redraw_all; +} + +void Screen::eraseMargin(bool top, u16 h) +{ + if (mWidth % FW(1)) { + fillRect(FW(mCols), top ? 0 : FH(mRows - h), mWidth % FW(1), FH(h), 0); + } + + if (mHeight % FH(1)) { + fillRect(0, FH(mRows), mWidth, mHeight % FH(1), 0); + } +} + +void Screen::drawText(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw) +{ + u32 startx, fw = FW(1); + + u16 startnum, *starttext; + bool *startdw, draw_space = false, draw_text = false; + + for (; num; num--, text++, dw++, x += fw) { + if (*text == 0x20) { + if (draw_text) { + draw_text = false; + drawGlyphs(startx, y, fc, bc, startnum - num, starttext, startdw); + } + + if (!draw_space) { + draw_space = true; + startx = x; + } + } else { + if (draw_space) { + draw_space = false; + fillRect(startx, y, x - startx, FH(1), bc); + } + + if (!draw_text) { + draw_text = true; + starttext = text; + startdw = dw; + startnum = num; + startx = x; + } + + if (*dw) x += fw; + } + } + + if (draw_text) { + drawGlyphs(startx, y, fc, bc, startnum - num, starttext, startdw); + } else if (draw_space) { + fillRect(startx, y, x - startx, FH(1), bc); + } +} + +void Screen::drawGlyphs(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw) +{ + for (; num--; text++, dw++) { + drawGlyph(x, y, fc, bc, *text, *dw); + x += *dw ? FW(2) : FW(1); + } +} + +void Screen::adjustOffset(u32 &x, u32 &y) +{ + if (mScrollType == XPan) x += mOffsetCur; + else y += mOffsetCur; +} + +void Screen::fillRect(u32 x, u32 y, u32 w, u32 h, u8 color) +{ + if (x >= mWidth || y >= mHeight || !w || !h) return; + if (x + w > mWidth) w = mWidth - x; + if (y + h > mHeight) h = mHeight - y; + + rotateRect(x, y, w, h); + adjustOffset(x, y); + + for (; h--;) { + if (mScrollType == YWrap && y > mOffsetMax) y -= mOffsetMax + 1; + (this->*fill)(x, y++, w, color); + } +} + +void Screen::drawGlyph(u32 x, u32 y, u8 fc, u8 bc, u16 code, bool dw) +{ + if (x >= mWidth || y >= mHeight) return; + + s32 w = (dw ? FW(2) : FW(1)), h = FH(1); + if (x + w > mWidth) w = mWidth - x; + if (y + h > mHeight) h = mHeight - y; + + Font::Glyph *glyph = (Font::Glyph *)Font::instance()->getGlyph(code); + if (!glyph) { + fillRect(x, y, w, h, bc); + return; + } + + s32 top = glyph->top; + if (top < 0) top = 0; + + s32 left = glyph->left; + if ((s32)x + left < 0) left = -x; + + s32 width = glyph->width; + if (width > w - left) width = w - left; + if ((s32)x + left + width > (s32)mWidth) width = mWidth - ((s32)x + left); + if (width < 0) width = 0; + + s32 height = glyph->height; + if (height > h - top) height = h - top; + if (y + top + height > mHeight) height = mHeight - (y + top); + if (height < 0) height = 0; + + if (top) fillRect(x, y, w, top, bc); + if (left > 0) fillRect(x, y + top, left, height, bc); + + s32 right = width + left; + if (w > right) fillRect((s32)x + right, y + top, w - right, height, bc); + + s32 bot = top + height; + if (h > bot) fillRect(x, y + bot, w, h - bot, bc); + + x += left; + y += top; + if (x >= mWidth || y >= mHeight || !width || !height) return; + + u32 nwidth = width, nheight = height; + rotateRect(x, y, nwidth, nheight); + + u8 *pixmap = glyph->pixmap; + u32 wdiff = glyph->width - width, hdiff = glyph->height - height; + + if (wdiff) { + if (mRotateType == Rotate180) pixmap += wdiff; + else if (mRotateType == Rotate270) pixmap += wdiff * glyph->pitch; + } + + if (hdiff) { + if (mRotateType == Rotate90) pixmap += hdiff; + else if (mRotateType == Rotate180) pixmap += hdiff * glyph->pitch; + } + + adjustOffset(x, y); + for (; nheight--; y++, pixmap += glyph->pitch) { + if ((mScrollType == YWrap) && y > mOffsetMax) y -= mOffsetMax + 1; + (this->*draw)(x, y, nwidth, fc, bc, pixmap); + } +} + +void Screen::rotateRect(u32 &x, u32 &y, u32 &w, u32 &h) +{ + u32 tmp; + switch (mRotateType) { + case Rotate0: + break; + + case Rotate90: + tmp = x; + x = mHeight - y - h; + y = tmp; + + tmp = w; + w = h; + h = tmp; + break; + + case Rotate180: + x = mWidth - x - w; + y = mHeight - y - h; + break; + + case Rotate270: + tmp = y; + y = mWidth - x - w; + x = tmp; + + tmp = w; + w = h; + h = tmp; + break; + } +} + +void Screen::rotatePoint(u32 W, u32 H, u32 &x, u32 &y) +{ + u32 tmp; + switch (mRotateType) { + case Rotate0: + break; + + case Rotate90: + tmp = x; + x = H - y - 1; + y = tmp; + break; + + case Rotate180: + x = W - x - 1; + y = H - y - 1; + break; + + case Rotate270: + tmp = y; + y = W - x - 1; + x = tmp; + break; + } +} diff --git a/src/screen.h b/src/screen.h new file mode 100644 index 0000000..136d1e2 --- /dev/null +++ b/src/screen.h @@ -0,0 +1,105 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 SCREEN_H +#define SCREEN_H + +#include "type.h" +#include "instance.h" + +#define NR_COLORS 256 + +struct Color { + u8 red, green, blue; +}; + +typedef enum { Rotate0 = 0, Rotate90, Rotate180, Rotate270 } RotateType; + +class Screen +{ + DECLARE_INSTANCE(Screen) +public : + u32 width() { return mWidth; } + u32 height() { return mHeight; } + u16 cols() { return mCols; } + u16 rows() { return mRows; } + + RotateType rotateType() { return mRotateType; } + void rotateRect(u32 &x, u32 &y, u32 &w, u32 &h); + void rotatePoint(u32 w, u32 h, u32 &x, u32 &y); + + void drawText(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw); + void fillRect(u32 x, u32 y, u32 w, u32 h, u8 color); + + bool move(u16 scol, u16 srow, u16 dcol, u16 drow, u16 w, u16 h); + void setPalette(const Color *palette); + + void enableScroll(bool enable) { mScrollEnable = enable; } + + void showInfo(bool verbose); + virtual void switchVc(bool enter); + +protected: + u32 mWidth, mHeight; + u16 mCols, mRows; + u32 mBitsPerPixel, mBytesPerLine; + + RotateType mRotateType; + + typedef enum { Redraw = 0, YPan, YWrap, XPan } ScrollType; + ScrollType mScrollType; + u32 mOffsetMax; + s32 mOffsetCur; + + u8 *mVMemBase; + const Color *mPalette; + +private: + virtual void setupOffset() {} + virtual void setupPalette(bool restore) {} + virtual const s8 *drvId() = 0; + + void eraseMargin(bool top, u16 h); + void drawGlyphs(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw); + void drawGlyph(u32 x, u32 y, u8 fc, u8 bc, u16 code, bool dw); + void adjustOffset(u32 &x, u32 &y); + + void initFillDraw(); + void endFillDraw(); + + void fillX(u32 x, u32 y, u32 w, u8 color); + void fillXBg(u32 x, u32 y, u32 w, u8 color); + void draw8(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw15(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw16(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw32(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw8Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw15Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw16Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + void draw32Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + + typedef void (Screen::*fillFun)(u32 x, u32 y, u32 w, u8 color); + typedef void (Screen::*drawFun)(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap); + + fillFun fill; + drawFun draw; + bool mScrollEnable; +}; +#endif diff --git a/src/screen_render.cpp b/src/screen_render.cpp new file mode 100644 index 0000000..e8f39b8 --- /dev/null +++ b/src/screen_render.cpp @@ -0,0 +1,242 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 <stdlib.h> +#include <string.h> +#include "screen.h" +#include "fbconfig.h" + +#define writeb(addr, val) (*(volatile u8 *)(addr) = (val)) +#define writew(addr, val) (*(volatile u16 *)(addr) = (val)) +#define writel(addr, val) (*(volatile u32 *)(addr) = (val)) + +static u32 bytes_per_pixel; +static u32 ppl, ppw, ppb; +static u32 fillColors[NR_COLORS]; + +static u8 *bgimage_mem; +static u8 bgcolor; + +void Screen::setPalette(const Color *palette) +{ + if (mPalette == palette) return; + mPalette = palette; + + for (u32 i = 0; i < NR_COLORS; i++) { + switch (mBitsPerPixel) { + case 8: + fillColors[i] = (i << 24) | (i << 16) | (i << 8) | i; + break; + case 15: + fillColors[i] = ((palette[i].red >> 3) << 10) | ((palette[i].green >> 3) << 5) | (palette[i].blue >> 3); + fillColors[i] |= fillColors[i] << 16; + break; + case 16: + fillColors[i] = ((palette[i].red >> 3) << 11) | ((palette[i].green >> 2) << 5) | (palette[i].blue >> 3); + fillColors[i] |= fillColors[i] << 16; + break; + case 32: + fillColors[i] = (palette[i].red << 16) | (palette[i].green << 8) | palette[i].blue; + break; + } + } + + setupPalette(false); + eraseMargin(true, mRows); +} + +void Screen::initFillDraw() +{ + if (mBitsPerPixel == 15) bytes_per_pixel = 2; + else bytes_per_pixel = (mBitsPerPixel >> 3); + + ppl = 4 / bytes_per_pixel; + ppw = ppl >> 1; + ppb = ppl >> 2; + + bool bg = false; + if (getenv("FBTERM_BACKGROUND_IMAGE")) { + bg = true; + mScrollType = Redraw; + + u32 color = 0; + Config::instance()->getOption("color-background", color); + if (color > 7) color = 0; + bgcolor = color; + + u32 size = mBytesPerLine * ((mRotateType == Rotate0 || mRotateType == Rotate180) ? mHeight : mWidth); + bgimage_mem = new u8[size]; + memcpy(bgimage_mem, mVMemBase, size); + } + + fill = bg ? &Screen::fillXBg : &Screen::fillX; + + switch (mBitsPerPixel) { + case 8: + draw = bg ? &Screen::draw8Bg : &Screen::draw8; + break; + case 15: + draw = bg ? &Screen::draw15Bg : &Screen::draw15; + break; + case 16: + draw = bg ? &Screen::draw16Bg : &Screen::draw16; + break; + case 32: + draw = bg ? &Screen::draw32Bg : &Screen::draw32; + break; + } +} + +void Screen::endFillDraw() +{ + if (bgimage_mem) delete[] bgimage_mem; +} + +void Screen::fillX(u32 x, u32 y, u32 w, u8 color) +{ + u32 c = fillColors[color]; + u8 *dst = mVMemBase + y * mBytesPerLine + x * bytes_per_pixel; + + // get better performance if write-combining not enabled for video memory + for (u32 i = w / ppl; i--; dst += 4) { + writel(dst, c); + } + + if (w & ppw) { + writew(dst, c); + dst += 2; + } + + if (w & ppb) { + writeb(dst, c); + } +} + +void Screen::fillXBg(u32 x, u32 y, u32 w, u8 color) +{ + if (color == bgcolor) { + u32 offset = y * mBytesPerLine + x * bytes_per_pixel; + memcpy(mVMemBase + offset, bgimage_mem + offset, w * bytes_per_pixel); + } else { + fillX(x, y, w, color); + } +} + +void Screen::draw8(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) +{ + bool isfg; + u8 *dst = mVMemBase + y * mBytesPerLine + x * bytes_per_pixel; + + for (; w--; pixmap++, dst++) { + isfg = (*pixmap & 0x80); + writeb(dst, fillColors[isfg ? fc : bc]); + } +} + +void Screen::draw8Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) +{ + if (bc != bgcolor) { + draw8(x, y, w, fc, bc, pixmap); + return; + } + + bool isfg; + u32 offset = y * mBytesPerLine + x * bytes_per_pixel; + u8 *dst = mVMemBase + offset; + u8 *bgimg = bgimage_mem + offset; + + for (; w--; pixmap++, dst++, bgimg++) { + isfg = (*pixmap & 0x80); + writeb(dst, isfg ? fillColors[fc] : (*bgimg)); + } +} + +#define drawX(bits, lred, lgreen, lblue, type, fbwrite) \ + \ +void Screen::draw##bits(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) \ +{ \ + u8 red, green, blue; \ + u8 pixel; \ + type color; \ + type *dst = (type *)(mVMemBase + y * mBytesPerLine + x * bytes_per_pixel); \ + \ + for (; w--; pixmap++, dst++) { \ + pixel = *pixmap; \ + \ + if (!pixel) fbwrite(dst, fillColors[bc]); \ + else if (pixel == 0xff) fbwrite(dst, fillColors[fc]); \ + else { \ + red = mPalette[bc].red + (((mPalette[fc].red - mPalette[bc].red) * pixel) >> 8); \ + green = mPalette[bc].green + (((mPalette[fc].green - mPalette[bc].green) * pixel) >> 8); \ + blue = mPalette[bc].blue + (((mPalette[fc].blue - mPalette[bc].blue) * pixel) >> 8); \ + \ + color = ((red >> (8 - lred) << (lgreen + lblue)) | (green >> (8 - lgreen) << lblue) | (blue >> (8 - lblue))); \ + fbwrite(dst, color); \ + } \ + } \ +} + +drawX(15, 5, 5, 5, u16, writew) +drawX(16, 5, 6, 5, u16, writew) +drawX(32, 8, 8, 8, u32, writel) + +#define drawXBg(bits, lred, lgreen, lblue, type, fbwrite) \ + \ +void Screen::draw##bits##Bg(u32 x, u32 y, u32 w, u8 fc, u8 bc, u8 *pixmap) \ +{ \ + if (bc != bgcolor) { \ + draw##bits(x, y, w, fc, bc, pixmap); \ + return; \ + } \ + \ + u8 red, green, blue; \ + u8 redbg, greenbg, bluebg; \ + u8 pixel; \ + type color; \ + \ + u32 offset = y * mBytesPerLine + x * bytes_per_pixel; \ + type *dst = (type *)(mVMemBase + offset); \ + type *bgimg = (type *)(bgimage_mem + offset); \ + \ + for (; w--; pixmap++, dst++, bgimg++) { \ + pixel = *pixmap; \ + \ + if (!pixel) fbwrite(dst, *bgimg); \ + else if (pixel == 0xff) fbwrite(dst, fillColors[fc]); \ + else { \ + color = *bgimg; \ + \ + redbg = ((color >> (lgreen + lblue)) & ((1 << lred) - 1)) << (8 - lred); \ + greenbg = ((color >> lblue) & ((1 << lgreen) - 1)) << (8 - lgreen); \ + bluebg = (color & ((1 << lblue) - 1)) << (8 - lblue); \ + \ + red = redbg + (((mPalette[fc].red - redbg) * pixel) >> 8); \ + green = greenbg + (((mPalette[fc].green - greenbg) * pixel) >> 8); \ + blue = bluebg + (((mPalette[fc].blue - bluebg) * pixel) >> 8); \ + \ + color = ((red >> (8 - lred) << (lgreen + lblue)) | (green >> (8 - lgreen) << lblue) | (blue >> (8 - lblue))); \ + fbwrite(dst, color); \ + } \ + } \ +} + +drawXBg(15, 5, 5, 5, u16, writew) +drawXBg(16, 5, 6, 5, u16, writew) +drawXBg(32, 8, 8, 8, u32, writel) diff --git a/src/signalfd.h b/src/signalfd.h new file mode 100644 index 0000000..2d6129e --- /dev/null +++ b/src/signalfd.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2007, 2008 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SIGNALFD_H +#define _SYS_SIGNALFD_H 1 + +#define __need_sigset_t +#include <signal.h> +#include <stdint.h> + + +struct signalfd_siginfo +{ + uint32_t ssi_signo; + int32_t ssi_errno; + int32_t ssi_code; + uint32_t ssi_pid; + uint32_t ssi_uid; + int32_t ssi_fd; + uint32_t ssi_tid; + uint32_t ssi_band; + uint32_t ssi_overrun; + uint32_t ssi_trapno; + int32_t ssi_status; + int32_t ssi_int; + uint64_t ssi_ptr; + uint64_t ssi_utime; + uint64_t ssi_stime; + uint64_t ssi_addr; + uint8_t __pad[48]; +}; + + +__BEGIN_DECLS + +/* Request notification for delivery of signals in MASK to be + performed using descriptor FD.*/ +extern int signalfd (int __fd, const sigset_t *__mask, int __flags) + __THROW __nonnull ((2)); + +__END_DECLS + +#endif /* sys/signalfd.h */ diff --git a/src/vbe.h b/src/vbe.h new file mode 100644 index 0000000..575b7f2 --- /dev/null +++ b/src/vbe.h @@ -0,0 +1,134 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 VBE_H +#define VBE_H + +#define VBE_FUN_GET_INFO 0x4f00 +#define VBE_FUN_GET_MODE_INFO 0x4f01 +#define VBE_FUN_SET_MODE 0x4f02 +#define VBE_FUN_GET_CURRENT_MODE 0x4f03 +#define VBE_FUN_SAVE_RESTORE_STATE 0x4f04 +#define VBE_FUN_DISPLAY_WIN_CONTROL 0x4f05 +#define VBE_FUN_LOGICAL_SCANLINE 0x4f06 +#define VBE_FUN_DISPLAY_START 0x4f07 +#define VBE_FUN_PALETTE_FORMAT 0x4f08 +#define VBE_FUN_PALETTE_DATA 0x4f09 + +#define VBE_ATTR_MODE_SUPPORTED (1 << 0) +#define VBE_ATTR_TTY (1 << 2) +#define VBE_ATTR_COLOR (1 << 3) +#define VBE_ATTR_GRAPHICS (1 << 4) +#define VBE_ATTR_NOT_VGA (1 << 5) +#define VBE_ATTR_NOT_WINDOWED (1 << 6) +#define VBE_ATTR_LINEAR (1 << 7) + +#define VBE_MODEL_TEXT 0 +#define VBE_MODEL_CGA 1 +#define VBE_MODEL_HERCULES 2 +#define VBE_MODEL_PLANAR 3 +#define VBE_MODEL_PACKED 4 +#define VBE_MODEL_256 5 +#define VBE_MODEL_RGB 6 +#define VBE_MODEL_YUV 7 + +/* structures for vbe 3.0 */ + +struct vbe_info_block { + char vbe_signature[4]; + short vbe_version; + unsigned short oem_string_off; + unsigned short oem_string_seg; + int capabilities; + unsigned short video_mode_list_off; + unsigned short video_mode_list_seg; + short total_memory; + short oem_software_rev; + unsigned short oem_vendor_name_off; + unsigned short oem_vendor_name_seg; + unsigned short oem_product_name_off; + unsigned short oem_product_name_seg; + unsigned short oem_product_rev_off; + unsigned short oem_product_rev_seg; + char reserved[222]; + char oem_data[256]; +} __attribute__ ((packed)); + +struct vbe_mode_info_block { + unsigned short mode_attributes; + unsigned char win_a_attributes; + unsigned char win_b_attributes; + unsigned short win_granularity; + unsigned short win_size; + unsigned short win_a_segment; + unsigned short win_b_segment; + unsigned short win_func_ptr_off; + unsigned short win_func_ptr_seg; + unsigned short bytes_per_scanline; + + unsigned short x_resolution; + unsigned short y_resolution; + unsigned char x_char_size; + unsigned char y_char_size; + unsigned char number_of_planes; + unsigned char bits_per_pixel; + unsigned char number_of_banks; + unsigned char memory_model; + unsigned char bank_size; + unsigned char number_of_image_pages; + unsigned char res1; + + unsigned char red_mask_size; + unsigned char red_field_position; + unsigned char green_mask_size; + unsigned char green_field_position; + unsigned char blue_mask_size; + unsigned char blue_field_position; + unsigned char rsvd_mask_size; + unsigned char rsvd_field_position; + unsigned char direct_color_mode_info; + + unsigned int phys_base_ptr; + unsigned int offscreen_mem_offset; + unsigned short offscreen_mem_size; + + unsigned short lin_bytes_per_scanline; + unsigned char bnk_number_of_image_page; + unsigned char lin_number_of_image_pages; + unsigned char lin_red_mask_size; + unsigned char lin_red_field_position; + unsigned char lin_green_mask_size; + unsigned char lin_green_field_position; + unsigned char lin_blue_mask_size; + unsigned char lin_blue_field_position; + unsigned char lin_rsvd_mask_size; + unsigned char lin_rsvd_field_position; + unsigned int max_pixel_clock; + unsigned char res2[189]; +} __attribute__ ((packed)); + +struct vbe_palette_entry { + unsigned char blue; + unsigned char green; + unsigned char red; + unsigned char align; +} __attribute__ ((packed)); + +#endif diff --git a/src/vesadev.cpp b/src/vesadev.cpp new file mode 100644 index 0000000..0b1028b --- /dev/null +++ b/src/vesadev.cpp @@ -0,0 +1,383 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 "config.h" +#ifdef ENABLE_VESA + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <sys/io.h> +#include <sys/mman.h> +extern "C" { +#include <libx86.h> +} +#include "vesadev.h" +#include "vbe.h" +#include "fbterm.h" + +#define MAX_VIDEO_MEM (16 * 1024 * 1024) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +static s16 cur_mode; +static vbe_mode_info_block mode_info; +static LRMI_regs r; +static u32 scanline_width, scanline_height; + +extern u32 effective_uid; + +static bool call_bios() +{ + bool success = true; + u16 fun = r.eax; + + if (!LRMI_int(0x10, &r)) success = false; + if ((fun >> 8) == 0x4f && (r.eax & 0xffff) != 0x4f) success = false; + + if (!success) { + fprintf(stderr, "call VESA function 0x%x failure!\n", fun); + } + + return success; +} + +static void save_restore_state(bool save) +{ + static void *state_buf; + static u32 state_size; + static bool saved = false; + + if (save) { + if (saved) return; + + r.eax = VBE_FUN_SAVE_RESTORE_STATE; + r.ecx = 0xf; /* all states */ + r.edx = 0; /* get buffer size */ + + if (!call_bios()) return; + + state_size = (r.ebx & 0xffff) * 64; + state_buf = malloc(state_size); + + void *buf = LRMI_alloc_real(state_size); + + r.eax = VBE_FUN_SAVE_RESTORE_STATE; + r.ecx = 0xf; /* all states */ + r.edx = 1; /* save state */ + r.es = (long)buf >> 4; + r.ebx = (long)buf & 0xf; + + if (call_bios()) { + saved = true; + memcpy(state_buf, buf, state_size); + } + + LRMI_free_real(buf); + } else if (saved) { + void *buf = LRMI_alloc_real(state_size); + memcpy(buf, state_buf, state_size); + + r.eax = VBE_FUN_SAVE_RESTORE_STATE; + r.ecx = 0xf; /* all states */ + r.edx = 2; /* restore state */ + r.es = (long)buf >> 4; + r.ebx = (long)buf & 0xf; + + call_bios(); + LRMI_free_real(buf); + } +} + +static void save_restore_mode(bool save) +{ + static s16 mode = -1; + + if (save) { + r.eax = VBE_FUN_GET_CURRENT_MODE; + if (call_bios()) mode = r.ebx; + } else if (mode != -1) { + r.eax = VBE_FUN_SET_MODE; + r.ebx = mode; + call_bios(); + } +} + +// input: mode 0 for auto-detect +// return: -1 for failure +static s16 get_mode(s16 mode, bool only_print) +{ + seteuid(0); + bool ret = (!LRMI_init() || ioperm(0, 1024, 1) || iopl(3)); + seteuid(getuid()); + + if (ret) { + fprintf(stderr, "Using VESA requires root privilege\n"); + return -1; + } + + vbe_info_block *info = (vbe_info_block *)LRMI_alloc_real(sizeof(*info)); + + r.eax = VBE_FUN_GET_INFO; + r.es = (long)info >> 4; + memcpy(info->vbe_signature, "VBE2", 4); + + if (!call_bios() || strncmp(info->vbe_signature, "VESA", 4) != 0) { + fprintf(stderr, "No VESA bios\n"); + LRMI_free_real(info); + return -1; + } + + s16 *mode_list = (s16*)(info->video_mode_list_seg * 16 + info->video_mode_list_off); + vbe_mode_info_block *minfo = (vbe_mode_info_block *)LRMI_alloc_real(sizeof(*minfo)); + u32 xres_tmp, yres_tmp, bpp_tmp; + s16 mode_tmp = -1; + bool valid_mode = false; + + for (; *mode_list != -1; mode_list++) { + r.eax = VBE_FUN_GET_MODE_INFO; + r.ecx = *mode_list; + r.es = (long)minfo >> 4; + + if (!call_bios()) continue; + + if (!(minfo->mode_attributes & VBE_ATTR_MODE_SUPPORTED) + || !(minfo->mode_attributes & VBE_ATTR_COLOR) + || !(minfo->mode_attributes & VBE_ATTR_GRAPHICS) + || !(minfo->mode_attributes & VBE_ATTR_LINEAR)) continue; + + switch (minfo->bits_per_pixel) { + case 8: + if (minfo->memory_model != VBE_MODEL_PACKED) continue; + break; + case 15: + case 16: + case 32: + if (minfo->memory_model != VBE_MODEL_RGB) continue; + break; + default: + continue; + } + + valid_mode = true; + + if (only_print) { + printf("[%d]: %dx%d-%dbpp\n", *mode_list, + minfo->x_resolution, minfo->y_resolution, minfo->bits_per_pixel); + } else { + if (mode) { + if (mode == *mode_list) return mode; + } else { + if ((mode_tmp == -1) + || (minfo->x_resolution > xres_tmp && minfo->y_resolution > yres_tmp) + || (minfo->x_resolution == xres_tmp && minfo->y_resolution == yres_tmp && minfo->bits_per_pixel > bpp_tmp)) { + + mode_tmp = *mode_list; + xres_tmp = minfo->x_resolution; + yres_tmp = minfo->y_resolution; + bpp_tmp = minfo->bits_per_pixel; + } + } + } + } + + if (!valid_mode) fprintf(stderr, "can't find a valid VESA mode for your video card\n"); + else if (!only_print && mode_tmp == -1) fprintf(stderr, "%d isn't a valid VESA mode for your video card\n", mode); + + LRMI_free_real(info); + LRMI_free_real(minfo); + return mode_tmp; +} + +void VesaDev::printModes() +{ + get_mode(0, true); +} + +VesaDev *VesaDev::initVesaDev(s16 mode) +{ + cur_mode = get_mode(mode, false); + if (cur_mode == -1) return 0; + + void *minfo = LRMI_alloc_real(sizeof(mode_info)); + + r.eax = VBE_FUN_GET_MODE_INFO; + r.ecx = cur_mode; + r.es = (long)minfo >> 4; + call_bios(); + + memcpy(&mode_info, minfo, sizeof(mode_info)); + LRMI_free_real(minfo); + + cur_mode |= 0x4000; // use linear frame buffer mode + return new VesaDev(); +} + +VesaDev::VesaDev() +{ + mWidth = mode_info.x_resolution; + mHeight = mode_info.y_resolution; + mBitsPerPixel = mode_info.bits_per_pixel; + + scanline_width = mWidth; + scanline_height = mHeight; +} + +VesaDev::~VesaDev() +{ + if (mVMemBase) munmap(mVMemBase, mBytesPerLine * scanline_height); +} + +const s8 *VesaDev::drvId() +{ + return "VESA"; +} + +void VesaDev::switchVc(bool enter) +{ + if (enter) { + static bool inited = false; + + if (!inited) { + save_restore_mode(true); + save_restore_state(true); + } + + r.eax = VBE_FUN_SET_MODE; + r.ebx = cur_mode; + call_bios(); + + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 0; // set scan line length in pixels + r.ecx = scanline_width; + call_bios(); + + if (!inited) { + inited = true; + + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 1; // get scan line length + call_bios(); // return ebx: scan line length in bytes + // ecx: scan line length in pixels + // edx: maximum scan lines + + mBytesPerLine = r.ebx; + initScrollType(); + + seteuid(0); + s32 fd = open("/dev/mem", O_RDWR); + seteuid(getuid()); + + mVMemBase = (u8 *)mmap(0, mBytesPerLine * scanline_height, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mode_info.phys_base_ptr); + close(fd); + } + } else { + save_restore_mode(false); + save_restore_state(false); + } + + Screen::switchVc(enter); +} + +void VesaDev::initScrollType() +{ + r.eax = VBE_FUN_DISPLAY_START; + r.ebx = 0; // set display start + r.ecx = 0; // x = 0 + r.edx = 0; // y = 0 + if (!call_bios()) return; + + if (mRotateType == Rotate0 || mRotateType == Rotate180) { + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 1; // get scan line length + call_bios(); + + u32 max_height = MIN(r.edx, MAX_VIDEO_MEM / mBytesPerLine); + if (max_height <= mHeight) return; + + mScrollType = YPan; + mOffsetMax = max_height - mHeight; + scanline_height = max_height; + } else { + // mWidth/mHeight has been swapped + u32 width = mHeight, height = mWidth; + + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 3; // get maximum scan line length + if (!call_bios()) return; + + u32 max_width = r.ecx; + + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 0; // set scan line length in pixels + call_bios(); + + r.eax = VBE_FUN_LOGICAL_SCANLINE; + r.ebx = 1; // get scan line length + call_bios(); + + if (r.ecx <= width || r.edx < height) return; + + scanline_width = max_width; + mScrollType = XPan; + mBytesPerLine = r.ebx; + mOffsetMax = r.ecx - width; + } +} + +void VesaDev::setupOffset() +{ + if (mScrollType != YPan && mScrollType != XPan) return; + + r.eax = VBE_FUN_DISPLAY_START; + r.ebx = 0; // set display start + if (mScrollType == YPan) { + r.ecx = 0; + r.edx = mOffsetCur; + } else { + r.ecx = mOffsetCur; + r.edx = 0; + } + call_bios(); +} + +void VesaDev::setupPalette(bool restore) +{ + if (mode_info.memory_model != VBE_MODEL_PACKED || restore) return; + + vbe_palette_entry *buf = (vbe_palette_entry *)LRMI_alloc_real(sizeof(*buf) * NR_COLORS); + + for (u32 i = 0; i < NR_COLORS; i++) { + buf[i].red = mPalette[i].red >> 2; + buf[i].green = mPalette[i].green >> 2; + buf[i].blue = mPalette[i].blue >> 2; + } + + r.eax = VBE_FUN_PALETTE_DATA; + r.ebx = 0; // set palette data + r.ecx = NR_COLORS; // number of palette entry + r.edx = 0; // first palette entry + r.es = (long)buf >> 4; + call_bios(); + + LRMI_free_real(buf); +} +#endif diff --git a/src/vesadev.h b/src/vesadev.h new file mode 100644 index 0000000..61020aa --- /dev/null +++ b/src/vesadev.h @@ -0,0 +1,42 @@ +/* + * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * This file is part of FbTerm. + * + * 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 VESADEV_H +#define VESADEV_H + +#include "screen.h" + +class VesaDev : public Screen { +private: + friend class Screen; + static void printModes(); + static VesaDev *initVesaDev(s16 mode); + + VesaDev(); + ~VesaDev(); + + virtual void setupOffset(); + virtual void setupPalette(bool restore); + virtual void switchVc(bool enter); + virtual const s8 *drvId(); + + void initScrollType(); +}; +#endif diff --git a/terminfo/Makefile.am b/terminfo/Makefile.am new file mode 100644 index 0000000..b023297 --- /dev/null +++ b/terminfo/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = fbterm + +install-data-local: + tic fbterm diff --git a/terminfo/Makefile.in b/terminfo/Makefile.in new file mode 100644 index 0000000..92cfbd9 --- /dev/null +++ b/terminfo/Makefile.in @@ -0,0 +1,330 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = terminfo +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FC_CFLAGS = @FC_CFLAGS@ +FC_LIBS = @FC_LIBS@ +FT2_CFLAGS = @FT2_CFLAGS@ +FT2_LIBS = @FT2_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +X86_LIBS = @X86_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = fbterm +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu terminfo/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu terminfo/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-data-local install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am + + +install-data-local: + tic fbterm + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/terminfo/fbterm b/terminfo/fbterm new file mode 100644 index 0000000..30c80c7 --- /dev/null +++ b/terminfo/fbterm @@ -0,0 +1,33 @@ +# Reconstructed via infocmp from file: /lib/terminfo/l/linux +fbterm|framebuffer based terminal emulator, + am, bce, ccc, eo, mir, msgr, xenl, xon, + colors#256, it#8, ncv#18, pairs#32767, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l\E[?1c, + clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?25h\E[?8c, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, + initc=\E[3;%p1%d;%p2%d;%p3%d;%p4%d}, + kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, oc=\E]R, + op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m, + rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, rmso=\E[27m, + rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + setab=\E[2;%p1%d}, setaf=\E[1;%p1%d}, + setb=\E[2;%p1%d}, setf=\E[1;%p1%d}, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smir=\E[4h, + smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c, + vpa=\E[%i%p1%dd, |