From 0f0653d8a5a219ae94cf066cdc41531e4609f007 Mon Sep 17 00:00:00 2001 From: kou1okada Date: Mon, 8 Mar 2004 19:19:33 +0900 Subject: [PATCH] IME Proxy canna2imm32 1.0.0 (released 2004-03-09) This commit was expanded from `canna2imm32-1.0.0-1-src.tar.bz2` as below: ```console $ ls -l --time-style="+%F %T" canna2imm32-1.0.0-1-src.tar.bz2 | awk '($3=$4="")||1' -rw-r--r--+ 1 119354 2004-03-09 02:59:12 canna2imm32-1.0.0-1-src.tar.bz2 $ tar tvf canna2imm32-1.0.0-1-src.tar.bz2 -rw-r--r-- arai/Administrators 0 2004-03-08 19:23 canna2imm32-1.0.0-1.patch -rwxr-xr-x arai/Administrators 6265 2004-03-08 19:23 canna2imm32-1.0.0-1.sh -rw-r--r-- arai/Administrators 115368 2004-03-08 19:23 canna2imm32-1.0.0.tar.bz2 $ tar xf canna2imm32-1.0.0-1-src.tar.bz2 $ tar xf canna2imm32-1.0.0.tar.bz2 --strip-components=1 ``` ```timestamp 2003-12-24 21:11:49.000000000 +0900 'AUTHORS' 2000-08-03 23:40:10.000000000 +0900 'COPYING' 2004-03-04 19:26:20.000000000 +0900 'ChangeLog' 2004-01-16 20:50:19.000000000 +0900 'Makefile.am' 2004-01-16 21:10:48.000000000 +0900 'Makefile.in' 2003-12-24 21:02:57.000000000 +0900 'NEWS' 2003-12-24 21:03:02.000000000 +0900 'README' 2004-02-16 15:58:54.000000000 +0900 'ReadMe1st.txt' 2004-01-16 18:53:01.000000000 +0900 'aclocal.m4' 2004-01-16 18:00:54.000000000 +0900 'canna2imm32rc' 2000-08-03 23:40:10.000000000 +0900 'cannaproto.c' 2000-08-03 23:40:10.000000000 +0900 'cannaproto.h' 2004-01-22 17:24:46.000000000 +0900 'cannasocket.c' 2000-08-03 23:40:10.000000000 +0900 'cannasocket.h' 2004-01-16 18:53:12.000000000 +0900 'configure' 2004-01-16 17:47:04.000000000 +0900 'configure.in' 2004-01-26 18:44:48.000000000 +0900 'constdef.h' 2004-01-26 18:17:08.000000000 +0900 'def.h' 2000-08-03 23:40:10.000000000 +0900 'esecanna_orig/4DEVELOPERS.jp' 2000-09-16 15:55:51.000000000 +0900 'esecanna_orig/CHANGES.jp' 2000-09-16 16:03:41.000000000 +0900 'esecanna_orig/CREDITS' 2000-09-09 12:38:30.000000000 +0900 'esecanna_orig/INSTALL.jp' 2000-09-09 12:37:14.000000000 +0900 'esecanna_orig/README.First.jp' 2000-09-09 12:38:39.000000000 +0900 'esecanna_orig/README.jp' 2004-01-26 19:34:00.000000000 +0900 'imewrapper.c' 2000-08-03 23:40:10.000000000 +0900 'imewrapper.h' 2000-08-03 23:40:10.000000000 +0900 'install-sh' 2003-10-30 20:08:38.000000000 +0900 'libtool' 2000-08-03 23:40:10.000000000 +0900 'ltconfig' 2000-08-03 23:40:10.000000000 +0900 'ltmain.sh' 2004-02-20 01:38:19.000000000 +0900 'main.c' 2004-02-20 01:29:12.000000000 +0900 'misc.c' 2004-02-20 01:17:16.000000000 +0900 'misc.h' 2000-08-03 23:40:11.000000000 +0900 'missing' 2000-08-03 23:40:11.000000000 +0900 'mkinstalldirs' 2004-03-08 19:19:33.000000000 +0900 'winimm.c' 2004-01-26 18:34:39.000000000 +0900 'winimm.h' ``` --- AUTHORS | 6 + COPYING | 339 +++ ChangeLog | 2 + Makefile.am | 12 + Makefile.in | 390 +++ NEWS | 0 README | 0 ReadMe1st.txt | 46 + aclocal.m4 | 134 + canna2imm32rc | 9 + cannaproto.c | 248 ++ cannaproto.h | 24 + cannasocket.c | 360 +++ cannasocket.h | 26 + configure | 2491 +++++++++++++++++++ configure.in | 47 + constdef.h | 45 + def.h | 77 + esecanna_orig/4DEVELOPERS.jp | 123 + esecanna_orig/CHANGES.jp | 73 + esecanna_orig/CREDITS | 16 + esecanna_orig/INSTALL.jp | 39 + esecanna_orig/README.First.jp | 45 + esecanna_orig/README.jp | 54 + imewrapper.c | 1068 ++++++++ imewrapper.h | 79 + install-sh | 251 ++ libtool | 4303 +++++++++++++++++++++++++++++++++ ltconfig | 3114 ++++++++++++++++++++++++ ltmain.sh | 4024 ++++++++++++++++++++++++++++++ main.c | 287 +++ misc.c | 1551 ++++++++++++ misc.h | 157 ++ missing | 190 ++ mkinstalldirs | 40 + winimm.c | 2222 +++++++++++++++++ winimm.h | 91 + 37 files changed, 21983 insertions(+) create mode 100755 AUTHORS create mode 100755 COPYING create mode 100755 ChangeLog create mode 100755 Makefile.am create mode 100755 Makefile.in create mode 100755 NEWS create mode 100755 README create mode 100755 ReadMe1st.txt create mode 100755 aclocal.m4 create mode 100755 canna2imm32rc create mode 100755 cannaproto.c create mode 100755 cannaproto.h create mode 100755 cannasocket.c create mode 100755 cannasocket.h create mode 100755 configure create mode 100755 configure.in create mode 100755 constdef.h create mode 100755 def.h create mode 100755 esecanna_orig/4DEVELOPERS.jp create mode 100755 esecanna_orig/CHANGES.jp create mode 100755 esecanna_orig/CREDITS create mode 100755 esecanna_orig/INSTALL.jp create mode 100755 esecanna_orig/README.First.jp create mode 100755 esecanna_orig/README.jp create mode 100755 imewrapper.c create mode 100755 imewrapper.h create mode 100755 install-sh create mode 100755 libtool create mode 100755 ltconfig create mode 100755 ltmain.sh create mode 100755 main.c create mode 100755 misc.c create mode 100755 misc.h create mode 100755 missing create mode 100755 mkinstalldirs create mode 100755 winimm.c create mode 100755 winimm.h diff --git a/AUTHORS b/AUTHORS new file mode 100755 index 0000000..57a7ee1 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +えせかんな本体については CREDITS を参照してください。 + +winimm.c/winimm.h については +Yasuyuki ARAI +が作業しました。バグ等ありましたらご連絡ください。 + diff --git a/COPYING b/COPYING new file mode 100755 index 0000000..a43ea21 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + 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. + + + Copyright (C) 19yy + + 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. + + , 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 100755 index 0000000..4f08def --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2 @@ +2004.03.04 Y.Arai +・resize_pause の時に、濁音、半濁音があるとそこを超えられないのを修正 diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..765c0d4 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,12 @@ +AUTOMAKE_OPTIONS = foreign + +sbin_PROGRAMS = canna2imm32 + +canna2imm32_SOURCES = cannaproto.c cannasocket.c imewrapper.c main.c misc.c winimm.c cannaproto.h cannasocket.h constdef.h def.h imewrapper.h misc.h winimm.h + +canna2imm32_LDADD = + +EXTRA_DIST = esecanna_orig/4DEVELOPERS.jp esecanna_orig/CHANGES.jp esecanna_orig/INSTALL.jp \ + esecanna_orig/README.First.jp esecanna_orig/README.jp \ + ReadMe1st.txt AUTHORS ChangeLog COPYING NEWS README canna2imm32rc +sysconf_DATA = canna2imm32rc diff --git a/Makefile.in b/Makefile.in new file mode 100755 index 0000000..9b88d6b --- /dev/null +++ b/Makefile.in @@ -0,0 +1,390 @@ +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = foreign + +sbin_PROGRAMS = canna2imm32 + +canna2imm32_SOURCES = cannaproto.c cannasocket.c imewrapper.c main.c misc.c winimm.c cannaproto.h cannasocket.h constdef.h def.h imewrapper.h misc.h winimm.h + +canna2imm32_LDADD = + +EXTRA_DIST = esecanna_orig/4DEVELOPERS.jp esecanna_orig/CHANGES.jp esecanna_orig/INSTALL.jp esecanna_orig/README.First.jp esecanna_orig/README.jp ReadMe1st.txt AUTHORS ChangeLog COPYING NEWS README canna2imm32rc + +sysconf_DATA = canna2imm32rc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +PROGRAMS = $(sbin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +canna2imm32_OBJECTS = cannaproto.o cannasocket.o imewrapper.o main.o \ +misc.o winimm.o +canna2imm32_DEPENDENCIES = +canna2imm32_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(sysconf_DATA) + +DIST_COMMON = README AUTHORS COPYING ChangeLog Makefile.am Makefile.in \ +NEWS aclocal.m4 configure configure.in install-sh ltconfig ltmain.sh \ +missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +DEP_FILES = .deps/cannaproto.P .deps/cannasocket.P .deps/imewrapper.P \ +.deps/main.P .deps/misc.P .deps/winimm.P +SOURCES = $(canna2imm32_SOURCES) +OBJECTS = $(canna2imm32_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-sbinPROGRAMS: + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) + +distclean-sbinPROGRAMS: + +maintainer-clean-sbinPROGRAMS: + +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sbindir) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(sbin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +canna2imm32: $(canna2imm32_OBJECTS) $(canna2imm32_DEPENDENCIES) + @rm -f canna2imm32 + $(LINK) $(canna2imm32_LDFLAGS) $(canna2imm32_OBJECTS) $(canna2imm32_LDADD) $(LIBS) + +install-sysconfDATA: $(sysconf_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sysconfdir) + @list='$(sysconf_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \ + fi; fi; \ + done + +uninstall-sysconfDATA: + @$(NORMAL_UNINSTALL) + list='$(sysconf_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(sysconfdir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(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 + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile + $(mkinstalldirs) $(distdir)/esecanna_orig + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-sbinPROGRAMS install-sysconfDATA +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-sbinPROGRAMS uninstall-sysconfDATA +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(sysconfdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \ + distclean-depend distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \ +clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ +install-sbinPROGRAMS mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile uninstall-sysconfDATA \ +install-sysconfDATA tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ +clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# 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/NEWS b/NEWS new file mode 100755 index 0000000..e69de29 diff --git a/README b/README new file mode 100755 index 0000000..e69de29 diff --git a/ReadMe1st.txt b/ReadMe1st.txt new file mode 100755 index 0000000..a03d3e7 --- /dev/null +++ b/ReadMe1st.txt @@ -0,0 +1,46 @@ +、ィ、サ、ォ、、ハ。ヲWindows IMM32 ネヌ Ver. 1.0.0 + 2004. 1.16 + +」ア.、マ、ク、皃ヒ +。。ヒワ・ス・ユ・ネ、マ。「、ィ、サ、ォ、、ハ、・ル。シ・ケ、ヒ、キ、ソ。「 Windows、ホIMM、ホAPI、サネヘム、キ、ニWindowsセ螟ホ +IMM、ヌ、ォ、ハエチサハムエケ、ケヤ、ヲ、ソ、皃ホ、筅ホ、ヌ、ケ。」 +。。、ィ、サ、ォ、、ハ、ネ、マー网、。「ヒワツホ、ネ・筵ク・蝪シ・、ヒ、マハャホ・、サ、コ。「ーツホケスツ、、ネ、キ、ニ、「、熙゙、ケ。」 +セュヘ陦「イソ、ォ、ホ、ソ、皃ヒハャホ・ケスツ、、ヒ、ケ、、ォ、筅キ、、ハ、、、ホ、ヌ。「、ス、ホ、「、ソ、熙ホケスツ、、マ、「、゙、熙、、ク +、鬢ハ、、、隍ヲ、ヒ、キ、ニ、「、熙゙、ケ、ャ。「ツソハャ、ウ、ホ、゙、゙、ヌ、キ、遉ヲ。ハWindowsセ螟ヌハャホ・ケスツ、、ヒ、ケ、ル、ュ +・ア。シ・ケ、ャサラ、、ナ、ソ、鬢ハ、、。ハエタ。ヒ。ヒ。」 +。。クスセ、ヌ、マ。「Win9Xキマ、ヒ、マツミア、キ、ニ、、、゙、サ、。ハUnicodeキマ、ホ・ユ・。・・ッ・キ・逾、サネヘム、キ、ニ、、 +、゙、ケ。ヒ。」・・ッ・ィ・ケ・ネ、ャ、「、、ミコ、、ォ、筅キ、、゙、サ、。」 + +」イ.・モ・・ノハヒ。 +。。$ make +、ヌ・皈、・ッ、キ、ニ、ッ、タ、オ、、。」 +autoconfキマ、ホ・ト。シ・、ヒ、マ、ス、ホ、ヲ、チツミア、ケ、、ォ、筅キ、、゙、サ、。ハcygwinエトカュ、ヌ、キ、ォーユフ」、ャフオ +、、・ス・ユ・ネ、ハ、ホ、ヌ、「、゙、ーユフ」、ャフオ、、、ォ、ハ、ネ、マサラ、テ、ニ、、、゙、ケ、ャ。ヒ。」 + +」ウ.オッニーハヒ。 +。。$ canna2imm32.exe & +、ヌオッニー、キ、ニ、ッ、タ、オ、、。」 +cygrunsrv.exe、ヌ・オ。シ・モ・ケ、ヒナミマソ、ケ、、ホ、マ、ェエォ、皃キ、゙、サ、。」 +オッニーサ、ホ・ェ・ラ・キ・逾、マ。「 +。。$ canna2imm32.exe --help +、ヌウホヌァ、キ、ニ、ッ、タ、オ、、。」 + +」エ.スェホサハヒ。 +。。$ kill +、ヌスェホサ、キ、ニ、ッ、タ、オ、、。」 +セ。シ熙ヒスェホサ、キ、ニ、キ、゙、ヲセケ遉マ。「・ミ・ー、ヌ、ケ。ハソス、キフ、ハ、、。ヒ。」 + +」オ。・エテホ、ホフ萃 +。ヲウリスャ、ヒシコヌヤ、ケ、、ウ、ネ、ャ、「、熙゙、ケ。」 + +」カ。・、ス、ホツセ +。ヲウー、ォ、鬣「・ッ・サ・ケ、ケ、、ソ、皃ヒ、マ。「/etc/hosts.canna2imm32 、ヒオュスメ、キ、ニ、ッ、タ、オ、、。」 + +xf1.mlb.jp +xf2.mlb.jp + +、ホヘヘ、ヒ。「ーケヤ、ヒ」ア・ロ・ケ・ネ、オュスメ、キ、ニ、ッ、タ、オ、、。」 +。。ニテ、ヒ/etc/hosts.canna2imm32、ヒオュスメ、ャフオ、、セケ遉ヌ、筍「localhost、ネオッニー、キ、ソ・ロ・ケ・ネフセ、ヌ、ホ +・「・ッ・サ・ケ、マイトヌス、ヌ、ケ。」 + +ーハセ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100755 index 0000000..6271694 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,134 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p6 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# 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. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.4-p6])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $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" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + diff --git a/canna2imm32rc b/canna2imm32rc new file mode 100755 index 0000000..e7eab3c --- /dev/null +++ b/canna2imm32rc @@ -0,0 +1,9 @@ +## チケ鄲゚ト・ユ・。・、・、ネ、キ、ニ。「/etc/canna2imm32rc 、ヒ、ハ、、、ネオッニー、キ、゙、サ、。」 + +# IME.. 、ノ、、、ト、ォ、ヲ、ォ。」 +# ~/.canna2imm32rc 、ホセケ遉マ。「、ス、ホ・譯シ・カ。シ、ャ、ノ、ホ IME 、サネ、ヲ、ォ、サリト熙ケ、、ャ。「 +# /etc/canna2imm32rc 、ホセケ遉マ。「~/.canna2imm32rc 、ャ、ハ、、セケ遉ヒ、ノ、ホ IME 、 +# ・ヌ・ユ・ゥ・・ネ、ヌサネ、ヲ、ォ。「、サリト熙ケ、。」 +# クスセ、ヌ、マIMM32 、ホ、゚ヘュク。」 +IME=IMM32 + diff --git a/cannaproto.c b/cannaproto.c new file mode 100755 index 0000000..52ce799 --- /dev/null +++ b/cannaproto.c @@ -0,0 +1,248 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "def.h" +#include "misc.h" +#include "imewrapper.h" +#include "cannaproto.h" + +typedef int (*intfunc_t)(); + +intfunc_t wrapperfunc[] = { + imewrapper_initialize, + imewrapper_finalize, + imewrapper_create_context, + imewrapper_duplicate_context, + imewrapper_close_context, + imewrapper_get_dictionary_list, + imewrapper_get_directory_list, + imewrapper_mount_dictionary, + imewrapper_unmount_dictionary, + imewrapper_remount_dictionary, + imewrapper_get_mountdictionary_list, + imewrapper_query_dictionary, + imewrapper_define_word, + imewrapper_delete_word, + imewrapper_begin_convert, + imewrapper_end_convert, + imewrapper_get_candidacy_list, + imewrapper_get_yomi, + imewrapper_subst_yomi, + imewrapper_store_yomi, + imewrapper_store_range, + imewrapper_get_lastyomi, + imewrapper_flush_yomi, + imewrapper_remove_yomi, + imewrapper_get_simplekanji, + imewrapper_resize_pause, + imewrapper_get_hinshi, + imewrapper_get_lex, + imewrapper_get_status, + imewrapper_set_locale, + imewrapper_auto_convert, + imewrapper_query_extensions, + imewrapper_set_applicationname, + imewrapper_notice_groupname, + imewrapper_through, + imewrapper_kill_server +}; + +intfunc_t wrapperfunc_e[] = { + imewrapper_get_serverinfo, + imewrapper_get_access_control_list, + imewrapper_create_dictionary, + imewrapper_delete_dictionary, + imewrapper_rename_dictionary, + imewrapper_get_wordtext_dictionary, + imewrapper_list_dictionary, + imewrapper_sync, + imewrapper_chmod_dictionary, + imewrapper_copy_dictionary +}; + +static buffer_t packetbuf; + +char *protocol_name[] = { + "Initialize", + "Finalize", + "CreateContext", + "DupricateContext", + "CloseContext", + "GetDictionaryList", + "GetDirectoryList", + "MountDictionary", + "UnmountDictionary", + "RemountDictionary", + "GetMountDictionaryList", + "QueryDictionary", + "DefineWord", + "DeleteWord", + "BeginConvert", + "EndConvert", + "GetCandidacyList", + "GetYomi", + "SubstYomi", + "StoreYomi", + "StoreRange", + "GetLastYomi", + "FlushYomi", + "RemoveYomi", + "GetSimpleKanji", + "ResizePause", + "GetHinshi", + "GetLex", + "GetStatus", + "SetLocale", + "AutoConvert", + "QueryExtensions", + "SetApplicationName", + "NoticeGroupName", + "Through", + "KillServer", + NULL +}; + +char *e_protocol_name[] = { + "GetServerInfo", + "GetAccessControlList", + "CreateDictionary", + "DeleteDictionary", + "RenameDictionary", + "GetWordTextDictionary", + "ListDictionary", + "Sync", + "ChmodDictionary", + "CopyDictionary", + NULL +}; + +extern client_t client[]; + +int canna_proto_recv_request(int id) +{ + int datalen, extflag, type; + cannaheader_t *header; + + buffer_check(&packetbuf, 24); + + if (m_socket_read(client[id].sockfd, packetbuf.buf, 4) < 0) { + /* read ・ィ・鬘シ、マ・ッ・鬣、・「・・ネ、ャセ。シ熙ヒヘ、チ、ソ、ネネステヌ、ケ、 */ + return -1; + } + + header = (cannaheader_t *)(packetbuf.buf); + + if (header->type == 0x00) { /* Initialize */ + if (m_socket_read(client[id].sockfd, (char *)(&datalen), 4) < 0) + return -1; + datalen = LSBMSB32(datalen); + + buffer_check(&packetbuf, datalen); + + if (m_socket_read(client[id].sockfd, packetbuf.buf, datalen) < 0) + return -1; + + return 0x01; + } else { + datalen = LSBMSB16(header->datalen); + extflag = header->extra ? 0x1000 : 0x0000; + type = header->type; + + if (datalen > 0) { + buffer_check(&packetbuf, datalen + 4); + + if (m_socket_read(client[id].sockfd, &(packetbuf.buf[4]), datalen) < 0) + return -1; + } + + return (type | extflag); + } +} + +int canna_proto_send_request(int id) +{ + int datalen; + cannaheader_t *header; + + header = (cannaheader_t *)(packetbuf.buf); + + datalen = LSBMSB16(header->datalen) + 4; + + if (m_socket_write(client[id].sockfd, packetbuf.buf, datalen) < 0) + return -1; + + return 0; +} + +int canna_proto_main(int id) +{ + int type, ret; + int (*callfunc)(); + char *reqname; + + if ((type = canna_proto_recv_request(id)) <= 0) { + client[id].need_terminate = TRUE; /* main.c 、ヌスェホサス靉、、キ、ニ、筅鬢ヲ */ + return 0; + } + + if ((0x01 <= type && type <= 0x24) || (0x1001 <= type && type <= 0x100a)) { + if (type & 0x1000) { + reqname = e_protocol_name[(type & 0xff) - 1]; + callfunc = wrapperfunc_e[(type & 0xff) - 1]; + } else { + reqname = protocol_name[type - 1]; + callfunc = wrapperfunc[type - 1]; + } + + m_msg_dbg("REQUEST %s called by %s@%s\n", reqname, client[id].user, + client[id].host); + + ret = (*callfunc)(id, &packetbuf); + + m_msg_dbg("Returned from request processing.\n"); + } else { + /* ・リ・テ・タ、ャハム。」main.c 、ヌスェホサス靉、、キ、ニ、筅鬢ヲ。」・・ッ・ィ・ケ・ネ、マ・ェ・ヲ・猝ヨ、キ */ + client[id].need_terminate = TRUE; + ret = 1; + } + + /* ret..1 タョク ret..0 フ、シツチ ret..-1 IME ヘ、チ、ソ */ + + if (type == 0x01) + write(client[id].sockfd, packetbuf.buf, 4); + else + canna_proto_send_request(id); + + if (ret == 0) + m_msg_dbg("Request %x is under construction.\n", type); + else if (ret == -1) { + m_msg("IME terminated.\n"); + + /* コニオッニース靉、、ケ、。」シコヌヤ、キ、ソセケ遉マ。「-ime 、ャハヨ、遙「main.c 、ヌ + * チエ、ニ、ホ・ッ・鬣、・「・・ネ、ホスェホサス靉、、ケ、、ソ、癸「-ime 、ハヨ、ケ + */ + + return imewrapper_ime_aborted(client[id].ime); + } + + return 0; +} diff --git a/cannaproto.h b/cannaproto.h new file mode 100755 index 0000000..c118569 --- /dev/null +++ b/cannaproto.h @@ -0,0 +1,24 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __cannaproto_h__ +#define __cannaproto_h__ + +int canna_proto_main(int id); + +#endif diff --git a/cannasocket.c b/cannasocket.c new file mode 100755 index 0000000..b5347e2 --- /dev/null +++ b/cannasocket.c @@ -0,0 +1,360 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "def.h" +#include "misc.h" + +static struct sockaddr_un unaddr; +static struct sockaddr_in inaddr; +static int canna_unixfd, canna_inetfd; + +extern client_t client[]; +extern char inetmode; + +#define MAXDATA 1024 +#define BUFSIZE 4096 +#define ACCESS_FILE "/etc/hosts.canna2imm32" + +/* + * canna_socket_open_unix : unix ・ノ・皈、・、ホ・ス・ア・テ・ネ、タクタョ、ケ、 + * : ・ユ・。・、・・ヌ・」・ケ・ッ・・ラ・ソ、ハヨ、ケ + */ + +static int canna_socket_open_unix() +{ + int old_umask; + int fd; + + old_umask = umask(0); + + mkdir(CANNA_UNIX_DOMAIN_DIR, 0777); + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + m_msg("Cannot open unix domain socket.\n"); + return -1; + } + + unaddr.sun_family = AF_UNIX; + strcpy(unaddr.sun_path, CANNA_UNIX_DOMAIN_PATH); + + if (bind(fd, (struct sockaddr *)(&unaddr), sizeof unaddr)) { + close(fd); + m_msg("Cannot bind.\n"); + m_msg("Another cannaserver detected.\n"); + m_msg("If you're sure cannaserver is not running,\n"); + m_msg("remove /tmp/.iroha_unix/IROHA.\n"); + return -1; + } + + if (listen(fd, 5)) { + close(fd); + m_msg("Cannot listen.\n"); + return -1; + } + + umask(old_umask); + + return fd; +} + +/* + * canna_socket_open_inet : inet ・ノ・皈、・、ホ・ス・ア・テ・ネ、タクタョ、ケ、 + * : ・ユ・。・、・・ヌ・」・ケ・ッ・・ラ・ソ、ハヨ、ケ + */ + +static int canna_socket_open_inet() +{ + struct servent *s; + int one = 1, fd, i; + + if (inetmode == 0) + return -1; + + if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + m_msg("Cannot open inet domain socket.\n"); + return -1; + } + +#ifdef SO_REUSEADDR + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)(&one), + sizeof (int)); +#endif + + s = getservbyname(CANNA_SERVICE_NAME, "tcp"); + + memset((char *)&inaddr, 0, sizeof inaddr); + inaddr.sin_family = AF_INET; + inaddr.sin_port = s ? s->s_port : htons(CANNA_DEFAULT_PORT); + inaddr.sin_addr.s_addr = htonl(INADDR_ANY); + + if ((i = bind(fd, (struct sockaddr *)(&inaddr), sizeof inaddr)) != 0) { + m_msg("Bind refused.\n"); + return -1; + } + + if (listen (fd, 5)) { + close(fd); + m_msg("Cannot listen.\n"); + return -1; + } + + return fd; +} + +/* + * canna_socket_open : unix, inet ・ノ・皈、・、ホ・ス・ア・テ・ネ、タクタョ、ケ、。」 + */ + +int canna_socket_open(int *ufd, int *ifd) +{ + if ((canna_unixfd = canna_socket_open_unix()) == -1) + m_msg("unix domain not created.\n"); + if ((canna_inetfd = canna_socket_open_inet()) == -1) + m_msg("inet domain not created.\n"); + + if (canna_unixfd == -1) + return -1; + if ((inetmode == 1) && (canna_inetfd == -1)) + return -1; + + *ufd = canna_unixfd; + *ifd = canna_inetfd; + + return 0; +} + +int canna_socket_close() +{ + close(canna_unixfd); + if (inetmode == 1) + close(canna_inetfd); + + unlink(CANNA_UNIX_DOMAIN_PATH); + + return 0; +} + +/* + * canna_socket_accept_new_connection : タワツウヘラオ皃シ、ア、 + * fd = canna_unixfd or canna_inetfd + * : ・ユ・。・、・・ヌ・」・ケ・ッ・・ラ・ソ、ハヨ、ケ + */ + +static int canna_socket_accept_new_connection(int fd) +{ + int i, newfd; + int /* localhost_inaddr, */myhost_inaddr, *ip; + char buf[MAXDATA], *host = NULL; + int size; + struct sockaddr_un addr_un; + struct sockaddr_in addr_in; + struct hostent *hp; + unsigned int addr_list[BUFSIZE]; /* 、ネ、熙「、ィ、コ4096、「、、ミ、、、、、ォ。ヲ。ヲ。ヲ */ + FILE *fp; + char *wp; + + size = sizeof(struct sockaddr_un); + + if ((newfd = accept(fd, (struct sockaddr *)(&addr_un), &size)) < 0) { + m_msg("Cannot open new socket. Connection refused.\n"); + return -1; + } + +/* >> フ萃熙マ、ウ、ウ、ォ、 */ + if (addr_un.sun_family == AF_INET) + { /* 、ウ、ホ・ヨ・・テ・ッ、ャ INET Y.A. */ + memcpy(&addr_in, (struct sockaddr *)(&addr_un),sizeof(struct sockaddr_in)); + + /* >> /etc/hosts.canna ツミア */ + i = 0; /* addr_list 、ホ・ェ・ユ・サ・テ・ネ */ + /* check my host name */ + if (gethostname(buf, MAXDATA) == 0) + { + if ((hp = gethostbyname(buf)) != NULL) + { + ip = (int *)(hp->h_addr_list[0]); + addr_list[i] = *ip; + i++; + } + } + + /* check "localhost" */ + if ((hp = gethostbyname("localhost")) != NULL) + { + ip = (int *)(hp->h_addr_list[0]); + addr_list[i] = *ip; + i++; + } + + /* check /etc/hosts.canna */ + if( (fp = fopen( ACCESS_FILE, "r" )) != (FILE *)NULL ) + { + while( fgets( (char *)buf, BUFSIZE, fp ) != (char *)NULL ) + { + buf[ strlen( (char *)buf )-1 ] = '\0' ; + wp = buf ; + if( !strtok( (char *)wp, ":" ) ) + continue ; + + if ((hp = gethostbyname(wp)) != NULL) + { + ip = (int *)(hp->h_addr_list[0]); + if (i < BUFSIZE - 1) + { + addr_list[i] = *ip; + i++; + } else + break; /* 、ウ、ーハセ衄、鬢ハ、、 */ + } + } + } + + addr_list[i] = 0; /* terminate */ + + /* */ + for (i=0; ih_name) + host = strdup(hp->h_name); + else + host = strdup(buf); + break; + } + } + + if (host == NULL) + { + m_netaddr2ascii(addr_in.sin_addr.s_addr, buf); + + m_msg("REFUSE THE CONNECTION REQUEST FROM %s.\n", buf); + close(newfd); + return -1; + } + + /* << /etc/hosts.canna ツミア */ +/* << 、ウ、ウ、゙、ヌ */ + } else { /* 、ウ、ホ・ヨ・・テ・ッ、ャ UNIX・ノ・皈、・ Y.A. */ + host = strdup("UNIX"); + } + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) { + if (client[i].sockfd == -1) { + client[i].sockfd = newfd; + client[i].host = host; + client[i].user[0] = 0; + + m_msg("New client #%d@%s accepted.\n", i, host); + + return 0; + } + } + + m_msg("Too many users. Connection from %s refused.\n", host); + close(newfd); + + if (host != NULL) + free(host); + + return -1; +} + +/* + * canna_socket_check_connection : タワツウ、ャヘュク、ォトエ、ル、 + */ + +static int canna_socket_check_connection() +{ + struct timeval tv; + fd_set set; + int i; + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) { + if (client[i].sockfd != -1) { + FD_ZERO(&set); + FD_SET(client[i].sockfd, &set); + + tv.tv_sec = tv.tv_usec = 0; + + if (select(client[i].sockfd + 1, &set, NULL, NULL, &tv) < 0) + client[i].need_terminate = TRUE; /* main.c 、ヌスェホサス靉、、キ、ニ、筅鬢ヲ */ + } + } + + return 0; +} + +int canna_socket_wait_trigger() +{ + fd_set set; + int i; + int maxfd = 0; + + FD_ZERO(&set); + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) + if (client[i].sockfd != -1) + { + FD_SET(client[i].sockfd, &set); + maxfd = client[i].sockfd > maxfd ? client[i].sockfd : maxfd; + } + if (canna_unixfd != -1) FD_SET(canna_unixfd, &set); + if (canna_inetfd != -1) FD_SET(canna_inetfd, &set); + if (canna_unixfd > maxfd) maxfd = canna_unixfd; + if (canna_inetfd > maxfd) maxfd = canna_inetfd; + + if (select(maxfd + 1, &set, NULL, NULL, NULL) < 0) + { + if (errno == EBADF) + canna_socket_check_connection(); + return -1; + } + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) + if (client[i].sockfd != -1) + if (FD_ISSET(client[i].sockfd, &set)) + client[i].data_received = 1; + + if (canna_unixfd != -1 && FD_ISSET(canna_unixfd, &set)) + canna_socket_accept_new_connection(canna_unixfd); + + if (canna_inetfd != -1 && FD_ISSET(canna_inetfd, &set)) + canna_socket_accept_new_connection(canna_inetfd); + + return 0; +} diff --git a/cannasocket.h b/cannasocket.h new file mode 100755 index 0000000..76e15ad --- /dev/null +++ b/cannasocket.h @@ -0,0 +1,26 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __cannasocket_h__ +#define __cannasocket_h__ + +int canna_socket_open(int *ufd, int *ifd); +int canna_socket_close(); +int canna_socket_wait_trigger(); + +#endif diff --git a/configure b/configure new file mode 100755 index 0000000..22f9421 --- /dev/null +++ b/configure @@ -0,0 +1,2491 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --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 +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=cannaproto.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +am__api_version="1.4" +# 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 +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:558: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:611: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +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" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:668: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=canna2imm32 + +VERSION=1.0.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:714: checking for working aclocal-${am__api_version}" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal-${am__api_version} + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:727: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 +echo "configure:740: checking for working automake-${am__api_version}" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-${am__api_version} + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake-${am__api_version}" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:753: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:766: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + +cat >> confdefs.h <> confdefs.h <<\EOF +#define DLLPATH "@libdir@/esecanna" +EOF + +cat >> confdefs.h <<\EOF +#define PIDPATH "/var/run" +EOF + +cat >> confdefs.h <<\EOF +#define LOGPATH "/var/log" +EOF + + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:801: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:833: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 844 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:875: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:880: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:908: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&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 + +for ac_prog in mawk gawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:944: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:976: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1006: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_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 $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1057: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1089: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1100 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1131: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1136: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1164: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1196: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# 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 +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1287: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1340: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1361: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1390: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6 +echo "configure:1419: checking for main in -lgdi32" >&5 +ac_lib_var=`echo gdi32'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgdi32 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo gdi32 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for main in -liconv""... $ac_c" 1>&6 +echo "configure:1462: checking for main in -liconv" >&5 +ac_lib_var=`echo iconv'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-liconv $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo iconv | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for main in -limm32""... $ac_c" 1>&6 +echo "configure:1505: checking for main in -limm32" >&5 +ac_lib_var=`echo imm32'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-limm32 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo imm32 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1549: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1653: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(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; } +EOF +if { (eval echo configure:1674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +for ac_hdr in fcntl.h sys/ioctl.h sys/time.h unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1698: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1736: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1811: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1844: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1877: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1891: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:1912: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:1925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:1946: checking for uid_t in sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes +else + rm -rf conftest* + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF +#define uid_t int +EOF + + cat >> confdefs.h <<\EOF +#define gid_t int +EOF + +fi + + +echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 +echo "configure:1981: checking for 8-bit clean memcmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_clean=no +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_memcmp_clean=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_memcmp_clean=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:2017: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:2039: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2058: checking for vprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +echo "configure:2110: checking for _doprnt" >&5 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +for ac_func in gethostname mkdir select socket strdup strstr +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2165: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CXX@%$CXX%g +s%@AWK@%$AWK%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@LN_S@%$LN_S%g +s%@RANLIB@%$RANLIB%g +s%@LIBOBJS@%$LIBOBJS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/configure.in b/configure.in new file mode 100755 index 0000000..482325f --- /dev/null +++ b/configure.in @@ -0,0 +1,47 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(cannaproto.c) + +AM_INIT_AUTOMAKE(canna2imm32, 1.0.0) +AC_DEFINE_UNQUOTED(RCPATH, "@sysconfdir@") +AC_DEFINE(DLLPATH, "@libdir@/esecanna") +AC_DEFINE(PIDPATH, "/var/run") +AC_DEFINE(LOGPATH, "/var/log") + +dnl Checks for programs. +AC_PROG_CXX +AC_PROG_AWK +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_RANLIB + +dnl Checks for libraries. +dnl Replace `main' with a function in -lgdi32: +AC_CHECK_LIB(gdi32, main) +dnl Replace `main' with a function in -liconv: +AC_CHECK_LIB(iconv, main) +dnl Replace `main' with a function in -limm32: +AC_CHECK_LIB(imm32, main) + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM +AC_TYPE_UID_T + +dnl Checks for library functions. +AC_FUNC_MEMCMP +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS(gethostname mkdir select socket strdup strstr) + +AC_OUTPUT(Makefile) diff --git a/constdef.h b/constdef.h new file mode 100755 index 0000000..3493cbb --- /dev/null +++ b/constdef.h @@ -0,0 +1,45 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __const_def__ +#define __const_def__ + +#define ESECANNA_VERSION "Canna2IMM32 1.0.0" +#define CANNA_UNIX_DOMAIN_DIR "/tmp/.iroha_unix" +#define CANNA_UNIX_DOMAIN_PATH "/tmp/.iroha_unix/IROHA" +#define CANNA_SERVICE_NAME "canna" +#define CANNA_DEFAULT_PORT 5680 + +#define ESECANNA_PID_PATH PIDPATH "/canna2imm32.pid" +#define ESECANNA_LOG_PATH LOGPATH "/canna2imm32.log" +#define ESECANNA_RC_PATH RCPATH "/canna2imm32rc" + +#define ESECANNA_DL_PATH DLLPATH + +#define MAX_CLIENT_NUM 16 +#define USER_CLIENT 3 +#define IMM32_ROOT_CLIENT 0 + +#ifndef TRUE + +#define TRUE 1 +#define FALSE 0 + +#endif + +#endif diff --git a/def.h b/def.h new file mode 100755 index 0000000..96a4b7f --- /dev/null +++ b/def.h @@ -0,0 +1,77 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __def_h__ +#define __def_h__ + +#ifndef __const_def__ +#include "constdef.h" +#endif + +#include + +#ifndef __uchar_t__ +#define __uchar_t__ +typedef unsigned char uchar; +#endif + + +typedef struct { + int sockfd; + + int ime; + + char user[10]; /* ・譯シ・カ。シフセ */ + char *host; /* ・ロ・ケ・ネフセ */ + char *homedir; /* ・ロ。シ・爭ヌ・」・・ッ・ネ・熙ホ・ム・ケ */ + + /* IME 、ヒクヌヘュ、ホ・ヌ。シ・ソ、 malloc 、キ、ニハンサ */ + union { + struct _winimm_t *winimm; + } data; + + int data_received:1; /* ・ス・ア・テ・ネ、ォ、鬣ヌ。シ・ソ、シソョ、キ、ソ。ゥ */ + int need_terminate:1; /* main.c 、ヌスェホサス靉、、ケ、ノャヘラ、「、遙ゥ */ + +} client_t; + +#define IME_NON 0 +#define IME_START 1 +#define IME_IMM32 1 +#define IME_END 1 + +typedef struct { + unsigned char type; + unsigned char extra; + unsigned short datalen; + union { + unsigned short e16; + unsigned char e8; + } err; +} cannaheader_t; + +#ifndef WORDS_BIGENDIAN +#define LSBMSB16(_s) ((((_s) >> 8) & 0xff) | (((_s) & 0xff) << 8)) +#define LSBMSB32(_s) ((((_s) >> 24) & 0xff) | (((_s) & 0xff) << 24) | \ + (((_s) >> 8) & 0xff00) | (((_s) & 0xff00) << 8)) +#else +#define LSBMSB16(_s) (_s) +#define LSBMSB32(_s) (_s) +#endif + +#endif diff --git a/esecanna_orig/4DEVELOPERS.jp b/esecanna_orig/4DEVELOPERS.jp new file mode 100755 index 0000000..73c30fd --- /dev/null +++ b/esecanna_orig/4DEVELOPERS.jp @@ -0,0 +1,123 @@ + + ________ 、ィ、サ、ォ、、ハ ________ + VJE-Delta ネヌ + + ----< esecanna-vje_DR-0.10.0 >---- + +」ア) HOW TO COMPILE + +make 、シツケヤ、キ、ニ、ッ、タ、オ、、。」エータョネヌ、ヌ、マ autoconf 、ハ、ノ、サネ、ェ、ヲ、ネサラ、テ、ニ、、、゙、ケ。」 + +」イ) HOW TO INSTALL + +make install 、マサネ、、ハ、、、ヌ、ッ、タ、オ、、。」・ウ・・ム・、・、キ、ソ・ヌ・」・・ッ・ネ・熙ヌシツケヤ、キ、ニ、ッ、タ、オ +、、。」 +% cp esecannarc ~/.esecannarc +、シツケヤ、キ、ニ。「・ロ。シ・爭ヌ・」・・ッ・ネ・熙ヒ。「、ィ、サ、ォ、、ハタ゚ト・ユ・。・、・、・ウ・ヤ。シ、キ、ニ、ッ、タ、オ、、。」 +、ス、キ、ニ。「OptDic1 。チ OptDic8。「MainDic。「UserDic 、ホケ猯ワ、ナャオケハヤスク、キ、ニ、ッ、タ、オ、、。」 +# cp esecannarc /etc/esecannarc +、シツケヤ、キ、ニ。「チケ鄲゚ト・ユ・。・、・、・ウ・ヤ。シ、キ、ニ、ッ、タ、オ、、。」 + +」ウ) HOW TO EXECUTE + +、゙、コ。「、ウ、、マウォネッネヌ・・遙シ・ケ、ネ、、、ヲ、ウ、ネ、ニャ、ヒニ、、ニ、ェ、、、ニ、ッ、タ、オ、、。」・ラ・・ー・鬣爨ヒ +、ソ、ッ、オ、 printf 、ャヒ荀盪、゙、、ニ、、、、ソ、癸「シツケヤ、ケ、、ネ。「・皈テ・サ。シ・ク、ツ醫フ、ヒナヌ、ュ、゙ +、ケ。」、ヌ、筍「スミホマ、・・タ・、・・ッ・ネ、キ、ニ /dev/null 、ヒチ、テ、ソ、熙マ、キ、ハ、、、ヌ、ッ、タ、オ、、。」、 +、キ。「、「、ハ、ソ、ャ・ミ・ー、ヒスミ、ッ、、キ、ソ、ミ、「、、。「スミホマ、オ、、ソ・皈テ・サ。シ・ク、ャ・ミ・ーイキ隍ホシ熙ャ、ォ、 +、ヒ、ハ、、ォ、鬢ヌ、ケ。」 +・・遙シ・ケ・エ。シ・、マ・ウ・・ス。シ・、ォ、鬢ヌ、篏ネ、ィ、、ウ、ネ、ヌ、ケ、ャ。「セ蠏ュ、ホヘヘウ、ヒ、隍遙「クスコ゚、マ +kterm セ螟ヌシツケヤ、キ、ニ、ッ、タ、オ、、。」 + +・ウ・・ム・、・、キ、ソ・ヌ・」・・ッ・ネ・熙ヌ。「 + + % ./esecannaserver -d + +、シツケヤ、キ、ニ、ッ、タ、オ、、。」、筅キ。「 + +v vjelibopen failed + +、ホ・皈テ・サ。シ・ク、スミ、キ、ニ。「スェホサ、キ、ニ、キ、゙、テ、ソセケ遑「、゙、コ。「 + + % vje + +、シツケヤ、キ、ソ、ホ、チ、ヒ。「(、ト、゙、遙「ーナル vje 、シツケヤ、キ、ソ、ホ、チ、ヒ) + + % ./esecannaserver -d + +、シツケヤ、キ、ニ、゚、ニ、ッ、タ、オ、、。」 +、゙、ソ。「、、、゙、゙、ヌ、ヒーナル、 vje 、サネ、テ、ソ、ウ、ネ、ャフオ、、セケ遉筍「vje 、ーナルシツケヤ、キ、ニイシ、オ、、。」 +テ狆。シォニーハムエケ、マ。「Emacs 、ヌ。「M-x canna-extend-mode 、ォ。「ESC [ 2 8 ~ 5 1 2 、ヌ。「 +タ゚ト熙キ、ニ、ッ、タ、オ、、。」 + +」エ) Known Bugs + + 。 vjed 、シツケヤ、キ、ソ、「、ネ。「vje.tgz 、ヒノユツー、ホ vje 、ーナルシツケヤ、キ、ハ、、、ネ + vjelibopen 、ヒシコヌヤ、ケ、。」、ウ、、マ vje 、ホ・ス。シ・ケ(delta.tgz 、ホ /newFrontend) + 、シォホマ・ウ・・ム・、・、キ、ソセケ遉簇アヘヘ。」。ン。 、ウ、、マツホクウネヌ、タ、ア、ホヘヘ、タ。」 + + 。 vjed 、ャヘ、チ、ニ、キ、゙、テ、ソセケ遉ホス靉、ャフオ、、、ソ、癸「・ッ・鬣、・「・・ネ、ャクヌ、゙、。」 + + 。 、ウ、、マ、ノ、ヲ、荀 VJE 、ホサナヘヘ、ホ、隍ヲ、ハ、ホ、タ、ャ。「ハクタ皃カ霏レ、トセ、キ、ソ、ネ、ュ。「 + kakutei1 、ホフ皃テヘ key_buf 、ャ・フ・・ケ・ネ・・・ー、ヒ、ハ、。」ノ眛フ、ヒハムエケ、キ、ニウホト熙キ、ソ + セケ遉マ。「ウホト熙キ、ソニ簣ニ、ャ、マ、、、、、タ、ア、ノ、ヘ。」 + + 。 cannastat 、キ、ソ、ネ、ュ、ヒ。「Broken Pipe 、ャオッ、ウ、、ウ、ネ、ャ、「、。」 + Thanx! > ソケナト。オツ 、オ、。」 + + 。 テ狆。ハムエケ、ヌ。「。ヨ、「、、、ヲ、ィ、ェ、ォ、ュ、ッ、ア、ウ....、荀讀隍鬢熙、、。ラ、ニホマ、キ、ニ、、、ッ、ネ + 。ヨ、。ラ、ニホマ、ケ、、ネニアサ、ヒクハ荀ャハム、ヒ、ハ、。」、ウ、、テ、ニ libcanna 、ホ・ミ・ー、チ、网ヲ。ゥ + +」オ) 、ス、ホツセ + + 。 ニーコ・チ・ァ・テ・ッ、マ。「、ワ、ッ、マ。「 Emacs 20.3.2 、ヌ、キ、ォ、荀テ、ニ、゙、サ、。」 + 。 Penguin Kun 、オ、、ヒ。「nvi。「canuum。「nicolatter(・。シ・゙サハムエケ、ホ、゚)。「kinput2 、ヌ + 、ホニーコウホヌァ、、キ、ニ、筅鬢、、゙、キ、ソ。」 + Thanx! > Penguin Kun 、オ、。」 + 。 VJE イ、熙ホ・ウ。シ・ノ、マ。「vje 、ホ・ス。シ・ケ、サイケヘ、ヒ、キ、゙、キ、ソ、ャ。「チエ、ニ・ケ・ッ・鬣テ・チ、ォ、 + ス、、、ニ、、、゙、ケ。」 + + 。 ・ミ・ー・・ン。シ・ネ、ヒ、マ。「./esecannaserver 、ャナヌ、、、ソ・皈テ・サ。シ・ク。「ニホマ、キ、ソニノ、゚。「サネ + ヘム、キ、ニ、、、ソ・ッ・鬣、・「・・ネ、ネ、ス、ホ・ミ。シ・ク・逾、ハ、ノ、ホセハ、ノャ、コス、、、ニ、ッ、タ、オ、、。」 + +」カ) ・ユ・。・、・、ホタ篶タ、ハ、ノ + + ++---------------+ +--------+ +-------------+ +| cannasocket.c | <-> | main.c | ----++ +--> | vjesocket.c | ++---------------+ +--------+ || | +-------------+ + || || | + \/ || | + +--------------+ || | + | cannaproto.c | || | + +--------------+ || | + || || | + \/ \/ | + +---------------------------+ | + | imewrapper.c |--+ + +---------------------------+ + || + \/ + +--------------+ + | vjewrapper.c | + +--------------+ + || + \/ + +------------+ + | vjeproto.c | + +------------+ + +* main.c ウニス魘イス・。シ・チ・、クニ、モスミ、キ。「・。シ・ラ、ヒニ、。」、ォ、、ハ、ホ・ム・ア・テ・ネ、 + シ、ア、、ネ。「cannaproto.c 、クニ、ヨ。」 +* cannasocket.c 、ォ、、ハ、ホ・ス・ア・テ・ネ、タクタョ、ケ、。」・ス・ア・テ・ネ、エニサ、キニホマ、ツヤ、ト。」 +* cannaproto.c 、ォ、、ハ・ラ・・ネ・ウ・、 send。「receive 、ケ、。」receive 、キ、ソヘラオ皈ム・ア・テ + ・ネ、ヒア、ク、ニ imewrapper_* 、クニ、モスミ、ケ。」 +* imewrapper.c IME クヌヘュ、ホス靉、ヒエリキク、ケ、。」 +* vjewrapper.c 、ォ、、ハ・ラ・・ネ・ウ・、イシ皃キ。「VJE・ラ・・ネ・ウ・、ナャタレ、ヒクニ、ヨ。」、゙、ソ。「 + vjed 、ォ、鬢ホハヨナ・ム・ア・テ・ネ、イシ皃キ。「、ォ、、ハ、ホハヨナ・ム・ア・テ・ネ、タクタョ、ケ + 、。」 +* vjeproto.c VJE・ラ・・ネ・ウ・、 send。「receive 、ケ、。」 +* vjesocket.c vjed 、ネ、ホタワツウ、ウホホゥ、ケ、。」 +* misc.c 、、、、、、、ハエリソ。」 + + + diff --git a/esecanna_orig/CHANGES.jp b/esecanna_orig/CHANGES.jp new file mode 100755 index 0000000..593843d --- /dev/null +++ b/esecanna_orig/CHANGES.jp @@ -0,0 +1,73 @@ +16 Sep 2000 esecanna_1.0.1 released. + + * CREDITS 、トノイテ、キ、ソ。」 + +09 Sep 2000 esecanna_1.0.0 released. + + * ・ェ・ユ・」・キ・罕・・遙シ・ケ + * misc.c: BIGENDIAN 、ハ・゙・キ・、ヌ IP・「・ノ・・ケ、ャタオ、キ、ッノスシィ、オ、、ハ、、・ミ・ー、 + ス、タオ。」 + フク。カ蠶 、オ、、ヒ・ム・テ・チ、トコ、ュ、゙、キ、ソ。」 + Thanx! > フク。カ蠶遉オ、。」 + * esecannarc: コル、ォ、、ス、タオ。」 + +14 Aug 2000 esecanna_0.99.3 released. + + * cannasocket.c: select() 、ヒナマ、ケ maxfd 、ャコヌツ酖ヘ、ヌ、マ、ハ、、イトヌスタュ、ャ、「、 + ・ミ・ー、ス、タオ。」 + +05 Jul 2000 esecanna_0.99.2 released. + + * ・ミ・、・ネ・ェ。シ・タ。シ、ホー网、、オロシ、ケ、ス、タオ。」 + cannawc2euc(), euc2cannawc(), LSBMSB16/32 、ヒシ熙ニ、、ソ。」 + * vasprintf() 、ャ、ハ、、セケ遉ホ ad-hoc 、ハス、タオ。」 + * m_daemonize() 、ス、タオ。」 + * タ・クヘ。・「・・ユ・。・キ・ケ・ニ・爭コ 、オ、、ヒ・ム・テ・チ、、、、ソ、タ、ュ、゙、キ、ソ。」 + Thanx! > タ・クヘ。・「・・ユ・。・キ・ケ・ニ・爭コ 、オ、。」 + +04 Apr 2000 esecanna_0.99.1 released. + + * misc.c: romatbl, glyph 、 static 、ヒ、キ。「vje30.so, vje25.so 、ャ・。シ・ノ + 、ヌ、ュ、ハ、、・ミ・ー、ス、タオ。」 + +28 Mar 2000 esecanna_0.99.0 released. + + * ・ラ・・ェ・ユ・」・キ・罕・・遙シ・ケ + * atok.so 、 dlopen 、ヌ、ュ、、隍ヲ、ヒス、タオ。」 + * ・筵ク・蝪シ・、ャ・。シ・ノ、オ、、ソ、ネ、ュ。「Debug mode 、ォ、ノ、ヲ、ォ、ナマ、ケ、隍ヲ、ヒ、キ、ソ。」 + +09 Mar 2000 esecanna_0.14.2 released. + + * cannasocket.c: gethostbyname() 、ヌ NULL 、ャハヨ、セケ遑「SEG Fault 、オッ、ウ + 、ケ・ミ・ー、ス、タオ。」 + Thanx! > サーハソ、オ、。」 + +08 Mar 2000 esecanna_0.14.1 released. + + * Makefile.am 、ヒ AUTOMAKE_OPTIONS 、トノイテ、キ。「automake 、シツケヤ、キ、ソ、ネ、ュ、ヒ + ・ィ・鬘シ、ャスミ、、ホ、ス、タオ、キ、ソ。」 + * mkinstalldirs 、ネ missing 、トノイテ、キ、ソ。」 + +06 Mar 2000 esecanna_0.14.0 released. + + * autoconf イス。」 + * libesecanna.so 、、ハ、ッ、キ、ソ。」 + +25 Feb 2000 esecanna_0.13.0 released. + + * wnn6.so 、ネニアエ。」 + * esecannarc 、ヒ WNN6 、ホタ゚ト熙トノイテ。」 + * Plugins: 、ノスシィ、ケ、、ネ、ュ、ヒ・ミ・ー、ャ、「、テ、ソ、ホ、トセ、キ、ソ。」 + Thanx! > ソケナト、オ、。「、゚、ハ、゚、ィ、オ、。「knu 、オ、。」 + * rcVer 、、ハ、ッ、キ、ソ。」 + +22 Feb 2000 esecanna_0.12.0 released. + + * vje30.so 、ネニアエ。」 + * esecannarc 、ヒ VJE30 、ホタ゚ト熙トノイテ。」 + +21 Feb 2000 esecanna_0.11.0 released. + + * ・タ・、・ハ・゚・テ・ッ・筵ク・蝪シ・、ヒーワケヤ、キ、ソ。」 + * コニオッニーオ。ヌス、ーサ disable 、キ、ソ。」 + diff --git a/esecanna_orig/CREDITS b/esecanna_orig/CREDITS new file mode 100755 index 0000000..4f40804 --- /dev/null +++ b/esecanna_orig/CREDITS @@ -0,0 +1,16 @@ +、ィ、サ、ォ、、ハウォネッ、ヒカィホマ、キ、ニ、ッ、タ、オ、テ、ソハ。ケ、ホ、ェフセチー、ヌ、ケ。」 +ヒワナ、ヒ、ノ、ヲ、筅「、熙ャ、ネ、ヲ、エ、カ、、、゙、キ、ソ。」 + +Yusuke NOGUCHI +Hideaki Seto +Akio Morita +HONDA Yasuhiro +Norimasa Matsumoto +Penguin Kun +Yukiko Minamie +Akinori -Aki- MUSHA + +ーハセ蝪「キノセハホャ。「ス酲ヤニア、ヌ、ケ。」 + + + diff --git a/esecanna_orig/INSTALL.jp b/esecanna_orig/INSTALL.jp new file mode 100755 index 0000000..d7d90b2 --- /dev/null +++ b/esecanna_orig/INSTALL.jp @@ -0,0 +1,39 @@ + + -------- 、ィ、サ、ォ、、ハ -------- + + ----< esecanna_1.0.0 >---- + +、゙、コ。「、ィ、サ、ォ、、ハヒワツホ (esecanna_x.y.z) 、ホ・ウ・・ム・、・、ネ・、・・ケ・ネ。シ・、ケヤ、、。「シ。、ヒ +・筵ク・蝪シ・、ホ・ウ・・ム・、・、ネ・、・・ケ・ネ。シ・、ケヤ、、ハ、ア、、ミ、ハ、熙゙、サ、。」 + +1) タ゚ト + +% ./configure [args...] + +、シツケヤ、キ、゙、ケ。」スナヘラ、ハーソ、ヒシ。、ホ、筅ホ、ャ、「、熙゙、ケ。」 + +--prefix=DIR ・ヌ・ユ・ゥ・・ネ、ヌ、マ /usr/local 、ヌ、ケ。」 +--sysconfdir=DIR esecannarc 、・、・・ケ・ネ。シ・、ケ、セス熙サリト熙キ、゙、ケ。」 + ・ヌ・ユ・ゥ・・ネ、ヌ、マ PREFIX/etc 、ヌ、ケ。」 +--with-dlldir=DIR ・タ・、・ハ・゚・テ・ッ・筵ク・蝪シ・、・、・・ケ・ネ。シ・、ケ、セス熙サリト熙キ、゙ + 、ケ。」・ヌ・ユ・ゥ・・ネ、ヌ、マ PREFIX/lib/esecanna 、ヌ、ケ。」 +--with-piddir=DIR PID 、オュマソ、キ、ソ・ユ・。・、・、テヨ、ッセス熙サリト熙キ、゙、ケ。」・ヌ・ユ・ゥ・ + ・ネ、ヌ、マ /var/run 、ヌ、ケ。」 +--with-logdir=DIR ・・ー・ユ・。・、・、スミホマ、ケ、セス熙サリト熙キ、゙、ケ。」・ヌ・ユ・ゥ・・ネ、ヌ、マ + /var/log 、ヌ、ケ。」 + +、゙、ソ。「ノャヘラ、ハ、鬢ミ。「constdef.h 、ナャナ、ヒハムケケ、キ、ニイシ、オ、、。」 + +」イ) ・ウ・・ム・、・ + +% make + +、シツケヤ、キ、ニ、ッ、タ、オ、、。」タオセ、ヒスェホサ、キ、ソ、 + +# make install + +、シツケヤ、キ、ニ、ッ、タ、オ、、。」、ウ、、ヌ、ィ、サ、ォ、、ハヒワツホ、ホ・ウ・・ム・、・、ネ・、・・ケ・ネ。シ・、マスェホサ、ヌ、ケ。」 +、ウ、ホ、「、ネ。「ウニ・筵ク・蝪シ・、ホ・ウ・・ム・、・、ネ・、・・ケ・ネ。シ・、、キ、ニ、ッ、タ、オ、、。」セワ、キ、ッ、マウニ +・筵ク・蝪シ・、ホ INSTALL.jp 、クォ、ニ、ッ、タ、オ、、。」 + + diff --git a/esecanna_orig/README.First.jp b/esecanna_orig/README.First.jp new file mode 100755 index 0000000..0e35f70 --- /dev/null +++ b/esecanna_orig/README.First.jp @@ -0,0 +1,45 @@ + + -------- 、ィ、サ、ォ、、ハ -------- + + - ---< esecanna_1.0.0 >---- + + 、ウ、、マ。「。ヨ、ィ、サ、ォ、、ハ。ラ、ホ Official Release 1.0。「・ム・テ・チ・・ル・ 0 、ホ +・ノ・ュ・螂皈・ネ、ヌ、ケ。」 + Mule 2.3 + esecannaserver 、ヒ、隍ス、、、ニ、、、゙、ケ。」 + +」ア) 、ィ、サ、ォ、、ハ、ホウォネッニーオ。 + + VJE-Delta 、 ATOK12 、マヘ・、、ソ、ォ、ハエチサハムエケ・キ・ケ・ニ・爨ヌ、ケ。」、キ、ォ、キ。「、ス、ホニホマ・皈ス・テ +・ノ、ヒ。「XIM 、キ、ォ、「、熙゙、サ、、ヌ、キ、ソ。」XIM 、マ X Window System 、ヌ、キ、ォサネ、ィ、ハ、、、ソ、癸「・ウ +・・ス。シ・、ヌ、ホサネヘム、マノヤイトヌス、ヌ、「、遙「GNU Emacs (XEmacs 、ヌ、マ、ハ、、)。「Mule 、ヌ、ホサネヘム、マコ、 +ニ、ヌ、キ、ソ。」、ウ、、マネセ、ヒノヤハリ、ハ、ウ、ネ、ヌ、ケ。」、ウ、ホセカキ、ツヌヌヒ、ケ、、ソ、皃ヒ。「、ィ、サ、ォ、、ハ、ウォ +ネッ、キ、゙、キ、ソ。」 + +」イ) 、ィ、サ、ォ、、ハ、ホニーコ + + 、ィ、サ、ォ、、ハ、マノスフフセ螟マ cannaserver 、ネ、キ、ニクォ、ィ、゙、ケ。」UNIX ・ノ・皈、・、ヌ、筍「INET ・ノ・ +・、・、ヌ、簑ワツウ、ヌ、ュ、゙、ケ。」スセ、テ、ニ・ッ・鬣、・「・・ネツヲ、ヌ、マ、ィ、サ、ォ、、ハ、ヒタワツウ、ケ、、ホ、ヒ。「ニテハフソキ +、ソ、ヒ・ウ。シ・ノ、ス、ッノャヘラ、マ、ハ、ッ。「スセヘ霪フ、ノ眛フ、ヒ cannaserver 、ヒタワツウ、ケ、・ウ。シ・ノ、ヌホノ、、 +、ホ、ヌ、ケ。」、ィ、サ、ォ、、ハ、ャ、ォ、ハエチサハムエケ、ホヘラオ皃シ、ア、、ネ。「ニ篷、ヌウニ、ォ、ハエチサハムエケ・オ。シ・ミ。シ +、ヒハムエケヘラオ皃、タ、キ。「、ス、ホキイフ、ハヨ、キ、゙、ケ。」 + +」ウ) 、ィ、サ、ォ、、ハ、ホヘナタ + + クスコ゚。「ス鬢皃ニ UNIX 、ヒソィ、、ソヘ、ャコヌス鬢ヒサネ、ヲ、ォ、ハエチサハムエケ・キ・ケ・ニ・爨ネ、キ、ニ。「、ォ、、ハ、ャ +ケュ、ッサネ、、、ニ、、、゙、ケ。」、ォ、、ハ、マ。「、ノ、ホ・ッ・鬣、・「・・ネ、ヌ、簇ア、ク・、・・ソ。シ・ユ・ァ。シ・ケ、トカ。、ケ +、、ネ、、、ヲ。「、ケ、ミ、鬢キ、、トケス熙ャ、「、熙゙、ケ。」、゙、ソ。「、ス、ホ・ュ。シ・ミ・、・・ノ、マトセエカナェ、ヌハャ、ォ、熙荀ケ +、ッ。「、゙、ソ UNIX ナェ、ヌ、ケ。」スセ、テ、ニ、ォ、、ハ、ホ・ュ。シ・ミ・、・・ノ、ヒエキ、、ニ、キ、゙、、。「ツセ、ホ、ォ、ハエチサニ +ホマエトカュ、シ、アノユ、ア、ハ、、ソヘ、篦ソ、、、ホ、ヌ、マ、ハ、、、ヌ、キ、遉ヲ、ォ。」、ィ、サ、ォ、、ハ、篷スフフセ螟マ、ォ、、ハ、ネ +ニア、ク、ハ、ホ、ヌ。「、ォ、、ハ、ホヘ・、、ソ・、・・ソ。シ・ユ・ァ。シ・ケ、ヌニホマ、キ。「、ハ、ェ、ォ、トセヲヘム、ォ、ハエチサハムエケ・オ +。シ・ミ。シ、ホヘ・、、ソハムエケタュヌス、シ、ア、、ウ、ネ、ャスミヘ隍、、ア、ヌ、ケ。」 + +」エ) ク「ヘ + + テコク「、マ ノ フケタ 、ヒツー、キ、゙、ケ。」 + GNU General Public License Version 2 、ホ、筅ネ、ヌ。「シォヘウ、ヒヘヘム。「ス、タオ。「コニヌロノロ、ケ、、ウ +、ネ、ャ、ヌ、ュ、゙、ケ。」 + +」オ) 、ス、ホツセ + + 、ィ、サ、ォ、、ハ、ホ・、・・ケ・ネ。シ・、ヒ、ト、、、ニ、マ INSTALL.jp 、。「セワ、キ、、サネヘムヒ。、ヒ、ト、、、ニ、マ +README.jp 、ニノ、、ヌ、ッ、タ、オ、、。」 diff --git a/esecanna_orig/README.jp b/esecanna_orig/README.jp new file mode 100755 index 0000000..c22f521 --- /dev/null +++ b/esecanna_orig/README.jp @@ -0,0 +1,54 @@ + + -------- 、ィ、サ、ォ、、ハ -------- + + ----< esecanna_1.0.0 >---- + +」ア) 、ィ、サ、ォ、、ハ、ホタ゚ト + +/etc/esecannarc 、マ、ィ、サ、ォ、、ハ、ホ・ヌ・ユ・ゥ・・ネ、ホニーコ、ト熙皃゙、ケ。」スナヘラ、ハ、ホ、マ + IME=xxxx +、ネス、、、ニ、「、ケヤ、ヌ、ケ。」、ウ、ホケヤ、ヌ、マ。「、ィ、サ、ォ、、ハ、ャ・ヌ・ユ・ゥ・・ネ、ヌタワツウ、サ、゚、、ォ、ハエチサハム +エケ・オ。シ・ミ。シ、サリト熙キ、゙、ケ。」、ォ、ハエチサハムエケ・オ。シ・ミ。シ、ネ。「xxxx 、ホツミア、マシ。、ホトフ、熙ヌ、ケ。」 + + ハムエケ・オ。シ・ミ。シ xxxx 、ヒサリト熙ケ、ハクサホ + + VJE-Delta 2.5 VJE25 + VJE-Delta 3.0 VJE30 + Wnn6 WNN6 + ATOK12 ATOK + +シ。、ヒ・譯シ・カ。シ、エ、ネ、ホタ゚ト熙ヌ、ケ。」・譯シ・カ。シ、エ、ネ、ホタ゚ト熙マ。「、ス、ホ・譯シ・カ。シ、ホ・ロ。シ・爭ヌ・」・・ッ +・ネ・熙ホ .esecannarc 、ネ、、、ヲ・ユ・。・、・、ヌサリト熙キ、゙、ケ。」、筅キ、ハ、ア、、ミ。「/etc/esecannarc +、・ウ・ヤ。シ、キ、ニ、ッ、タ、オ、、。」、ウ、ホ・ユ・。・、・、ホ + IME=xxxx +、ネ、、、ヲケヤ、マ。「、ス、ホ・譯シ・カ。シ、ャタワツウ、ケ、ハムエケ・オ。シ・ミ。シ、ト熙皃゙、ケ。」タ゚トハヒ。、マ +/etc/esecannarc 、ホセケ遉ネニア、ク、ヌ、ケ。」 + ツセ、ヒ、 .esecannarc 、ヌ、マソァ。ケ、ネタ゚トイトヌス、ヌ、ケ、ャ。「、ウ、、マウニ・筵ク・蝪シ・、ホ README.jp +、ニノ、、ヌ、ッ、タ、オ、、。」 + +」イ) タ゚ト・ユ・。・、・、ホヘ・タ霓邁フ + + 、筅キ .esecannarc 、ャ、「、セケ遉マ、ス、チ、鬢ヘ・タ隍キ、゙、ケ。」、ハ、、セケ /etc/esecannarc 、 +サネヘム、キ、゙、ケ。」 + +」ウ) ・筵ク・蝪シ・、ヒ、ト、、、ニ + + 、ィ、サ、ォ、、ハ、マ 0.11.0 、ォ、鬣ラ・鬣ー・、・キソシー、ホ・筵ク・蝪シ・、・オ・ン。シ・ネ、キ、゙、キ、ソ。」コ」、゙、ヌ +、マ esecanna-vje30, esecanna-atok 、ホ、隍ヲ、ヒタワツウ、ケ、ハムエケ・オ。シ・ミ。シ、ヒ、隍テ、ニ・ス。シ・ケ。「 +・ミ・、・ハ・熙ャー网、、゙、キ、ソ、ャ。「、ウ、、ォ、鬢マ、ォ、、ハ・オ。シ・ミ。シノハャ、トカ。、ケ、 esecanna 、ネ。「ウニ +ハムエケ・オ。シ・ミ。シ、ネ、ホタワツウノハャ、トカ。、ケ、・筵ク・蝪シ・、ヒハャウ荀オ、、゙、ケ。」 + + ・筵ク・蝪シ・、マ・ウ・・ム・、・サ、ヒ DLLDIR 、ヌサリト熙キ、ソ・ヌ・」・・ッ・ネ・熙ヒ・、・・ケ・ネ。シ・、キ、ニ、ッ +、タ、オ、、。」ニテ、ヒ esecannaserver 、コニオッニー、キ、ソ、熙ケ、ノャヘラ、マ、「、熙゙、サ、。」 + +」エ) ツセ + + オッニーサ、ヒシォニー、ヌホゥ、チセ螟ャ、、隍ヲ、ヒ、キ、ソ、ア、、ミ。「/etc/rc.d/rc.local 、ハ、ノ、ヒ +esecannaserver +、ホーケヤ、イテ、ィ、ニ、ッ、タ、オ、、。」cannaserver 、ネニアサ、ヒサネ、ヲ、ウ、ネ、マスミヘ隍ハ、、、ホ、ヌテーユ、キ、ニ、ッ、タ +、オ、、。」 + + 、ィ、サ、ォ、、ハ、マ /var/log/esecanna.log 、ヒ・・ー、ナヌ、ュ、゙、ケ。」、ウ、ホ・・ー、クォ、ニ。「イソ、ャオッ、ュ +、ニ、、ホ、ォ。「シ熙ャ、ォ、熙ニタ、、ウ、ネ、ャスミヘ隍゙、ケ。」 + + 、ィ、サ、ォ、、ハ、マ /var/run/esecanna.pid 、ヒ PID 、ナヌ、ュ、゙、ケ。」 diff --git a/imewrapper.c b/imewrapper.c new file mode 100755 index 0000000..9caf691 --- /dev/null +++ b/imewrapper.c @@ -0,0 +1,1068 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "def.h" + +#include "misc.h" +#include "winimm.h" + +#define IW_ERROR16(_buf) { \ + cannaheader_t *he; \ + he = (cannaheader_t *)(_buf); \ + he->datalen = LSBMSB16(2); \ + he->err.e16 = LSBMSB16(-1); \ +} + +#define IW_ERROR8(_buf) { \ + cannaheader_t *he; \ + he = (cannaheader_t *)(_buf); \ + he->datalen = LSBMSB16(1); \ + he->err.e8 = -1; \ +} + +typedef int (*imefunc_t)(); + +static char *funcsymbols[] = { + "_finalize", + "_create_context", + "_duplicate_context", + "_close_context", + "_define_word", + "_delete_word", + "_begin_convert", + "_end_convert", + "_get_candidacy_list", + "_get_yomi", + "_subst_yomi", + "_store_yomi", + "_store_range", + "_get_lastyomi", + "_flush_yomi", + "_remove_yomi", + "_get_simplekanji", + "_resize_pause", + "_get_hinshi", + "_get_lex", + "_get_status", + "_set_locale", + "_auto_convert", + "_initialize", + "_init_rootclient", + "_end_client", + "_end_rootclient", + "_clear_client_data" +}; + +/* ・タ・、・ハ・゚・テ・ッ・・・ッ、ヌニタ、エリソ、ネネヨケ讀ネ、ホツミアノユ、ア */ +/* + _finalize 0 + _create_context 1 + _duplicate_context 2 + _close_context 3 + _define_word 4 + _delete_word 5 + _begin_convert 6 + _end_convert 7 + _get_candidacy_list 8 + _get_yomi 9 + _subst_yomi 10 + _store_yomi 11 + _store_range 12 + _get_lastyomi 13 + _flush_yomi 14 + _remove_yomi 15 + _get_simplekanji 16 + _resize_pause 17 + _get_hinshi 18 + _get_lex 19 + _get_status 20 + _set_locale 21 + _auto_convert 22 + _initialize 23 + _init_rootclient 24 + _end_client 25 + _end_rootclient 26 + _clear_client_data 27 + */ + +#define F_initialize 23 +#define F_init_rootclient 24 +#define F_end_client 25 +#define F_end_rootclient 26 +#define F_clear_client_data 27 + +#define F_COMMON_END 27 + +static imefunc_t imm32func[28] = +{ + imm32wrapper_finalize, + imm32wrapper_create_context, + imm32wrapper_duplicate_context, + imm32wrapper_close_context, + imm32wrapper_define_word, + imm32wrapper_delete_word, + imm32wrapper_begin_convert, + imm32wrapper_end_convert, + imm32wrapper_get_candidacy_list, + imm32wrapper_get_yomi, + imm32wrapper_subst_yomi, + imm32wrapper_store_yomi, + imm32wrapper_store_range, + imm32wrapper_get_lastyomi, + imm32wrapper_flush_yomi, + imm32wrapper_remove_yomi, + imm32wrapper_get_simplekanji, + imm32wrapper_resize_pause, + imm32wrapper_get_hinshi, + imm32wrapper_get_lex, + imm32wrapper_get_status, + imm32wrapper_set_locale, + imm32wrapper_auto_convert, + imm32wrapper_initialize, + imm32wrapper_init_rootclient, + imm32wrapper_end_client, + imm32wrapper_end_rootclient, + imm32wrapper_clear_client_data +}; + +static imefunc_t *imefunc[IME_END] = {imm32func}; +static char ime_connected_flag[IME_END]; +static void *ime_dl_handler[IME_END]; + +extern char *protocol_name[], *e_protocol_name[]; +extern client_t client[]; + +extern HWND hWnd_IMM; /* 、ォ、ハエチニーコヘム、ホ・ヲ・」・・ノ・ヲ */ + +/* + * ・ウ・・ユ・」・ョ・螂。シ・キ・逾・ユ・。・、・、ニノ、゚。「、ノ、チ、鬢ホ IME 、ヒタワツウ、ケ、、ォハヨ、ケ + */ + +static char *iw_get_conf_file_path(char *home) +{ + char *path = NULL; + + if (strlen(home) != 0) + { + if ((path = m_makepath(home, ".canna2imm32rc")) == NULL) + { + m_msg("out of memory!\n"); + return NULL; + } + + if (access(path, R_OK) == 0) + { + m_msg("Config file %s\n", path); + return path; + } + } + + /* home 、ヒ .canna2imm32rc 、ャフオ、、、ネ、ュ、マ /etc/canna2imm32rc 、テオ、ケ */ + MYFREE(path); + if ((path = strdup(ESECANNA_RC_PATH)) == NULL) + { + m_msg("out of memory!\n"); + return NULL; + } + + if (access(path, R_OK)) + { + m_msg("No %s found.\n", path); + return NULL; + } + + m_msg("Config file %s\n", path); + return path; +} + +static int iw_read_conf_file(char *path) +{ + FILE *fp; + char buf[1024]; + char *ope, *val; + int ret = IME_NON; + + if ((fp = fopen(path, "r")) == NULL) { + m_msg("Cannot open Conffile %s.\n", path); + return IME_NON; + } + + while (fgets(buf, 1024, fp)) { + if (buf[0] != '#' && m_conf1_parse(buf, &ope, &val) == 0) { + if (m_conf_isequal(ope, "IME", val, "IMM32") == 2) + ret = IME_IMM32; + if (ret == IME_NON && m_conf_isequal(ope, "IME", val, "dummy")) + m_msg("Unsupported IME: [%s]\n", val); + + if (ret != IME_NON) + break; + } + } + + fclose(fp); + + return ret; +} + +/* + * ・タ・、・ハ・゚・テ・ッ・筵ク・蝪シ・、・。シ・ノ、ケ、 + */ +static int iw_retrieve_imm32_symbols(void *handler) +{ + return imm32wrapper_dl_started(client); +} + +static int iw_load_library(int ime) +{ + iw_retrieve_imm32_symbols(ime_dl_handler[ime - 1]); + m_msg("Use internal Module.\n"); + return 0; +} + +/* + * ・タ・、・ハ・゚・テ・ッ・筵ク・蝪シ・、・「・・。シ・ノ、ケ、 + */ + +static int iw_unload_library(int ime) +{ + return 0; +} + +/* + * ・ッ・鬣、・「・・ネ、ホスェホサス靉、、ケ、 + */ + +int imewrapper_end_client(int id) +{ + int ime = client[id].ime; + + if (ime > 0 && ime_dl_handler[ime - 1]) { + SendMessage(hWnd_IMM, WM_USER + F_end_client, id, 0); + } + + return 0; +} + +/* + * 、「、 IME 、ホスェホサス靉、、ケ、。」 + */ + +int imewrapper_end_rootclient(int ime) +{ + imefunc_t *func; + + if (ime > 0 && ime_dl_handler[ime - 1] != NULL) { + /* ・タ・、・ハ・゚・テ・ッ・筵ク・蝪シ・、ャ・。シ・ノ、オ、、ニ、、、、ホ、ハ、鮨ェホサス靉、、ケ、 */ + SendMessage(hWnd_IMM, WM_USER + F_end_rootclient, 0, 0); + + /* ・筵ク・蝪シ・、ウォハ、ケ、 */ + iw_unload_library(ime); + + /* タワツウ・ユ・鬣ー、・ッ・・「 */ + ime_connected_flag[ime - 1] = FALSE; + } + + return 0; +} + +/* + * client[] 、ホ・ヌ。シ・ソ、・ッ・・「、ケ、エリソ、クニ、ヨ + */ + +int imewrapper_clear_client_data(int id) +{ + int ime = client[id].ime; + + if (ime > 0 && ime_dl_handler[ime - 1]) { + SendMessage(hWnd_IMM, WM_USER + F_clear_client_data, id, 0); + } + + MYFREE(client[id].host); + MYFREE(client[id].homedir); + + client[id].ime = IME_NON; + + memset(&(client[id]), 0, sizeof(client_t)); + + client[id].sockfd = -1; + + return 0; +} + + + +/* + * IME 、ャーロセスェホサ、キ、ソ、ネ、ュ、ホス靉エリキク、ホエリソs + */ + +static int iw_imm32_aborted(int ime) +{ + return -ime; +} + +int imewrapper_ime_aborted(int ime) +{ + switch (ime) { + case IME_IMM32: + return iw_imm32_aborted(ime); + } + + return -1; +} + +/* + * 、ィ、サ、ォ、、ハ、スェホサ、オ、サ、、ソ、皃ホエリソ + */ + +static int iw_send_term_signal() +{ + raise(SIGTERM); + + return 0; +} + +/* + * Windows IMM 、ヒ、゙、タタワツウ、キ、ニ、、、ハ、、セケ遉ヒクニ、ミ、、 + */ + +static int iw_imm32_connect(int ime) +{ + /* ・筵ク・蝪シ・、・。シ・ノ */ + if (iw_load_library(ime) == 0) + { + /* ス魘イス */ + if (SendMessage(hWnd_IMM, WM_USER + F_init_rootclient, 0, 0) == 0) + { + /* Wnn タワツウ & ス魘イス、ヒタョク。」*/ + client[IMM32_ROOT_CLIENT].ime = ime; + ime_connected_flag[ime - 1] = TRUE; + + return 0; + } else { + SendMessage(hWnd_IMM, WM_USER + F_end_rootclient, 0, 0); + } + + iw_unload_library(ime); + } + + return -1; +} + +/* + * IME 、ヒ、゙、タタワツウ、キ、ニ、、、ハ、、セケ遉ヒクニ、ミ、、 + */ + +static int iw_ime_connect(int ime) +{ + switch (ime) + { + case IME_IMM32: + return iw_imm32_connect(ime); + default: + break; + } + + return -1; +} + +/* + * 、ォ、、ハ・ラ・・ネ・ウ・、 wrap 、ケ、エリソs + */ + +/* + 、ォ、ハエチサハムエケ・オ。シ・ミ、ネ・ッ・鬣、・「・・ネ、ネ、ホタワツウ、ウホホゥ、キ。、、ォ、ハエチサハムエケエトカュ、ケステロ、ケ、。・ +*/ +int imewrapper_initialize(int id, buffer_t *cbuf) +{ + int ime = IME_NON, errflag, *ip = (int *)cbuf->buf; + short *sp = (short *)cbuf->buf; + short cx_num; + char *p, *major_p, *minor_p, *user = NULL, *home; + short major, minor; + struct passwd *pwd; + char *conffile = NULL; + + errflag = 0; + + major_p = &(cbuf->buf[0]); /* Initialize 、ヒクツ、, cbuf->buf 、ヒ・リ・テ・タ。シ、マ + ニ、鬢ハ、、 */ + home = NULL; + major = minor = -1; + + if ((p = strchr(major_p, '.')) == NULL) + errflag = 1; + else + { + *p = 0; + + minor_p = p + 1; + + if ((p = strchr(minor_p, ':')) == NULL) + errflag = 2; + else + { + *p = 0; + user = p + 1; + + if (user[0] == 0) + errflag = 3; + else + { + if ((pwd = getpwnam(user)) == NULL) + errflag = 4; + else + { + if ((home = pwd->pw_dir) == NULL) + errflag = 5; + } + } + /* ・譯シ・カ、ャフオ、ッ、ニ、 /etc/canna2imm32rc 、ャ、「、、ミ OK 、ヒ、ケ、 */ + if (errflag != 0) + { + MYFREE(home); + home = (char*)malloc(1); + home[0] = '\0'; + } + if ((conffile = iw_get_conf_file_path(home)) == NULL) + errflag = 6; + else + errflag = 0; + + major = atoi(major_p); + minor = atoi(minor_p); + } + } + + /* FIXME: major, minor 、ヌセケ遉ヒ、隍テ、ニ、マ・ィ・鬘シ、ハヨ、ケ、隍ヲス、タオ */ + + if (errflag) + m_msg("Header invalid. Maybe server version mismatch? (%d)\n", errflag); + + if (errflag == 0) + { + if ((ime = client[id].ime = iw_read_conf_file(conffile)) != 0) + { + if (ime_connected_flag[ime - 1] == FALSE) + { + /* タワツウヘラオ皃オ、、ソ IME 、ヒ、゙、タタワツウ、キ、ニ、、、ハ、、セケ */ + iw_ime_connect(ime); + } + } else + { + m_msg("IME not determined.\n"); + } + } + + if (errflag == 0 && ime > 0 && ime_connected_flag[ime - 1] == TRUE) + { + /* client[] 、ヒ user フセ、ネ, ・ロ。シ・爭ヌ・」・・ッ・ネ・熙ホ・ム・ケ、ハンエノ */ + strncpy(client[id].user, user, 10); + client[id].user[9] = 0; + client[id].homedir = strdup(home); + + cx_num = SendMessage(hWnd_IMM, WM_USER + F_initialize, id, (LPARAM)conffile); + } else + { + cx_num = -1; + } + + if (cx_num == -1) + { + m_msg("Initialize failed. #%d %s@%s refused.\n", id, user ? user : "", client[id].host); + + /* ・・ス。シ・ケ・ユ・。・、・、ニノ、゚ケ、狹ハウャ、ヌ、ホシコヌヤ。「、゙、ソ、マ・ウ・・ニ・ュ・ケ・ネ、ホウヘニタ、ヒ + シコヌヤ。」・ッ・鬣、・「・・ネ、ネ、ホタワツウ、マタレ、テ、ニ、キ、゙、ヲ */ + client[id].need_terminate = TRUE; /* main.c 、ヌスェホサス靉、、キ、ニ、筅鬢ヲ */ + *ip = LSBMSB32(-1); + } else + { /* Success */ + sp[0] = LSBMSB16(3); + sp[1] = LSBMSB16(cx_num); + } + + if (conffile) + free(conffile); + + return 1; +} + +#define CALLFUNC(_num) return SendMessage(hWnd_IMM, WM_USER+_num, (WPARAM)id, (LPARAM)cbuf); + +/* + 、ォ、ハエチサハムエケス靉、スェホサ、ケ、。・・オ。シ・ミオレ、モ・ッ・鬣、・「・・ネ、ヒウホハン、オ、、ニ、、、ソ、ケ、ル、ニ、ホサクサ、イハ、ケ、。・ + 、゙、ソ。「ウリスャニ簣ニ、ヌシュス、ヒネソアヌ、オ、、ニ、、、ハ、、、筅ホ、ャ、「、、ミシュス、ヒネソアヌ、ケ、。・ +*/ +int imewrapper_finalize(int id, buffer_t *cbuf) +{ + CALLFUNC(0); +} + +/* + ハムエケ・ウ・・ニ・ッ・ケ・ネ、コタョ、キ。、、ス、ホハムエケ・ウ・・ニ・ッ・ケ・ネ、ノス、ケ・ウ・・ニ・ッ・ケ・ネネヨケ讀ハヨ、ケ。・ +*/ +int imewrapper_create_context(int id, buffer_t *cbuf) +{ + CALLFUNC(1); +} + +/* + サリト熙オ、、ソハムエケ・ウ・・ニ・ッ・ケ・ネ、ハ」タス、キ。、ソキ、キ、、ハムエケ・ウ・・ニ・ッ・ケ・ネ、タクタョ、キ、ス、、ノス、ケ・ウ・・ニ・ッ・ケ・ネ + ネヨケ讀ハヨ、ケ。・ +*/ +int imewrapper_duplicate_context(int id, buffer_t *cbuf) +{ + CALLFUNC(2); +} + +/* + ・ウ・・ニ・ッ・ケ・ネ、ャサネヘム、キ、ニ、、、サクサ、イハ、ケ、。・、ス、ホク螂ウ・・ニ・ッ・ケ・ネ、マフ、トオチ、ネ、ハ、。・ +*/ +int imewrapper_close_context(int id, buffer_t *cbuf) +{ + CALLFUNC(3); +} + +/* + シュス・ニ。シ・ヨ・、ヒナミマソ、オ、、ニ、、、シュスーヘ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_dictionary_list(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = 0; + + return 1; +} + +/* + シュス・ヌ・」・・ッ・ネ・熙ヒ、「、シュス、ホーヘ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_directory_list(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = 0; + + return 1; +} + +/* + サリト熙オ、、ソシュス、、ォ、ハエチサハムエケ、ヌヘヘム、オ、、、隍ヲ、ヒ、ケ、。」 +*/ +int imewrapper_mount_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + サリト熙オ、、ソシュス、ャ、ォ、ハエチサハムエケ、ヌヘヘム、オ、、ハ、、、隍ヲ、ヒ、ケ、。」 +*/ +int imewrapper_unmount_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + サネヘムシュス、ホシュス・・ケ・ネ、ホス酳ヨ、ハムケケ、ケ、。・ +*/ +int imewrapper_remount_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + シュス・ニ。シ・ヨ・、ヒナミマソ、オ、、ニ、、、シュス・・ケ・ネ +*/ +int imewrapper_get_mountdictionary_list(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = 0; + + return 1; +} + +/* + サリト熙キ、ソシュス、ホセハ、ニタ、 +*/ +int imewrapper_query_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + シュス、ヒソキ、キ、、テアク、ナミマソ、ケ、 +*/ +int imewrapper_define_word(int id, buffer_t *cbuf) +{ + CALLFUNC(4); +} + +/* + シュス、ォ、鯏アク、コス、ケ、。・ +*/ +int imewrapper_delete_word(int id, buffer_t *cbuf) +{ + CALLFUNC(5); +} + +/* + ニノ、゚、ホ、ォ、ハハクサホ、ヒツミ、キ。、マ「ハクタ睫ムエケ・筍シ・ノ、ヌ、ォ、ハエチサハムエケ、ケヤ、ヲ。・ +*/ +int imewrapper_begin_convert(int id, buffer_t *cbuf) +{ + CALLFUNC(6); +} + +/* + クスコ゚、ホ、ォ、ハエチサハムエケコカネ、スェホサ、キ。、ノャヘラ、ヒア、ク、ニウリスャ、ケヤ、ヲ。・ +*/ +int imewrapper_end_convert(int id, buffer_t *cbuf) +{ + CALLFUNC(7); +} + +/* + サリト熙オ、、ソハクタ皃ホ、ケ、ル、ニ、ホクハ萍クサホ、ネニノ、゚、シ霹タ、ケ、。・ +*/ +int imewrapper_get_candidacy_list(int id, buffer_t *cbuf) +{ + CALLFUNC(8); +} + +/* + ・ォ・・・ネハクタ皃ホニノ、゚、ャ、ハ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_yomi(int id, buffer_t *cbuf) +{ + CALLFUNC(9); +} + +/* + シォニーハムエケ・筍シ・ノサ、ヒニノ、゚・ミ・テ・ユ・。、ホニ簣ニ、ハムケケ、キ。、コニナルハムエケ、ケヤ、ヲ。・ +*/ +int imewrapper_subst_yomi(int id, buffer_t *cbuf) +{ + CALLFUNC(10); +} + +/* + ・ォ・・・ネハクタ皃ホニノ、゚、ャ、ハ、ハムケケ、キ。、、ス、ーハケ゚、ホハクタ皃コニハムエケ、ケ、。・ +*/ +int imewrapper_store_yomi(int id, buffer_t *cbuf) +{ + CALLFUNC(11); +} + +/* + ・ォ・・・ネハクタ皃ホニノ、゚、ャ、ハ、ハムケケ、キ。、・ォ・・・ネハクタ皃ホ、゚、テアハクタ睫ムエケ、ケ、。・ +*/ +int imewrapper_store_range(int id, buffer_t *cbuf) +{ + CALLFUNC(12); +} + +/* + フ、キ靆クタ皃ホニノ、゚、シ霹タ、ケ、。・ +*/ +int imewrapper_get_lastyomi(int id, buffer_t *cbuf) +{ + CALLFUNC(13); +} + +/* + フ、キ霪ハクタ皃カッタゥナェ、ヒハムエケ、ケ、。・ +*/ +int imewrapper_flush_yomi(int id, buffer_t *cbuf) +{ + CALLFUNC(14); +} + +/* + タ霹ャハクタ皃ォ、鬣ォ・・・ネハクタ皃゙、ヌニノ、゚、ニノ、゚・ミ・テ・ユ・。、ォ、鮠隍ス、ッ。・ +*/ +int imewrapper_remove_yomi(int id, buffer_t *cbuf) +{ + CALLFUNC(15); +} + +/* + サリト熙オ、、ソシュス、ォ、鬢ス、ホシュス、ヒエ゙、゙、、ニ、、、クハ荀ホ、゚、シ霹タ、ケ、。・ +*/ +int imewrapper_get_simplekanji(int id, buffer_t *cbuf) +{ + CALLFUNC(16); +} + +/* + サリト熙オ、、ソハクタ皃。、サリト熙オ、、ソトケ、オ、ヒカ霏レ、トセ、キ、ニ。、コニナル、ォ、ハエチサハムエケ、ケ、。・ +*/ +int imewrapper_resize_pause(int id, buffer_t *cbuf) +{ + CALLFUNC(17); +} + +/* + ・ォ・・・ネクハ荀ヒツミ、ケ、ノハサセハ、ハクサホ、ヌシ霹タ、ケ、。・ +*/ +int imewrapper_get_hinshi(int id, buffer_t *cbuf) +{ + CALLFUNC(18); +} + +/* + ・ォ・・・ネハクタ皃ホキチツヨチヌセハ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_lex(int id, buffer_t *cbuf) +{ + CALLFUNC(19); +} + +/* + ・ォ・・・ネクハ荀ヒエリ、ケ、イタマセハ、オ皃皃。・ +*/ +int imewrapper_get_status(int id, buffer_t *cbuf) +{ + CALLFUNC(20); +} + +/* + locale セハ、ホハムケケ、ケヤ、ヲ。・ +*/ +int imewrapper_set_locale(int id, buffer_t *cbuf) +{ + CALLFUNC(21); +} + +/* + シォニーハムエケ・筍シ・ノ、ヌ、ォ、ハエチサハムエケ、ケヤ、ヲ。・ +*/ +int imewrapper_auto_convert(int id, buffer_t *cbuf) +{ + CALLFUNC(22); +} + +/* + 、ス、ホ・オ。シ・ミ、ホウネト・・ラ・・ネ・ウ・、ホフ荀、ケ遉、サ。・ +*/ +int imewrapper_query_extensions(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + ・ッ・鬣、・「・・ネ、ホ・「・ラ・・ア。シ・キ・逾フセ、、ス、ホ・オ。シ・ミ、ヒトフテホ、キ。、ナミマソ、ケ、。・ +*/ +int imewrapper_set_applicationname(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + ・ッ・鬣、・「・・ネ、ホ・ー・。シ・ラフセ、・オ。シ・ミ、ヒトフテホ、キ。「ナミマソ、ケ、。」 +*/ +int imewrapper_notice_groupname(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + +*/ +int imewrapper_through(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = 0; + + return 1; +} + +/* + ・オ。シ・ミ、ヒスェホサヘラオ皃トフテホ、キ。「・オ。シ・ミ、スェホサ、オ、サ、。」 +*/ +int imewrapper_kill_server(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + int err = 0; + char buf[128]; + struct passwd *pw; + uid_t pid; + + if (gethostname(buf, 128)) + buf[0] = 0; + pw = getpwnam(client[id].user); + pid = getuid(); + + if (strcmp(client[id].host, "UNIX") && + strcmp(client[id].host, buf) && + strcmp(client[id].host, "localhost")) + { + err = -111; /* NOTUXSRV */ + } else if (pw->pw_uid != 0 && pw->pw_gid != 0 && pw->pw_uid != pid) + err = -112; /* NOTOWNSRV */ + + header->datalen = LSBMSB16(1); + header->err.e8 = err; + + if (err == 0) + { + signal(SIGALRM, (void(*)())iw_send_term_signal); + alarm(1); + + m_msg("KillServer from %s@%s accepted.\n", client[id].user, client[id].host); + } + + return 1; +} + +/* + ・オ。シ・ミ、ヒタワツウ、キ、ニ、、、・ッ・鬣、・「・・ネソ、ハ、ノ、ホ・オ。シ・ミセハ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_serverinfo(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + int protocol_num, e_protocol_num, datalen, protocol_datalen, pnt; + int i; + uint ui; + short s; + + for (protocol_num = 0; protocol_name[protocol_num] != NULL; protocol_num++) + ; + for (e_protocol_num = 0; e_protocol_name[e_protocol_num] != NULL; + e_protocol_num++); + + protocol_datalen = 0; + for (i = 0; i < protocol_num; i++) + protocol_datalen += strlen(protocol_name[i]) + 1; + for (i = 0; i < e_protocol_num; i++) + protocol_datalen += strlen(e_protocol_name[i]) + 1; + protocol_datalen++; + + datalen = 17 + protocol_datalen + (protocol_num + e_protocol_num) * 4; + + buffer_check(cbuf, datalen + 4); + header = (cannaheader_t *)cbuf->buf; + + header->type = 0x01; + header->extra = 0x01; + header->datalen = LSBMSB16(datalen); + + cbuf->buf[4] = 0; + cbuf->buf[5] = 3; /* Major Server Version */ + cbuf->buf[6] = 5; /* Minor Server Version */ + + ui = (uint)time(NULL); ui = LSBMSB32(ui); + memcpy(&(cbuf->buf[7]), &ui, 4); + + i = protocol_num + e_protocol_num; + s = LSBMSB16(i); + memcpy(&(cbuf->buf[11]), &s, 2); + + s = LSBMSB16(protocol_datalen); + memcpy(&(cbuf->buf[13]), &s, 2); + + pnt = 15; + for (i = 0; i < protocol_num; i++) + { + strcpy(&(cbuf->buf[pnt]), protocol_name[i]); + pnt += strlen(protocol_name[i]) + 1; + } + + for (i = 0; i < e_protocol_num; i++) + { + strcpy(&(cbuf->buf[pnt]), e_protocol_name[i]); + pnt += strlen(e_protocol_name[i]) + 1; + } + + cbuf->buf[pnt++] = 0; + + memset(&(cbuf->buf[pnt]), 0, 4 * (protocol_num + e_protocol_num)); + pnt += 4 * (protocol_num + e_protocol_num); + + memset(&(cbuf->buf[pnt]), 0, 6); + pnt += 6; + + return 1; +} + +/* + ・オ。シ・ミ、ホサネヘムオイト、ホサイセネ、ェ、隍モタ゚ト熙ケヤ、ヲ。・ +*/ +int imewrapper_get_access_control_list(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + + return 1; +} + +/* + ・ニ・ュ・ケ・ネシュス、コタョ、キ。、dics.dir 、ホニ簣ニ、ケケソキ、ケ、。・ +*/ +int imewrapper_create_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + ・ニ・ュ・ケ・ネシュス、コス、キ。、dics.dir 、ホニ簣ニ、ケケソキ、ケ、。・ +*/ +int imewrapper_delete_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + ・譯シ・カシュス、ホシュスフセ、ハムケケ、ケ、。・ +*/ +int imewrapper_rename_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + ・ニ・ュ・ケ・ネシュス、ホテアクセハ、シ霹タ、ケ、。・ +*/ +int imewrapper_get_wordtext_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + + return 1; +} + +/* + サリト熙キ、ソシュス・ヌ・」・・ッ・ネ・熙ヒ、「、シュス・ニ。シ・ヨ・、シ霹タ、ケ、。・ +*/ +int imewrapper_list_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + ・皈筵ニ筅ホハンサ、キ、ニ、、、シュスセハ、シュス、ヒス、ュケ、爍・ +*/ +int imewrapper_sync(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* + シュス、ホREAD/WRITE ク「、ホハムケケ、ケヤ、ヲ。」 +*/ +int imewrapper_chmod_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +/* + シュス、ホハ」シフ +*/ +int imewrapper_copy_dictionary(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} diff --git a/imewrapper.h b/imewrapper.h new file mode 100755 index 0000000..d9a0513 --- /dev/null +++ b/imewrapper.h @@ -0,0 +1,79 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __imewrapper_h__ +#define __imewrapper_h__ + +int imewrapper_end_client(int id); +int imewrapper_end_rootclient(int id); + +int imewrapper_ime_aborted(int ime); + +int imewrapper_clear_client_data(int id); + +int imewrapper_initialize(); +int imewrapper_finalize(); +int imewrapper_create_context(); +int imewrapper_duplicate_context(); +int imewrapper_close_context(); +int imewrapper_get_dictionary_list(); +int imewrapper_get_directory_list(); +int imewrapper_mount_dictionary(); +int imewrapper_unmount_dictionary(); +int imewrapper_remount_dictionary(); +int imewrapper_get_mountdictionary_list(); +int imewrapper_query_dictionary(); +int imewrapper_define_word(); +int imewrapper_delete_word(); +int imewrapper_begin_convert(); +int imewrapper_end_convert(); +int imewrapper_get_candidacy_list(); +int imewrapper_get_yomi(); +int imewrapper_subst_yomi(); +int imewrapper_store_yomi(); +int imewrapper_store_range(); +int imewrapper_get_lastyomi(); +int imewrapper_flush_yomi(); +int imewrapper_remove_yomi(); +int imewrapper_get_simplekanji(); +int imewrapper_resize_pause(); +int imewrapper_get_hinshi(); +int imewrapper_get_lex(); +int imewrapper_get_status(); +int imewrapper_set_locale(); +int imewrapper_auto_convert(); +int imewrapper_query_extensions(); +int imewrapper_set_applicationname(); +int imewrapper_notice_groupname(); +int imewrapper_through(); +int imewrapper_kill_server(); + +int imewrapper_get_serverinfo(); +int imewrapper_get_access_control_list(); +int imewrapper_create_dictionary(); +int imewrapper_delete_dictionary(); +int imewrapper_rename_dictionary(); +int imewrapper_get_wordtext_dictionary(); +int imewrapper_list_dictionary(); +int imewrapper_sync(); +int imewrapper_chmod_dictionary(); +int imewrapper_copy_dictionary(); + + + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libtool b/libtool new file mode 100755 index 0000000..0245126 --- /dev/null +++ b/libtool @@ -0,0 +1,4303 @@ +#! /bin/sh + +# libtool - Provide generalized library-building support services. +# Generated automatically by ltconfig (GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +# Libtool was configured as follows, on host towns: +# +# CC="gcc" CFLAGS="-g -O2" CPPFLAGS="" \ +# LD="/usr/i686-pc-cygwin/bin/ld.exe" LDFLAGS="" LIBS="" \ +# NM="/usr/bin/nm -B" RANLIB="ranlib" LN_S="ln -s" \ +# DLLTOOL="" OBJDUMP="" AS="" \ +# ./ltconfig --cache-file=./config.cache --with-gcc --with-gnu-ld --enable-dlopen --no-verify ./ltmain.sh i686-pc-cygwin +# +# Compiler and other test output produced by ltconfig, useful for +# debugging ltconfig, is in ./config.log if it exists. + +# The version of ltconfig that generated this script. +LTCONFIG_VERSION="1.3.5" + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=no + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to optimize for fast installation. +fast_install=needless + +# The host system. +host_alias=i686-pc-cygwin +host=i686-pc-cygwin + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" + +# The default C compiler. +CC="gcc" + +# The linker used to build libraries. +LD="/usr/i686-pc-cygwin/bin/ld.exe" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Executable file suffix (normally ""). +exeext=".exe" + +# Additional compiler flags for building library objects. +pic_flag="" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Can we write directly to a .lo ? +compiler_o_lo="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen=yes + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=windows + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\`echo \${release} | sed -e s/[.]/-/g\`\${versuffix}.dll \$libname.a" + +# The coded name of the library, if different from the real name. +soname_spec="" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR cru \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="\$DLLTOOL --as=\$AS --dllname \$soname --def \$objdir/\$soname-def --output-lib \$objdir/\$libname.a" + +# Commands used to build and install a shared archive. +archive_cmds="" +archive_expsym_cmds="echo EXPORTS > \$objdir/\$soname-def~ + _lt_hint=1; + cat \$export_symbols | while read symbol; do + set dummy \\\$symbol; + case \\\$# in + 2) echo \\\" \\\$2 @ \\\$_lt_hint ; \\\" >> \$objdir/\$soname-def;; + *) echo \\\" \\\$2 @ \\\$_lt_hint \\\$3 ; \\\" >> \$objdir/\$soname-def;; + esac; + _lt_hint=\\\`expr 1 + \\\$_lt_hint\\\`; + done~ + test -f \$objdir/\$soname-ltdll.c || sed -e \\\"/^# \\\\/\\\\* ltdll\\\\.c starts here \\\\*\\\\//,/^# \\\\/\\\\* ltdll.c ends here \\\\*\\\\// { s/^# //; p; }\\\" -e d < \$0 > \$objdir/\$soname-ltdll.c~ + test -f \$objdir/\$soname-ltdll.\$objext || (cd \$objdir && \$CC -c \$soname-ltdll.c)~ + \$CC -Wl,--base-file,\$objdir/\$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o \$lib \$objdir/\$soname-ltdll.\$objext \$libobjs \$deplibs \$linkopts~ + \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def \$objdir/\$soname-def --base-file \$objdir/\$soname-base --output-exp \$objdir/\$soname-exp~ + \$CC -Wl,--base-file,\$objdir/\$soname-base \$objdir/\$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o \$lib \$objdir/\$soname-ltdll.\$objext \$libobjs \$deplibs \$linkopts~ + \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def \$objdir/\$soname-def --base-file \$objdir/\$soname-base --output-exp \$objdir/\$soname-exp~ + \$CC \$objdir/\$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o \$lib \$objdir/\$soname-ltdll.\$objext \$libobjs \$deplibs \$linkopts" +postinstall_cmds="" +postuninstall_cmds="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="file_magic file format pei*-i386(.*architecture: i386)?" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\${OBJDUMP} -f" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="unsupported" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGISTW]\\)[ ][ ]*\\(_\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern char \\1;/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=unknown + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=yes + +# The commands to list exported symbols. +export_symbols_cmds="test -f \$objdir/\$soname-ltdll.c || sed -e \\\"/^# \\\\/\\\\* ltdll\\\\.c starts here \\\\*\\\\//,/^# \\\\/\\\\* ltdll.c ends here \\\\*\\\\// { s/^# //; p; }\\\" -e d < \$0 > \$objdir/\$soname-ltdll.c~ + test -f \$objdir/\$soname-ltdll.\$objext || (cd \$objdir && \$CC -c \$soname-ltdll.c)~ + \$DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def \$objdir/\$soname-def \$objdir/\$soname-ltdll.\$objext \$libobjs \$convenience~ + sed -e \\\"1,/EXPORTS/d\\\" -e \\\"s/ @ [0-9]*//\\\" -e \\\"s/ *;.*\$//\\\" < \$objdir/\$soname-def > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +### END LIBTOOL CONFIG + +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/ltconfig b/ltconfig new file mode 100755 index 0000000..c14d83c --- /dev/null +++ b/ltconfig @@ -0,0 +1,3114 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.5 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi +if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' + + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # As osf3* with the addition of the -msym flag + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + rhapsody*) + archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flags_spec='-L$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + unixware7*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + case "$host_os" in + hpux10.20*) + # TODO: Does this work for hpux-11 too? + deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method=pass_all + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rhapsody*) + version_type=sunos + library_names_spec='${libname}.so' + soname_spec='${libname}.so' + shlibpath_var=DYLD_LIBRARY_PATH + deplibs_check_method=pass_all + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + sequent) + file_magic_cmd='/bin/file' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2248: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2288: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2335: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2375: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2423: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2488: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile >/dev/null 2>conftest.out" +{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2526: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/ltmain.sh b/ltmain.sh new file mode 100755 index 0000000..766732d --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,4024 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/main.c b/main.c new file mode 100755 index 0000000..d88841a --- /dev/null +++ b/main.c @@ -0,0 +1,287 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include + +#include +#include + +#include "def.h" +#include "constdef.h" +#include "cannaproto.h" +#include "cannasocket.h" +#include "imewrapper.h" +#include "misc.h" + +char debugmode = 0; +char daemonizemode = 1; /* 0: ノ眛フ、ホ・「・ラ・熙ネ、キ、ニニーコ 1: ・ヌ。シ・筵、ネ、キ、ニニーコ */ +char inetmode = 0; /* 0: inet・ノ・皈、・・ス・ア・テ・ネ、サネ、、ハ、、 1: inet・ノ・皈、・・ス・ア・テ・ネ、サネ、ヲ */ +char logmode = 1; /* 0: ・ウ・・ス。シ・、ヒ・・ー、スミホマ、ケ、 1: ESECANNA_LOG_PATH 、ヒ・・ー、スミホマ、ケ、 */ +client_t client[MAX_CLIENT_NUM]; + +#ifdef USEDLL +extern char *ime_dl_name[]; +#endif + +BOOL WINAPI handler_routine(DWORD dwCtrlType); + +int term_all(char *msg) +{ + int i; + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) + { + if (client[i].sockfd != -1) + { + imewrapper_end_client(i); + close(client[i].sockfd); + imewrapper_clear_client_data(i); + } + } + + imewrapper_clear_client_data(IMM32_ROOT_CLIENT); + imewrapper_end_rootclient(IMM32_ROOT_CLIENT); + + canna_socket_close(); + + m_msg(msg); + m_message_term(); + + SetConsoleCtrlHandler(handler_routine, FALSE); + + exit(0); +} + +void sig_terminate() +{ + term_all("Terminated by signal.\n"); +} + +/* windowsセ螟ヌ・ウ・・ス。シ・・「・ラ・熙ャ・キ・罕テ・ネ・タ・ヲ・ナ、ホ・、・ル・・ネ、シ、ア、、ソ、皃ホ・。シ・チ・ */ +BOOL WINAPI handler_routine(DWORD dwCtrlType) +{ + /* print out what control event was received to the current console */ + switch(dwCtrlType) + { + case CTRL_C_EVENT: + case CTRL_BREAK_EVENT: + case CTRL_SHUTDOWN_EVENT: + case CTRL_LOGOFF_EVENT: + term_all("Terminated by windows event.\n"); + return(TRUE); + + case CTRL_CLOSE_EVENT: /* 、「、シ、ホ・ヌ。シ・筵、ネ、キ、ニニー、ュ、ソ、、、ホ、ヌ、ウ、、マオムイシ */ + return(TRUE); + + default: + break; + } + return(FALSE); +} + +int init_private() +{ + int i; + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) { + memset(&(client[i]), 0, sizeof(client_t)); + + client[i].sockfd = -1; + } + + return 0; +} + +int init_all() +{ + int canna_ufd, canna_ifd; + + init_private(); + + if (canna_socket_open(&canna_ufd, &canna_ifd) < 0) + { + return -1; + } + + m_system_register_file(canna_ufd); + if (inetmode == 1) + m_system_register_file(canna_ifd); + + m_message_init(logmode ? ESECANNA_LOG_PATH : NULL); + + if (daemonizemode == 1) + { + m_daemonize(ESECANNA_PID_PATH); + m_msg("%s started by UID[%d]\n", ESECANNA_VERSION, getuid()); + } + + m_setup_signal((signalhandler_t)sig_terminate); + + SetConsoleCtrlHandler(handler_routine, TRUE); + + /* 、ォ、ハエチ、ケヤ、ヲ、ソ、皃ホ・タ・゚。シ・ヲ・」・・ノ・ヲ、ホコタョ */ + if (mw_InitWindow() != 0) + return -1; + + return 0; +} + +void loop() +{ + int i, ii, ret, flag; + char down_flag[IME_END], end_flag[IME_END]; + + for (;;) + { + memset(down_flag, 0, IME_END); + memset(end_flag, 0, IME_END); + + canna_socket_wait_trigger(); + + for (i = USER_CLIENT; i < MAX_CLIENT_NUM; i++) + { + if (client[i].data_received) + { + client[i].data_received = FALSE; + ret = canna_proto_main(i); + + if (ret < 0) + { + /* IME 、ャヘ、チ、ソ。」-(IME_???) 、ャハヨ、オ、、。」*/ + down_flag[-(ret) - 1] = TRUE; + } + } + + if (client[i].need_terminate) + { + if (client[i].ime > 0) + end_flag[client[i].ime - 1] = TRUE; + + client[i].need_terminate = FALSE; + imewrapper_end_client(i); + close(client[i].sockfd); + imewrapper_clear_client_data(i); + } + } + + + for (i = IME_START; i <= IME_END; i++) + { + if (down_flag[i - 1] == TRUE) + { + /* IME 、ャヘ、チ、ソ、ホ、ヌ。「スェホサス靉、、ケ、 */ + + for (ii = USER_CLIENT; ii < MAX_CLIENT_NUM; ii++) + { + if (client[ii].ime == i) + { + imewrapper_end_client(ii); + close(client[ii].sockfd); + imewrapper_clear_client_data(ii); + } + } + + /* rootclient 、篆ェホサ。」ニアサ、ヒ・筵ク・蝪シ・、箋ォハ、オ、、。」*/ + imewrapper_end_rootclient(i); + } + } + + /* IME 、ャヘ、チ、ソ、ホ、ヌ、マ、ハ、ッ,・ッ・鬣、・「・・ネ、ホスェホサス靉、、キ、ソセケ遉マ, + * ツセ、ヒ IME 、ヒタワツウ、キ、ニ、、、・ッ・鬣、・「・・ネ、ャ、、、、ォ、ノ、ヲ、ォ、ウホ、ォ、皃ニ + * IME 、セケ遉ヒ、隍テ、ニ、マスェホサ、オ、サ、 + */ + for (i = IME_START; i <= IME_END; i++) + { + if (end_flag[i - 1] == TRUE && down_flag[i - 1] == FALSE) + { + flag = 0; + + for (ii = USER_CLIENT; ii < MAX_CLIENT_NUM; ii++) + { + if (client[ii].ime == i) + flag = 1; + } + + if (flag == 0) + imewrapper_end_rootclient(i); + } + } + } +} + +static void show_help(void) +{ + fprintf(stderr, "%s\n", ESECANNA_VERSION); + fprintf(stderr, "options are:\n"); + fprintf(stderr, " -inet use inet domain\n"); + fprintf(stderr, " -f run foreground\n"); + fprintf(stderr, " -nolog no log output\n"); + fprintf(stderr, " -d debug mode\n"); +} + +int main(int argc, char **argv) +{ + int i; + char buf[1024]; + + for (i = 1; i < argc; i++) + { + if (strcmp(argv[i], "-d") == 0) + debugmode = 1; + else if (strcmp(argv[i], "-f") == 0) + daemonizemode = 0; + else if (strcmp(argv[i], "-inet") == 0) + inetmode = 1; + else if (strcmp(argv[i], "-nolog") == 0) + logmode = 0; + else if (strcmp(argv[i], "--help") == 0) + { + show_help(); + return 0; + } + } + + fprintf(stderr, "%s, start\n", ESECANNA_VERSION); +#ifdef USEDLL + fprintf(stderr, "\tPlugins: "); + + for (i = IME_START; i <= IME_END; i++) + { + sprintf(buf, "%s/%s", ESECANNA_DL_PATH, ime_dl_name[i - 1]); + if (access(buf, F_OK) == 0) + fprintf(stderr, "%s ", ime_dl_name[i - 1]); + } + + fprintf(stderr, "\n"); +#endif + i = init_all(); + + if (i < 0) + { + return -1; + } + + loop(); + + fprintf(stderr, "%s, end.\n", ESECANNA_VERSION); + return 0; +} diff --git a/misc.c b/misc.c new file mode 100755 index 0000000..5773f0e --- /dev/null +++ b/misc.c @@ -0,0 +1,1551 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#define __USE_GNU +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define __misc_c__ + +#include "misc.h" + +struct { + uchar zen[3]; + uchar c; +} zen_han_table[] = { + {{0x81, 0x49, 0}, '!'}, + {{0x81, 0x68, 0}, '"'}, + {{0x81, 0x94, 0}, '#'}, + {{0x81, 0x90, 0}, '$'}, + {{0x81, 0x93, 0}, '%'}, + {{0x81, 0x95, 0}, '&'}, + {{0x81, 0x66, 0}, 0x27}, /* ' */ + {{0x81, 0x69, 0}, '('}, + {{0x81, 0x6a, 0}, ')'}, + {{0x81, 0x96, 0}, '*'}, + {{0x81, 0x7b, 0}, '+'}, + {{0x81, 0x43, 0}, ','}, + {{0x81, 0x7c, 0}, '-'}, + {{0x81, 0x44, 0}, '.'}, + {{0x81, 0x5e, 0}, '/'}, + {{0x81, 0x46, 0}, ':'}, + {{0x81, 0x47, 0}, ';'}, + {{0x81, 0x83, 0}, '<'}, + {{0x81, 0x81, 0}, '='}, + {{0x81, 0x84, 0}, '!'}, + {{0x81, 0x48, 0}, '?'}, + {{0x81, 0x97, 0}, '@'}, + {{0x81, 0x6b, 0}, '['}, + {{0x81, 0x8f, 0}, '\\'}, + {{0x81, 0x6e, 0}, ']'}, + {{0x81, 0x4f, 0}, '^'}, + {{0x81, 0x51, 0}, '_'}, + {{0x81, 0x4d, 0}, '`'}, + {{0x81, 0x6f, 0}, '{'}, + {{0x81, 0x62, 0}, '|'}, + {{0x81, 0x70, 0}, '}'}, + {{0x81, 0x60, 0}, '~'}, + {{0x81, 0x50, 0}, '~'}, + {{0x81, 0x42, 0}, 0xa1}, /*。」*/ + {{0x81, 0x75, 0}, 0xa2}, /*。ヨ*/ + {{0x81, 0x76, 0}, 0xa3}, /*。ラ*/ + {{0x81, 0x41, 0}, 0xa4}, /*。「*/ + {{0x81, 0x45, 0}, 0xa5}, /*。ヲ*/ + {{0x81, 0x5b, 0}, 0xb0}, /*。シ*/ + {{0x81, 0x4a, 0}, 0xde}, /*。ォ*/ + {{0x81, 0x4b, 0}, 0xdf}, /*。ャ*/ + {{ 0, 0, 0}, 0} +}; + +#define MOD_TEN 0x01 /* 。ォ 、ャシ。、ヒヘ隍ソセケ,ケ鄲ョ(・ォ + 。ォ= ・ャ)、ケ、、ォ */ +#define MOD_MARU 0x02 /* 。ャ 、ャシ。、ヒヘ隍ソセケ,ケ鄲ョ、ケ、、ォ */ +#define MOD_TM 0x03 /* ・マケヤ、マ, 。ォ 、ネ 。ャ ホセハシ、アノユ、ア、 */ + +/* + MOD_xxx 、マ。「テア、ハ、・ユ・鬣ー、ネ、キ、ニ、タ、ア、マ、ハ、、。」 + ハクサ、ホハツ、モ、マ。「。ヨ、ニ、、ニ、、ハ、キ。ラ。ヨ、ニ、、ニ、、「、遙ラ。ヨ、゙、、「、遙ラ、ホス遑」 + 、ケ、ハ、、チ。「。ヨ・ォ・ャ・ュ・ョ...。ラ 。ヨ・マ・ミ・ム・メ・モ・ヤ...。ラ、ホ、隍ヲ、ヒハツ、ヨ。」 + 、隍テ、ニ。「ホ网ィ、ミ 。ヨ・ォ。ラ、ヒ, MOD_TEN 、ツュ、サ、ミ。「。ヨ・ャ。ラ、ヒ、ハ、、ホ、タ。」 +*/ + + +struct { + uchar han_start, han_end; /* 0xa1 - 0xdf */ + uchar modifiers:4, /* MOD_xxx 、ホ OR */ + offset:4; /* イソ・ミ・、・ネ、エ、ネ、ヒクス、、、ォ */ + uchar zenkaku2_start; /* euc 、ホ」イ・ミ・、・ネフワ */ +} kana_table[] = { + {0xa6, 0xa6, 0, 0, 0xf2}, /* ・ */ + {0xa7, 0xab, 0, 2, 0xa1}, /* ・。 - ・ゥ */ + {0xac, 0xae, 0, 2, 0xe3}, /* ・ - ・ */ + {0xaf, 0xaf, 0, 0, 0xc3}, /* ・テ */ + {0xb1, 0xb5, 0, 2, 0xa2}, /* ・「 - ・ェ */ + {0xb3, 0xb3, MOD_TEN, 0, 0xf3}, /* ・ */ + {0xb6, 0xba, MOD_TEN, 2, 0xab}, /* ・ォ - ・ウ ・ャ - ・エ */ + {0xbb, 0xbf, MOD_TEN, 2, 0xb5}, /* ・オ - ・ス ・カ 鴫 ・セ */ + {0xc0, 0xc1, MOD_TEN, 2, 0xbf}, /* ・ソ - ・チ ・タ 鴫 ・ツ */ + {0xc2, 0xc2, MOD_TEN, 0, 0xc4}, /* ・ト ・ナ */ + {0xc3, 0xc4, MOD_TEN, 2, 0xc6}, /* ・ニ - ・ネ ・ヌ - ・ノ */ + {0xc5, 0xc9, 0, 1, 0xca}, /* ・ハ 鴫 ・ホ */ + {0xca, 0xce, MOD_TM, 3, 0xcf}, /* ・マ 鴫 ・ロ ・ミ - ・ワ ・ム 鴫 ・ン */ + {0xcf, 0xd3, 0, 1, 0xde}, /* ・゙ - ・ */ + {0xd4, 0xd6, 0, 2, 0xe4}, /* ・ - ・ */ + {0xd7, 0xdb, 0, 1, 0xe9}, /* ・ - ・ */ + {0xdc, 0xdc, 0, 0, 0xef}, /* ・ */ + {0xdd, 0xdd, 0, 0, 0xf3}, /* ・ */ + { 0, 0, 0, 0, 0} +}; + +extern char debugmode; +extern char daemonizemode; +extern char logmode; + +/* + * Daemonize. from iMultiMouse... + */ + +static pid_t child; +static char *pid_file_path; + +static void m_quit_parent() +{ + FILE *fp; + + if (pid_file_path != NULL && (fp = fopen(pid_file_path, "w")) != NULL) + { + fprintf(fp, "%d\n", child); + fclose(fp); + } + + exit(0); +} + +int m_daemonize(char *pid_path) +{ + pid_t parent; + int fd; + + pid_file_path = pid_path; + + parent = getpid(); + + close(fileno(stdin)); + close(fileno(stdout)); + + if ((child = fork()) == -1) + { + perror(""); + return(EOF); + } + + if (child) + m_quit_parent(); + + signal(SIGHUP, SIG_IGN); + + setsid(); + + close(fileno(stderr)); + + if ((fd = open("/dev/null", 2)) >= 0) + { + if (fd != 0) + dup2(fd, 0); + if (fd != 1) + dup2(fd, 1); + if (fd != 2) + dup2(fd, 2); + if (fd != 0 && fd != 1 && fd != 2) + close(fd); + } + + chdir("/"); + + return(0); +} + +/* + * m_message ... derived from Report* function, written by Morita Akio. + */ + +static FILE *logfp = NULL; +static ino_t loginode = 0; +static char *logfile; + +static int m_message_log_open() +{ + struct stat st; + + if (logfile) { + if ((logfp = fopen(logfile, "a")) != NULL) { + if (fstat(fileno(logfp), &st) == 0) { + loginode = st.st_ino; + + return 0; + } + + loginode = 0; + + fclose(logfp); + } + + free(logfile); + logfile = NULL; + } + + logfp = stderr; + + m_msg_dbg("Logging to file failed.\n"); + + return -1; +} + +static int m_message_log_close() +{ + if (logfp != NULL && logfp != stderr) { + fclose(logfp); + logfp = stderr; + } + + return 0; +} + +static int m_message_log_check() +{ + struct stat st; + static char recall_flag; + + if (recall_flag) + return 0; + + recall_flag = 1; + + if (loginode) { + if (stat(logfile, &st) < 0 || st.st_ino != loginode) { + m_msg("Logfile rotated. Try to reopen...\n"); + + m_message_log_close(); + if (m_message_log_open() == 0) + m_msg("Reopening logfile succeeded.\n"); + else + m_msg("Reopening logfile failed.\n"); + } + } + + recall_flag = 0; + + return 0; +} + +int m_message_init(char *logfilepath) +{ + if (logfilepath) { + logfile = strdup(logfilepath); + + m_message_log_open(); + } else + logfp = stderr; + + return 0; +} + +int m_message_term() +{ + m_message_log_close(); + + return 0; +} + +int m_message_output(int level, const char *msg) +{ + time_t tm; + char *timebuf, buf[26]; + + if (logfp && level == MSG_NOTICE) { + m_message_log_check(); + + tm = time(0); + timebuf = ctime(&tm); + memcpy(buf, &timebuf[4], 16); + buf[15] = 0; + + fprintf(logfp, "%s: %s", buf, msg); + fflush(logfp); + } else if (logfp && level == MSG_DEBUG) { + m_message_log_check(); + + tm = time(0); + timebuf = ctime(&tm); + memcpy(buf, &timebuf[4], 16); + buf[15] = 0; + + fprintf(logfp, "%s: DBG: %s", buf, msg); + fflush(logfp); + } else { + fprintf(stderr, "%s", msg); + fflush(stderr); + } + + return 0; +} + +int m_message_debug(const char *fmt, ...) +{ +#if HAVE_VASPRINTF + char *formated; +#else + char formated[1024]; /* FIXME:too ad-hoc!! */ +#endif + va_list ap; + + if (debugmode == 0) + return 0; + + va_start(ap, fmt); +#if HAVE_VASPRINTF + vasprintf(&formated, fmt, ap); +#else +#if HAVE_VSNPRINTF + vsnprintf(formated, 1024, fmt, ap); +#else + vsprintf(formated, fmt, ap); +#endif +#endif + va_end(ap); + + if (formated != NULL) { + m_message_output(MSG_DEBUG, formated); +#if HAVE_VASPRINTF + free((void *)formated); +#endif + return 0; + } else { + m_message_output(MSG_DEBUG, "out of memory!\n"); + return -1; + } +} + +int m_message_notice(const char *fmt, ...) +{ +#if HAVE_VASPRINTF + char *formated; +#else + char formated[1024]; +#endif + va_list ap; + + if (logmode == 0) + return 0; + + va_start(ap, fmt); +#if HAVE_VASPRINTF + vasprintf(&formated, fmt, ap); +#else +#if HAVE_VSNPRINTF + vsnprintf(formated, 1024, fmt, ap); +#else + vsprintf(formated, fmt, ap); +#endif +#endif + va_end(ap); + + if (formated != NULL) { + m_message_output(MSG_NOTICE, formated); +#if HAVE_VASPRINTF + free((void *)formated); +#endif + return 0; + } else { + m_message_output(MSG_NOTICE, "out of memory!\n"); + return -1; + } +} + +/* + * buffer_ + */ + +int buffer_free(buffer_t *b) +{ + if (b->buf && b->size) + free(b->buf); + + b->buf = NULL; + b->size = 0; + + return 0; +} + +int buffer_check(buffer_t *b, size_t required_size) +{ + char *buf; + size_t size; + +#ifdef DEBUG /* for Memory Allocate Stress Test */ + size = required_size; + if (size > 0) { + if ((buf = malloc(size)) != NULL) { + memset(buf, 0, size); + if (b->size > 0) { + if (size > b->size) { + memcpy(buf, b->buf, b->size); /* Copy Buffer */ + } else { + memcpy(buf, b->buf, size); /* Copy Buffer */ + } + memset(b->buf, 0, b->size); /* Clear Old Buffer */ + free(b->buf); /* Free Old Buffer */ + } + + /* + m_message_debug("Buffer Rellocate Request %d (%d -> %d reallcated)", + equired_size, b->size, size); + */ + + b->buf = buf; + b->size = size; + + return 0; + } else { + return -1; + } + } else { + memset(b->buf, 0, b->size); /* Clear Old Buffer */ + free(b->buf); /* Free Old Buffer */ + b->size = 0; + + /* + m_message_debug("Buffer Rellocate Request %d (%d -> %d reallcated)", + required_size, b->size, size); + */ + return 0; + } +#else + if (required_size > b->size) { + size = ((required_size + 127) / 128) * 128; + if ((buf = realloc(b->buf, size)) != NULL) { + if (b->size == 0) + memset(buf, 0, size); + + /* + m_message_debug("Buffer Rellocate Request %d (%d -> %d reallcated)", + required_size, b->size, size); + */ + + b->buf = buf; + b->size = size; + + return 0; + } else { + return -1; + } + } +#endif + return 0; +} + +int buffer_clear(buffer_t *b) +{ + if (b->buf) + memset(b->buf, 0, b->size); + return 0; +} + +/* m_conf1_parse() : タ゚ト・ユ・。・、・、ホ、「、ーケヤ、イタマ、ケ、 + * ハクヒ。 : OpeCode=String + * オ「、テヘ : 0..Success -1..Error + * - line ... ・ユ・。・、・、ホケヤ。」ハンツク、オ、、ハ、、。」 + * - ope_r ... OpeCode 、ホハクサホ、ハヨ、ケ + * - val_r ... String 、ホハクサホ、ハヨ、ケ + */ + +int m_conf1_parse(char *line, char **ope_r, char **val_r) +{ + char *p; + + if ((p = strchr(line, '\n')) != NULL) + *p = '\0'; + if ((p = strchr(line, '=')) != NULL) { + *p = '\0'; + *val_r = p + 1; + *ope_r = line; + + return 0; + } + + return -1; +} + +int m_conf_string(char *ope, char *opestr, char *val, char **val_r) +{ + if (strcmp(ope, opestr) == 0) { + if (*val_r) + free(*val_r); + + if (val[0]) + *val_r = strdup(val); + else + *val_r = NULL; + + return 1; + } + + return 0; +} + +int m_conf_multiple_choice(char *ope, char *opestr, char *val, char **choice, + int choice_n, int case_sensitive) +{ + int i; + int (*compare)(const char *, const char *); + + compare = (case_sensitive) ? strcmp : strcasecmp; + + if (strcmp(ope, opestr) == 0) { + for (i = 0; i < choice_n; i++) { + if (compare(val, choice[i]) == 0) + return i + 1; + } + } + + return 0; +} + +int m_conf_tof(char *ope, char *opestr, char *val, char *str1, char *str2, + int case_sensitive) +{ + char *choice[2]; + + choice[0] = str1; + choice[1] = str2; + + return m_conf_multiple_choice(ope, opestr, val, choice, 2, case_sensitive); +} + +int m_conf_isequal(char *ope, char *opestr, char *val, char *valstr) +{ + if (strcmp(ope, opestr) == 0) { + if (strcmp(val, valstr) == 0) + return 2; + else + return 1; + } + + return 0; +} + +/* + * m_memdup() + */ + +void *m_memdup(void *src, size_t n) +{ + char *dst; + + dst = malloc(n); + memcpy(dst, src, n); + + return (void *)dst; +} + + +/* + * m_makepath m_splitpath + */ + +char *m_makepath(char *dir, char *file) +{ + int dirlen, filelen; + char *path; + + dirlen = strlen(dir); + filelen = strlen(file); + + path = malloc(dirlen + 1 + filelen + 1); + + if (path) { + strcpy(path, dir); + + if (dirlen > 0 && dir[dirlen - 1] != '/') + strcat(path, "/"); + + strcat(path, file); + } + + return path; +} + +int m_splitpath(char *path, char **dir, char **file) +{ + char *lastslash, *buf; + + buf = strdup(path); + lastslash = strrchr(buf, '/'); + + if (dir != NULL) { + if (lastslash != NULL) { + *lastslash = '\0'; + + if ((*dir = strdup(buf)) == NULL) { + free(buf); + return -1; + } + + lastslash++; + } else { + *dir = NULL; + lastslash = buf; + } + } else { + if (lastslash == NULL) + lastslash = buf; + } + + if (file != NULL) { + if ((*file = strdup(lastslash)) == NULL) { + free(buf); + return -1; + } + } + + free(buf); + + return 0; +} + +/* + * m_netaddr2ascii() + */ + +char *m_netaddr2ascii(uint netaddr, char *ascii) +{ +#ifdef WORDS_BIGENDIAN + sprintf(ascii, "%d,%d,%d,%d", + (netaddr >> 24) & 0xff, (netaddr >> 16) & 0xff, + (netaddr >> 8) & 0xff, (netaddr) & 0xff); +#else + sprintf(ascii, "%d.%d.%d.%d", + (netaddr) & 0xff, (netaddr >> 8) & 0xff, + (netaddr >> 16) & 0xff, (netaddr >> 24) & 0xff); +#endif /* WORDS_BIGENDIAN */ + + return ascii; +} + +/* + * analyze canna converting mode... + */ + +int m_count_canna_mode(int mode) +{ + int ret = 0; + + while (mode) { + mode = mode >> 4; + ret++; + } + + return ret; +} + +int m_get_canna_mode(int mode, int n) +{ + int ret; + + ret = (mode >> (4 * n)) & 0x0f; + + /* ret..1: HIRAGANA 2: HANKAKU 3: KATAKANA 4: ZENKAKU */ + + return ret; +} + +int m_count_valid_canna_mode(int mode) +{ + int ret = 0; + int i, max, cmode; + + max = m_count_canna_mode(mode); + + for (i = 0; i < max; i++) { + cmode = m_get_canna_mode(mode, i); + + if (cmode == 1 || cmode == 3) + ret++; + } + + return ret; +} + +/* + * convert coding system... + */ + +int cannawc2euc(ushort *src, int srclen, char *dest, int destlen) +{ + register int i, j; + register uchar *c; + + for (i = 0, j = 0 ; i < srclen && j + 2 < destlen ; i++) { + c = (unsigned char *)(&src[i]); + switch ((c[0] | (c[1] << 8)) & 0x8080) { + case 0: + /* ASCII */ + // dest[j++] = (char)(((unsigned)wc & 0x7f00) >> 8); + dest[j++] = c[1]; + break; + case 0x8000: + /* ネセウム・ォ・ハ */ + dest[j++] = (char)0x8e; /* SS2 */ + // dest[j++] = (char)((((unsigned)wc & 0x7f00) >> 8) | 0x80); + dest[j++] = c[1] | 0x80; + break; + case 0x0080: + /* ウーサ */ + dest[j++] = (char)0x8f; + // dest[j++] = (char)(((unsigned)wc & 0x7f) | 0x80); + // dest[j++] = (char)((((unsigned)wc & 0x7f00) >> 8) | 0x80); + dest[j++] = c[0] | 0x80; + dest[j++] = c[1] | 0x80; + break; + case 0x8080: + /* エチサ */ + // dest[j++] = (char)(((unsigned)wc & 0x7f) | 0x80); + // dest[j++] = (char)((((unsigned)wc & 0x7f00) >> 8) | 0x80); + dest[j++] = c[0] | 0x80; + dest[j++] = c[1] | 0x80; + break; + } + } + dest[j] = '\0'; + return j; +} + +int euc2cannawc(char *src, int srclen, ushort *dest, int destlen) +{ + register int i, j; + register unsigned ec; + uchar *c; + for (i = 0, j = 0 ; i < srclen && j + 1 < destlen ; i++) { + ec = (unsigned)(unsigned char)src[i]; + c = (unsigned char *)(&dest[j++]); + if (ec & 0x80) { + switch (ec) { + case 0x8e: /* SS2 */ + // dest[j++] = (ushort)((0x80 | ((unsigned)src[++i] & 0x7f)) << 8); + c[0] = 0; + c[1] = src[++i] | 0x80; + break; + case 0x8f: /* SS3 */ + // dest[j++] = (ushort)(0x0080 + // | ((unsigned)src[i + 1] & 0x7f) + // | (((unsigned)src[i + 2] & 0x7f) << 8)); + c[0] = 0x80 | src[i + 1]; + c[1] = src[i + 2] & 0x7f; + + i += 2; + break; + default: + // dest[j++] = (ushort)(0x8080 | ((unsigned)src[i] & 0x7f) + // | (((unsigned)src[i + 1] & 0x7f) << 8)); + c[0] = 0x80 | src[i]; + c[1] = 0x80 | src[i + 1]; + + i++; + break; + } + } + else { + // dest[j++] = (ushort)(ec << 8); + c[0] = 0; + c[1] = ec; + } + } + dest[j] = 0; + return j; +} + +int cannawcstrlen(ushort *ws) +{ + int res = 0; + while (*ws++) { + res++; + } + return res; +} + +ushort *cannawcstrdup(ushort *ws) +{ + ushort *p; + int len; + + len = cannawcstrlen(ws) * 2 + 2; + + p = (ushort *)malloc(len); + memcpy(p, ws, len); + + return (ushort *)p; +} + +ushort *cannawcstrcat(ushort *p1, ushort *p2) +{ + uint l1, l2; + + l1 = cannawcstrlen(p1); + l2 = cannawcstrlen(p2); + + memcpy(&(p1[l1]), p2, l2); + p1[l1 + l2] = 0; + + return p1; +} + +/* src テ讀ヒ、、、ッ、ト、ホ key 、ャクス、、、ォ、ニタ、 */ + +int cannawcnumstr(ushort *src, ushort *key) +{ + int i, len1, len2, ret; + + len1 = cannawcstrlen(src); + len2 = cannawcstrlen(key); + ret = 0; + + for (i = 0; i <= len1 - len2;) { + if (memcmp(&(src[i]), key, len2 * 2) == 0) { + ret++; + i += len2; + } else { + i++; + } + } + + return ret; +} + + +int euc2sjis(uchar *euc, int euclen, uchar *sjis, int sjislen) +{ + int euc_pnt = 0, sjis_pnt = 0; + uint hi, lo; + + while (euc[euc_pnt] && euc_pnt < euclen && sjis_pnt < sjislen) { + if (euc[euc_pnt] & 0x80) { + if (euc[euc_pnt] == 0x8e) { /* ネセウム・ォ・ハ */ + euc_pnt++; + sjis[sjis_pnt++] = euc[euc_pnt++]; + } else { /* チエウムハクサ */ + hi = euc[euc_pnt++] & 0x7f; + lo = euc[euc_pnt++] & 0x7f; + + if ((hi & 1) == 0) { + lo += 0x5e; + hi--; + } + + hi = ((hi - 0x21) >> 1) + 0x81; + lo += (0x40 - 0x21); + + if (lo >= 0x7f) + lo++; + if (hi >= 0xa0) + hi += 0x40; + + sjis[sjis_pnt++] = hi; + sjis[sjis_pnt++] = lo; + } + } else { /* ANK */ + sjis[sjis_pnt++] = euc[euc_pnt++]; + } + } + + if (sjis_pnt < sjislen) + sjis[sjis_pnt] = '\0'; + else + sjis[sjislen - 1] = '\0'; + + return sjis_pnt; +} + +int sjis2euc(uchar *sjis, int sjislen, uchar *euc, int euclen) +{ + int euc_pnt = 0, sjis_pnt = 0; + int hi, lo; + + while (sjis[sjis_pnt] && sjis_pnt < sjislen && euc_pnt < euclen) { + if (ISSJISKANJI1(sjis[sjis_pnt])) { /* チエウムハクサ */ + hi = sjis[sjis_pnt++] & 0xff; + lo = sjis[sjis_pnt++] & 0xff; + + if (hi >= 0xe0) + hi -= 0x40; + if (lo >= 0x80) + lo--; + + lo -= (0x40 - 0x21); + hi = ((hi - 0x81) << 1) + 0x21; + + if (lo >= 0x7f) { + lo -= 0x5e; + hi++; + } + + euc[euc_pnt++] = hi | 0x80; + euc[euc_pnt++] = lo | 0x80; + } else if (ISSJISKANA(sjis[sjis_pnt])) { /* ネセウム・ォ・ハ */ + euc[euc_pnt++] = 0x8e; + euc[euc_pnt++] = sjis[sjis_pnt++]; + } else { + euc[euc_pnt++] = sjis[sjis_pnt++]; + } + } + + if (euc_pnt < euclen) + euc[euc_pnt] = '\0'; + else + euc[euclen - 1] = '\0'; + + return euc_pnt; +} + +/* + * signal setup... + */ + +int m_setup_signal(signalhandler_t handler) +{ + signal(SIGINT, (void(*)())handler); + signal(SIGTERM, (void(*)())handler); + if (daemonizemode == 1) + signal(SIGHUP, SIG_IGN); + else + signal(SIGHUP, (void(*)())handler); + signal(SIGQUIT, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + + return 0; +} + +/* + * copy file... + */ + +int m_copy_file_fp(FILE *from, FILE *to) +{ + char buf[1024]; + int i; + + do { + i = fread(buf, 1, 1024, from); + fwrite(buf, 1, i, to); + } while (i == 1024); + + return 0; +} + +int m_copy_file(char *from, char *to) +{ + FILE *fp1, *fp2; + char buf[1024]; + int i; + + if ((fp1 = fopen(from, "r")) != NULL) { + if ((fp2 = fopen(to, "w")) != NULL) { + do { + i = fread(buf, 1, 1024, fp1); + fwrite(buf, 1, i, fp2); + } while (i == 1024); + + fclose(fp2); + fclose(fp1); + + return 0; + } + fclose(fp1); + } + + return -1; +} + +/* + * system() 、ネニアナ、ホエリソ + */ + +static char m_system_opened_file[FOPEN_MAX]; + +int m_system_clear() +{ + memset(m_system_opened_file, 0, FOPEN_MAX); + return 0; +} + +int m_system_register_file(int fd) +{ + m_system_opened_file[fd] = 0xff; + return 0; +} + +int m_system(char *command) +{ + int i, status, pid; + char *argv[4]; + + if (command == NULL) + return -1; + + pid = fork(); + + if (pid == -1) + return -1; + + if (pid == 0) + { + for (i = 0; i < FOPEN_MAX; i++) + if (m_system_opened_file[i]) + close(m_system_opened_file[i]); + + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = command; + argv[3] = NULL; + + execv("/bin/sh", argv); + + exit(127); + } + + for (;;) + { + if (waitpid(pid, &status, 0) == -1) + { + if (errno != EINTR) + return -1; + } else + return status; + } +} + +/* + * read/write from/to socket functions... + */ + +int m_socket_read(int fd, char *ptr, int totalsize) +{ + int size, ret; + + size = 0; + while (size < totalsize) { + if ((ret = read(fd, &ptr[size], totalsize - size)) <= 0) + return -1; + + size += ret; + } + + return 0; +} + +int m_socket_write(int fd, char *ptr, int totalsize) +{ + int size, ret; + + size = 0; + while (size < totalsize) { + if ((ret = write(fd, &ptr[size], totalsize - size)) < 0) + return -1; + + size += ret; + } + + return 0; +} + +/* + * string modifier... + */ + +int m_replace_string(uchar *eucbuf, char *pre, char *post) +{ + char *p; + int slen, prelen, postlen; + + prelen = strlen(pre); + postlen = strlen(post); + + while ((p = strstr(eucbuf, pre)) != NULL) { + slen = strlen(p); + + memmove(p + postlen, p + prelen, slen - prelen + 1); + memcpy(p, post, postlen); + } + + return strlen(eucbuf); +} + +int m_convert_zen2han(uchar *sjisbuf) +{ + int i = 0; + + if (sjisbuf[0] == 0x82) { /* Alphabet */ + if (0x60 <= sjisbuf[1] && sjisbuf[1] < 0x60 + 26) /* A-Z */ + return 'A' + sjisbuf[1] - 0x60; + if (0x81 <= sjisbuf[1] && sjisbuf[1] < 0x81 + 26) /* a-z */ + return 'a' + sjisbuf[1] - 0x81; + } + if (sjisbuf[0] == 0x82 && 0x4f <= sjisbuf[1] && sjisbuf[1] <= 0x58) /* 0-9 */ + return '0' + sjisbuf[1] - 0x4f; + + if (sjisbuf[0] == 0x81) { /* 、ュ、エ、ヲ */ + while (zen_han_table[i].c) { + if (zen_han_table[i].zen[1] == sjisbuf[1]) + return zen_han_table[i].c; + i++; + } + } + + return 0; +} + +static int m_lookup_kana_table(uchar kana, int mod) +{ + int i, j; + + j = -1; i = 0; + while (kana_table[i].han_start) { + if (kana_table[i].han_start <= kana && kana <= kana_table[i].han_end) { + j = i; + + if (mod == 0 || (kana_table[i].modifiers & mod) != 0) + break; + } + i++; + } + + return j; +} + +int m_convert_hankana2zenkana(uchar *euc, int len) +{ + int i, j; + uchar mod, c; + + for (i = 0; i < len; i++) { + mod = 0; + + if (euc[i] == 0x8e) { /* non-ascii 、ホネセウムハクサ、ハ、 */ + if (euc[i + 1] == 0xde) { /* コ」、ャ 。ォ 、ハ、 */ + euc[i] = 0xa1; + euc[i + 1] = 0xab; + i++; + } else if (euc[i + 1] == 0xdf) { /* コ」、ャ 。ャ 、ハ、 */ + euc[i] = 0xa1; + euc[i + 1] = 0xac; + i++; + } else { /* ノ眛フ、ホネセウム・ォ・ソ・ォ・ハ、ハ、 */ + if (i + 3 < len) { + if (euc[i + 2] == 0x8e && euc[i + 3] == 0xde) /* シ。、ャ 。ォ 、ハ、 */ + mod = MOD_TEN; + if (euc[i + 2] == 0x8e && euc[i + 3] == 0xdf) /* シ。、ャ 。ャ 、ハ、 */ + mod = MOD_MARU; + } + + if ((j = m_lookup_kana_table(euc[i + 1], mod)) != -1) { + mod &= kana_table[j].modifiers; /* mod 、マ。ヨ、ニ、、ニ、、ハ、キ。ラ、ォ、鬢ホ + ・ェ・ユ・サ・テ・ネ、シィ、ケ */ + c = kana_table[j].zenkaku2_start; + c += (euc[i + 1] - kana_table[j].han_start) * kana_table[j].offset; + c += mod; + + euc[i] = 0xa5; euc[i + 1] = c; + + if (mod) { + memmove(&(euc[i + 2]), &(euc[i + 4]), len - (i + 4) + 1); + len -= 2; + } + + i++; + } + } + } + } + + euc[len] = '\0'; + + return len; +} + +int m_convert_zenkana2zenhira(uchar *src, uchar *dst, int len) +{ + int i = 0; + uchar euc[10]; + + while (i < len) { + dst[i] = 0x82; + dst[i + 1] = src[i + 1] + (0x9f - 0x40); + if (src[i + 1] >= 0x80) + dst[i + 1] -= 1; + + i += 2; + } + + sjis2euc(dst, len, euc, 10); + + return 0; +} + +int m_exist_hankata(uchar *euc) +{ + uchar *p; + + p = euc; + + while (*p) { + if (*p & 0x80) { + if (*p == 0x8e) + return 1; + else + p += 2; + } else { + p++; + } + } + + return 0; +} + +int m_is_zenkata_string(uchar *euc) +{ + uchar *p; + + p = euc; + + while (*p) { + if (*p == 0xa5) + p += 2; + else + return 0; + } + + return 1; +} + +int m_is_hiragana_string(uchar *euc) +{ + uchar *p; + int vu_flag = 0, hira_flag = 0; + + p = euc; + + while (*p) { + if (*p == 0xa4) { + hira_flag = 1; + p += 2; + } else if (*p == 0xa5 && *(p + 1) == 0xf4) { /* ・ 、ホセケ */ + vu_flag = 1; + p += 2; + } else + return 0; + } + + if (vu_flag && hira_flag == 0) + return 0; /* ・ 、タ、ア、ホセケ遉マ・ォ・ソ・ォ・ハ、ネネステヌ */ + + return 1; +} + +int m_convert_zenhira2zenkata(uchar *euc_hira, int slen, uchar *euc_kata) +{ + int i, j; + + for (i = j = 0; i < slen;) { + if (euc_hira[i] == 0xa4) { + if (i + 4 <= slen && euc_hira[i + 1] == 0xa6 && + euc_hira[i + 2] == 0xa1 && euc_hira[i + 3] == 0xab) { + /* 、ヲ。ォ 、ホセケ */ + euc_kata[j] = 0xa5; + euc_kata[j + 1] = 0xf4; + j += 2; + i += 4; + } else { + euc_kata[j] = 0xa5; + euc_kata[j + 1] = euc_hira[i + 1]; + j += 2; + i += 2; + } + } else if (euc_hira[i] & 0x80) { + euc_kata[j++] = euc_hira[i++]; + euc_kata[j++] = euc_hira[i++]; + } else { + euc_kata[j++] = euc_hira[i++]; + } + } + + euc_kata[j] = 0; + + return j; +} + +/* reconvroma.c */ + +typedef struct { + uchar roma[5]; + uchar hira[10]; +} romatbl_t; + +static romatbl_t romatbl[] = { + "a", "、「", + "i", "、、", + "u", "、ヲ", + "e", "、ィ", + "o", "、ェ", + "ka", "、ォ", + "ki", "、ュ", + "ku", "、ッ", + "ke", "、ア", + "ko", "、ウ", + "ga", "、ャ", + "gi", "、ョ", + "gu", "、ー", + "ge", "、イ", + "go", "、エ", + "sa", "、オ", + "si", "、キ", + "su", "、ケ", + "se", "、サ", + "so", "、ス", + "za", "、カ", + "zi", "、ク", + "zu", "、コ", + "ze", "、シ", + "zo", "、セ", + "ta", "、ソ", + "ti", "、チ", + "tu", "、ト", + "te", "、ニ", + "to", "、ネ", + "da", "、タ", + "di", "、ツ", + "du", "、ナ", + "de", "、ヌ", + "do", "、ノ", + "na", "、ハ", + "ni", "、ヒ", + "nu", "、フ", + "ne", "、ヘ", + "no", "、ホ", + "nn", "、", + "ha", "、マ", + "hi", "、メ", + "fu", "、ユ", + "he", "、リ", + "ho", "、ロ", + "ba", "、ミ", + "bi", "、モ", + "bu", "、ヨ", + "be", "、ル", + "bo", "、ワ", + "pa", "、ム", + "pi", "、ヤ", + "pu", "、ラ", + "pe", "、レ", + "po", "、ン", + "ma", "、゙", + "mi", "、゚", + "mu", "、", + "me", "、", + "mo", "、", + "ya", "、", + "yu", "、", + "yo", "、", + "ra", "、", + "ri", "、", + "ru", "、", + "re", "、", + "ro", "、", + "wa", "、", + "wi", "、", + "we", "、", + "wo", "、", + "xa", "、。", + "xi", "、」", + "xu", "、・", + "xe", "、ァ", + "xo", "、ゥ", + "xwa", "、", + "xtu", "、テ", + "xya", "、", + "xyu", "、", + "xyo", "、", +}; + +static char *glyph = +" ,.,./:;?! '` ^~_ -- /\\ | ' \"() []{}<> []{} +- = <> '\" \\$ %#&*@ "; + +#define romatbl_num (sizeof(romatbl) / sizeof(romatbl_t)) + +static int reconvroma_lookup(uchar *hira) +{ + int i; + + for (i = 0; i < romatbl_num; i++) { + if (hira[1] == romatbl[i].hira[1]) + return i; + } + + return -1; +} + +static uchar *reconvroma_katakana2hiragana(uchar *src) +{ + int slen, i, j; + uchar *p; + static buffer_t zbuf; + + slen = strlen(src); + buffer_check(&zbuf, slen * 2); + p = zbuf.buf; + + if (p) { + for (i = j = 0; i < slen;) { + if (src[i] == 0xa5) { /* ・ォ・ソ・ォ・ハ、ホセケ */ + switch (src[i + 1]) { + case 0xf4: /* ・ */ + memcpy(&(p[j]), "、ヲ。ォ", 4); + j += 4; + break; + case 0xf5: + case 0xf6: + memcpy(&(p[j]), "、ォ", 2); + j += 2; + break; + default: + p[j++] = 0xa4; + p[j++] = src[i + 1]; + } + + i += 2; + } else if (src[i] & 0x80) { + p[j++] = src[i++]; + p[j++] = src[i++]; + } else { + p[j++] = src[i++]; + } + } + + p[j] = 0; + } + + return p; +} + +/* + * 、メ、鬢ャ、ハ。「・ォ・ソ・ォ・ハ。「・「・・ユ・。・ル・テ・ネ。「ソサ、ォ、鮖スタョ、オ、、ニノ、゚、。「 + * ・。シ・゙サ、ヒハムエケ、ケ、。」 + * ・「・・ユ・。・ル・テ・ネ、ヒエリ、キ、ニ、マ。「0x80 、 OR 、ケ、。」 + */ + +int m_reconvroma(uchar *src, uchar *dst) +{ + int src_pnt, i, srclen; + uchar *p, buf[2]; + + p = reconvroma_katakana2hiragana(src); /* ・ォ・ソ・ォ・ハ、、メ、鬢ャ、ハ、ヒハムエケ */ + srclen = strlen(p); + dst[0] = '\0'; + src_pnt = 0; + + while (p[src_pnt]) { + switch (p[src_pnt]) { + case 0xa4: /* 、メ、鬢ャ、ハ */ + if (src_pnt + 4 <= srclen && p[src_pnt + 1] == 0xa6 && + p[src_pnt + 2] == 0xa1 && p[src_pnt + 3] == 0xab) { + /* 。ヨ、ヲ。ォ。ラ、ホ、ミ、「、、 */ + strcat(dst, "vu"); + src_pnt += 4; + } else { + if ((i = reconvroma_lookup(&(p[src_pnt]))) != -1) { + strcat(dst, romatbl[i].roma); + src_pnt += 2; + } else { + fprintf(stderr, "UNEXPECTED YOMI %d:%s\n", src_pnt, &(p[src_pnt])); + free(p); + return -1; + } + } + break; + case 0xa1: /* オュケ */ + if (glyph[p[src_pnt + 1] - 0xa1] != ' ') { + buf[0] = glyph[p[src_pnt + 1] - 0xa1]; + buf[1] = 0; + strcat(dst, buf); + src_pnt += 2; + } else { + fprintf(stderr, "UNEXPECTED GLYPH:%d:%s\n", src_pnt, &(p[src_pnt])); + free(p); + return -1; + } + break; + case 0xa3: /* ソサ,・「・・ユ・。・ル・テ・ネ */ + if (0xb0 <= p[src_pnt + 1] && p[src_pnt + 1] <= 0xb9) { + buf[0] = '0' + (p[src_pnt + 1] - 0xb0); + buf[1] = 0; + strcat(dst, buf); + src_pnt += 2; + } else if (0xc1 <= p[src_pnt + 1] && p[src_pnt + 1] <= 0xda) { + buf[0] = ('A' + (p[src_pnt + 1] - 0xc1)) | 0x80; + buf[1] = 0; + strcat(dst, buf); + src_pnt += 2; + } else if (0xe1 <= p[src_pnt + 1] && p[src_pnt + 1] <= 0xfa) { + buf[0] = ('a' + (p[src_pnt + 1] - 0xe1)) | 0x80; + buf[1] = 0; + strcat(dst, buf); + src_pnt += 2; + } else { + fprintf(stderr, "UNEXPECTED ALNUM:%d:%s\n", src_pnt, &(p[src_pnt])); + free(p); + return -1; + } + break; + default: + if ((p[src_pnt] & 0x80) == 0) { + buf[0] = p[src_pnt] | 0x80; + buf[1] = 0; + strcat(dst, buf); + src_pnt++; + } else { + fprintf(stderr, "UNEXPECTED:%d:%s\n", src_pnt, &(p[src_pnt])); + free(p); + return -1; + } + } + } + + return 0; +} + + diff --git a/misc.h b/misc.h new file mode 100755 index 0000000..b23ebbb --- /dev/null +++ b/misc.h @@ -0,0 +1,157 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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. +*/ + +#ifndef __misc_h__ +#define __misc_h__ + +#ifndef TRUE + +#define TRUE 1 +#define FALSE 0 + +#endif + +typedef struct { + size_t size; + char *buf; +} buffer_t; + +#ifndef __uchar_t__ +#define __uchar_t__ +typedef unsigned char uchar; +#endif + +#define ISSJISKANJI1(_c) ((((_c) & 0xff) >= 0x81 && ((_c) & 0xff) <= 0x9f) || \ + (((_c) & 0xff) >= 0xe0 && ((_c) & 0xff) <= 0xfc)) + +#define ISSJISKANA(_c) (((_c) & 0xff) >= 0xa0 && ((_c) & 0xff) <= 0xdf) + + +#define ISSJIS_ZENKAKU_HIRAGANA(_c1,_c2) (((_c1) & 0xff) == 0x82 && \ + ((_c2) & 0xff) >= 0x9f && \ + ((_c2) & 0xff) <= 0xf1) + +#define ISSJIS_ZENKAKU_KATAKANA(_c1,_c2) (((_c1) & 0xff) == 0x83 && \ + ((_c2) & 0xff) >= 0x40 && \ + ((_c2) & 0xff) <= 0x94) + +#define ISSJIS_ZENKAKU_VU(_c1,_c2) (((_c1) & 0xff) == 0x83 && \ + ((_c2) & 0xff) == 0x94) + +#define MYFREE(_p) {if(_p) {free(_p); _p=NULL;} } + + +typedef void (*signalhandler_t)(int); + +int m_daemonize(char *pid_path); + +#ifndef __misc_c__ +extern int m_message_level; +#endif + +#define MSG_DEBUG 0 +#define MSG_NOTICE 1 + +int m_message_init(char *logfilepath); +int m_message_term(); +int m_message_debug(const char *fmt, ...); +int m_message_notice(const char *fmt, ...); + +#define m_msg_dbg m_message_debug +#define m_msg m_message_notice + +int buffer_free(buffer_t *b); +int buffer_check(buffer_t *b, size_t required_size); +int buffer_clear(buffer_t *b); + +void *m_memdup(void *src, size_t n); + +char *m_makepath(char *dir, char *file); +int m_splitpath(char *path, char **dir, char **file); + +char *m_netaddr2ascii(uint netaddr, char *ascii); + +int m_socket_read(int fd, char *ptr, int totalsize); +int m_socket_write(int fd, char *ptr, int totalsize); + +int m_count_canna_mode(int mode); +int m_get_canna_mode(int mode, int n); +int m_count_valid_canna_mode(int mode); + +int cannawc2euc(ushort *src, int srclen, char *dest, int destlen); +int euc2cannawc(char *src, int srclen, ushort *dest, int destlen); +int cannawcstrlen(ushort *ws); +int euc2sjis(uchar *euc, int euclen, uchar *sjis, int sjislen); +int sjis2euc(uchar *sjis, int sjislen, uchar *euc, int euclen); + +int m_replace_string(uchar *eucbuf, char *pre, char *post); +int m_convert_zen2han(uchar *sjisbuf); +int m_convert_hankana2zenkana(uchar *euc, int len); +int m_convert_zenkana2zenhira(uchar *src, uchar *dst, int len); +int m_convert_zenhira2zenkata(uchar *euc_hira, int slen, uchar *euc_kata); + +int m_setup_signal(signalhandler_t handler); +int m_copy_file(char *from, char *to); +int m_copy_file_fp(FILE *from, FILE *to); + +int m_exist_hankata(uchar *euc); +int m_is_zenkata_string(uchar *euc); +int m_is_hiragana_string(uchar *euc); + +int m_reconvroma(uchar *src, uchar *dst); + +/* system() */ + +int m_system_clear(); +int m_system_register_file(int fd); +int m_system(char *command); + +/* タ゚ト・ユ・。・、・ニノ、゚ケ、゚エリソ */ + +int m_conf1_parse(char *line, char **ope_r, char **val_r); +int m_conf_string(char *ope, char *opestr, char *val, char **val_r); +int m_conf_multiple_choice(char *ope, char *opestr, char *val, char **choice, + int choice_n, int case_sensitive); +int m_conf_tof(char *ope, char *opestr, char *val, char *str1, char *str2, + int case_sensitive); +int m_conf_isequal(char *ope, char *opestr, char *val, char *valstr); + +#define M_CONF_YESNO(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "NO","YES",TRUE) + +#define M_CONF_IYESNO(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "NO","YES",FALSE) + +#define M_CONF_ONOFF(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "OFF","ON",TRUE) + +#define M_CONF_IONOFF(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "OFF","ON",FALSE) + +#define M_CONF_TORF(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "FALSE", "ON", TRUE) + +#define M_CONF_ITORF(_ope,_opestr,_val) m_conf_tof((_ope),(_opestr),(_val), \ + "FALSE", "TRUE", FALSE) + + + + + + +#endif diff --git a/missing b/missing new file mode 100755 index 0000000..7789652 --- /dev/null +++ b/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. 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.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..4f58503 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/winimm.c b/winimm.c new file mode 100755 index 0000000..e70b495 --- /dev/null +++ b/winimm.c @@ -0,0 +1,2222 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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 + * ree Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "def.h" +#include "misc.h" +#include "winimm.h" + +#include +extern int errno; +extern void sig_terminate(); + +typedef struct _winimm_t +{ + void *dummy; /* ・タ・゚。シ */ +} winimm_t; + +/* 、ウ、ウ、ヌハンサ、キ、ニ、、、szCompReadStr,szCompStrナ、マ。「、「、ッ、゙、ヌ、簗ムエケテ讀ホ、ケ、ル、ニ、ホセハ、ヌ、「、遙「resize_pause、ヌナモテ讀ォ、鬢ホサ、簔エツホ、ャニ、テ、ニ、、、 */ +typedef struct _context_t +{ + struct _context_t *prev, *next; /* ・ウ・・ニ・ュ・ケ・ネ、ホ・・・ッヘム */ + short context_num; /* ・ウ・・ニ・ュ・ケ・ネネヨケ */ + int client_id; /* ・ッ・鬣、・「・・ネ。ハWnnヘム、ネ、ォATOKヘム、ネ、ォ。ヒ、ホシアハフサメ */ + int fIME; /* クスコ゚、ホニホマ・・ア。シ・、ヒIME、ャ、「、、ォ、ノ、ヲ、ォ */ + HIMC hIMC; /* ・ェ。シ・ラ・、キ、ニ、、、IM、ホ・マ・・ノ・。ハ0、ハ、鬣ッ・。シ・コセツヨ。ヒ */ + + BOOL fOpen; /* ・ェ。シ・ラ・テ讀ォネン、ォ */ + DWORD fdwConversion; /* 、ォ、ハエチ、ホニホマ・筍シ・ノ */ + DWORD fdwSentence; /* 、ォ、ハエチ、ホハムエケ・筍シ・ノ */ + + /* >> ハムエケテ讀ホセツヨハンサヘム */ + ushort* szYomiStr; /* ウー、ォ、鮟リト熙オ、、ソニノ、゚。ハ、ウ、、マCanna、ホ・・、・ノハクサホ。ヒ */ + /* 、マサ゚、皃ニ。「szCompReadStr、チエウム。ヲCanna、ホ・・、・ノハクサ、ヒ、キ、ソ、筅ホ、ニ、、ニ、ェ、ッ */ + LPDWORD dwYomiCls; /* チエウムニノ、゚、ホセハ。ハ・ミ・、・ネテアーフ。ヒ */ + DWORD dwYomiClsLen; /* dwYomiCls、ホトケ、オ */ + + LPWSTR szCompStr; /* クスコ゚、ホハムエケク衞クサホ */ + LPDWORD dwCompCls; /* ハクタ皃ホセハ。ハ・ミ・、・ネテアーフ。ヒ */ + DWORD dwCompClsLen; /* dwCompCls、ホトケ、オ */ + LPBYTE bCompAttr; /* ツータュ、ホセハ */ + DWORD dwCompAttrLen; /* bCompAttr、ホトケ、オ */ + + LPWSTR szCompReadStr; /* クスコ゚、ホハムエケク螟ホニノ、゚。ハ、ノ、ヲ、荀鯤セウム、ヌヘ隍。ヒ */ + LPDWORD dwCompReadCls; /* 。ハ・ミ・、・ネテアーフ。ヒ */ + DWORD dwCompReadClsLen; /* */ + LPBYTE bCompReadAttr; /* */ + DWORD dwCompReadAttrLen; /* */ + /* << ハムエケテ讀ホセツヨハンサヘム */ +} context_t; + +static context_t *cx_top; /* esecannaヘム、ホ・ウ・・ニ・ュ・ケ・ネ、ホ・・ケ・ネ。ハcontext_t。ヒ、ホタ霹ャヘラチヌ、リ、ホ・ン・、・・ソ */ +static client_t *client; /* esecanna、ャサ、テ、ニ、、、・ッ・鬣、・「・・ネ。ハwnnヘム、ホ・筵ク・蝪シ・、ネ、ォ。ヒ、リ、ホ・ン・、・・ソ */ +HWND hWnd_IMM; /* 、ォ、ハエチニーコヘム、ホ・ヲ・」・・ノ・ヲ */ +/* static HIMC DefaultIMMContext; *//* hWnd_IMM、ホ・ヌ・ユ・ゥ・・ネニホマ・ウ・・ニ・ュ・ケ・ネ */ +static short last_context_num; /* クスコ゚、ホ・ウ・・ニ・ュ・ケ・ネネヨケ譯ハ・ウ・・ニ・ュ・ケ・ネ、エ、ネ、ホセツヨ、ホタ゚ト熙ネハムケケヘム。ヒ */ + +static HDESK hdeskCurrent; /* ス魘セツヨ、ホ・ヌ・ケ・ッ・ネ・テ・ラ */ +static HDESK hdesk; /* ・ェ。シ・ラ・、キ、ソ・ヌ・ケ・ッ・ネ・テ・ラ */ +static HWINSTA hwinsta; /* */ +static HWINSTA hwinstaCurrent; /* */ + +static int wm_create_done; /* */ + +#define WW_ERROR16(_buf) { \ + cannaheader_t *he; \ + he = (cannaheader_t *)(_buf); \ + he->datalen = LSBMSB16(2); \ + he->err.e16 = LSBMSB16(-1); \ +} + +#define WW_ERROR8(_buf) { \ + cannaheader_t *he; \ + he = (cannaheader_t *)(_buf); \ + he->datalen = LSBMSB16(1); \ + he->err.e8 = -1; \ +} + +/* kana_table、ォ、 宍 、ウー、キ、ソ、筅ホ */ +#define MOD_TEN 0x01 /* 。ォ 、ャシ。、ヒヘ隍ソセケ,ケ鄲ョ(・ォ + 。ォ= ・ャ)、ケ、、ォ */ +#define MOD_MARU 0x02 /* 。ャ 、ャシ。、ヒヘ隍ソセケ,ケ鄲ョ、ケ、、ォ */ +#define MOD_TM 0x03 /* ・マケヤ、マ, 。ォ 、ネ 。ャ ホセハシ、アノユ、ア、 */ + +/* cannawcs・ミ。シ・ク・逾 */ +struct { + ushort han_start, han_end; + uchar modifiers:4, + offset:4; + ushort zenkaku2_start; +} hira_table[] = +{ +/* han_start, han_end, modifiers, offset, zenkaku2_start */ + {0xa600, 0xa600, 0, 0, 0xf2}, /* 示 */ + {0xa700, 0xab00, 0, 2, 0xa1}, /* 而-辞 */ + {0xac00, 0xae00, 0, 2, 0xe3}, /* 汐-式 */ + {0xaf00, 0xaf00, 0, 0, 0xc3}, /* 識 */ + {0xb100, 0xb500, 0, 2, 0xa2}, /* 竺-七 */ + {0xb600, 0xba00, MOD_TEN, 2, 0xab}, /* 叱-室 */ + {0xbb00, 0xbf00, MOD_TEN, 2, 0xb5}, /* 悉-質 */ + {0xc000, 0xc100, MOD_TEN, 2, 0xbf}, /* 実-蔀 */ + {0xc200, 0xc200, MOD_TEN, 0, 0xc4}, /* 篠 */ + {0xc300, 0xc400, MOD_TEN, 2, 0xc6}, /* 偲-柴 */ + {0xc500, 0xc900, 0, 1, 0xca}, /* 芝-舎 */ + {0xca00, 0xce00, MOD_TM, 3, 0xcf}, /* 写-斜 */ + {0xcf00, 0xd300, 0, 1, 0xde}, /* 煮-謝 */ + {0xd400, 0xd600, 0, 2, 0xe4}, /* 車-蛇 */ + {0xd700, 0xdb00, 0, 1, 0xe9}, /* 邪-杓 */ + {0xdc00, 0xdc00, 0, 0, 0xef}, /* 灼 */ + {0xdd00, 0xdd00, 0, 0, 0xf3}, /* 爵 */ + { 0, 0, 0, 0, 0} +}; + +ushort daku_table[] = +{ + 0xACA4, 0xAEA4, 0xB0A4, 0xB2A4, 0xB4A4, /* 、ャ、ョ、ー、イ、エ */ + 0xB6A4, 0xB8A4, 0xBAA4, 0xBCA4, 0xBEA4, /* 、カ、ク、コ、シ、セ */ + 0xC0A4, 0xC2A4, 0xC5A4, 0xC7A4, 0xC9A4, /* 、タ、ツ、ナ、ヌ、ノ */ + 0xD0A4, 0xD3A4, 0xD6A4, 0xD9A4, 0xDCA4, /* 、ミ、モ、ヨ、ル、ワ */ + 0xD1A4, 0xD4A4, 0xD7A4, 0xDAA4, 0xDDA4, /* 、ム、ヤ、ラ、レ、ン */ + 0 +}; + + +/* + * wrapper functions 、ォ、鮟ネ、、、 ・譯シ・ニ・」・・ニ・」エリソs + */ + +/* ・ウ・・ニ・ュ・ケ・ネエリマ「 */ +/* + mw_switch_context + + サリト熙オ、、ソ・ウ・・ニ・ュ・ケ・ネセハ、クオ、ヒ、ォ、ハエチ、ホセツヨ、タレ、ツリ、ィ、 +*/ +static short mw_switch_context(context_t *cx) +{ + HIMC hIMC = 0; + + if (hWnd_IMM == 0) + return 0; + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC == 0) + return 0; + + /* ハムエケテ讀ホセツヨハンサヘムハムソ、ス魘イス */ + if (cx->szYomiStr != NULL) + MYFREE(cx->szYomiStr); + if (cx->dwYomiCls != NULL) + MYFREE(cx->szYomiStr); + if (cx->szCompStr != NULL) + MYFREE(cx->szCompStr); + if (cx->szCompReadStr != NULL) + MYFREE(cx->szCompReadStr); + if (cx->bCompAttr != NULL) + MYFREE(cx->bCompAttr); + if (cx->dwCompCls != NULL) + MYFREE(cx->dwCompCls); + if (cx->bCompReadAttr != NULL) + MYFREE(cx->bCompReadAttr); + if (cx->dwCompReadCls != NULL) + MYFREE(cx->dwCompReadCls); + cx->dwYomiClsLen = cx->dwCompClsLen = cx->dwCompAttrLen = cx->dwCompReadClsLen = cx->dwCompReadAttrLen = 0; + + ImmReleaseContext(hWnd_IMM, hIMC); + return 1; +} + +/* + mw_new_context + + ソキ、キ、、・ウ・・ニ・ュ・ケ・ネ、ホセハ、コタョ、ケ、 +*/ +static short mw_new_context(int id) +{ + context_t *cx, *new_context; + short cx_num; + + /* ・ウ・・ニ・ュ・ケ・ネ、ホセハ、ホ・皈筵熙ャシ隍、ハ、ォ、テ、ソ、鬣ィ・鬘シ */ + if ((new_context = (context_t *)calloc(1, sizeof(context_t))) == NULL) + return -1; + + /* new_context、・ウ・・ニ・ュ・ケ・ネ、ホ・・ケ・ネ、ヒチネ、゚ケ、 */ + cx = cx_top; + if (cx) + { + while (cx->next) + cx = cx->next; + cx->next = new_context; + new_context->prev = cx; + } else + { + cx_top = new_context; + } + + /* ・・ケ・ネ、ホコヌク蝪ハカ、ホヘラチヌ、ホシ。。ヒ、テオ、キ、ニカ、ホヘラチヌ、ヒクスコ゚、ホ・ッ・鬣、・「・・ネセハ、ヒ荀皃 */ + cx_num = 1; + for (;;) + { + cx = cx_top; + + for (;;) + { + if (cx == NULL) + { + new_context->context_num = cx_num; + new_context->client_id = id; + new_context->fIME = 0; + mw_switch_context(new_context); + return cx_num; + } + + if (cx->context_num == cx_num) + { + cx_num++; + break; + } + + cx = cx->next; + } + } +} + +/* + mw_get_context + + サリト熙オ、、ソ・ウ・・ニ・ュ・ケ・ネネヨケ讀ホ・ウ・・ニ・ュ・ケ・ネセハ、シ霹タ、ケ、 +*/ +static context_t *mw_get_context(short cx_num) +{ + context_t *cx; + + if (cx_num == -1) + return NULL; + + cx = cx_top; + + while (cx) + { + if (cx->context_num == cx_num) + { + if (cx->context_num != last_context_num) + { + mw_switch_context(cx); + last_context_num = cx->context_num; + } + return cx; + } + cx = cx->next; + } + + return NULL; +} + +/* + mw_clear_context + + サリト熙オ、、ソ・ウ・・ニ・ュ・ケ・ネネヨケ讀ホ・ウ・・ニ・ュ・ケ・ネセハ、ホテ豼ネ、・ッ・・「、ケ、 +*/ +static int mw_clear_context(short cx_num) +{ + context_t *cx; + + cx = mw_get_context(cx_num); + + if (cx->szYomiStr != NULL) + MYFREE(cx->szYomiStr); + if (cx->dwYomiCls != NULL) + MYFREE(cx->szYomiStr); + if (cx->szCompStr != NULL) + MYFREE(cx->szCompStr); + if (cx->szCompReadStr != NULL) + MYFREE(cx->szCompReadStr); + if (cx->bCompAttr != NULL) + MYFREE(cx->bCompAttr); + if (cx->dwCompCls != NULL) + MYFREE(cx->dwCompCls); + if (cx->bCompReadAttr != NULL) + MYFREE(cx->bCompReadAttr); + if (cx->dwCompReadCls != NULL) + MYFREE(cx->dwCompReadCls); + cx->dwYomiClsLen = cx->dwCompClsLen = cx->dwCompAttrLen = cx->dwCompReadClsLen = cx->dwCompReadAttrLen = 0; + + return 0; +} + +/* + mw_free_context + + サリト熙オ、、ソ・ウ・・ニ・ュ・ケ・ネネヨケ讀ホ・ウ・・ニ・ュ・ケ・ネセハヒワツホ、ウォハ、ケ、 +*/ +static int mw_free_context(short cx_num) +{ + context_t *cx; + + cx = mw_get_context(cx_num); + mw_clear_context(cx_num); + + if (cx->prev) + cx->prev->next = cx->next; + else + cx_top = cx->next; + if (cx->next) + cx->next->prev = cx->prev; + + free(cx); + + return 0; +} + +/* + * Wnn 、ォ、鮑ニ、ミ、、エリソ + */ + +/* コ、トセ、キ。「、テ、ニ、、、ヲ、ォノャヘラ。ゥ */ +static int mw_ime32_message(char *s) +{ + return 0; +} + +/* + * + */ + +/* + mw_open_imm32 + + 、ォ、ハエチニーコウォサマ + esecanna、ホ・ウ・・ニ・ュ・ケ・ネヒ隍ヒWindows、ホニホマ・ウ・・ニ・ュ・ケ・ネ、コタョ、ケ、 +*/ +static int mw_open_imm32(int id, context_t *cx, char *envname) +{ + HIMC hIMC; + if (hWnd_IMM == 0) + return 0; + + hIMC = ImmGetContext(hWnd_IMM); + + if (hIMC == 0) + return 0; + else + { + /* セツヨ、ホウホヌァ */ + HKL hKL = GetKeyboardLayout(0); + cx->fIME = ImmIsIME(hKL); + if (cx->fIME != 0) + { + ImmGetConversionStatus(hIMC, &(cx->fdwConversion), &(cx->fdwSentence)); + cx->fOpen = ImmGetOpenStatus(hIMC); + } + ImmReleaseContext(hWnd_IMM, hIMC); + } + return 1; +} + +/* + mw_close_imm32 + + ・ッ・。シ・コ、ケ、。ハニホマ・ウ・・ニ・ュ・ケ・ネ、ヌヒエ、ケ、。ヒ +*/ +static int mw_close_imm32(context_t *cx) +{ + if (cx->fIME) + { + HIMC hIMC; + if (hWnd_IMM == 0) + return 0; + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC == 0) + return 0; + + /* ・ッ・。シ・コ、ケ、 */ + if (ImmGetOpenStatus(hIMC) == TRUE) + { + ImmSetOpenStatus(hIMC, FALSE); + cx->fOpen = FALSE; + } + ImmReleaseContext(hWnd_IMM, hIMC); + } + return 1; +} + +/* + * wcs2ucs() - 、ォ、、ハ、ヌサネ、、、・・、・ノ・ュ・罕鬣ッ・ソ、ォ、餠CS-2、リ + * len、マハクサソ。」、ネ、熙「、ィ、コcannawc2euc()、ネeuc2sjis()、サネ、テ、ニス、、、ニ、ェ、ッ、ア、ノ。「 + * ク螟ヌークト、ヒ、キ、隍ヲ + */ +static LPWSTR mw_wcs2ucs(ushort *src) +{ + int wclen, euclen; + char *workeuc; + LPWSTR dst; + static buffer_t zbuf; + iconv_t cd = (iconv_t)-1; + size_t status, inbytesleft, outbytesleft; + char *inbuf, *outbuf; + + /* ナモテ讀ヌサネヘム、ケ、eucヘム、ホ・ミ・テ・ユ・。ウホハン */ + wclen = cannawcstrlen(src); + workeuc = (char*)calloc(1, wclen * 3); + + /* ーテカeuc、リ */ + euclen = cannawc2euc(src, wclen, workeuc, wclen * 3); /* cannawc2euc()、ホsrc、ホトケ、オ、マハクサソ。「dest、ホトケ、オ、マ・ミ・、・ネソ。「フ皃テヘ、マ・ミ・、・ネソ */ + + outbytesleft = (wclen + 1) * 2; + buffer_check(&zbuf, outbytesleft); /* UCS、マーハクサ2byte */ + dst = (LPWSTR)(zbuf.buf); + + /* euc、ォ、餠CS2、リ */ + cd = iconv_open("UCS-2-INTERNAL", "EUC-JP"); + if (cd == (iconv_t)-1) + { + dst = NULL; + goto end_exit; + } + + inbytesleft = euclen; + inbuf = workeuc; + outbuf = (char*)dst; + status = iconv(cd, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); + if (status == (size_t)-1) + { + dst = NULL; + goto end_exit; + } + + dst[(((wclen + 1) * 2) - outbytesleft) / 2] = L'\0'; +end_exit: + free(workeuc); + if (cd != (iconv_t)-1) + iconv_close(cd); + return dst; +} + +/* + * ucs2wcs() -UCS-2、ォ、 、ォ、、ハ、ヌサネ、、、・・、・ノ・ュ・罕鬣ッ・ソ、リ + * + * srclen: ハクサソ + */ +static ushort *mw_ucs2wcs(LPCWSTR src, int srclen) +{ + int euclen; + char *workeuc; + ushort *dst; + static buffer_t zbuf; + iconv_t cd = (iconv_t)-1; + size_t inbytesleft, status, outbytesleft; + uchar *inbuf; + char *outbuf; + int i; + ushort *workucs; + + /* ナモテ讀ヌサネヘム、ケ、eucヘム、ホ・ミ・テ・ユ・。ウホハン */ + workeuc = (char*)calloc(1, srclen * 3 + 1); + + /* ナモテ讀ヌサネヘム、ケ、UCSヘム、ホ・ミ・テ・ユ・。ウホハン */ + workucs = (ushort*)calloc(1, srclen * 2); + + /* UCS-2、ォ、魏テカeuc、リ */ + cd = iconv_open("EUC-JP", "UCS-2-INTERNAL"); + if (cd == (iconv_t)-1) + { + dst = NULL; + goto end_exit; + } + + /* Windowsクヌヘュ、ホ・ウ。シ・ノ、・ム・テ・チ、ケ、 */ + for (i=0; i 0) + { + status = iconv(cd, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); + if (status == (size_t)-1) + { + /* ノスクス、ヌ、ュ、ハ、、ハクサ、ャ、ュ、ソ、ホ、ヌ'。ゥ'、ヌヒ荀皃 */ + *outbuf++ = 0xA1; + *outbuf++ = 0xA9; + inbuf += 2; + inbytesleft -= 2; + outbytesleft -= 2; + } + } + + workeuc[(srclen * 3 + 1) - outbytesleft] = '\0'; + euclen = strlen(workeuc); + + buffer_check(&zbuf, srclen * 2 + 2); + dst = (ushort *)(zbuf.buf); + + /* euc、ォ、馗annawc、リ */ + euc2cannawc(workeuc, euclen, dst, srclen * 2 + 2); /* euc2cannawc()、ホsrc、ホトケ、オ、マ・ミ・、・ネソ。「dest、ホトケ、オ、マハクサソ。「フ皃テヘ、マハクサソ */ + +end_exit: + free(workeuc); + if (cd != (iconv_t)-1) + iconv_close(cd); + return dst; +} + +/* + * wcs2sjis() - 、ォ、、ハ、ヌサネ、、、・・、・ノ・ュ・罕鬣ッ・ソ、ォ、駸jis、リ + * len、マハクサソ。」、ネ、熙「、ィ、コcannawc2euc()、ネeuc2sjis()、サネ、テ、ニス、、、ニ、ェ、ッ、ア、ノ。「 + * ク螟ヌークト、ヒ、キ、隍ヲ + */ +static LPSTR mw_wcs2sjis(ushort *src) +{ + int wclen, euclen; + char *workeuc; + LPSTR dst; + static buffer_t zbuf; + + /* ナモテ讀ヌサネヘム、ケ、eucヘム、ホ・ミ・テ・ユ・。ウホハン */ + wclen = cannawcstrlen(src); + workeuc = (char*)calloc(1, wclen * 3); + + /* ーテカeuc、リ */ + euclen = cannawc2euc(src, wclen, workeuc, wclen * 3); /* cannawc2euc()、ホsrc、ホトケ、オ、マハクサソ。「dest、ホトケ、オ、マ・ミ・、・ネソ。「フ皃テヘ、マ・ミ・、・ネソ */ + + buffer_check(&zbuf, wclen * 2 + 1); /* sjis、マdbcs、タ、ォ、鮗ヌツ2byte */ + dst = (LPSTR)(zbuf.buf); + + /* euc、ォ、駸jis、リ */ + euc2sjis(workeuc, euclen, dst, wclen * 2 + 1); /* euc2sjis()、ホsrc,dest、ネ、筅ヒトケ、オ、マ・ミ・、・ネソ。「フ皃テヘ、マ・ミ・、・ネソ */ + + free(workeuc); + + return dst; +} + +/* + * sjis2wcs() -sjis、ォ、 、ォ、、ハ、ヌサネ、、、・・、・ノ・ュ・罕鬣ッ・ソ、リ + */ +static ushort *mw_sjis2wcs(LPCSTR src, int srclen) +{ +/* int srclen, euclen; */ + int euclen; + char *workeuc; + ushort *dst; + static buffer_t zbuf; + + /* ナモテ讀ヌサネヘム、ケ、eucヘム、ホ・ミ・テ・ユ・。ウホハン */ + workeuc = (char*)calloc(1, srclen * 3); + + /* sjis、ォ、魏テカeuc、リ */ + euclen = sjis2euc((uchar*)src, srclen, workeuc, srclen * 3); + + buffer_check(&zbuf, srclen * 2 + 2); + dst = (ushort *)(zbuf.buf); + + /* euc、ォ、馗annawc、リ */ + euc2cannawc(workeuc, euclen, dst, srclen * 2 + 2); /* euc2cannawc()、ホsrc、ホトケ、オ、マ・ミ・、・ネソ。「dest、ホトケ、オ、マハクサソ。「フ皃テヘ、マハクサソ */ + + free(workeuc); + + return dst; +} + +/* + * mw_after_conversion() - ハムエケク蟶ニ、ヨ。」サリトハクタ皃ォ、鬢ホウニハクタ皃ホコヌヘ・タ雕ハ荀ニタ、。」 + * + * ーソ - bun サリトハクタ + * フ皃テヘ - nbun ハクタ眩 + * len_r + * + */ +static ushort *mw_after_conversion(context_t *cx, HIMC hIMC, int *nbun, int bun, int *len_r) +{ + BOOL nRet = TRUE; + long BufLen; + ushort *ret; + + /* チーイ、゙、ヌ、ホク蟒マヒ */ + mw_clear_context(cx->context_num); + + /* ハクタ皺フテヨ、ホセハ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPCLAUSE, NULL, 0); + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->dwCompCls = (LPDWORD)calloc(1, BufLen); + cx->dwCompClsLen = ImmGetCompositionStringW(hIMC, GCS_COMPCLAUSE, cx->dwCompCls, BufLen); + *nbun = cx->dwCompClsLen / sizeof(DWORD) - 1; /* ・ミ・、・ネ・オ・、・コ、ヌロホ、ホヘラチヌソ、ヒハムエケ */ + } + + /* ハムエケク衞クサホシ霹タ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0); /* ハムエケク蠑霹タ */ + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->szCompStr = (LPWSTR)calloc(1, BufLen + 1); + ImmGetCompositionStringW(hIMC, GCS_COMPSTR, cx->szCompStr, BufLen + 1); + } + + /* ニノ、゚ハクサホシ霹タ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPREADSTR, NULL, 0); + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->szCompReadStr = (LPWSTR)calloc(1, BufLen + 1); + ImmGetCompositionStringW(hIMC, GCS_COMPREADSTR, cx->szCompReadStr, BufLen + 1); + } + + /* ハクタ眥ータュ、ホセハ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0); + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->bCompAttr = (LPBYTE)calloc(1, BufLen); + cx->dwCompAttrLen = ImmGetCompositionStringW(hIMC,GCS_COMPATTR,cx->bCompAttr,BufLen); + } + + /* ニノ、゚ハクタ皃ホセハ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPREADCLAUSE, NULL, 0); + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->dwCompReadCls = (LPDWORD)calloc(1, BufLen); + cx->dwCompReadClsLen = ImmGetCompositionStringW(hIMC,GCS_COMPREADCLAUSE,cx->dwCompReadCls,BufLen); + } + + /* ニノ、゚ツータュ、ホセハ */ + BufLen = ImmGetCompositionStringW(hIMC, GCS_COMPREADATTR, NULL, 0); + if ((BufLen == IMM_ERROR_NODATA) || (BufLen == IMM_ERROR_GENERAL) || (BufLen == 0)) + { + nRet = FALSE; + goto end_exit; + } else + { + cx->bCompReadAttr = (LPBYTE)calloc(1, BufLen); + cx->dwCompReadAttrLen = ImmGetCompositionStringW(hIMC,GCS_COMPREADATTR,cx->bCompReadAttr,BufLen); + } + +end_exit: + if (nRet == FALSE) + { /* ハムエケ、ヒシコヌヤ、キ、ソ、隍ヲ、ハ、ホ、ヌク蟒マヒ */ + mw_clear_context(cx->context_num); + ret = NULL; + *len_r = 0; + } else + { /* タョク、キ、ソ、ホ、ヌcannawc、コ、テ、ニスェホサ */ + ushort *workp; + int worklen; + int i; + static buffer_t zbuf; + + /* 、゙、コハクサソ、ソ、ィ、 */ + workp = mw_ucs2wcs(&(cx->szCompStr[cx->dwCompCls[bun]]), wcslen(&(cx->szCompStr[cx->dwCompCls[bun]]))); + if (workp == NULL) + { + mw_clear_context(cx->context_num); + ret = NULL; + *len_r = 0; + goto end_exit_2; + } + worklen = cannawcstrlen(workp); + + /* ノャヘラ、ネ、ハ、・ミ・テ・ユ・。、ウホハン */ + buffer_check(&zbuf, (worklen + *nbun + 1) * 2); /* ハクサ。ワハクタ盒ヨ、ホ・ケ・レ。シ・ケ。ワ・ソ。シ・゚・ヘ。シ・ネ */ + ret = (ushort *)(zbuf.buf); + memset((LPVOID)ret, 0, (worklen + *nbun + 1) * 2); + + /* ハクタ皃エ、ネ、ヒsjis->cannawcハムエケ、ケ、 */ + *len_r = 0; + + for (i=bun; i<*nbun; i++) + { + workp = mw_ucs2wcs(&(cx->szCompStr[cx->dwCompCls[i]]), cx->dwCompCls[i+1] - cx->dwCompCls[i]); + if (workp == NULL) + { + mw_clear_context(cx->context_num); + ret = NULL; + *len_r = 0; + goto end_exit_2; + } + worklen = cannawcstrlen(workp); + memcpy(ret, workp, worklen * 2); + *len_r += (worklen + 1); + ret += (worklen + 1); + } + + /* コヌク螟ヒフ皃テヘ、ハクサホ、ホタ霹ャ、ヒ、ケ、 */ + ret = (ushort *)(zbuf.buf); + } +end_exit_2: + return ret; +} + +/* + * mw_set_target_clause() + * + * サリト熙オ、、ソハクタ皃ハムエケツミセンハクタ皃ヒ、ケ、 + * + * フ皃テヘ。ァ シコヌヤ: -1 タョク: クスコ゚、ホハクタ睚ヨケ + * + */ +static int mw_set_target_clause(context_t *cx, HIMC hIMC, int bun_no) +{ + int fRet = 0, CurClause = -1; + UINT uClause, uMaxClause, uCnt, uCntRead; + DWORD i, j; + BOOL fAttrOK = FALSE, fAttrReadOK = FALSE; + BYTE bAt; + +/* >> クスコ゚、ホハムエケツミセン、ホハクタ皃ャサリト熙オ、、ソハクタ皃ネーテラ、ケ、、ォ。ゥ */ + uMaxClause = (UINT)(cx->dwCompClsLen / sizeof(DWORD)) - 1; + if (uMaxClause <= 0) + { + return -1; /* クスコ゚ハムエケテ讀ホハクサホ、マフオ、、 */ + } + + for (CurClause = 0; CurClause < (int)uMaxClause; CurClause++) + { + if ((cx->bCompAttr[cx->dwCompCls[CurClause]] == ATTR_TARGET_CONVERTED) || + (cx->bCompAttr[cx->dwCompCls[CurClause]] == ATTR_TARGET_NOTCONVERTED)) + break; + } + + if (CurClause == -1) + { + return -1; /* ハムエケツミセン、ホハクタ皃ャフオ、、、ホ、マツソハャ・ィ・鬘シ、タ、、ヲ */ + } +/* << クスコ゚、ホハムエケツミセン、ホハクタ皃ャサリト熙オ、、ソハクタ皃ネーテラ、ケ、、ォ。ゥ */ +/* >> クスコ゚、ホハムエケツミセン、ホハクタ皃サリト熙オ、、ソハクタ皃ヒーワニー */ + if (CurClause != bun_no) + { + uMaxClause = (cx->dwCompClsLen / sizeof(DWORD)) - 1; + uClause = bun_no; + uCnt = 0; + if (uClause < uMaxClause) + { + for (i=0; i < uMaxClause; i++) + { + if (i == uClause) + { + switch (cx->bCompAttr[cx->dwCompCls[i]]) + { + case ATTR_INPUT: + bAt = ATTR_TARGET_NOTCONVERTED; + break; + case ATTR_CONVERTED: + bAt = ATTR_TARGET_CONVERTED; + break; + default: + bAt = cx->bCompAttr[cx->dwCompCls[i]]; + break; + } + } else + { + switch (cx->bCompAttr[cx->dwCompCls[i]]) + { + case ATTR_TARGET_CONVERTED: + bAt = ATTR_CONVERTED; + break; + case ATTR_TARGET_NOTCONVERTED: + bAt = ATTR_INPUT; + break; + default: + bAt = cx->bCompAttr[cx->dwCompCls[i]]; + break; + } + } + + for (j = 0; j < (cx->dwCompCls[i+1] - cx->dwCompCls[i]); j++) + { + cx->bCompAttr[uCnt++] = bAt; + } + } + fAttrOK = TRUE; + } + + uCntRead = 0; + + if (uClause < uMaxClause) + { + for (i=0; i < uMaxClause; i++) + { + if (i == uClause) + { + switch (cx->bCompReadAttr[cx->dwCompReadCls[i]]) + { + case ATTR_INPUT: + bAt = ATTR_TARGET_NOTCONVERTED; + break; + case ATTR_CONVERTED: + bAt = ATTR_TARGET_CONVERTED; + break; + default: + bAt = cx->bCompReadAttr[cx->dwCompReadCls[i]]; + break; + } + } else + { + switch (cx->bCompReadAttr[cx->dwCompReadCls[i]]) + { + case ATTR_TARGET_CONVERTED: + bAt = ATTR_CONVERTED; + break; + case ATTR_TARGET_NOTCONVERTED: + bAt = ATTR_INPUT; + break; + default: + bAt = cx->bCompReadAttr[cx->dwCompReadCls[i]]; + break; + } + } + + for (j = 0; j < (cx->dwCompReadCls[i+1] - cx->dwCompReadCls[i]); j++) + { + cx->bCompReadAttr[uCntRead++] = bAt; + } + } + fAttrReadOK = TRUE; + } + + if (fAttrReadOK && fAttrOK) + { + fRet = ImmSetCompositionStringW(hIMC,SCS_CHANGEATTR,cx->bCompAttr,uCnt,cx->bCompReadAttr,uCntRead); + if (fRet == FALSE) + { + return -1; + } + } + } +/* << クスコ゚、ホハムエケツミセン、ホハクタ皃サリト熙オ、、ソハクタ皃ヒーワニー */ + + return CurClause; +} + + +/* + * mw_lookup_hira_table() - + * + */ +/* cannawc・ミ。シ・ク・逾 */ +static int mw_lookup_hira_table(ushort kana, int mod) +{ + int i, j; + + j = -1; i = 0; + while (hira_table[i].han_start) + { + if (hira_table[i].han_start <= kana && kana <= hira_table[i].han_end) + { + j = i; + + if (mod == 0 || (hira_table[i].modifiers & mod) != 0) + break; + } + i++; + } + + return j; +} + +/* + * mw_convert_hankana2zenhira() - + * + * cannawc 、ホネセウム・ォ・ソ・ォ・ハ、ォ、鮹エウム、メ、鬢ャ、ハ、リハムエケ、ケ、 + * + */ +static int mw_convert_hankana2zenhira(ushort *wcs, int len) +{ + int i, j; + uchar mod, c; + ushort c1, c2; + for (i = 0; i < len; i++) + { + mod = 0; + if ((wcs[i] & 0x8000) == 0x8000) + { + if ((wcs[i] & 0xFF00) == 0xDE00) + { /* 。ォ */ + wcs[i] = 0xABA1; + } else if ((wcs[i] & 0xFF00) == 0xDF00) + { /* 。ャ */ + wcs[i] = 0xACA1; + } else + { + if (i + 1 < len) + { + if ((wcs[i + 1] & 0xFF00) == 0xDE00) + mod = MOD_TEN; + if ((wcs[i + 1] & 0xFF00) == 0xDF00) + mod = MOD_MARU; + } + + if ((j = mw_lookup_hira_table((wcs[i] & 0xFF00), mod)) != -1) + { + mod &= hira_table[j].modifiers; + c = hira_table[j].zenkaku2_start; + c1 = (wcs[i] & 0xFF00) >> 8; + c2 = (hira_table[j].han_start & 0xFF00) >> 8; + c += (c1 - c2) * hira_table[j].offset; + c += mod; + + wcs[i] = 0x00a4 + (((ushort)c) << 8); + + if (mod) + { + memmove(&(wcs[i + 1]), &(wcs[i + 2]), (len - (i + 1) + 1) * 2); + len --; + } + } + } + } + } + + wcs[len] = '\0'; + + return len; +} + +/* + * mw_get_yomi() - サリト熙オ、、ソハクタ皃ホニノ、゚、シ霹タ、ケ、。」 + * Windows、ホニノ、゚、マネセウム・ォ・ハ、ヌニ、テ、ニ、、、、隍ヲ、ハ、ホ、ヌ。「、ス、、チエウム、ヒトセ、キ、ニ、荀。」 + * + * len_r: ハクサソ + * + * フ皃、ホ、マCanna・・、・ノハクサ + */ + +static ushort *mw_get_yomi(context_t *cx, int bun_no, int *len_r) +{ +/* cannawc・ミ。シ・ク・逾 */ + ushort *ret = NULL; + int len; + static buffer_t zbuf; + ushort *workp; + DWORD i; + + DWORD uMaxClause = (cx->dwCompReadClsLen / sizeof(DWORD)) - 1; + + if (bun_no < uMaxClause) + { + len = cx->dwCompReadCls[bun_no + 1] - cx->dwCompReadCls[bun_no]; + + buffer_check(&zbuf, (len + 1) * 2); + ret = (ushort *)(zbuf.buf); + workp = mw_ucs2wcs(&(cx->szCompReadStr[cx->dwCompReadCls[bun_no]]), len); + mw_convert_hankana2zenhira(workp, len + 1); + memcpy(ret, workp, (len + 1) * 2); + *len_r = cannawcstrlen(ret); + } + + if (ret == NULL) + { /* フオ、ォ、テ、ソ。ヲ。ヲ。ヲ */ + *len_r = 0; + } + + return ret; +} + +/* + * mw_get_yomi_2() - サリト熙オ、、ソハクタ *ーハケ゚* 、ホニノ、゚、シ霹タ、ケ、。」 + * + * len_r: ハクサソ + * + * フ皃、ホ、マCanna・・、・ノハクサ + */ + +static ushort *mw_get_yomi_2(context_t *cx, int bun_no, int *len_r) +{ +/* cannawc・ミ。シ・ク・逾 */ + ushort *ret = NULL; + int len; + static buffer_t zbuf; + ushort *workp; + DWORD i; + + DWORD uMaxClause = (cx->dwCompReadClsLen / sizeof(DWORD)) - 1; + if (bun_no < uMaxClause) + { + len = cx->dwCompReadCls[uMaxClause] - cx->dwCompReadCls[bun_no]; + + buffer_check(&zbuf, (len + 1) * 2); + ret = (ushort *)(zbuf.buf); + workp = mw_ucs2wcs(&(cx->szCompReadStr[cx->dwCompReadCls[bun_no]]), len); + mw_convert_hankana2zenhira(workp, len + 1); + memcpy(ret, workp, (len + 1) * 2); + *len_r = cannawcstrlen(ret); + } + + if (ret == NULL) + { /* フオ、ォ、テ、ソ。ヲ。ヲ。ヲ */ + *len_r = 0; + } + + return ret; +} + +/* + + +*/ +LRESULT CALLBACK mw_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { +/* + case WM_INITMENU: + EnableMenuItem((HMENU)wParam, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); + return 0; +*/ + case WM_IME_SETCONTEXT: +m_msg_dbg("WM_IME_SETCONTEXT\n"); + lParam &= ~ISC_SHOWUICANDIDATEWINDOW; + return (DefWindowProc(hWnd, uMsg, wParam, lParam)); + + case WM_IME_COMPOSITION: +m_msg_dbg("WM_IME_COMPOSITION\n"); + /* MS、ホ・オ・・ラ・、マスヲ、テ、ニ、ハ、、、ア、ノ、、、、、ホ、ォ、ハ。ヲ。ヲ。ヲ */ + /* ヒワナ、マ、ウ、、ャ。「Imm、ホエーホサトフテホ、ホ、マ、コ、ハ、、タ、ア、ノ。「 */ + /* API、サネ、テ、ニシツケヤ、ケ、、ネ、ュ、マ、、、鬢ハ、、、ホ、ォ、ハ。ゥ */ + return (DefWindowProc(hWnd, uMsg, wParam, lParam)); + + case WM_CREATE: +m_msg_dbg("WM_CREATE\n"); + wm_create_done = 1; + return 0; + + case WM_QUERYENDSESSION: +m_msg_dbg("WM_QUERYENDSESSION\n"); + return TRUE; + + case WM_CLOSE: + case WM_ENDSESSION: /* windows、ホスェホササ、ヒ・ス・ア・テ・ネ、コス、ケ、 */ +m_msg_dbg("WM_CLOSE / WM_ENDSESSION\n"); + sig_terminate(); + return 0; + + case WM_DESTROY: +m_msg_dbg("WM_DESTROY\n"); + PostQuitMessage (0); + return 0; + + case WM_ACTIVATE: +m_msg_dbg("WM_ACTIVATE\n"); + switch(wParam) + { + case WA_INACTIVE: +m_msg_dbg(" WA_INACTIVE\n"); +#if 0 + /* 、ノ、ヲ、稱nactive、ヒ、ハ、、ネ、ォ、ハエチ、ャスミヘ隍ハ、ッ、ハ、、ホ、ヌニ、、。」 */ + if (SetActiveWindow(hWnd_IMM) == NULL) + m_msg("Can't activate\n"); +#endif + break; + case WA_ACTIVE: +m_msg_dbg(" WA_ACTIVE\n"); + break; + case WA_CLICKACTIVE: +m_msg_dbg(" WA_CLICKACTIVE\n"); + break; + default: +m_msg_dbg(" OTHER\n"); + break; + } + return 0; + + case WM_IME_NOTIFY: + { + switch (wParam) + { + case IMN_OPENSTATUSWINDOW: +m_msg_dbg("IMN_OPENSTATUSWINDOW\n"); + break; + case IMN_CLOSESTATUSWINDOW: +m_msg_dbg("IMN_CLOSESTATUSWINDOW\n"); +#if 1 + /* 、ノ、ヲ、稱nactive、ヒ、ハ、、ネIMN_CLOSESTATUSWINDOW、ャヘ隍ニ */ + /* 、ォ、ハエチ、ャスミヘ隍ハ、ッ、ハ、、ホ、ヌニ、、。」 */ + if (SetActiveWindow(hWnd_IMM) == NULL) + m_msg_dbg("Can't activate\n"); +#endif + break; + case IMN_SETOPENSTATUS: +m_msg_dbg("IMN_SETOPENSTATUS\n"); + break; + case IMN_SETCONVERSIONMODE: +m_msg_dbg("IMN_SETCONVERSIONMODE\n"); + break; + case IMN_OPENCANDIDATE: +m_msg_dbg("IMN_OPENCANDIDATE\n"); + break; + case IMN_CHANGECANDIDATE: +m_msg_dbg("IMN_CHANGECANDIDATE\n"); + break; + case IMN_CLOSECANDIDATE: +m_msg_dbg("IMN_CLOSECANDIDATE\n"); + break; + case IMN_GUIDELINE: +m_msg_dbg("IMN_GUIDELINE\n"); + break; + default: +m_msg_dbg("WM_IME_NOTIFY OTHER: %lx\n", wParam); + break; + } + } + break; + + case WM_CANNA_FINALIZE : +m_msg_dbg("WM_CANNA_FINALIZE\n"); + return imm32wrapper_finalize((int)wParam, (buffer_t *)lParam); + case WM_CANNA_CREATE_CONTEXT : +m_msg_dbg("WM_CANNA_CREATE_CONTEXT\n"); + return imm32wrapper_create_context((int)wParam, (buffer_t *)lParam); + case WM_CANNA_DUPLICATE_CONTEXT : +m_msg_dbg("WM_CANNA_DUPLICATE_CONTEXT\n"); + return imm32wrapper_duplicate_context((int)wParam, (buffer_t *)lParam); + case WM_CANNA_CLOSE_CONTEXT : +m_msg_dbg("WM_CANNA_CLOSE_CONTEXT\n"); + return imm32wrapper_close_context((int)wParam, (buffer_t *)lParam); + case WM_CANNA_DEFINE_WORD : +m_msg_dbg("WM_CANNA_DEFINE_WORD\n"); + return imm32wrapper_define_word((int)wParam, (buffer_t *)lParam); + case WM_CANNA_DELETE_WORD : +m_msg_dbg("WM_CANNA_DELETE_WORD\n"); + return imm32wrapper_delete_word((int)wParam, (buffer_t *)lParam); + case WM_CANNA_BEGIN_CONVERT : +m_msg_dbg("WM_CANNA_BEGIN_CONVERT\n"); + return imm32wrapper_begin_convert((int)wParam, (buffer_t *)lParam); + case WM_CANNA_END_CONVERT : +m_msg_dbg("WM_CANNA_END_CONVERT\n"); + return imm32wrapper_end_convert((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_CANDIDACY_LIST : +m_msg_dbg("WM_CANNA_GET_CANDIDACY_LIST\n"); + return imm32wrapper_get_candidacy_list((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_YOMI : +m_msg_dbg("WM_CANNA_GET_YOMI\n"); + return imm32wrapper_get_yomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_SUBST_YOMI : +m_msg_dbg("WM_CANNA_SUBST_YOMI\n"); + return imm32wrapper_subst_yomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_STORE_YOMI : +m_msg_dbg("WM_CANNA_STORE_YOMI\n"); + return imm32wrapper_store_yomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_STORE_RANGE : +m_msg_dbg("WM_CANNA_STORE_RANGE\n"); + return imm32wrapper_store_range((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_LASTYOMI : +m_msg_dbg("WM_CANNA_GET_LASTYOMI\n"); + return imm32wrapper_get_lastyomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_FLUSH_YOMI : +m_msg_dbg("WM_CANNA_FLUSH_YOMI\n"); + return imm32wrapper_flush_yomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_REMOVE_YOMI : +m_msg_dbg("WM_CANNA_REMOVE_YOMI\n"); + return imm32wrapper_remove_yomi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_SIMPLEKANJI : +m_msg_dbg("WM_CANNA_GET_SIMPLEKANJI\n"); + return imm32wrapper_get_simplekanji((int)wParam, (buffer_t *)lParam); + case WM_CANNA_RESIZE_PAUSE : +m_msg_dbg("WM_CANNA_RESIZE_PAUSE\n"); + return imm32wrapper_resize_pause((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_HINSHI : +m_msg_dbg("WM_CANNA_GET_HINSHI\n"); + return imm32wrapper_get_hinshi((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_LEX : +m_msg_dbg("WM_CANNA_GET_LEX\n"); + return imm32wrapper_get_lex((int)wParam, (buffer_t *)lParam); + case WM_CANNA_GET_STATUS : +m_msg_dbg("WM_CANNA_GET_STATUS\n"); + return imm32wrapper_get_status((int)wParam, (buffer_t *)lParam); + case WM_CANNA_SET_LOCALE : +m_msg_dbg("WM_CANNA_SET_LOCALE\n"); + return imm32wrapper_set_locale((int)wParam, (buffer_t *)lParam); + case WM_CANNA_AUTO_CONVERT : +m_msg_dbg("WM_CANNA_AUTO_CONVERT\n"); + return imm32wrapper_auto_convert((int)wParam, (buffer_t *)lParam); + + case WM_CANNA_INITIALIZE : +m_msg_dbg("WM_CANNA_INITIALIZE\n"); + return imm32wrapper_initialize((int)wParam, (char *)lParam); + case WM_CANNA_INIT_ROOTCLIENT : +m_msg_dbg("WM_CANNA_INIT_ROOTCLIENT\n"); + return imm32wrapper_init_rootclient(); + case WM_CANNA_END_CLIENT : +m_msg_dbg("WM_CANNA_END_CLIENT\n"); + return imm32wrapper_end_client((int)wParam); + case WM_CANNA_END_ROOTCLIENT : +m_msg_dbg("WM_CANNA_END_ROOTCLIENT\n"); + return imm32wrapper_end_rootclient(); + case WM_CANNA_CLEAR_CLIENT_DATA : +m_msg_dbg("WM_CANNA_CLEAR_CLIENT_DATA\n"); + return imm32wrapper_clear_client_data((int)wParam); + + default: +m_msg_dbg("WM_ othe Message: 0x%lx\n", uMsg); + return (DefWindowProc(hWnd, uMsg, wParam, lParam)); + } + return 0L; +} + +/* + + +*/ +static BOOL mw_RegIMMWindow(void) +{ + WNDCLASS wc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = mw_WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = (struct HINSTANCE__ *)GetCurrentProcess(); /* 、ウ、、ヌ。ノオシサ。ノ・マ・・ノ・、ャシ隍、、鬢キ、、 */ + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "WinIMM32"; + return (RegisterClass(&wc)); +} + +/* + + +*/ +void mw_IMMWindowMsgLoop(void* pParam) /* pParam == NULL */ +{ + MSG msg; + HWND hwnd; + hwnd = CreateWindow("WinIMM32", "", WS_POPUPWINDOW | WS_SYSMENU, 0,0,0,0, NULL, 0, 0, 0); /* HWND_MESSAGE・ヲ・」・・ノ・ヲ、マニホマ、シ、アノユ、ア、ハ、、、鬢キ、、。ハImmXXXキマ、ホAPI、シ、アノユ、ア、ハ、、。ヒ */ + if (hwnd == 0) + { + wm_create_done = 1; + return; + } else + { +/* *((HWND *)pParam) = hwnd;*/ + hWnd_IMM = hwnd; + } + + SetWindowText(hwnd, "Canna2IMM32"); + ShowWindow(hwnd, SW_SHOW); /* 、ノ、ヲ、荀餞howWindow()、キ、ハ、、、ネImmSetCompositionString()、ヌ、ュ、ハ、、、鬢キ、、 */ + + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + +/* + * ウー、ヒクウォ、ケ、エリソs + */ +/* + mw_InitWindow + +*/ +int mw_InitWindow(void) +{ + + hWnd_IMM = 0; + + /* 、゙、コ・タ・゚。シ、ホ・ヲ・」・・ノ・ヲヘム、ホ・ッ・鬣ケ、ナミマソ */ + if (mw_RegIMMWindow() == 0) + { + return -1; + } + + /* ・皈テ・サ。シ・ク・。シ・ラヘム、ホ・ケ・・テ・ノコタョ */ + { + pthread_t thread; + pthread_attr_t attr_thread; + int i; + + wm_create_done = 0; + i = pthread_create(&thread, NULL, (void *)mw_IMMWindowMsgLoop, (void *)NULL); + while (wm_create_done == 0) /* wait */ + Sleep(100); + } + +/* + { + HMENU hMenu = GetSystemMenu( hWnd_IMM, FALSE); + EnableMenuItem(hMenu, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); + } +*/ + return 0; +} + +/* + imm32wrapper_dl_started + + 、ウ、ホ・筵ク・蝪シ・、esecanna、ャニノ、゚ケ、爨ネ、ュ、ヒーナルクニ、モスミ、オ、、。」 + esecanna、ホハ、ャハンサ、キ、ニ、、、・ッ・鬣、・「・・ネセハ、リ、ホ・ン・、・・ソ、ャナマ、テ、ニ、ッ、、ホ、ヌ + 、ス、、・。シ・ォ・、ヒハンツク、ケ、。」 + + Windows、ヌ、マ。「、ォ、ハエチ、サネ、ヲ、ホ、ヒ・ヲ・」・・ノ・ヲ、ャノャヘラ。ハニホマ、マ・ヲ・」・・ノ・ヲ、ヒノユソ、ケ、。ヒ、ハ、ホ、ヌ + ・タ・゚。シ、ホ・ヲ・」・・ノ・ヲ、コタョ、ケ、 + */ +int imm32wrapper_dl_started(client_t *cl) +{ + /* Windows、ホ・ミ。シ・ク・逾・チ・ァ・テ・ッ。」Unicodeキマ、ホAPI、サネ、ヲ、ホ、ヌ。「Win2Kーハセ螟ヒクツト熙ケ、 */ + { + OSVERSIONINFO osvi; + + /* OSVERSIONINFO ケスツ、ツホ、ホス魘イス */ + memset(&osvi, 0, sizeof(OSVERSIONINFO)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx((OSVERSIONINFO*)&osvi); + + /* ・ミ。シ・ク・逾、ホ・チ・ァ・テ・ッ */ + if ((osvi.dwMajorVersion < 5) || (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)) + { + m_msg("Can't exec in this Windows version.\n"); + return -1; + } + } + + /* 、ォ、ハエチ、ケヤ、ヲ、ソ、皃ホ・タ・゚。シ・ヲ・」・・ノ・ヲ、ホコタョ */ +/* + if (mw_InitWindow() != 0) + return -1; +*/ + + /* esecanna、ホ・ッ・鬣、・「・・ネセハケスツ、ツホ、リ、ホ・ン・、・・ソ、、ウ、チ、鯆ヲ、ヒハンツク */ + client = cl; + + cx_top = NULL; /* ーアス魘イス、キ、ニ、ェ、ウ、ヲ。ハオ、サ、チーュ、、、ォ、鬘ヒ 03.10.17 Y.A. */ + last_context_num = -1; /* */ + + return 0; +} + +/* 、ォ、ハエチウォサマ */ +int imm32wrapper_init_rootclient() +{ + short cx_num; + context_t *cx; + int ret; + + m_msg("Initializing root client for IMM.\n"); + + if ((cx_num = mw_new_context(IMM32_ROOT_CLIENT)) == -1) + { + m_msg("Out of Memory.\n"); + return -1; + } + + cx = mw_get_context(cx_num); + + ret = mw_open_imm32(IMM32_ROOT_CLIENT, cx, "canna2imm32"); + + if (ret != 1) + { + m_msg("Cannot connect to IMM. Aborting.\n"); + return -1; + } + + m_msg("Initialize succeeded.\n"); + + return 0; +} + +/* 、ォ、ハエチスェホサ */ +int imm32wrapper_end_client(int id) +{ + context_t *cx, *cx2; + + cx = cx_top; + + while (cx) + { + if (cx->client_id == id) + { + cx2 = cx->next; + + mw_close_imm32(cx); + mw_free_context(cx->context_num); + + cx = cx2; + } else + cx = cx->next; + } + + return 0; +} + +/* 、ォ、ハエチスェホサ。ハ_end_client()、クニ、ヨ。ヒ */ +int imm32wrapper_end_rootclient() +{ + imm32wrapper_end_client(IMM32_ROOT_CLIENT); + + return 0; +} + +/* ・ッ・鬣、・「・・ネ、ホセハ、セテオ、ケ、 */ +int imm32wrapper_clear_client_data(int id) +{ + return 0; +} + +/* + * 。ヨ、ォ、、ハ。ラ、 Wnn 、ヌ wrapping 、ケ、エリソs + */ +/* ス魘イスス靉 */ +int imm32wrapper_initialize(int id, char *conffile) +{ + return mw_new_context(id); +} + +/* スェホサス靉 */ +int imm32wrapper_finalize(int id, buffer_t *cbuf) +{ + cannaheader_t *header; + HIMC hIMC; + + /* hIMC、ホウホハン */ + if (hWnd_IMM != 0) + { + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC != 0) + { + /* ハムエケナモテ讀ハ、魘ーホサ、オ、サ、 */ +/* ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); */ /* シコヌヤ、キ、ニ、篶オサ */ + ImmReleaseContext(hWnd_IMM, hIMC); + } + } + + client[id].need_terminate = TRUE; /* main.c 、ヌスェホサス靉、、キ、ニ、筅鬢ヲ */ + + header = (cannaheader_t *)cbuf->buf; + header->type = 0x02; + header->extra = 0; + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* ・ウ・・ニ・ッ・ケ・ネコタョ */ +int imm32wrapper_create_context(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + short *sp = (short *)cbuf->buf; + short cx_num; + + cx_num = mw_new_context(id); + + header->type = 0x03; + header->extra = 0; + header->datalen = LSBMSB16(2); + + sp[2] = LSBMSB16(cx_num); + + return 1; +} + +/* ・ウ・・ニ・ッ・ケ・ネハ」シフ */ +int imm32wrapper_duplicate_context(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + short *sp = (short *)cbuf->buf; + short cx_n_new, cx_n_orig; + + cx_n_orig = LSBMSB16(sp[2]); + cx_n_new = mw_new_context(id); + + header->type = 0x04; + header->extra = 0; + header->datalen = LSBMSB16(2); + + sp[2] = LSBMSB16(cx_n_new); + + return 1; +} + +/* ・ウ・・ニ・ッ・ケ・ネコス */ +int imm32wrapper_close_context(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + short *sp = (short *)cbuf->buf; + short cx_num; + context_t *cx; + + cx_num = LSBMSB16(sp[2]); + cx = mw_get_context(cx_num); + + mw_close_imm32(cx); + mw_free_context(cx->context_num); + + header->type = 0x05; + header->extra = 0; + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + return 1; +} + +/* テアクナミマソ。ハスミヘ隍、ア、ノ、荀テ、ニ、ハ、、。ヒ */ +int imm32wrapper_define_word(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 0; +} + +/* テアクコス。ハスミヘ隍、ア、ノ、荀テ、ニ、ハ、、。ヒ */ +int imm32wrapper_delete_word(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 0; +} + +/* + imm32wrapper_begin_convert() + + ハムエケ、ウォサマ、ケ、。ハハムエケニーコ、マ、ウ、ウ、ォ、鮟マ、゙、。ヒ + +*/ +int imm32wrapper_begin_convert(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + ushort *sp = (ushort *)cbuf->buf; + ushort *cyomi, *ckoho; + int *ip = (int *)cbuf->buf; + int cmode, nbun, len; + ushort cx_num, datalen; + context_t *cx; + + int nRet = 1; + BOOL fRet; + HIMC hIMC = 0; + LPWSTR iyomi; + + cx_num = LSBMSB16(sp[4]); + cmode = LSBMSB32(ip[1]); + cyomi = &sp[5]; /* cyomi: kinput2->canna、ホニノ、゚ */ + + cx = mw_get_context(cx_num); + + if (cx->fIME == 0) + mw_open_imm32(id, cx, client[cx->client_id].user); + + if (cx->fIME != 0) + { + /* hIMC、ホウホハン */ + if (hWnd_IMM == 0) + goto error_exit; + + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC == 0) + { + goto error_exit; + } + + /* ・ェ。シ・ラ・、キ、ニ、、、ハ、ォ、テ、ソ、鬣ェ。シ・ラ・、ケ、 */ + if (ImmGetOpenStatus(hIMC) != TRUE) + { + if (ImmSetOpenStatus(hIMC, TRUE) != TRUE) + { + goto error_exit; + } + } + + /* ・ッ・鬣、・「・・ネ、ォ、鮟リト熙オ、、ソニノ、゚、ハンツク */ + /* 、ネ、熙「、ィ、コ、ネ、テ、ニ、ェ、ッ、ア、ノノャヘラ、ハ、ォ、テ、ソ、鮟゚、皃 */ + len = cannawcstrlen(cyomi); + cx->szYomiStr = (ushort*)calloc(1, (len * 2) + 2); + memcpy((void*)cx->szYomiStr, (void*)cyomi, len * 2); + + iyomi = mw_wcs2ucs(cyomi); /* iyomi: Win32 Imm 、ホニノ、゚ */ + if (iyomi == NULL) + { + goto error_exit; + } + fRet = ImmSetCompositionStringW(hIMC, SCS_SETSTR, NULL, 0, (LPCVOID)(iyomi), wcslen(iyomi) * 2); /* ニノ、゚タ゚ト */ + if (fRet == FALSE) + { + goto error_exit; + } + fRet = ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CONVERT, 0); /* ハムエケシツケヤ */ + if (fRet == FALSE) + { + goto error_exit; + } + + ckoho = mw_after_conversion(cx, hIMC, &nbun, 0, &len); + datalen = 2 + len * 2 + 2; + + buffer_check(cbuf, 4 + datalen); + header = (cannaheader_t *)cbuf->buf; + sp = (ushort *)cbuf->buf; + + header->type = 0x0f; + header->extra = 0; + header->datalen = LSBMSB16(datalen); + sp[2] = LSBMSB16(nbun); + memcpy(&(sp[3]), ckoho, len * 2); + sp[3 + len] = 0; + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; + } + +error_exit: + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; +} + +/* + imm32wrapper_end_convert() + + + +*/ +int imm32wrapper_end_convert(int id, buffer_t *cbuf) +{ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + short *sp = (short *)cbuf->buf; + long *lp = (long *)cbuf->buf; + short cx_num; + short bun_num; + context_t *cx; + HIMC hIMC = 0; + short *pList; + DWORD nMode; + + cx_num = LSBMSB16(sp[2]); + bun_num = LSBMSB16(sp[3]); + nMode = LSBMSB32(lp[2]); + pList = &(sp[6]); + cx = mw_get_context(cx_num); + + if ((cx->fIME != 0) && (hWnd_IMM != 0)) + { + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC != 0) + { + if (ImmGetOpenStatus(hIMC) == TRUE) + { + if (nMode != 0) + { /* コヌク螟ホハムエケ、ウホト熙オ、サ、 */ + int i; + for (i=0; i= 0) + { + if (LSBMSB16(pList[i]) != 0) + ImmNotifyIME(hIMC, NI_SELECTCANDIDATESTR, 0, LSBMSB16(pList[i])); + } + } + ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + } + + /* ・ッ・。シ・コ、ケ、 */ + ImmSetOpenStatus(hIMC, FALSE); + } + } + } + mw_clear_context(cx_num); + + header->type = 0x10; + header->extra = 0; + header->datalen = LSBMSB16(1); + header->err.e8 = 0; + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; +} + +/* + imm32wrapper_get_candidacy_list() + + サリト熙オ、、ソハクタ皃ホクハ荀ネニノ、゚、ハヨ、ケ + + + +*/ +int imm32wrapper_get_candidacy_list(int id, buffer_t *cbuf) +{ + context_t *cx; + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + ushort *sp = (short *)cbuf->buf; + int bun_no, koho_num = 0, len, pnt, errflag = 0, i; + short cx_num, datalen; + ushort *ckoho; + HIMC hIMC = 0; + int CurClause; + DWORD dwRet; + LPCANDIDATELIST lpCandList; + long BufLen; + + cx_num = LSBMSB16(sp[2]); + bun_no = LSBMSB16(sp[3]); + + cx = mw_get_context(cx_num); + + datalen = 6; + pnt = 6; + + if ((cx->fIME != 0) && (hWnd_IMM != 0)) + { + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC != 0) + { + /* クハ荀ホシ霹タ */ + CurClause = mw_set_target_clause(cx, hIMC, bun_no); + if (CurClause < 0) + { /* ハクタ皃ホーワニー、ヒシコヌヤ、キ、ソ */ + errflag = 1; + } else + { /* ハムエケクハ茹・ケ・ネ、シ霹タ */ + ImmNotifyIME(hIMC, NI_OPENCANDIDATE, 0, 0); /* ハムエケクハ茹・ケ・ネノスシィ */ + BufLen = ImmGetCandidateListW(hIMC, 0, NULL, 0); + lpCandList = (LPCANDIDATELIST)calloc(1, BufLen); + dwRet = ImmGetCandidateListW(hIMC, 0, lpCandList, BufLen); + if (dwRet != 0) + { + DWORD i; + LPDWORD lpdwOffset; + lpdwOffset = &lpCandList->dwOffset[0]; + + for (i = 0; i < lpCandList->dwCount; i++) + { + LPWSTR lpstr = (LPWSTR)((LPSTR)lpCandList + *lpdwOffset++); + + ckoho = mw_ucs2wcs(lpstr, wcslen(lpstr)); + len = (cannawcstrlen(ckoho) * 2) + 2; + + datalen += len; + buffer_check(cbuf, datalen); + + memcpy(&(cbuf->buf[pnt]), ckoho, len); + pnt += len; + koho_num ++; + } + } else + { + errflag = 1; + } + + MYFREE(lpCandList); + } + } else + { + errflag = 1; + } + + if (errflag == 0) + { + datalen += 2; + buffer_check(cbuf, datalen); + header = (cannaheader_t *)cbuf->buf; + sp = (ushort *)cbuf->buf; + cbuf->buf[pnt++] = 0; + cbuf->buf[pnt++] = 0; + + sp[2] = LSBMSB16(koho_num); + + header->type = 0x11; + header->extra = 0; + header->datalen = LSBMSB16(datalen); + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; + } + } + + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; +} + +/* + imm32wrapper_get_yomi() + + サリト熙オ、、ソハクタ皃ホニノ、゚、ハヨ、ケ + + + +*/ +int imm32wrapper_get_yomi(int id, buffer_t *cbuf) +{ +/* cannawc・ミ。シ・ク・逾 */ + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + ushort *sp = (short *)cbuf->buf; + ushort *cyomi; + short cx_num, bun_no, datalen; + context_t *cx; + int len, byte; + + cx_num = LSBMSB16(sp[2]); + bun_no = LSBMSB16(sp[3]); + + cx = mw_get_context(cx_num); + + if ((cyomi = mw_get_yomi(cx, bun_no, &len)) != NULL) + { + byte = (len + 1) * 2; + + datalen = 2 + byte; + + buffer_check(cbuf, datalen + 4); + sp = (ushort *)cbuf->buf; + header = (cannaheader_t *)cbuf->buf; + + header->type = 0x12; + header->extra = 0; + header->datalen = LSBMSB16(datalen); + sp[2] = LSBMSB16(len); + memcpy(&(cbuf->buf[6]), cyomi, byte); + } else + { + header->type = 0x12; + header->extra = 0; + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + } + + return 1; +} + +int imm32wrapper_subst_yomi(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +int imm32wrapper_store_yomi(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +int imm32wrapper_store_range(int id, buffer_t *cbuf) +{ + WW_ERROR8(cbuf); + return 1; +} + +int imm32wrapper_get_lastyomi(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +int imm32wrapper_flush_yomi(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +int imm32wrapper_remove_yomi(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +int imm32wrapper_get_simplekanji(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +/* + imm32wrapper_resize_pause() + + サリト熙オ、、ソハクタ皃サリト熙オ、、ソトケ、オ、ヒハムケケ、キ、ニコニハムエケ、ケ、 + + 2004.03.04 ツナタ。「ネセツナタ、ャ、「、、ネ、ュ、ヒシコヌヤ、ケ、、ホ、ス、タオ + +*/ +int imm32wrapper_resize_pause(int id, buffer_t *cbuf) +{ + int curyomilen, oldyomilen; + short cannayomilen, bun_no, cx_num, datalen; + int nbun, len; + short *sp = (short *)cbuf->buf; + ushort *ckoho; + ushort *cyomi; + LPWSTR iyomi; + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + context_t *cx; + + UINT uMaxClause; + + cx_num = LSBMSB16(sp[2]); + bun_no = LSBMSB16(sp[3]); + cannayomilen = LSBMSB16(sp[4]); + + cx = mw_get_context(cx_num); + uMaxClause = (cx->dwCompReadClsLen / sizeof(DWORD)) - 1; + + if ((cx->fIME != 0) && (cyomi = mw_get_yomi_2(cx, bun_no, &oldyomilen)) != NULL && hWnd_IMM != 0 && bun_no < uMaxClause) + { + DWORD i; + DWORD dwTargetLen; + BOOL fRet; + DWORD dwClsRead[512]; /* 、ウ、、、ト、マクヌト・オ・、・コ、ク、网゙、コ、、、ォ、筅キ、、 */ + + HIMC hIMC = ImmGetContext(hWnd_IMM); + if (hIMC != 0) + { + /* ツミセンハクタ皃ホトケ、オキ霪 */ + if (mw_get_yomi(cx, bun_no, &curyomilen) == NULL) + { + ImmReleaseContext(hWnd_IMM, hIMC); + goto error_exit; + } + dwTargetLen = curyomilen; + + switch(cannayomilen) + { + case -1: /* ハクタ眩ュ、ミ、キ */ + dwTargetLen ++; + break; + case -2: /* ハクタ眇フ、 */ + if (dwTargetLen != 0) + dwTargetLen --; + break; + default: /* ツィテヘ */ + dwTargetLen = cannayomilen; + break; + } + if (dwTargetLen > oldyomilen) + { + ckoho = mw_after_conversion(cx, hIMC, &nbun, bun_no, &len); /* nbun、マ・「・ノ・・ケ、ヒ 03.10.20 Y.A. */ + datalen = 2 + len * 2 + 2; + + buffer_check(cbuf, 4 + datalen); + header = (cannaheader_t *)cbuf->buf; + sp = (ushort *)cbuf->buf; + + header->type = 0x1a; + header->extra = 0; + header->datalen = LSBMSB16(datalen); + sp[2] = LSBMSB16(nbun); + memcpy(&(sp[3]), ckoho, len * 2); + sp[3 + len] = 0; + + ImmReleaseContext(hWnd_IMM, hIMC); + return 1; + } + + /* トケ、オ、ホトエター */ + if (oldyomilen < dwTargetLen) + dwTargetLen = oldyomilen; + cyomi[dwTargetLen] = '\0'; + /* IMM 、ャヌァシア、キ、ニ、、、トケ、オ、ヒフ皃ケ、ソ、皃ヒネセウム、ヌ・ォ・ヲ・・ネ、ケ、 */ + { + int ii, len = 0; + for (ii=0; iidwCompReadCls[i]; + } + + if (ImmSetCompositionStringW(hIMC,SCS_CHANGECLAUSE,NULL,0,dwClsRead,(uMaxClause+1)*sizeof(DWORD)) == TRUE && + ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CONVERT, 0) == TRUE) + { + ckoho = mw_after_conversion(cx, hIMC, &nbun, bun_no, &len); /* nbun、マ・「・ノ・・ケ、ヒ 03.10.20 Y.A. */ + datalen = 2 + len * 2 + 2; + + buffer_check(cbuf, 4 + datalen); + header = (cannaheader_t *)cbuf->buf; + sp = (ushort *)cbuf->buf; + + header->type = 0x1a; + header->extra = 0; + header->datalen = LSBMSB16(datalen); + sp[2] = LSBMSB16(nbun); + memcpy(&(sp[3]), ckoho, len * 2); + sp[3 + len] = 0; + + ImmReleaseContext(hWnd_IMM, hIMC); + return 1; + } + } + ImmReleaseContext(hWnd_IMM, hIMC); + } + +error_exit: + header->datalen = LSBMSB16(2); + header->err.e16 = LSBMSB16(-1); + + return 1; +} + +int imm32wrapper_get_hinshi(int id, buffer_t *cbuf) +{ + WW_ERROR8(cbuf); + return 1; +} + +int imm32wrapper_get_lex(int id, buffer_t *cbuf) +{ + WW_ERROR16(cbuf); + return 1; +} + +/* + imm32wrapper_get_status() + + サリト熙オ、、ソハクタ皃ホイタマセハ、オ皃皃 + + + +*/ +int imm32wrapper_get_status(int id, buffer_t *cbuf) +{ + struct + { + int bunnum; /* ・ォ・・・ネハクタ皃ホハクタ睚ヨケ */ + int candnum; /* クハ荀ホテ讀ホクハ菠ヨケ */ + int maxcand; /* ・ォ・・・ネハクタ皃ホクハ菫 */ + int diccand; /* maxcand - ・筍シ・ノサリトハャ。ハ、ヌ、筅ネ、熙「、ィ、コesecanna、ヌ、マmaxcand、ネニア、ク。ヒ */ + int ylen; /* ニノ、゚、ホトケ、オ */ + int klen; /* ・ォ・・・ネクハ荀ホニノ、゚、ャ、ハ、ホ・ミ・、・ネソ */ + int tlen; /* ・ォ・・・ネクハ荀ホケスタョテアクソ == 1 */ + } stat; + + short bun_no, koho_no, cx_num; + short *sp = (short *)cbuf->buf; + int len, koho_num, errflag = 0, ylen, klen; + cannaheader_t *header = (cannaheader_t *)cbuf->buf; + context_t *cx; + HIMC hIMC = 0; + int CurClause; + DWORD dwRet; + LPCANDIDATELIST lpCandList; + ushort *ckoho; + long BufLen; + + cx_num = LSBMSB16(sp[2]); + bun_no = LSBMSB16(sp[3]); + koho_no = LSBMSB16(sp[4]); + + cx = mw_get_context(cx_num); + + if ((cx->fIME != 0)) + { + if (mw_get_yomi(cx, bun_no, &ylen) != NULL) + { + hIMC = ImmGetContext(hWnd_IMM); + if (hIMC != 0) + { + /* クハ荀ホシ霹タ */ + CurClause = mw_set_target_clause(cx, hIMC, bun_no); + if (CurClause < 0) + { /* ハクタ皃ホーワニー、ヒシコヌヤ、キ、ソ */ + errflag = 1; + } else + { /* ハムエケクハ茹・ケ・ネ、シ霹タ */ + ImmNotifyIME(hIMC, NI_OPENCANDIDATE, 0, 0); /* ハムエケクハ茹・ケ・ネノスシィ */ + BufLen = ImmGetCandidateListW(hIMC, 0, NULL, 0); + lpCandList = (LPCANDIDATELIST)calloc(1, BufLen); + dwRet = ImmGetCandidateListW(hIMC, 0, lpCandList, BufLen); + if (dwRet != 0 && lpCandList->dwCount > koho_no) + { /* ハムエケクハ荀ャ、「、、ミツミセンクハ菠ヨケ讀ホクハ荀ウホハン、キ、ニ、ェ、ッ */ + LPWSTR lpstr; + koho_num = (int)(lpCandList->dwCount); + lpstr = (LPWSTR)((LPSTR)lpCandList + lpCandList->dwOffset[koho_no]); + ckoho = mw_ucs2wcs(lpstr, wcslen(lpstr)); + klen = cannawcstrlen(ckoho) * 2; + } else + errflag = 1; + + MYFREE(lpCandList); + } + } else + errflag = 1; + + if (errflag == 0) + { + stat.ylen = LSBMSB32(ylen); /* ・ォ・・・ネクハ荀ホニノ、゚、ャ、ハ、ホ・ミ・、・ネソ */ + stat.klen = LSBMSB32(klen); /* ・ォ・・・ネクハ荀ホエチサクハ荀ホ・ミ・、・ネソ */ + stat.tlen = LSBMSB32(1); /* ・ォ・・・ネクハ荀ホケスタョテアクソ */ + stat.maxcand = LSBMSB32(koho_num); /* ・ォ・・・ネハクタ皃ホクハ菫 */ + stat.diccand = LSBMSB32(koho_num); /* FIXME: maxcand - ・筍シ・ノサリトハャ */ + stat.bunnum = LSBMSB32(bun_no); + stat.candnum = LSBMSB32(koho_no); + + buffer_check(cbuf, 33); + header->type = 0x1d; + header->extra = 0; + header->datalen = LSBMSB16(29); + + cbuf->buf[4] = 0; + + memcpy(&(cbuf->buf[5]), (char *)&stat, 28); + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + + return 1; + } + } + } + + if (hIMC != 0) + ImmReleaseContext(hWnd_IMM, hIMC); + header->datalen = LSBMSB16(1); + header->err.e8 = -1; + + return 1; +} + +int imm32wrapper_set_locale(int id, buffer_t *cbuf) +{ + WW_ERROR8(cbuf); + return 1; +} + +int imm32wrapper_auto_convert(int id, buffer_t *cbuf) +{ + WW_ERROR8(cbuf); + return 1; +} diff --git a/winimm.h b/winimm.h new file mode 100755 index 0000000..6bdd065 --- /dev/null +++ b/winimm.h @@ -0,0 +1,91 @@ +/* esecannaserver --- pseudo canna server that wraps another IME. + * Copyright (C) 1999-2000 Yasuhiro Take + * + * 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 + * ree 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. +*/ + +#ifndef __winimm32_h__ +#define __winimm32_h__ + +#define ESECANNA_MODULE_VERSION "Imm32 1.0.0" + +#include +#include +#include +/* #include */ + +/* proto */ +int imm32wrapper_finalize(int id, buffer_t *cbuf); +int imm32wrapper_create_context(int id, buffer_t *cbuf); +int imm32wrapper_duplicate_context(int id, buffer_t *cbuf); +int imm32wrapper_close_context(int id, buffer_t *cbuf); +int imm32wrapper_define_word(int id, buffer_t *cbuf); +int imm32wrapper_delete_word(int id, buffer_t *cbuf); +int imm32wrapper_begin_convert(int id, buffer_t *cbuf); +int imm32wrapper_end_convert(int id, buffer_t *cbuf); +int imm32wrapper_get_candidacy_list(int id, buffer_t *cbuf); +int imm32wrapper_get_yomi(int id, buffer_t *cbuf); +int imm32wrapper_subst_yomi(int id, buffer_t *cbuf); +int imm32wrapper_store_yomi(int id, buffer_t *cbuf); +int imm32wrapper_store_range(int id, buffer_t *cbuf); +int imm32wrapper_get_lastyomi(int id, buffer_t *cbuf); +int imm32wrapper_flush_yomi(int id, buffer_t *cbuf); +int imm32wrapper_remove_yomi(int id, buffer_t *cbuf); +int imm32wrapper_get_simplekanji(int id, buffer_t *cbuf); +int imm32wrapper_resize_pause(int id, buffer_t *cbuf); +int imm32wrapper_get_hinshi(int id, buffer_t *cbuf); +int imm32wrapper_get_lex(int id, buffer_t *cbuf); +int imm32wrapper_get_status(int id, buffer_t *cbuf); +int imm32wrapper_set_locale(int id, buffer_t *cbuf); +int imm32wrapper_auto_convert(int id, buffer_t *cbuf); +int imm32wrapper_initialize(int id, char *conffile); +int imm32wrapper_init_rootclient(); +int imm32wrapper_end_client(int id); +int imm32wrapper_end_rootclient(); +int imm32wrapper_clear_client_data(int id); + +/* >> メッセージ化対応 */ +#define WM_CANNA_FINALIZE WM_USER+0 +#define WM_CANNA_CREATE_CONTEXT WM_USER+1 +#define WM_CANNA_DUPLICATE_CONTEXT WM_USER+2 +#define WM_CANNA_CLOSE_CONTEXT WM_USER+3 +#define WM_CANNA_DEFINE_WORD WM_USER+4 +#define WM_CANNA_DELETE_WORD WM_USER+5 +#define WM_CANNA_BEGIN_CONVERT WM_USER+6 +#define WM_CANNA_END_CONVERT WM_USER+7 +#define WM_CANNA_GET_CANDIDACY_LIST WM_USER+8 +#define WM_CANNA_GET_YOMI WM_USER+9 +#define WM_CANNA_SUBST_YOMI WM_USER+10 +#define WM_CANNA_STORE_YOMI WM_USER+11 +#define WM_CANNA_STORE_RANGE WM_USER+12 +#define WM_CANNA_GET_LASTYOMI WM_USER+13 +#define WM_CANNA_FLUSH_YOMI WM_USER+14 +#define WM_CANNA_REMOVE_YOMI WM_USER+15 +#define WM_CANNA_GET_SIMPLEKANJI WM_USER+16 +#define WM_CANNA_RESIZE_PAUSE WM_USER+17 +#define WM_CANNA_GET_HINSHI WM_USER+18 +#define WM_CANNA_GET_LEX WM_USER+19 +#define WM_CANNA_GET_STATUS WM_USER+20 +#define WM_CANNA_SET_LOCALE WM_USER+21 +#define WM_CANNA_AUTO_CONVERT WM_USER+22 +#define WM_CANNA_INITIALIZE WM_USER+23 +#define WM_CANNA_INIT_ROOTCLIENT WM_USER+24 +#define WM_CANNA_END_CLIENT WM_USER+25 +#define WM_CANNA_END_ROOTCLIENT WM_USER+26 +#define WM_CANNA_CLEAR_CLIENT_DATA WM_USER+27 +/* << メッセージ化対応 */ + + +#endif /* __winimm32_h__ */